diff options
Diffstat (limited to 'js/src/vm/Interpreter.cpp')
-rw-r--r-- | js/src/vm/Interpreter.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
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<PropertyName*> name, JSOp nextOp, MutableHandleValue vp) { /* Kludge to allow (typeof foo == "undefined") tests. */ - if (nextOp == JSOp::Typeof) { + if (IsTypeOfNameOp(nextOp)) { return GetEnvironmentName<GetNameMode::TypeOf>(cx, envChain, name, vp); } return GetEnvironmentName<GetNameMode::Normal>(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; } } |