remove dupavlue and freevalue

This commit is contained in:
2026-02-25 09:40:58 -06:00
parent c77f1f8639
commit d0bf757d91
16 changed files with 32 additions and 869 deletions

View File

@@ -324,7 +324,6 @@ void script_startup(JSContext *js)
js->actor_label = js->name; /* may be NULL; updated when name is set */
JS_SetHeapMemoryLimit(js, ACTOR_MEMORY_LIMIT);
JS_FreeValue(js, js_core_blob_use(js));
// Try engine fast-path: load engine.cm from source-hash cache
size_t bin_size;
@@ -390,8 +389,8 @@ void script_startup(JSContext *js)
js->actor_sym_ref.val = JS_NewObject(js);
JS_CellStone(js, js->actor_sym_ref.val);
JS_SetActorSym(js, JS_DupValue(js, js->actor_sym_ref.val));
JS_SetPropertyStr(js, env_ref.val, "actorsym", JS_DupValue(js, js->actor_sym_ref.val));
JS_SetActorSym(js, js->actor_sym_ref.val);
JS_SetPropertyStr(js, env_ref.val, "actorsym", js->actor_sym_ref.val);
// Always set init (even if null)
if (js->init_wota) {
@@ -621,11 +620,10 @@ int cell_init(int argc, char **argv)
ctx->actor_sym_ref.val = JS_NewObject(ctx);
JS_CellStone(ctx, ctx->actor_sym_ref.val);
JS_SetActorSym(ctx, JS_DupValue(ctx, ctx->actor_sym_ref.val));
JS_SetActorSym(ctx, ctx->actor_sym_ref.val);
root_ctx = ctx;
JS_FreeValue(ctx, js_core_blob_use(ctx));
int exit_code = 0;
int use_native_engine = 0;
@@ -670,7 +668,7 @@ int cell_init(int argc, char **argv)
JS_SetPropertyStr(ctx, boot_env_ref.val, "core_path", btmp);
btmp = shop_path ? JS_NewString(ctx, shop_path) : JS_NULL;
JS_SetPropertyStr(ctx, boot_env_ref.val, "shop_path", btmp);
JS_SetPropertyStr(ctx, boot_env_ref.val, "actorsym", JS_DupValue(ctx, ctx->actor_sym_ref.val));
JS_SetPropertyStr(ctx, boot_env_ref.val, "actorsym", ctx->actor_sym_ref.val);
btmp = js_core_json_use(ctx);
JS_SetPropertyStr(ctx, boot_env_ref.val, "json", btmp);
if (native_mode)
@@ -734,7 +732,7 @@ int cell_init(int argc, char **argv)
JS_SetPropertyStr(ctx, env_ref.val, "core_path", tmp);
tmp = shop_path ? JS_NewString(ctx, shop_path) : JS_NULL;
JS_SetPropertyStr(ctx, env_ref.val, "shop_path", tmp);
JS_SetPropertyStr(ctx, env_ref.val, "actorsym", JS_DupValue(ctx, ctx->actor_sym_ref.val));
JS_SetPropertyStr(ctx, env_ref.val, "actorsym", ctx->actor_sym_ref.val);
tmp = js_core_json_use(ctx);
JS_SetPropertyStr(ctx, env_ref.val, "json", tmp);
if (native_mode || !warn_mode || eval_script) {