rm global

This commit is contained in:
2026-02-04 18:57:45 -06:00
parent 3abe20fee0
commit ed7dd91c3f
3 changed files with 3 additions and 48 deletions

View File

@@ -3838,10 +3838,6 @@ void JS_ComputeMemoryUsage (JSRuntime *rt, JSMemoryUsage *s) {
void JS_DumpMemoryUsage (FILE *fp, const JSMemoryUsage *s, JSRuntime *rt) { void JS_DumpMemoryUsage (FILE *fp, const JSMemoryUsage *s, JSRuntime *rt) {
} }
JSValue JS_GetGlobalObject (JSContext *ctx) {
return ctx->global_obj;
}
/* WARNING: obj is freed */ /* WARNING: obj is freed */
JSValue JS_Throw (JSContext *ctx, JSValue obj) { JSValue JS_Throw (JSContext *ctx, JSValue obj) {
JSRuntime *rt = ctx->rt; JSRuntime *rt = ctx->rt;
@@ -19243,8 +19239,6 @@ done:
return ret; return ret;
} }
/* global object */
/* ============================================================================ /* ============================================================================
* Cell Script Native Global Functions * Cell Script Native Global Functions
* ============================================================================ * ============================================================================
@@ -23783,8 +23777,9 @@ static JSValue js_cell_proto (JSContext *ctx, JSValue this_val, int argc, JSValu
/* If prototype is Object.prototype, return null */ /* If prototype is Object.prototype, return null */
if (JS_IsObject (proto)) { if (JS_IsObject (proto)) {
if (JS_VALUE_GET_OBJ (proto) JSValue obj_proto = ctx->class_proto[JS_CLASS_OBJECT];
== JS_VALUE_GET_OBJ (ctx->class_proto[JS_CLASS_OBJECT])) { if (JS_IsObject (obj_proto)
&& JS_VALUE_GET_OBJ (proto) == JS_VALUE_GET_OBJ (obj_proto)) {
return JS_NULL; return JS_NULL;
} }
} }

View File

@@ -723,7 +723,6 @@ JSValue JS_Compile (JSContext *ctx, const char *input, size_t input_len,
env should be stoned record or null. env should be stoned record or null.
Variables resolve: env first, then global intrinsics. */ Variables resolve: env first, then global intrinsics. */
JSValue JS_Integrate (JSContext *ctx, JSValue bytecode, JSValue env); JSValue JS_Integrate (JSContext *ctx, JSValue bytecode, JSValue env);
JSValue JS_GetGlobalObject (JSContext *ctx);
void JS_SetOpaque (JSValue obj, void *opaque); void JS_SetOpaque (JSValue obj, void *opaque);
void *JS_GetOpaque (JSValue obj, JSClassID class_id); void *JS_GetOpaque (JSValue obj, JSClassID class_id);
void *JS_GetOpaque2 (JSContext *ctx, JSValue obj, JSClassID class_id); void *JS_GetOpaque2 (JSContext *ctx, JSValue obj, JSClassID class_id);

View File

@@ -954,24 +954,6 @@ TEST(array_foreach_basic) {
return 1; return 1;
} }
/* ============================================================================
GLOBAL OBJECT TEST
============================================================================ */
TEST(global_object) {
JSGCRef global_ref;
JS_PushGCRef(ctx, &global_ref);
global_ref.val = JS_GetGlobalObject(ctx);
ASSERT(JS_IsRecord(global_ref.val));
/* Set something on global */
JS_SetPropertyStr(ctx, global_ref.val, "testGlobal", JS_NewInt32(ctx, 777));
JSValue val = JS_GetPropertyStr(ctx, global_ref.val, "testGlobal");
JS_PopGCRef(ctx, &global_ref);
ASSERT_INT(val, 777);
return 1;
}
/* ============================================================================ /* ============================================================================
VALUE CONVERSION TESTS VALUE CONVERSION TESTS
============================================================================ */ ============================================================================ */
@@ -1521,23 +1503,6 @@ TEST(new_cfunction_with_args) {
return 1; return 1;
} }
TEST(call_function_on_global) {
JSGCRef func_ref, global_ref;
JS_PushGCRef(ctx, &global_ref);
JS_PushGCRef(ctx, &func_ref);
global_ref.val = JS_GetGlobalObject(ctx);
func_ref.val = JS_NewCFunction(ctx, cfunc_return_42, "testFunc", 0);
JS_SetPropertyStr(ctx, global_ref.val, "testFunc", func_ref.val);
JSValue got = JS_GetPropertyStr(ctx, global_ref.val, "testFunc");
int is_func = JS_IsFunction(got);
JSValue result = JS_Call(ctx, got, JS_NULL, 0, NULL);
JS_PopGCRef(ctx, &func_ref);
JS_PopGCRef(ctx, &global_ref);
ASSERT(is_func);
ASSERT_INT(result, 42);
return 1;
}
/* ============================================================================ /* ============================================================================
PROPERTY ACCESS TESTS PROPERTY ACCESS TESTS
============================================================================ */ ============================================================================ */
@@ -2113,9 +2078,6 @@ int run_c_test_suite(JSContext *ctx)
RUN_TEST(strict_eq_null); RUN_TEST(strict_eq_null);
RUN_TEST(strict_eq_bool); RUN_TEST(strict_eq_bool);
printf("\nGlobal Object:\n");
RUN_TEST(global_object);
printf("\nValue Conversions:\n"); printf("\nValue Conversions:\n");
RUN_TEST(to_bool_true_values); RUN_TEST(to_bool_true_values);
RUN_TEST(to_bool_false_values); RUN_TEST(to_bool_false_values);
@@ -2188,7 +2150,6 @@ int run_c_test_suite(JSContext *ctx)
printf("\nC Functions:\n"); printf("\nC Functions:\n");
RUN_TEST(new_cfunction_no_args); RUN_TEST(new_cfunction_no_args);
RUN_TEST(new_cfunction_with_args); RUN_TEST(new_cfunction_with_args);
RUN_TEST(call_function_on_global);
printf("\nProperty Access:\n"); printf("\nProperty Access:\n");
RUN_TEST(get_property_with_jsvalue_key); RUN_TEST(get_property_with_jsvalue_key);