diff options
Diffstat (limited to '')
-rw-r--r-- | js/src/jit/BaselineIC.cpp | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index 705dcb8e46..88ff52e16e 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -32,6 +32,7 @@ #include "vm/JSFunction.h" #include "vm/JSScript.h" #include "vm/Opcodes.h" +#include "vm/TypeofEqOperand.h" // TypeofEqOperand #ifdef MOZ_VTUNE # include "vtune/VTuneWrapper.h" #endif @@ -356,6 +357,8 @@ class MOZ_STATIC_CLASS OpToFallbackKindTable { setKind(JSOp::Typeof, BaselineICFallbackKind::TypeOf); setKind(JSOp::TypeofExpr, BaselineICFallbackKind::TypeOf); + setKind(JSOp::TypeofEq, BaselineICFallbackKind::TypeOfEq); + setKind(JSOp::ToPropertyKey, BaselineICFallbackKind::ToPropertyKey); setKind(JSOp::Iter, BaselineICFallbackKind::GetIterator); @@ -429,6 +432,7 @@ bool ICSupportsPolymorphicTypeData(JSOp op) { switch (kind) { case BaselineICFallbackKind::ToBool: case BaselineICFallbackKind::TypeOf: + case BaselineICFallbackKind::TypeOfEq: return true; default: return false; @@ -1143,7 +1147,7 @@ bool DoGetNameFallback(JSContext* cx, BaselineFrame* frame, static_assert(JSOpLength_GetGName == JSOpLength_GetName, "Otherwise our check for JSOp::Typeof isn't ok"); - if (JSOp(pc[JSOpLength_GetGName]) == JSOp::Typeof) { + if (IsTypeOfNameOp(JSOp(pc[JSOpLength_GetGName]))) { if (!GetEnvironmentName<GetNameMode::TypeOf>(cx, envChain, name, res)) { return false; } @@ -2056,6 +2060,45 @@ bool FallbackICCodeCompiler::emit_TypeOf() { } // +// TypeOfEq_Fallback +// + +bool DoTypeOfEqFallback(JSContext* cx, BaselineFrame* frame, + ICFallbackStub* stub, HandleValue val, + MutableHandleValue res) { + stub->incrementEnteredCount(); + MaybeNotifyWarp(frame->outerScript(), stub); + FallbackICSpew(cx, stub, "TypeOfEq"); + + jsbytecode* pc = StubOffsetToPc(stub, frame->script()); + auto operand = TypeofEqOperand::fromRawValue(GET_UINT8(pc)); + JSType type = operand.type(); + JSOp compareOp = operand.compareOp(); + + TryAttachStub<TypeOfEqIRGenerator>("TypeOfEq", cx, frame, stub, val, type, + compareOp); + + bool result = js::TypeOfValue(val) == type; + if (compareOp == JSOp::Ne) { + result = !result; + } + res.setBoolean(result); + return true; +} + +bool FallbackICCodeCompiler::emit_TypeOfEq() { + EmitRestoreTailCallReg(masm); + + masm.pushValue(R0); + masm.push(ICStubReg); + pushStubPayload(masm, R0.scratchReg()); + + using Fn = bool (*)(JSContext*, BaselineFrame*, ICFallbackStub*, HandleValue, + MutableHandleValue); + return tailCallVM<Fn, DoTypeOfEqFallback>(masm); +} + +// // ToPropertyKey_Fallback // |