Skip to content

Commit 53c3a2d

Browse files
authored
Replace JS_DupValue() calls with js_dup() (#941)
1 parent d44bb29 commit 53c3a2d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

quickjs.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14945,7 +14945,7 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValue func_obj,
1494514945
int n = min_int(argc, b->arg_count);
1494614946
arg_buf = local_buf;
1494714947
for(i = 0; i < n; i++)
14948-
arg_buf[i] = JS_DupValue(caller_ctx, argv[i]);
14948+
arg_buf[i] = js_dup(argv[i]);
1494914949
for(; i < b->arg_count; i++)
1495014950
arg_buf[i] = JS_UNDEFINED;
1495114951
sf->arg_count = b->arg_count;
@@ -20437,7 +20437,7 @@ static __exception int emit_push_const(JSParseState *s, JSValue val,
2043720437
if (JS_VALUE_GET_TAG(val) == JS_TAG_STRING && as_atom) {
2043820438
JSAtom atom;
2043920439
/* warning: JS_NewAtomStr frees the string value */
20440-
JS_DupValue(s->ctx, val);
20440+
js_dup(val);
2044120441
atom = JS_NewAtomStr(s->ctx, JS_VALUE_GET_STRING(val));
2044220442
if (atom != JS_ATOM_NULL && !__JS_AtomIsTaggedInt(atom)) {
2044320443
emit_op(s, OP_push_atom_value);
@@ -20446,7 +20446,7 @@ static __exception int emit_push_const(JSParseState *s, JSValue val,
2044620446
}
2044720447
}
2044820448

20449-
idx = cpool_add(s, JS_DupValue(s->ctx, val));
20449+
idx = cpool_add(s, js_dup(val));
2045020450
if (idx < 0)
2045120451
return -1;
2045220452
emit_op(s, OP_push_const);
@@ -27334,7 +27334,7 @@ static JSValue js_import_meta(JSContext *ctx)
2733427334

2733527335
static JSValue JS_NewModuleValue(JSContext *ctx, JSModuleDef *m)
2733627336
{
27337-
return JS_DupValue(ctx, JS_MKPTR(JS_TAG_MODULE, m));
27337+
return js_dup(JS_MKPTR(JS_TAG_MODULE, m));
2733827338
}
2733927339

2734027340
static JSValue js_load_module_rejected(JSContext *ctx, JSValue this_val,
@@ -27603,7 +27603,7 @@ static JSValue js_async_module_execution_rejected(JSContext *ctx, JSValue this_v
2760327603
assert(module->async_evaluation);
2760427604

2760527605
module->eval_has_exception = true;
27606-
module->eval_exception = JS_DupValue(ctx, error);
27606+
module->eval_exception = js_dup(error);
2760727607
module->status = JS_MODULE_STATUS_EVALUATED;
2760827608

2760927609
for(i = 0; i < module->async_parent_modules_count; i++) {
@@ -27756,7 +27756,7 @@ static int js_inner_module_evaluation(JSContext *ctx, JSModuleDef *m,
2775627756
if (m->status == JS_MODULE_STATUS_EVALUATING_ASYNC ||
2775727757
m->status == JS_MODULE_STATUS_EVALUATED) {
2775827758
if (m->eval_has_exception) {
27759-
*pvalue = JS_DupValue(ctx, m->eval_exception);
27759+
*pvalue = js_dup(m->eval_exception);
2776027760
return -1;
2776127761
} else {
2776227762
*pvalue = JS_UNDEFINED;
@@ -27795,7 +27795,7 @@ static int js_inner_module_evaluation(JSContext *ctx, JSModuleDef *m,
2779527795
assert(m1->status == JS_MODULE_STATUS_EVALUATING_ASYNC ||
2779627796
m1->status == JS_MODULE_STATUS_EVALUATED);
2779727797
if (m1->eval_has_exception) {
27798-
*pvalue = JS_DupValue(ctx, m1->eval_exception);
27798+
*pvalue = js_dup(m1->eval_exception);
2779927799
return -1;
2780027800
}
2780127801
}
@@ -27862,7 +27862,7 @@ static JSValue js_evaluate_module(JSContext *ctx, JSModuleDef *m)
2786227862
}
2786327863
/* a promise may be created only on the cycle_root of a cycle */
2786427864
if (!JS_IsUndefined(m->promise))
27865-
return JS_DupValue(ctx, m->promise);
27865+
return js_dup(m->promise);
2786627866
m->promise = JS_NewPromiseCapability(ctx, m->resolving_funcs);
2786727867
if (JS_IsException(m->promise))
2786827868
return JS_EXCEPTION;
@@ -27874,7 +27874,7 @@ static JSValue js_evaluate_module(JSContext *ctx, JSModuleDef *m)
2787427874
assert(m1->status == JS_MODULE_STATUS_EVALUATING);
2787527875
m1->status = JS_MODULE_STATUS_EVALUATED;
2787627876
m1->eval_has_exception = true;
27877-
m1->eval_exception = JS_DupValue(ctx, result);
27877+
m1->eval_exception = js_dup(result);
2787827878
m1->cycle_root = m; /* spec bug: should be present */
2787927879
stack_top = m1->stack_prev;
2788027880
}
@@ -27898,7 +27898,7 @@ static JSValue js_evaluate_module(JSContext *ctx, JSModuleDef *m)
2789827898
}
2789927899
assert(stack_top == NULL);
2790027900
}
27901-
return JS_DupValue(ctx, m->promise);
27901+
return js_dup(m->promise);
2790227902
}
2790327903

2790427904
static __exception JSAtom js_parse_from_clause(JSParseState *s)
@@ -48469,7 +48469,7 @@ JSValue JS_PromiseResult(JSContext *ctx, JSValue promise)
4846948469
JSPromiseData *s = JS_GetOpaque(promise, JS_CLASS_PROMISE);
4847048470
if (!s)
4847148471
return JS_UNDEFINED;
48472-
return JS_DupValue(ctx, s->promise_result);
48472+
return js_dup(s->promise_result);
4847348473
}
4847448474

4847548475
bool JS_IsPromise(JSValue val)

0 commit comments

Comments
 (0)