From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- js/src/vm/Interpreter.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'js/src/vm/Interpreter.cpp') diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index f4cdc86f18..f005c12949 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -63,6 +63,7 @@ #include "vm/StringType.h" #include "vm/ThrowMsgKind.h" // ThrowMsgKind #include "vm/Time.h" +#include "vm/TypeofEqOperand.h" // TypeofEqOperand #ifdef ENABLE_RECORD_TUPLE # include "vm/RecordType.h" # include "vm/TupleType.h" @@ -249,7 +250,7 @@ static inline bool GetNameOperation(JSContext* cx, HandleObject envChain, Handle name, JSOp nextOp, MutableHandleValue vp) { /* Kludge to allow (typeof foo == "undefined") tests. */ - if (nextOp == JSOp::Typeof) { + if (IsTypeOfNameOp(nextOp)) { return GetEnvironmentName(cx, envChain, name, vp); } return GetEnvironmentName(cx, envChain, name, vp); @@ -2650,6 +2651,16 @@ bool MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER js::Interpret(JSContext* cx, } END_CASE(Typeof) + CASE(TypeofEq) { + auto operand = TypeofEqOperand::fromRawValue(GET_UINT8(REGS.pc)); + bool result = js::TypeOfValue(REGS.sp[-1]) == operand.type(); + if (operand.compareOp() == JSOp::Ne) { + result = !result; + } + REGS.sp[-1].setBoolean(result); + } + END_CASE(TypeofEq) + CASE(Void) { REGS.sp[-1].setUndefined(); } END_CASE(Void) @@ -4140,13 +4151,7 @@ bool MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER js::Interpret(JSContext* cx, } if (!DebugAPI::onResumeFrame(cx, REGS.fp())) { - if (cx->isPropagatingForcedReturn()) { - MOZ_ASSERT_IF( - REGS.fp() - ->callee() - .isGenerator(), // as opposed to an async function - gen->isClosed()); - } + MOZ_ASSERT_IF(cx->isPropagatingForcedReturn(), gen->isClosed()); goto error; } } -- cgit v1.2.3