native function type

This commit is contained in:
2026-02-17 17:40:44 -06:00
parent b25285f2e1
commit ad419797b4
8 changed files with 603 additions and 265 deletions

View File

@@ -1442,6 +1442,8 @@ void gc_scan_object (JSContext *ctx, void *ptr, uint8_t *from_base, uint8_t *fro
/* Scan outer_frame and env_record */
fn->u.reg.outer_frame = gc_copy_value (ctx, fn->u.reg.outer_frame, from_base, from_end, to_base, to_free, to_end);
fn->u.reg.env_record = gc_copy_value (ctx, fn->u.reg.env_record, from_base, from_end, to_base, to_free, to_end);
} else if (fn->kind == JS_FUNC_KIND_NATIVE) {
fn->u.native.outer_frame = gc_copy_value (ctx, fn->u.native.outer_frame, from_base, from_end, to_base, to_free, to_end);
}
break;
}
@@ -4732,6 +4734,8 @@ JSValue JS_CallInternal (JSContext *ctx, JSValue func_obj, JSValue this_obj,
case JS_FUNC_KIND_REGISTER:
return JS_CallRegisterVM (ctx, f->u.reg.code, this_obj, argc, argv,
f->u.reg.env_record, f->u.reg.outer_frame);
case JS_FUNC_KIND_NATIVE:
return cell_native_dispatch (ctx, func_obj, this_obj, argc, argv);
default:
return JS_ThrowTypeError (ctx, "not a function");
}
@@ -4753,6 +4757,8 @@ JSValue JS_Call (JSContext *ctx, JSValue func_obj, JSValue this_obj, int argc, J
case JS_FUNC_KIND_REGISTER:
return JS_CallRegisterVM (ctx, f->u.reg.code, this_obj, argc, argv,
f->u.reg.env_record, f->u.reg.outer_frame);
case JS_FUNC_KIND_NATIVE:
return cell_native_dispatch (ctx, func_obj, this_obj, argc, argv);
default:
return JS_ThrowTypeError (ctx, "not a function");
}