This commit is contained in:
2026-02-02 23:02:50 -06:00
parent 256a00c501
commit 69b032d3dc
3 changed files with 0 additions and 38 deletions

View File

@@ -85,8 +85,6 @@
// #define DUMP_GC
/* dump objects freed by the garbage collector */
// #define DUMP_GC_FREE
/* dump objects leaking when freeing the runtime */
// #define DUMP_LEAKS 1
/* dump memory usage before running the garbage collector */
// #define DUMP_MEM
// #define DUMP_OBJECTS /* dump objects in JS_FreeContext */
@@ -367,13 +365,6 @@ struct JSRuntime {
/* Interrupt handler for checking execution limits */
JSInterruptHandler *interrupt_handler;
void *interrupt_opaque;
/* Primary context (for single-context runtimes) */
JSContext *js;
#ifdef DUMP_LEAKS
struct list_head string_list;
#endif
};
struct JSClass {
@@ -1028,14 +1019,6 @@ void *js_realloc (JSContext *ctx, void *ptr, size_t size) {
/* Forward declaration for ctx_gc */
static int ctx_gc (JSContext *ctx);
/* Run GC on a specific context */
void JS_RunGC (JSRuntime *rt) {
JSContext *ctx = rt->js;
if (ctx) {
ctx_gc (ctx);
}
}
/* JS_MarkValue - mark a value during GC traversal.
With copying GC, this is a no-op as we discover live objects by tracing. */
void JS_MarkValue (JSRuntime *rt, JSValue val, JS_MarkFunc *mark_func) {
@@ -2320,10 +2303,6 @@ JSRuntime *JS_NewRuntime (void) {
if (!rt) return NULL;
memset (rt, 0, sizeof (*rt));
#ifdef DUMP_LEAKS
init_list_head (&rt->string_list);
#endif
/* create the object, array and function classes */
if (init_class_range (rt, js_std_class_def, JS_CLASS_OBJECT, countof (js_std_class_def))
< 0)
@@ -2399,7 +2378,6 @@ void JS_FreeRuntime (JSRuntime *rt) {
}
JSContext *JS_NewContextRaw (JSRuntime *rt) {
assert (!rt->js);
JSContext *ctx;
int i;
@@ -2475,7 +2453,6 @@ JSContext *JS_NewContextRaw (JSRuntime *rt) {
ctx->heap_end = ctx->heap_base + ctx->current_block_size;
JS_AddIntrinsicBasicObjects (ctx);
rt->js = ctx;
return ctx;
}
@@ -2902,16 +2879,6 @@ static JSValue pretext_end (JSContext *ctx, JSText *s) {
js_free (ctx, s);
return JS_KEY_empty;
}
int cap = (int)objhdr_cap56 (s->hdr);
if (len < cap) {
/* Try to shrink, but OK if realloc fails */
size_t new_size = sizeof (JSText) + ((len + 1) / 2) * sizeof (uint64_t);
JSText *new_str = js_realloc_rt (s, new_size);
if (new_str) s = new_str;
}
#ifdef DUMP_LEAKS
list_add_tail (&s->link, &ctx->rt->string_list);
#endif
/* Set final length in capacity field and clear length for hash storage */
s->hdr = objhdr_set_cap56 (s->hdr, len);
s->length = 0;
@@ -25768,5 +25735,3 @@ JSValue js_math_cycles_use (JSContext *ctx) {
JS_SetPropertyFunctionList (ctx, obj, js_math_cycles_funcs, countof (js_math_cycles_funcs));
return obj;
}
JSContext *JS_GetContext (JSRuntime *rt) { return rt->js; }

View File

@@ -388,7 +388,6 @@ void JS_SetRuntimeOpaque (JSRuntime *rt, void *opaque);
typedef void JS_MarkFunc (JSRuntime *rt, JSGCObjectHeader *gp);
/* JS_MarkValue is a no-op with copying GC (values are traced from roots) */
void JS_MarkValue (JSRuntime *rt, JSValue val, JS_MarkFunc *mark_func);
void JS_RunGC (JSRuntime *rt);
JS_BOOL JS_IsLiveObject (JSRuntime *rt, JSValue obj);
JSContext *JS_NewContext (JSRuntime *rt);