Merge remote-tracking branch 'origin/js-rm-htmldda' into js-rm-modules

This commit is contained in:
2025-06-16 14:18:40 -05:00
2 changed files with 5 additions and 43 deletions

View File

@@ -722,7 +722,6 @@ struct JSObject {
uint8_t is_constructor : 1; /* TRUE if object is a constructor function */
uint8_t has_immutable_prototype : 1; /* cannot modify the prototype */
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 */
};
};
@@ -4645,7 +4644,6 @@ static JSValue JS_NewObjectFromShape(JSContext *ctx, JSShape *sh, JSClassID clas
p->is_constructor = 0;
p->has_immutable_prototype = 0;
p->tmp_mark = 0;
p->is_HTMLDDA = 0;
p->weakref_count = 0;
p->u.opaque = NULL;
p->shape = sh;
@@ -9525,24 +9523,6 @@ static JSValue JS_ToPrimitive(JSContext *ctx, JSValueConst val, int 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)
{
uint32_t tag = JS_VALUE_GET_TAG(val);
@@ -9589,14 +9569,8 @@ static int JS_ToBoolFree(JSContext *ctx, JSValue val)
return ret;
}
case JS_TAG_OBJECT:
{
JSObject *p = JS_VALUE_GET_OBJ(val);
BOOL ret;
ret = !p->is_HTMLDDA;
JS_FreeValue(ctx, val);
return ret;
}
break;
JS_FreeValue(ctx, val);
return 1;
default:
if (JS_TAG_IS_FLOAT64(tag)) {
double d = JS_VALUE_GET_FLOAT64(val);
@@ -13959,15 +13933,7 @@ static no_inline __exception int js_eq_slow(JSContext *ctx, JSValue *sp,
}
goto redo;
} else {
/* IsHTMLDDA object is equivalent to undefined for '==' and '!=' */
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;
}
res = FALSE;
JS_FreeValue(ctx, op1);
JS_FreeValue(ctx, op2);
}
@@ -14260,9 +14226,7 @@ static __exception int js_operator_typeof(JSContext *ctx, JSValueConst op1)
{
JSObject *p;
p = JS_VALUE_GET_OBJ(op1);
if (unlikely(p->is_HTMLDDA))
atom = JS_ATOM_undefined;
else if (JS_IsFunction(ctx, op1))
if (JS_IsFunction(ctx, op1))
atom = JS_ATOM_function;
else
goto obj_type;
@@ -17879,6 +17843,7 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValueConst func_obj,
/* XXX: could merge to a single opcode */
CASE(OP_typeof_is_undefined):
/* different from OP_is_undefined because of isHTMLDDA */
/* HTMLDDA removed, so can merge */
if (js_operator_typeof(ctx, sp[-1]) == JS_ATOM_undefined) {
goto free_and_set_true;
} else {

View File

@@ -878,9 +878,6 @@ void JS_SetInterruptHandler(JSRuntime *rt, JSInterruptHandler *cb, void *opaque)
void JS_SetStripInfo(JSRuntime *rt, int flags);
int JS_GetStripInfo(JSRuntime *rt);
/* set the [IsHTMLDDA] internal slot */
void JS_SetIsHTMLDDA(JSContext *ctx, JSValueConst obj);
/* Object Writer/Reader (currently only used to handle precompiled code) */
#define JS_WRITE_OBJ_BYTECODE (1 << 0) /* allow function/module */
#define JS_WRITE_OBJ_BSWAP (1 << 1) /* byte swapped output */