revert instanceof use

This commit is contained in:
2025-02-18 15:03:06 -06:00
parent 7796393a3f
commit 255d82c71b
4 changed files with 18 additions and 10 deletions

View File

@@ -51,4 +51,19 @@ qjs = executable('qjs',
'qjs.c', 'quickjs-libc.c', qjscalc_c, qjsrepl_c,
dependencies: [quickjs_dep, threads],
build_by_default:false
)
)
test_root = join_paths(meson.project_source_root(), 'tests')
test('closure', qjs, args: ['test_closure.js'], workdir: test_root)
test('language', qjs, args: ['test_language.js'], workdir: test_root)
test('builtin', qjs, args: ['test_builtin.js'], workdir: test_root)
test('loop', qjs, args: ['test_loop.js'], workdir: test_root)
test('std', qjs, args: ['test_std.js'], workdir: test_root)
test('worker', qjs, args: ['test_worker.js'], workdir: test_root)
test('op_overloading', qjs, args: ['--bignum', 'test_op_overloading.js'], workdir: test_root)
test('bignum', qjs, args: ['--bignum', 'test_bignum.js'], workdir: test_root)
test('qjscalc', qjs, args: ['--qjscalc', 'test_qjscalc.js'], workdir: test_root)
benchmark('microbench', qjs, args: ['microbench.js'], workdir: test_root, timeout: 0)

2
qjs.c
View File

@@ -512,7 +512,7 @@ int main(int argc, char **argv)
if (dump_memory) {
JSMemoryUsage stats;
JS_ComputeMemoryUsage(rt, &stats);
JS_DumpMemoryUsage(stdout, &stats, rt);
// JS_DumpMemoryUsage(stdout, &stats, rt);
}
js_std_free_handlers(rt);
JS_FreeContext(ctx);

View File

@@ -736,7 +736,7 @@ static JSValue js_std_getenviron(JSContext *ctx, JSValueConst this_val,
static JSValue js_std_gc(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
JS_RunGC(JS_GetRuntime(ctx), ctx);
JS_RunGC(JS_GetRuntime(ctx));
return JS_UNDEFINED;
}

View File

@@ -7581,15 +7581,9 @@ static JSValue js_object_isPrototypeOf(JSContext *ctx, JSValueConst this_val, in
/* return TRUE, FALSE or (-1) in case of exception */
int JS_IsInstanceOf(JSContext *ctx, JSValueConst val, JSValueConst obj)
{
JSValue ret = js_object_isPrototypeOf(ctx, obj, 1, &val);
int b = JS_ToBool(ctx,ret);
JS_FreeValue(ctx,ret);
return b;
/*
JSValue method;
if (!JS_IsObject(obj))
goto fail;
if (!JS_
method = JS_GetProperty(ctx, obj, JS_ATOM_Symbol_hasInstance);
if (JS_IsException(method))
return -1;
@@ -7605,7 +7599,6 @@ int JS_IsInstanceOf(JSContext *ctx, JSValueConst val, JSValueConst obj)
return -1;
}
return JS_OrdinaryIsInstanceOf(ctx, val, obj);
*/
}
/* return the value associated to the autoinit property or an exception */