remove htmldda

This commit is contained in:
2025-06-15 09:47:09 -05:00
parent 9c0565d34f
commit 6dc8d97001
2 changed files with 5 additions and 43 deletions

View File

@@ -929,7 +929,6 @@ struct JSObject {
uint8_t is_constructor : 1; /* TRUE if object is a constructor function */ uint8_t is_constructor : 1; /* TRUE if object is a constructor function */
uint8_t has_immutable_prototype : 1; /* cannot modify the prototype */ uint8_t has_immutable_prototype : 1; /* cannot modify the prototype */
uint8_t tmp_mark : 1; /* used in JS_WriteObjectRec() */ uint8_t tmp_mark : 1; /* used in JS_WriteObjectRec() */
uint8_t is_HTMLDDA : 1; /* specific annex B IsHtmlDDA behavior */
uint16_t class_id; /* see JS_CLASS_x */ uint16_t class_id; /* see JS_CLASS_x */
}; };
}; };
@@ -5058,7 +5057,6 @@ static JSValue JS_NewObjectFromShape(JSContext *ctx, JSShape *sh, JSClassID clas
p->is_constructor = 0; p->is_constructor = 0;
p->has_immutable_prototype = 0; p->has_immutable_prototype = 0;
p->tmp_mark = 0; p->tmp_mark = 0;
p->is_HTMLDDA = 0;
p->weakref_count = 0; p->weakref_count = 0;
p->u.opaque = NULL; p->u.opaque = NULL;
p->shape = sh; p->shape = sh;
@@ -10399,24 +10397,6 @@ static JSValue JS_ToPrimitive(JSContext *ctx, JSValueConst val, int hint)
return JS_ToPrimitiveFree(ctx, JS_DupValue(ctx, val), hint); return JS_ToPrimitiveFree(ctx, JS_DupValue(ctx, val), hint);
} }
void JS_SetIsHTMLDDA(JSContext *ctx, JSValueConst obj)
{
JSObject *p;
if (JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT)
return;
p = JS_VALUE_GET_OBJ(obj);
p->is_HTMLDDA = TRUE;
}
static inline BOOL JS_IsHTMLDDA(JSContext *ctx, JSValueConst obj)
{
JSObject *p;
if (JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT)
return FALSE;
p = JS_VALUE_GET_OBJ(obj);
return p->is_HTMLDDA;
}
static int JS_ToBoolFree(JSContext *ctx, JSValue val) static int JS_ToBoolFree(JSContext *ctx, JSValue val)
{ {
uint32_t tag = JS_VALUE_GET_TAG(val); uint32_t tag = JS_VALUE_GET_TAG(val);
@@ -10463,14 +10443,8 @@ static int JS_ToBoolFree(JSContext *ctx, JSValue val)
return ret; return ret;
} }
case JS_TAG_OBJECT: case JS_TAG_OBJECT:
{ JS_FreeValue(ctx, val);
JSObject *p = JS_VALUE_GET_OBJ(val); return 1;
BOOL ret;
ret = !p->is_HTMLDDA;
JS_FreeValue(ctx, val);
return ret;
}
break;
default: default:
if (JS_TAG_IS_FLOAT64(tag)) { if (JS_TAG_IS_FLOAT64(tag)) {
double d = JS_VALUE_GET_FLOAT64(val); double d = JS_VALUE_GET_FLOAT64(val);
@@ -14898,15 +14872,7 @@ static no_inline __exception int js_eq_slow(JSContext *ctx, JSValue *sp,
} }
goto redo; goto redo;
} else { } else {
/* IsHTMLDDA object is equivalent to undefined for '==' and '!=' */ res = FALSE;
if ((JS_IsHTMLDDA(ctx, op1) &&
(tag2 == JS_TAG_NULL || tag2 == JS_TAG_UNDEFINED)) ||
(JS_IsHTMLDDA(ctx, op2) &&
(tag1 == JS_TAG_NULL || tag1 == JS_TAG_UNDEFINED))) {
res = TRUE;
} else {
res = FALSE;
}
JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op1);
JS_FreeValue(ctx, op2); JS_FreeValue(ctx, op2);
} }
@@ -15254,9 +15220,7 @@ static __exception int js_operator_typeof(JSContext *ctx, JSValueConst op1)
{ {
JSObject *p; JSObject *p;
p = JS_VALUE_GET_OBJ(op1); p = JS_VALUE_GET_OBJ(op1);
if (unlikely(p->is_HTMLDDA)) if (JS_IsFunction(ctx, op1))
atom = JS_ATOM_undefined;
else if (JS_IsFunction(ctx, op1))
atom = JS_ATOM_function; atom = JS_ATOM_function;
else else
goto obj_type; goto obj_type;
@@ -19277,6 +19241,7 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValueConst func_obj,
/* XXX: could merge to a single opcode */ /* XXX: could merge to a single opcode */
CASE(OP_typeof_is_undefined): CASE(OP_typeof_is_undefined):
/* different from OP_is_undefined because of isHTMLDDA */ /* different from OP_is_undefined because of isHTMLDDA */
/* HTMLDDA removed, so can merge */
if (js_operator_typeof(ctx, sp[-1]) == JS_ATOM_undefined) { if (js_operator_typeof(ctx, sp[-1]) == JS_ATOM_undefined) {
goto free_and_set_true; goto free_and_set_true;
} else { } else {

View File

@@ -924,9 +924,6 @@ void JS_SetCanBlock(JSRuntime *rt, JS_BOOL can_block);
void JS_SetStripInfo(JSRuntime *rt, int flags); void JS_SetStripInfo(JSRuntime *rt, int flags);
int JS_GetStripInfo(JSRuntime *rt); int JS_GetStripInfo(JSRuntime *rt);
/* set the [IsHTMLDDA] internal slot */
void JS_SetIsHTMLDDA(JSContext *ctx, JSValueConst obj);
typedef struct JSModuleDef JSModuleDef; typedef struct JSModuleDef JSModuleDef;
/* return the module specifier (allocated with js_malloc()) or NULL if /* return the module specifier (allocated with js_malloc()) or NULL if