diff --git a/source/quickjs.c b/source/quickjs.c index d78fe3cb..38a5c085 100644 --- a/source/quickjs.c +++ b/source/quickjs.c @@ -929,7 +929,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 */ }; }; @@ -5058,7 +5057,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; @@ -10399,24 +10397,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); @@ -10463,14 +10443,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); @@ -14898,15 +14872,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); } @@ -15254,9 +15220,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; @@ -19277,6 +19241,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 { diff --git a/source/quickjs.h b/source/quickjs.h index 7340d7dc..b773bb04 100644 --- a/source/quickjs.h +++ b/source/quickjs.h @@ -924,9 +924,6 @@ void JS_SetCanBlock(JSRuntime *rt, JS_BOOL can_block); void JS_SetStripInfo(JSRuntime *rt, int flags); int JS_GetStripInfo(JSRuntime *rt); -/* set the [IsHTMLDDA] internal slot */ -void JS_SetIsHTMLDDA(JSContext *ctx, JSValueConst obj); - typedef struct JSModuleDef JSModuleDef; /* return the module specifier (allocated with js_malloc()) or NULL if