finish removing big int stuff; fixes memory leak

This commit is contained in:
2025-06-17 21:36:06 -05:00
parent 843b4bd8a8
commit 91a3fef065

View File

@@ -131,7 +131,6 @@ enum {
JS_CLASS_C_FUNCTION_DATA, /* u.c_function_data_record */
JS_CLASS_FOR_IN_ITERATOR, /* u.for_in_iterator */
JS_CLASS_REGEXP, /* u.regexp */
JS_CLASS_BIG_INT, /* u.object_data */
JS_CLASS_MAP, /* u.map_state */
JS_CLASS_SET, /* u.map_state */
JS_CLASS_MAP_ITERATOR, /* u.map_iterator_data */
@@ -4552,7 +4551,6 @@ static JSValue JS_NewObjectFromShape(JSContext *ctx, JSShape *sh, JSClassID clas
case JS_CLASS_STRING:
case JS_CLASS_BOOLEAN:
case JS_CLASS_SYMBOL:
case JS_CLASS_BIG_INT:
p->u.object_data = JS_NULL;
goto set_exotic;
case JS_CLASS_REGEXP:
@@ -4610,7 +4608,6 @@ static JSValue JS_GetObjectData(JSContext *ctx, JSValueConst obj)
case JS_CLASS_STRING:
case JS_CLASS_BOOLEAN:
case JS_CLASS_SYMBOL:
case JS_CLASS_BIG_INT:
return JS_DupValue(ctx, p->u.object_data);
}
}
@@ -4629,7 +4626,6 @@ static int JS_SetObjectData(JSContext *ctx, JSValueConst obj, JSValue val)
case JS_CLASS_STRING:
case JS_CLASS_BOOLEAN:
case JS_CLASS_SYMBOL:
case JS_CLASS_BIG_INT:
JS_FreeValue(ctx, p->u.object_data);
p->u.object_data = val; /* for JS_CLASS_STRING, 'val' must
be JS_TAG_STRING (and not a
@@ -5670,7 +5666,6 @@ void JS_ComputeMemoryUsage(JSRuntime *rt, JSMemoryUsage *s)
case JS_CLASS_STRING: /* u.object_data */
case JS_CLASS_BOOLEAN: /* u.object_data */
case JS_CLASS_SYMBOL: /* u.object_data */
case JS_CLASS_BIG_INT: /* u.object_data */
compute_value_size(p->u.object_data, hp);
break;
case JS_CLASS_C_FUNCTION: /* u.cfunc */
@@ -6541,10 +6536,6 @@ int JS_SetPrototype(JSContext *ctx, JSValueConst obj, JSValueConst proto_val)
static JSValueConst JS_GetPrototypePrimitive(JSContext *ctx, JSValueConst val)
{
switch(JS_VALUE_GET_NORM_TAG(val)) {
case JS_TAG_SHORT_BIG_INT:
case JS_TAG_BIG_INT:
val = ctx->class_proto[JS_CLASS_BIG_INT];
break;
case JS_TAG_INT:
case JS_TAG_FLOAT64:
val = ctx->class_proto[JS_CLASS_NUMBER];
@@ -11217,8 +11208,7 @@ exception:
static BOOL tag_is_number(uint32_t tag)
{
return (tag == JS_TAG_INT ||
tag == JS_TAG_FLOAT64 ||
tag == JS_TAG_BIG_INT || tag == JS_TAG_SHORT_BIG_INT);
tag == JS_TAG_FLOAT64);
}
static no_inline __exception int js_eq_slow(JSContext *ctx, JSValue *sp,
@@ -26504,7 +26494,6 @@ typedef enum BCTagEnum {
BC_TAG_STRING,
BC_TAG_OBJECT,
BC_TAG_ARRAY,
BC_TAG_BIG_INT,
BC_TAG_TEMPLATE_OBJECT,
BC_TAG_FUNCTION_BYTECODE,
BC_TAG_MODULE,
@@ -27030,7 +27019,6 @@ static int JS_WriteObjectRec(BCWriterState *s, JSValueConst obj)
case JS_CLASS_NUMBER:
case JS_CLASS_STRING:
case JS_CLASS_BOOLEAN:
case JS_CLASS_BIG_INT:
bc_put_u8(s, BC_TAG_OBJECT_VALUE);
ret = JS_WriteObjectRec(s, p->u.object_data);
break;
@@ -28205,10 +28193,6 @@ static JSValue JS_ToObject(JSContext *ctx, JSValueConst val)
case JS_TAG_OBJECT:
case JS_TAG_EXCEPTION:
return JS_DupValue(ctx, val);
case JS_TAG_SHORT_BIG_INT:
case JS_TAG_BIG_INT:
obj = JS_NewObjectClass(ctx, JS_CLASS_BIG_INT);
goto set_value;
case JS_TAG_INT:
case JS_TAG_FLOAT64:
obj = JS_NewObjectClass(ctx, JS_CLASS_NUMBER);
@@ -36202,8 +36186,6 @@ static JSValue js_json_check(JSContext *ctx, JSONStringifyContext *jsc,
case JS_TAG_FLOAT64:
case JS_TAG_BOOL:
case JS_TAG_NULL:
case JS_TAG_SHORT_BIG_INT:
case JS_TAG_BIG_INT:
case JS_TAG_EXCEPTION:
return val;
default:
@@ -36251,7 +36233,7 @@ static int js_json_to_str(JSContext *ctx, JSONStringifyContext *jsc,
if (JS_IsException(val))
goto exception;
goto concat_primitive;
} else if (cl == JS_CLASS_BOOLEAN || cl == JS_CLASS_BIG_INT)
} else if (cl == JS_CLASS_BOOLEAN)
{
/* This will thow the same error as for the primitive object */
set_value(ctx, &val, JS_DupValue(ctx, p->u.object_data));