author | Benjamin Bouvier <benj@benj.me> |
Wed, 29 Aug 2018 10:07:10 +0000 | |
changeset 433761 | eff3d90694630f95e35b09ae343fda4ad07e6870 |
parent 433760 | d325fc4bbfc2cedcfa9e9630d3783db221151c11 |
child 433762 | adbee46f307f7bc4617735c425398b3b87e9994e |
push id | 34522 |
push user | csabou@mozilla.com |
push date | Wed, 29 Aug 2018 17:32:47 +0000 |
treeherder | mozilla-central@2d1a1f2205c5 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | tcampbell |
bugs | 1486829 |
milestone | 63.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/gdb/mozilla/unwind.py +++ b/js/src/gdb/mozilla/unwind.py @@ -33,27 +33,27 @@ except ImportError: def debug(something): # print("@@ " + something) pass # Maps frametype enum base names to corresponding class. SizeOfFramePrefix = { - 'JitFrame_IonJS': 'ExitFrameLayout', - 'JitFrame_BaselineJS': 'JitFrameLayout', - 'JitFrame_BaselineStub': 'BaselineStubFrameLayout', - 'JitFrame_IonStub': 'JitStubFrameLayout', - 'JitFrame_CppToJSJit': 'JitFrameLayout', - 'JitFrame_WasmToJSJit': 'JitFrameLayout', - 'JitFrame_Rectifier': 'RectifierFrameLayout', - 'JitFrame_IonAccessorIC': 'IonAccessorICFrameLayout', - 'JitFrame_IonICCall': 'IonICCallFrameLayout', - 'JitFrame_Exit': 'ExitFrameLayout', - 'JitFrame_Bailout': 'JitFrameLayout', + 'FrameType::IonJS': 'ExitFrameLayout', + 'FrameType::BaselineJS': 'JitFrameLayout', + 'FrameType::BaselineStub': 'BaselineStubFrameLayout', + 'FrameType::IonStub': 'JitStubFrameLayout', + 'FrameType::CppToJSJit': 'JitFrameLayout', + 'FrameType::WasmToJSJit': 'JitFrameLayout', + 'FrameType::Rectifier': 'RectifierFrameLayout', + 'FrameType::IonAccessorIC': 'IonAccessorICFrameLayout', + 'FrameType::IonICCall': 'IonICCallFrameLayout', + 'FrameType::Exit': 'ExitFrameLayout', + 'FrameType::Bailout': 'JitFrameLayout', } class UnwinderTypeCache(object): # All types and symbols that we need are attached to an object that we # can dispose of as needed. def __init__(self): @@ -327,17 +327,17 @@ class UnwinderState(object): def get_frame(self, frame): sp = long(frame.read_register(self.SP_REGISTER)) if sp in self.frame_map: return self.frame_map[sp] return None # Add information about a frame to the frame map. This map is # queried by |self.get_frame|. |sp| is the frame's stack pointer, - # and |name| the frame's type as a string, e.g. "JitFrame_Exit". + # and |name| the frame's type as a string, e.g. "FrameType::Exit". def add_frame(self, sp, name=None, this_frame=None): self.frame_map[long(sp)] = {"name": name, "this_frame": this_frame} # See whether |pc| is claimed by some text mapping. See # |parse_proc_maps| for details on how the decision is made. def text_address_claimed(self, pc): for (start, end) in self.proc_mappings: if (pc >= start and pc <= end): @@ -382,17 +382,17 @@ class UnwinderState(object): # representing the previous frame's type. def unpack_descriptor(self, common): value = long(common['descriptor_']) local_size = value >> self.typecache.FRAMESIZE_SHIFT header_size = ((value >> self.typecache.FRAME_HEADER_SIZE_SHIFT) & self.typecache.FRAME_HEADER_SIZE_MASK) header_size = header_size * self.typecache.void_starstar.sizeof frame_type = long(value & self.typecache.FRAMETYPE_MASK) - if frame_type == self.typecache.JitFrame_CppToJSJit: + if frame_type == self.typecache.CppToJSJit: # Trampoline-x64.cpp pushes a JitFrameLayout object, but # the stack pointer is actually adjusted as if a # CommonFrameLayout object was pushed. header_size = self.typecache.typeCommonFrameLayout.sizeof return (local_size, header_size, frame_type) # Create a new frame for gdb. This makes a new unwind info object # and fills it in, then returns it. It also registers any @@ -458,25 +458,25 @@ class UnwinderState(object): else: self.activation = self.activation['prevJitActivation_'] packedExitFP = self.activation['packedExitFP_'] if packedExitFP == 0: return None exit_sp = pending_frame.read_register(self.SP_REGISTER) - frame_type = self.typecache.JitFrame_Exit + frame_type = self.typecache.Exit return self.create_frame(pc, exit_sp, packedExitFP, frame_type, pending_frame) # A wrapper for unwind_entry_frame_registers that handles # architecture-independent boilerplate. def unwind_entry_frame(self, pc, pending_frame): sp = self.next_sp # Notify the frame filter. - self.add_frame(sp, name='JitFrame_CppToJSJit') + self.add_frame(sp, name='FrameType::CppToJSJit') # Make an unwind_info for the per-architecture code to fill in. frame_id = SpiderMonkeyFrameId(sp, pc) unwind_info = pending_frame.create_unwind_info(frame_id) self.unwind_entry_frame_registers(sp, unwind_info) self.next_sp = None self.next_type = None return unwind_info @@ -487,17 +487,17 @@ class UnwinderState(object): pc = pending_frame.read_register(self.PC_REGISTER) # If the jit does not claim this address, bail. GDB defers to our # unwinder by default, but we don't really want that kind of power. if not self.is_jit_address(long(pc)): return None if self.next_sp is not None: - if self.next_type == self.typecache.JitFrame_CppToJSJit: + if self.next_type == self.typecache.CppToJSJit: return self.unwind_entry_frame(pc, pending_frame) return self.unwind_ordinary(pc, pending_frame) # Maybe we've found an exit frame. FIXME I currently don't # know how to identify these precisely, so we'll just hope for # the time being. return self.unwind_exit_frame(pc, pending_frame) # The UnwinderState subclass for x86-64.
--- a/js/src/gdb/tests/test-unwind.py +++ b/js/src/gdb/tests/test-unwind.py @@ -21,19 +21,19 @@ def do_unwinder_test(): found_inner = False found_outer = False frames = list(gdb.frames.execute_frame_filters(gdb.newest_frame(), 0, -1)) for frame in frames: print("examining " + frame.function()) if first: assert_eq(frame.function().startswith("Something"), True) first = False - elif frame.function() == "<<JitFrame_Exit>>": + elif frame.function() == "<<FrameType::Exit>>": found_exit = True - elif frame.function() == "<<JitFrame_CppToJSJit>>": + elif frame.function() == "<<FrameType::CppToJSJit>>": found_entry = True elif frame.function() == "main": found_main = True elif "unwindFunctionInner" in frame.function(): found_inner = True elif "unwindFunctionOuter" in frame.function(): found_outer = True
--- a/js/src/jit/BaselineBailouts.cpp +++ b/js/src/jit/BaselineBailouts.cpp @@ -356,30 +356,30 @@ struct BaselineStackBuilder // Get the incoming frame. BufferPointer<JitFrameLayout> topFrame = topFrameAddress(); FrameType type = topFrame->prevType(); // For IonJS, IonICCall and Entry frames, the "saved" frame pointer // in the baseline frame is meaningless, since Ion saves all registers // before calling other ion frames, and the entry frame saves all // registers too. - if (JSJitFrameIter::isEntry(type) || type == JitFrame_IonJS || type == JitFrame_IonICCall) + if (JSJitFrameIter::isEntry(type) || type == FrameType::IonJS || type == FrameType::IonICCall) return nullptr; // BaselineStub - Baseline calling into Ion. // PrevFramePtr needs to point to the BaselineStubFrame's saved frame pointer. // STACK_START_ADDR + JitFrameLayout::Size() + PREV_FRAME_SIZE // - BaselineStubFrameLayout::reverseOffsetOfSavedFramePtr() - if (type == JitFrame_BaselineStub) { + if (type == FrameType::BaselineStub) { size_t offset = JitFrameLayout::Size() + topFrame->prevFrameLocalSize() + BaselineStubFrameLayout::reverseOffsetOfSavedFramePtr(); return virtualPointerAtStackOffset(offset); } - MOZ_ASSERT(type == JitFrame_Rectifier); + MOZ_ASSERT(type == FrameType::Rectifier); // Rectifier - behaviour depends on the frame preceding the rectifier frame, and // whether the arch is x86 or not. The x86 rectifier frame saves the frame pointer, // so we can calculate it directly. For other archs, the previous frame pointer // is stored on the stack in the frame that precedes the rectifier frame. size_t priorOffset = JitFrameLayout::Size() + topFrame->prevFrameLocalSize(); #if defined(JS_CODEGEN_X86) // On X86, the FramePointer is pushed as the first value in the Rectifier frame. MOZ_ASSERT(BaselineFrameReg == FramePointer); @@ -389,22 +389,22 @@ struct BaselineStackBuilder defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) || \ defined(JS_CODEGEN_X64) // On X64, ARM, ARM64, and MIPS, the frame pointer save location depends on // the caller of the rectifier frame. BufferPointer<RectifierFrameLayout> priorFrame = pointerAtStackOffset<RectifierFrameLayout>(priorOffset); FrameType priorType = priorFrame->prevType(); MOZ_ASSERT(JSJitFrameIter::isEntry(priorType) || - priorType == JitFrame_IonJS || - priorType == JitFrame_BaselineStub); + priorType == FrameType::IonJS || + priorType == FrameType::BaselineStub); // If the frame preceding the rectifier is an IonJS or entry frame, // then once again the frame pointer does not matter. - if (priorType == JitFrame_IonJS || JSJitFrameIter::isEntry(priorType)) + if (priorType == FrameType::IonJS || JSJitFrameIter::isEntry(priorType)) return nullptr; // Otherwise, the frame preceding the rectifier is a BaselineStub frame. // let X = STACK_START_ADDR + JitFrameLayout::Size() + PREV_FRAME_SIZE // X + RectifierFrameLayout::Size() // + ((RectifierFrameLayout*) X)->prevFrameLocalSize() // - BaselineStubFrameLayout::reverseOffsetOfSavedFramePtr() size_t extraOffset = RectifierFrameLayout::Size() + priorFrame->prevFrameLocalSize() + @@ -1235,17 +1235,17 @@ InitFromBailout(JSContext* cx, size_t fr cx->runtime()->geckoProfiler().markEvent(buf.get()); } return true; } // Write out descriptor of BaselineJS frame. size_t baselineFrameDescr = MakeFrameDescriptor((uint32_t) builder.framePushed(), - JitFrame_BaselineJS, + FrameType::BaselineJS, BaselineStubFrameLayout::Size()); if (!builder.writeWord(baselineFrameDescr, "Descriptor")) return false; // Calculate and write out return address. // The icEntry in question MUST have an inlinable fallback stub. ICEntry& icEntry = baselineScript->icEntryFromPCOffset(pcOff); MOZ_ASSERT(IsInlinableFallback(icEntry.firstStub()->getChainFallback())); @@ -1346,17 +1346,17 @@ InitFromBailout(JSContext* cx, size_t fr // In case these arguments need to be copied on the stack again for a rectifier frame, // save the framePushed values here for later use. size_t endOfBaselineStubArgs = builder.framePushed(); // Calculate frame size for descriptor. size_t baselineStubFrameSize = builder.framePushed() - startOfBaselineStubFrame; size_t baselineStubFrameDescr = MakeFrameDescriptor((uint32_t) baselineStubFrameSize, - JitFrame_BaselineStub, + FrameType::BaselineStub, JitFrameLayout::Size()); // Push actual argc if (!builder.writeWord(actualArgc, "ActualArgc")) return false; // Push callee token (must be a JS Function) JitSpew(JitSpew_BaselineBailouts, " Callee = %016" PRIx64, callee.asRawBits()); @@ -1459,17 +1459,17 @@ InitFromBailout(JSContext* cx, size_t fr builder.pointerAtStackOffset<uint8_t>(builder.framePushed() - endOfBaselineStubArgs); JitSpew(JitSpew_BaselineBailouts, " MemCpy from %p", stubArgsEnd.get()); memcpy(builder.pointerAtStackOffset<uint8_t>(0).get(), stubArgsEnd.get(), (actualArgc + 1) * sizeof(Value)); // Calculate frame size for descriptor. size_t rectifierFrameSize = builder.framePushed() - startOfRectifierFrame; size_t rectifierFrameDescr = MakeFrameDescriptor((uint32_t) rectifierFrameSize, - JitFrame_Rectifier, + FrameType::Rectifier, JitFrameLayout::Size()); // Push actualArgc if (!builder.writeWord(actualArgc, "ActualArgc")) return false; // Push calleeToken again. if (!builder.writePtr(CalleeToToken(calleeFun, pushedNewTarget), "CalleeToken")) @@ -1521,20 +1521,20 @@ jit::BailoutIonToBaseline(JSContext* cx, // IonJS - Ion calling into Ion. // BaselineStub - Baseline calling into Ion. // Entry / WasmToJSJit - Interpreter or other (wasm) calling into Ion. // Rectifier - Arguments rectifier calling into Ion. MOZ_ASSERT(iter.isBailoutJS()); #if defined(DEBUG) || defined(JS_JITSPEW) FrameType prevFrameType = iter.prevType(); MOZ_ASSERT(JSJitFrameIter::isEntry(prevFrameType) || - prevFrameType == JitFrame_IonJS || - prevFrameType == JitFrame_BaselineStub || - prevFrameType == JitFrame_Rectifier || - prevFrameType == JitFrame_IonICCall); + prevFrameType == FrameType::IonJS || + prevFrameType == FrameType::BaselineStub || + prevFrameType == FrameType::Rectifier || + prevFrameType == FrameType::IonICCall); #endif // All incoming frames are going to look like this: // // +---------------+ // | ... | // +---------------+ // | Args |
--- a/js/src/jit/BaselineCompiler.cpp +++ b/js/src/jit/BaselineCompiler.cpp @@ -4758,17 +4758,17 @@ BaselineCompiler::emit_JSOP_RESUME() // Push |undefined| for |this|. masm.pushValue(UndefinedValue()); // Update BaselineFrame frameSize field and create the frame descriptor. masm.computeEffectiveAddress(Address(BaselineFrameReg, BaselineFrame::FramePointerOffset), scratch2); masm.subStackPtrFrom(scratch2); masm.store32(scratch2, Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfFrameSize())); - masm.makeFrameDescriptor(scratch2, JitFrame_BaselineJS, JitFrameLayout::Size()); + masm.makeFrameDescriptor(scratch2, FrameType::BaselineJS, JitFrameLayout::Size()); masm.Push(Imm32(0)); // actual argc masm.PushCalleeToken(callee, /* constructing = */ false); masm.Push(scratch2); // frame descriptor regs.add(callee); // Load the return value. @@ -4889,17 +4889,17 @@ BaselineCompiler::emit_JSOP_RESUME() pushArg(retVal); pushArg(genObj); pushArg(scratch2); TrampolinePtr code = cx->runtime()->jitRuntime()->getVMWrapper(GeneratorThrowOrReturnInfo); // Create the frame descriptor. masm.subStackPtrFrom(scratch1); - masm.makeFrameDescriptor(scratch1, JitFrame_BaselineJS, ExitFrameLayout::Size()); + masm.makeFrameDescriptor(scratch1, FrameType::BaselineJS, ExitFrameLayout::Size()); // Push the frame descriptor and a dummy return address (it doesn't // matter what we push here, frame iterators will use the frame pc // set in jit::GeneratorThrowOrReturn). masm.push(scratch1); // On ARM64, the callee will push the return address. #ifndef JS_CODEGEN_ARM64
--- a/js/src/jit/BaselineDebugModeOSR.cpp +++ b/js/src/jit/BaselineDebugModeOSR.cpp @@ -184,17 +184,17 @@ static bool CollectJitStackScripts(JSContext* cx, const Debugger::ExecutionObservableSet& obs, const ActivationIterator& activation, DebugModeOSREntryVector& entries) { ICStub* prevFrameStubPtr = nullptr; bool needsRecompileHandler = false; for (OnlyJSJitFrameIter iter(activation); !iter.done(); ++iter) { const JSJitFrameIter& frame = iter.frame(); switch (frame.type()) { - case JitFrame_BaselineJS: { + case FrameType::BaselineJS: { JSScript* script = frame.script(); if (!obs.shouldRecompileOrInvalidate(script)) { prevFrameStubPtr = nullptr; break; } BaselineFrame* baselineFrame = frame.baselineFrame(); @@ -229,22 +229,22 @@ CollectJitStackScripts(JSContext* cx, co needsRecompileHandler |= true; } entries.back().oldStub = prevFrameStubPtr; prevFrameStubPtr = nullptr; break; } - case JitFrame_BaselineStub: + case FrameType::BaselineStub: prevFrameStubPtr = reinterpret_cast<BaselineStubFrameLayout*>(frame.fp())->maybeStubPtr(); break; - case JitFrame_IonJS: { + case FrameType::IonJS: { InlineFrameIterator inlineIter(cx, &frame); while (true) { if (obs.shouldRecompileOrInvalidate(inlineIter.script())) { if (!entries.append(DebugModeOSREntry(inlineIter.script()))) return false; } if (!inlineIter.more()) break; @@ -383,17 +383,17 @@ PatchBaselineFramesForDebugMode(JSContex // CommonFrameLayout* prev = nullptr; size_t entryIndex = *start; for (OnlyJSJitFrameIter iter(activation); !iter.done(); ++iter) { const JSJitFrameIter& frame = iter.frame(); switch (frame.type()) { - case JitFrame_BaselineJS: { + case FrameType::BaselineJS: { // If the script wasn't recompiled or is not observed, there's // nothing to patch. if (!obs.shouldRecompileOrInvalidate(frame.script())) break; DebugModeOSREntry& entry = entries[entryIndex]; if (!entry.recompiled()) { @@ -585,17 +585,17 @@ PatchBaselineFramesForDebugMode(JSContex prev->setReturnAddress(reinterpret_cast<uint8_t*>(handlerAddr)); frame.baselineFrame()->setDebugModeOSRInfo(recompInfo); frame.baselineFrame()->setOverridePc(recompInfo->pc); entryIndex++; break; } - case JitFrame_BaselineStub: { + case FrameType::BaselineStub: { JSJitFrameIter prev(iter.frame()); ++prev; BaselineFrame* prevFrame = prev.baselineFrame(); if (!obs.shouldRecompileOrInvalidate(prevFrame->script())) break; DebugModeOSREntry& entry = entries[entryIndex]; @@ -628,17 +628,17 @@ PatchBaselineFramesForDebugMode(JSContex MOZ_ASSERT(entry.newStub || prevFrame->isHandlingException()); SpewPatchStubFrame(entry.oldStub, entry.newStub); layout->setStubPtr(entry.newStub); } break; } - case JitFrame_IonJS: { + case FrameType::IonJS: { // Nothing to patch. InlineFrameIterator inlineIter(cx, &frame); while (true) { if (obs.shouldRecompileOrInvalidate(inlineIter.script())) entryIndex++; if (!inlineIter.more()) break; ++inlineIter;
--- a/js/src/jit/BaselineJIT.cpp +++ b/js/src/jit/BaselineJIT.cpp @@ -1189,27 +1189,27 @@ jit::ToggleBaselineTraceLoggerEngine(JSR #endif static void MarkActiveBaselineScripts(JSContext* cx, const JitActivationIterator& activation) { for (OnlyJSJitFrameIter iter(activation); !iter.done(); ++iter) { const JSJitFrameIter& frame = iter.frame(); switch (frame.type()) { - case JitFrame_BaselineJS: + case FrameType::BaselineJS: frame.script()->baselineScript()->setActive(); break; - case JitFrame_Exit: + case FrameType::Exit: if (frame.exitFrame()->is<LazyLinkExitFrameLayout>()) { LazyLinkExitFrameLayout* ll = frame.exitFrame()->as<LazyLinkExitFrameLayout>(); ScriptFromCalleeToken(ll->jsFrame()->calleeToken())->baselineScript()->setActive(); } break; - case JitFrame_Bailout: - case JitFrame_IonJS: { + case FrameType::Bailout: + case FrameType::IonJS: { // Keep the baseline script around, since bailouts from the ion // jitcode might need to re-enter into the baseline jitcode. frame.script()->baselineScript()->setActive(); for (InlineFrameIterator inlineIter(cx, &frame); inlineIter.more(); ++inlineIter) inlineIter.script()->baselineScript()->setActive(); break; } default:;
--- a/js/src/jit/CodeGenerator.cpp +++ b/js/src/jit/CodeGenerator.cpp @@ -4631,17 +4631,17 @@ CodeGenerator::visitCallGeneric(LCallGen masm.loadJitCodeRaw(calleereg, objreg); else masm.loadJitCodeNoArgCheck(calleereg, objreg); // Nestle the StackPointer up to the argument vector. masm.freeStack(unusedStack); // Construct the IonFramePrefix. - uint32_t descriptor = MakeFrameDescriptor(masm.framePushed(), JitFrame_IonJS, + uint32_t descriptor = MakeFrameDescriptor(masm.framePushed(), FrameType::IonJS, JitFrameLayout::Size()); masm.Push(Imm32(call->numActualArgs())); masm.PushCalleeToken(calleereg, call->mir()->isConstructing()); masm.Push(Imm32(descriptor)); // Check whether the provided arguments satisfy target argc. // We cannot have lowered to LCallGeneric with a known target. Assert that we didn't // add any undefineds in IonBuilder. NB: MCall::numStackArgs includes |this|. @@ -4753,17 +4753,17 @@ CodeGenerator::visitCallKnown(LCallKnown masm.loadJitCodeRaw(calleereg, objreg); else masm.loadJitCodeNoArgCheck(calleereg, objreg); // Nestle the StackPointer up to the argument vector. masm.freeStack(unusedStack); // Construct the IonFramePrefix. - uint32_t descriptor = MakeFrameDescriptor(masm.framePushed(), JitFrame_IonJS, + uint32_t descriptor = MakeFrameDescriptor(masm.framePushed(), FrameType::IonJS, JitFrameLayout::Size()); masm.Push(Imm32(call->numActualArgs())); masm.PushCalleeToken(calleereg, call->mir()->isConstructing()); masm.Push(Imm32(descriptor)); // Finally call the function in objreg. uint32_t callOffset = masm.callJit(objreg); markSafepointAt(callOffset, call); @@ -5069,17 +5069,17 @@ CodeGenerator::emitApplyGeneric(T* apply // Knowing that calleereg is a non-native function, load jitcode. masm.loadJitCodeRaw(calleereg, objreg); // Create the frame descriptor. unsigned pushed = masm.framePushed(); Register stackSpace = extraStackSpace; masm.addPtr(Imm32(pushed), stackSpace); - masm.makeFrameDescriptor(stackSpace, JitFrame_IonJS, JitFrameLayout::Size()); + masm.makeFrameDescriptor(stackSpace, FrameType::IonJS, JitFrameLayout::Size()); masm.Push(argcreg); masm.Push(calleereg); masm.Push(stackSpace); // descriptor Label underflow, rejoin; // Check whether the provided arguments satisfy target argc.
--- a/js/src/jit/Ion.cpp +++ b/js/src/jit/Ion.cpp @@ -2572,59 +2572,59 @@ InvalidateActivation(FreeOp* fop, const activations->asJit()->setCheckRegs(false); #endif size_t frameno = 1; for (OnlyJSJitFrameIter iter(activations); !iter.done(); ++iter, ++frameno) { const JSJitFrameIter& frame = iter.frame(); MOZ_ASSERT_IF(frameno == 1, frame.isExitFrame() || - frame.type() == JitFrame_Bailout || - frame.type() == JitFrame_JSJitToWasm); + frame.type() == FrameType::Bailout || + frame.type() == FrameType::JSJitToWasm); #ifdef JS_JITSPEW switch (frame.type()) { - case JitFrame_Exit: + case FrameType::Exit: JitSpew(JitSpew_IonInvalidate, "#%zu exit frame @ %p", frameno, frame.fp()); break; - case JitFrame_JSJitToWasm: + case FrameType::JSJitToWasm: JitSpew(JitSpew_IonInvalidate, "#%zu wasm exit frame @ %p", frameno, frame.fp()); break; - case JitFrame_BaselineJS: - case JitFrame_IonJS: - case JitFrame_Bailout: + case FrameType::BaselineJS: + case FrameType::IonJS: + case FrameType::Bailout: { MOZ_ASSERT(frame.isScripted()); const char* type = "Unknown"; if (frame.isIonJS()) type = "Optimized"; else if (frame.isBaselineJS()) type = "Baseline"; else if (frame.isBailoutJS()) type = "Bailing"; JitSpew(JitSpew_IonInvalidate, "#%zu %s JS frame @ %p, %s:%u (fun: %p, script: %p, pc %p)", frameno, type, frame.fp(), frame.script()->maybeForwardedFilename(), frame.script()->lineno(), frame.maybeCallee(), (JSScript*)frame.script(), frame.returnAddressToFp()); break; } - case JitFrame_BaselineStub: + case FrameType::BaselineStub: JitSpew(JitSpew_IonInvalidate, "#%zu baseline stub frame @ %p", frameno, frame.fp()); break; - case JitFrame_Rectifier: + case FrameType::Rectifier: JitSpew(JitSpew_IonInvalidate, "#%zu rectifier frame @ %p", frameno, frame.fp()); break; - case JitFrame_IonICCall: + case FrameType::IonICCall: JitSpew(JitSpew_IonInvalidate, "#%zu ion IC call frame @ %p", frameno, frame.fp()); break; - case JitFrame_CppToJSJit: + case FrameType::CppToJSJit: JitSpew(JitSpew_IonInvalidate, "#%zu entry frame @ %p", frameno, frame.fp()); break; - case JitFrame_WasmToJSJit: + case FrameType::WasmToJSJit: JitSpew(JitSpew_IonInvalidate, "#%zu wasm frames @ %p", frameno, frame.fp()); break; } #endif // JS_JITSPEW if (!frame.isIonScripted()) continue;
--- a/js/src/jit/IonCacheIRCompiler.cpp +++ b/js/src/jit/IonCacheIRCompiler.cpp @@ -289,32 +289,32 @@ CacheRegisterAllocator::restoreIonLiveRe availableRegs_.set() = GeneralRegisterSet(); availableRegsAfterSpill_.set() = GeneralRegisterSet::All(); } static void* GetReturnAddressToIonCode(JSContext* cx) { JSJitFrameIter frame(cx->activation()->asJit()); - MOZ_ASSERT(frame.type() == JitFrame_Exit, + MOZ_ASSERT(frame.type() == FrameType::Exit, "An exit frame is expected as update functions are called with a VMFunction."); void* returnAddr = frame.returnAddress(); #ifdef DEBUG ++frame; MOZ_ASSERT(frame.isIonJS()); #endif return returnAddr; } // The AutoSaveLiveRegisters parameter is used to ensure registers were saved void IonCacheIRCompiler::prepareVMCall(MacroAssembler& masm, const AutoSaveLiveRegisters&) { - uint32_t descriptor = MakeFrameDescriptor(masm.framePushed(), JitFrame_IonJS, + uint32_t descriptor = MakeFrameDescriptor(masm.framePushed(), FrameType::IonJS, IonICCallFrameLayout::Size()); pushStubCodePointer(); masm.Push(Imm32(descriptor)); masm.Push(ImmPtr(GetReturnAddressToIonCode(cx_))); #ifdef DEBUG calledPrepareVMCall_ = true; #endif @@ -323,17 +323,17 @@ IonCacheIRCompiler::prepareVMCall(MacroA bool IonCacheIRCompiler::callVM(MacroAssembler& masm, const VMFunction& fun) { MOZ_ASSERT(calledPrepareVMCall_); TrampolinePtr code = cx_->runtime()->jitRuntime()->getVMWrapper(fun); uint32_t frameSize = fun.explicitStackSlots() * sizeof(void*); - uint32_t descriptor = MakeFrameDescriptor(frameSize, JitFrame_IonICCall, + uint32_t descriptor = MakeFrameDescriptor(frameSize, FrameType::IonICCall, ExitFrameLayout::Size()); masm.Push(Imm32(descriptor)); masm.callJit(code); // Remove rest of the frame left on the stack. We remove the return address // which is implicitly poped when returning. int framePop = sizeof(ExitFrameLayout) - sizeof(void*); @@ -966,17 +966,17 @@ IonCacheIRCompiler::emitCallScriptedGett bool isCrossRealm = reader.readBool(); MOZ_ASSERT(isCrossRealm == (cx_->realm() != target->realm())); allocator.discardStack(masm); uint32_t framePushedBefore = masm.framePushed(); // Construct IonICCallFrameLayout. - uint32_t descriptor = MakeFrameDescriptor(masm.framePushed(), JitFrame_IonJS, + uint32_t descriptor = MakeFrameDescriptor(masm.framePushed(), FrameType::IonJS, IonICCallFrameLayout::Size()); pushStubCodePointer(); masm.Push(Imm32(descriptor)); masm.Push(ImmPtr(GetReturnAddressToIonCode(cx_))); // The JitFrameLayout pushed below will be aligned to JitStackAlignment, // so we just have to make sure the stack is aligned after we push the // |this| + argument Values. @@ -990,17 +990,17 @@ IonCacheIRCompiler::emitCallScriptedGett masm.Push(UndefinedValue()); masm.Push(TypedOrValueRegister(MIRType::Object, AnyRegister(obj))); if (isCrossRealm) masm.switchToRealm(target->realm(), scratch); masm.movePtr(ImmGCPtr(target), scratch); - descriptor = MakeFrameDescriptor(argSize + padding, JitFrame_IonICCall, + descriptor = MakeFrameDescriptor(argSize + padding, FrameType::IonICCall, JitFrameLayout::Size()); masm.Push(Imm32(0)); // argc masm.Push(scratch); masm.Push(Imm32(descriptor)); // Check stack alignment. Add sizeof(uintptr_t) for the return address. MOZ_ASSERT(((masm.framePushed() + sizeof(uintptr_t)) % JitStackAlignment) == 0); @@ -2101,17 +2101,17 @@ IonCacheIRCompiler::emitCallScriptedSett AutoScratchRegister scratch(allocator, masm); allocator.discardStack(masm); uint32_t framePushedBefore = masm.framePushed(); // Construct IonICCallFrameLayout. - uint32_t descriptor = MakeFrameDescriptor(masm.framePushed(), JitFrame_IonJS, + uint32_t descriptor = MakeFrameDescriptor(masm.framePushed(), FrameType::IonJS, IonICCallFrameLayout::Size()); pushStubCodePointer(); masm.Push(Imm32(descriptor)); masm.Push(ImmPtr(GetReturnAddressToIonCode(cx_))); // The JitFrameLayout pushed below will be aligned to JitStackAlignment, // so we just have to make sure the stack is aligned after we push the // |this| + argument Values. @@ -2127,17 +2127,17 @@ IonCacheIRCompiler::emitCallScriptedSett masm.Push(val); masm.Push(TypedOrValueRegister(MIRType::Object, AnyRegister(obj))); if (isCrossRealm) masm.switchToRealm(target->realm(), scratch); masm.movePtr(ImmGCPtr(target), scratch); - descriptor = MakeFrameDescriptor(argSize + padding, JitFrame_IonICCall, + descriptor = MakeFrameDescriptor(argSize + padding, FrameType::IonICCall, JitFrameLayout::Size()); masm.Push(Imm32(1)); // argc masm.Push(scratch); masm.Push(Imm32(descriptor)); // Check stack alignment. Add sizeof(uintptr_t) for the return address. MOZ_ASSERT(((masm.framePushed() + sizeof(uintptr_t)) % JitStackAlignment) == 0);
--- a/js/src/jit/JSJitFrameIter.cpp +++ b/js/src/jit/JSJitFrameIter.cpp @@ -12,40 +12,40 @@ #include "jit/JitFrames.h" #include "jit/Safepoints.h" using namespace js; using namespace js::jit; JSJitFrameIter::JSJitFrameIter(const JitActivation* activation) : current_(activation->jsExitFP()), - type_(JitFrame_Exit), + type_(FrameType::Exit), returnAddressToFp_(nullptr), frameSize_(0), cachedSafepointIndex_(nullptr), activation_(activation) { if (activation_->bailoutData()) { current_ = activation_->bailoutData()->fp(); frameSize_ = activation_->bailoutData()->topFrameSize(); - type_ = JitFrame_Bailout; + type_ = FrameType::Bailout; } else { MOZ_ASSERT(!TlsContext.get()->inUnsafeCallWithABI); } } JSJitFrameIter::JSJitFrameIter(const JitActivation* activation, FrameType frameType, uint8_t* fp) : current_(fp), type_(frameType), returnAddressToFp_(nullptr), frameSize_(0), cachedSafepointIndex_(nullptr), activation_(activation) { - MOZ_ASSERT(type_ == JitFrame_JSJitToWasm || type_ == JitFrame_Exit); + MOZ_ASSERT(type_ == FrameType::JSJitToWasm || type_ == FrameType::Exit); MOZ_ASSERT(!activation_->bailoutData()); MOZ_ASSERT(!TlsContext.get()->inUnsafeCallWithABI); } bool JSJitFrameIter::checkInvalidation() const { IonScript* dummy; @@ -97,17 +97,17 @@ JSJitFrameIter::maybeCallee() const if (isScripted() && isFunctionFrame()) return callee(); return nullptr; } bool JSJitFrameIter::isBareExit() const { - if (type_ != JitFrame_Exit) + if (type_ != FrameType::Exit) return false; return exitFrame()->isBareExit(); } bool JSJitFrameIter::isFunctionFrame() const { return CalleeTokenIsFunction(calleeToken()); @@ -341,69 +341,69 @@ JSJitFrameIter::dumpBaseline() const #endif } } void JSJitFrameIter::dump() const { switch (type_) { - case JitFrame_CppToJSJit: + case FrameType::CppToJSJit: fprintf(stderr, " Entry frame\n"); fprintf(stderr, " Frame size: %u\n", unsigned(current()->prevFrameLocalSize())); break; - case JitFrame_BaselineJS: + case FrameType::BaselineJS: dumpBaseline(); break; - case JitFrame_BaselineStub: + case FrameType::BaselineStub: fprintf(stderr, " Baseline stub frame\n"); fprintf(stderr, " Frame size: %u\n", unsigned(current()->prevFrameLocalSize())); break; - case JitFrame_Bailout: - case JitFrame_IonJS: + case FrameType::Bailout: + case FrameType::IonJS: { InlineFrameIterator frames(TlsContext.get(), this); for (;;) { frames.dump(); if (!frames.more()) break; ++frames; } break; } - case JitFrame_Rectifier: + case FrameType::Rectifier: fprintf(stderr, " Rectifier frame\n"); fprintf(stderr, " Frame size: %u\n", unsigned(current()->prevFrameLocalSize())); break; - case JitFrame_IonICCall: + case FrameType::IonICCall: fprintf(stderr, " Ion IC call\n"); fprintf(stderr, " Frame size: %u\n", unsigned(current()->prevFrameLocalSize())); break; - case JitFrame_WasmToJSJit: + case FrameType::WasmToJSJit: fprintf(stderr, " Fast wasm-to-JS entry frame\n"); fprintf(stderr, " Frame size: %u\n", unsigned(current()->prevFrameLocalSize())); break; - case JitFrame_Exit: + case FrameType::Exit: fprintf(stderr, " Exit frame\n"); break; - case JitFrame_JSJitToWasm: + case FrameType::JSJitToWasm: fprintf(stderr, " Wasm exit frame\n"); break; }; fputc('\n', stderr); } #ifdef DEBUG bool JSJitFrameIter::verifyReturnAddressUsingNativeToBytecodeMap() { MOZ_ASSERT(returnAddressToFp_ != nullptr); // Only handle Ion frames for now. - if (type_ != JitFrame_IonJS && type_ != JitFrame_BaselineJS) + if (type_ != FrameType::IonJS && type_ != FrameType::BaselineJS) return true; JSRuntime* rt = TlsContext.get()->runtime(); // Don't verify while off thread. if (!CurrentThreadCanAccessRuntime(rt)) return true; @@ -433,17 +433,17 @@ JSJitFrameIter::verifyReturnAddressUsing JitSpew(JitSpew_Profiling, "Found bytecode location of depth %d:", depth); for (size_t i = 0; i < location.length(); i++) { JitSpew(JitSpew_Profiling, " %s:%u - %zu", location[i].script->filename(), location[i].script->lineno(), size_t(location[i].pc - location[i].script->code())); } - if (type_ == JitFrame_IonJS) { + if (type_ == FrameType::IonJS) { // Create an InlineFrameIterator here and verify the mapped info against the iterator info. InlineFrameIterator inlineFrames(TlsContext.get(), this); for (size_t idx = 0; idx < location.length(); idx++) { MOZ_ASSERT(idx < location.length()); MOZ_ASSERT_IF(idx < location.length() - 1, inlineFrames.more()); JitSpew(JitSpew_Profiling, "Match %d: ION %s:%u(%zu) vs N2B %s:%u(%zu)", @@ -466,31 +466,31 @@ JSJitFrameIter::verifyReturnAddressUsing } #endif // DEBUG JSJitProfilingFrameIterator::JSJitProfilingFrameIterator(JSContext* cx, void* pc) { // If no profilingActivation is live, initialize directly to // end-of-iteration state. if (!cx->profilingActivation()) { - type_ = JitFrame_CppToJSJit; + type_ = FrameType::CppToJSJit; fp_ = nullptr; returnAddressToFp_ = nullptr; return; } MOZ_ASSERT(cx->profilingActivation()->isJit()); JitActivation* act = cx->profilingActivation()->asJit(); // If the top JitActivation has a null lastProfilingFrame, assume that // it's a trivially empty activation, and initialize directly // to end-of-iteration state. if (!act->lastProfilingFrame()) { - type_ = JitFrame_CppToJSJit; + type_ = FrameType::CppToJSJit; fp_ = nullptr; returnAddressToFp_ = nullptr; return; } // Get the fp from the current profilingActivation fp_ = (uint8_t*) act->lastProfilingFrame(); @@ -516,17 +516,17 @@ JSJitProfilingFrameIterator::JSJitProfil if (tryInitWithTable(table, lastCallSite, /* forLastCallSite = */ true)) return; } MOZ_ASSERT(frameScript()->hasBaselineScript()); // If nothing matches, for now just assume we are at the start of the last frame's // baseline jit code. - type_ = JitFrame_BaselineJS; + type_ = FrameType::BaselineJS; returnAddressToFp_ = frameScript()->baselineScript()->method()->raw(); } template <typename ReturnType = CommonFrameLayout*> static inline ReturnType GetPreviousRawFrame(CommonFrameLayout* frame) { size_t prevSize = frame->prevFrameLocalSize() + frame->headerSize(); @@ -540,24 +540,24 @@ JSJitProfilingFrameIterator::JSJitProfil bool JSJitProfilingFrameIterator::tryInitWithPC(void* pc) { JSScript* callee = frameScript(); // Check for Ion first, since it's more likely for hot code. if (callee->hasIonScript() && callee->ionScript()->method()->containsNativePC(pc)) { - type_ = JitFrame_IonJS; + type_ = FrameType::IonJS; returnAddressToFp_ = pc; return true; } // Check for containment in Baseline jitcode second. if (callee->hasBaselineScript() && callee->baselineScript()->method()->containsNativePC(pc)) { - type_ = JitFrame_BaselineJS; + type_ = FrameType::BaselineJS; returnAddressToFp_ = pc; return true; } return false; } bool @@ -572,62 +572,62 @@ JSJitProfilingFrameIterator::tryInitWith return false; JSScript* callee = frameScript(); MOZ_ASSERT(entry->isIon() || entry->isBaseline() || entry->isIonCache() || entry->isDummy()); // Treat dummy lookups as an empty frame sequence. if (entry->isDummy()) { - type_ = JitFrame_CppToJSJit; + type_ = FrameType::CppToJSJit; fp_ = nullptr; returnAddressToFp_ = nullptr; return true; } if (entry->isIon()) { // If looked-up callee doesn't match frame callee, don't accept lastProfilingCallSite if (entry->ionEntry().getScript(0) != callee) return false; - type_ = JitFrame_IonJS; + type_ = FrameType::IonJS; returnAddressToFp_ = pc; return true; } if (entry->isBaseline()) { // If looked-up callee doesn't match frame callee, don't accept lastProfilingCallSite if (forLastCallSite && entry->baselineEntry().script() != callee) return false; - type_ = JitFrame_BaselineJS; + type_ = FrameType::BaselineJS; returnAddressToFp_ = pc; return true; } if (entry->isIonCache()) { void* ptr = entry->ionCacheEntry().rejoinAddr(); const JitcodeGlobalEntry& ionEntry = table->lookupInfallible(ptr); MOZ_ASSERT(ionEntry.isIon()); if (ionEntry.ionEntry().getScript(0) != callee) return false; - type_ = JitFrame_IonJS; + type_ = FrameType::IonJS; returnAddressToFp_ = pc; return true; } return false; } void JSJitProfilingFrameIterator::fixBaselineReturnAddress() { - MOZ_ASSERT(type_ == JitFrame_BaselineJS); + MOZ_ASSERT(type_ == FrameType::BaselineJS); BaselineFrame* bl = (BaselineFrame*)(fp_ - BaselineFrame::FramePointerOffset - BaselineFrame::Size()); // Debug mode OSR for Baseline uses a "continuation fixer" and stashes the // actual return address in an auxiliary structure. if (BaselineDebugModeOSRInfo* info = bl->getDebugModeOSRInfo()) { returnAddressToFp_ = info->resumeAddr; return; @@ -652,28 +652,28 @@ JSJitProfilingFrameIterator::operator++( void JSJitProfilingFrameIterator::moveToWasmFrame(CommonFrameLayout* frame) { // No previous js jit frame, this is a transition frame, used to // pass a wasm iterator the correct value of FP. returnAddressToFp_ = nullptr; fp_ = GetPreviousRawFrame<uint8_t*>(frame); - type_ = JitFrame_WasmToJSJit; + type_ = FrameType::WasmToJSJit; MOZ_ASSERT(!done()); } void JSJitProfilingFrameIterator::moveToCppEntryFrame() { // No previous frame, set to nullptr to indicate that // JSJitProfilingFrameIterator is done(). returnAddressToFp_ = nullptr; fp_ = nullptr; - type_ = JitFrame_CppToJSJit; + type_ = FrameType::CppToJSJit; } void JSJitProfilingFrameIterator::moveToNextFrame(CommonFrameLayout* frame) { /* * fp_ points to a Baseline or Ion frame. The possible call-stacks * patterns occurring between this frame and a previous Ion or Baseline @@ -706,92 +706,92 @@ JSJitProfilingFrameIterator::moveToNextF * ^--- Ion * | * ^--- Baseline * | * ^--- Baseline Stub <---- Baseline */ FrameType prevType = frame->prevType(); - if (prevType == JitFrame_IonJS) { + if (prevType == FrameType::IonJS) { returnAddressToFp_ = frame->returnAddress(); fp_ = GetPreviousRawFrame<uint8_t*>(frame); - type_ = JitFrame_IonJS; + type_ = FrameType::IonJS; return; } - if (prevType == JitFrame_BaselineJS) { + if (prevType == FrameType::BaselineJS) { returnAddressToFp_ = frame->returnAddress(); fp_ = GetPreviousRawFrame<uint8_t*>(frame); - type_ = JitFrame_BaselineJS; + type_ = FrameType::BaselineJS; fixBaselineReturnAddress(); return; } - if (prevType == JitFrame_BaselineStub) { + if (prevType == FrameType::BaselineStub) { BaselineStubFrameLayout* stubFrame = GetPreviousRawFrame<BaselineStubFrameLayout*>(frame); - MOZ_ASSERT(stubFrame->prevType() == JitFrame_BaselineJS); + MOZ_ASSERT(stubFrame->prevType() == FrameType::BaselineJS); returnAddressToFp_ = stubFrame->returnAddress(); fp_ = ((uint8_t*) stubFrame->reverseSavedFramePtr()) + jit::BaselineFrame::FramePointerOffset; - type_ = JitFrame_BaselineJS; + type_ = FrameType::BaselineJS; return; } - if (prevType == JitFrame_Rectifier) { + if (prevType == FrameType::Rectifier) { RectifierFrameLayout* rectFrame = GetPreviousRawFrame<RectifierFrameLayout*>(frame); FrameType rectPrevType = rectFrame->prevType(); - if (rectPrevType == JitFrame_IonJS) { + if (rectPrevType == FrameType::IonJS) { returnAddressToFp_ = rectFrame->returnAddress(); fp_ = GetPreviousRawFrame<uint8_t*>(rectFrame); - type_ = JitFrame_IonJS; + type_ = FrameType::IonJS; return; } - if (rectPrevType == JitFrame_BaselineStub) { + if (rectPrevType == FrameType::BaselineStub) { BaselineStubFrameLayout* stubFrame = GetPreviousRawFrame<BaselineStubFrameLayout*>(rectFrame); returnAddressToFp_ = stubFrame->returnAddress(); fp_ = ((uint8_t*) stubFrame->reverseSavedFramePtr()) + jit::BaselineFrame::FramePointerOffset; - type_ = JitFrame_BaselineJS; + type_ = FrameType::BaselineJS; return; } - if (rectPrevType == JitFrame_WasmToJSJit) { + if (rectPrevType == FrameType::WasmToJSJit) { moveToWasmFrame(rectFrame); return; } - if (rectPrevType == JitFrame_CppToJSJit) { + if (rectPrevType == FrameType::CppToJSJit) { moveToCppEntryFrame(); return; } MOZ_CRASH("Bad frame type prior to rectifier frame."); } - if (prevType == JitFrame_IonICCall) { + if (prevType == FrameType::IonICCall) { IonICCallFrameLayout* callFrame = GetPreviousRawFrame<IonICCallFrameLayout*>(frame); - MOZ_ASSERT(callFrame->prevType() == JitFrame_IonJS); + MOZ_ASSERT(callFrame->prevType() == FrameType::IonJS); returnAddressToFp_ = callFrame->returnAddress(); fp_ = GetPreviousRawFrame<uint8_t*>(callFrame); - type_ = JitFrame_IonJS; + type_ = FrameType::IonJS; return; } - if (prevType == JitFrame_WasmToJSJit) { + if (prevType == FrameType::WasmToJSJit) { moveToWasmFrame(frame); return; } - if (prevType == JitFrame_CppToJSJit) { + if (prevType == FrameType::CppToJSJit) { moveToCppEntryFrame(); return; } MOZ_CRASH("Bad frame type."); }
--- a/js/src/jit/JSJitFrameIter.h +++ b/js/src/jit/JSJitFrameIter.h @@ -15,60 +15,60 @@ #include "vm/JSFunction.h" #include "vm/JSScript.h" namespace js { namespace jit { typedef void * CalleeToken; -enum FrameType +enum class FrameType { // A JS frame is analogous to a js::InterpreterFrame, representing one scripted // function activation. IonJS frames are used by the optimizing compiler. - JitFrame_IonJS, + IonJS, // JS frame used by the baseline JIT. - JitFrame_BaselineJS, + BaselineJS, // Frame pushed by Baseline stubs that make non-tail calls, so that the // return address -> ICEntry mapping works. - JitFrame_BaselineStub, + BaselineStub, // The entry frame is the initial prologue block transitioning from the VM // into the Ion world. - JitFrame_CppToJSJit, + CppToJSJit, // A rectifier frame sits in between two JS frames, adapting argc != nargs // mismatches in calls. - JitFrame_Rectifier, + Rectifier, // Ion IC calling a scripted getter/setter or a VMFunction. - JitFrame_IonICCall, + IonICCall, // An exit frame is necessary for transitioning from a JS frame into C++. // From within C++, an exit frame is always the last frame in any // JitActivation. - JitFrame_Exit, + Exit, // A bailout frame is a special IonJS jit frame after a bailout, and before // the reconstruction of the BaselineJS frame. From within C++, a bailout // frame is always the last frame in a JitActivation iff the bailout frame // information is recorded on the JitActivation. - JitFrame_Bailout, + Bailout, // A wasm to JS frame is constructed during fast calls from wasm to the JS // jits, used as a marker to interleave JS jit and wasm frames. From the // point of view of JS JITs, this is just another kind of entry frame. - JitFrame_WasmToJSJit, + WasmToJSJit, // A JS to wasm frame is constructed during fast calls from any JS jits to // wasm, and is a special kind of exit frame that doesn't have the exit // footer. From the point of view of the jit, it can be skipped as an exit. - JitFrame_JSJitToWasm, + JSJitToWasm, }; enum ReadFrameArgsBehavior { // Only read formals (i.e. [0 ... callee()->nargs] ReadFrame_Formals, // Only read overflown args (i.e. [callee()->nargs ... numActuals()] ReadFrame_Overflown, @@ -151,47 +151,47 @@ class JSJitFrameIter inline ExitFrameLayout* exitFrame() const; // Returns whether the JS frame has been invalidated and, if so, // places the invalidated Ion script in |ionScript|. bool checkInvalidation(IonScript** ionScript) const; bool checkInvalidation() const; bool isExitFrame() const { - return type_ == JitFrame_Exit; + return type_ == FrameType::Exit; } bool isScripted() const { - return type_ == JitFrame_BaselineJS || type_ == JitFrame_IonJS || type_ == JitFrame_Bailout; + return type_ == FrameType::BaselineJS || type_ == FrameType::IonJS || type_ == FrameType::Bailout; } bool isBaselineJS() const { - return type_ == JitFrame_BaselineJS; + return type_ == FrameType::BaselineJS; } bool isIonScripted() const { - return type_ == JitFrame_IonJS || type_ == JitFrame_Bailout; + return type_ == FrameType::IonJS || type_ == FrameType::Bailout; } bool isIonJS() const { - return type_ == JitFrame_IonJS; + return type_ == FrameType::IonJS; } bool isIonICCall() const { - return type_ == JitFrame_IonICCall; + return type_ == FrameType::IonICCall; } bool isBailoutJS() const { - return type_ == JitFrame_Bailout; + return type_ == FrameType::Bailout; } bool isBaselineStub() const { - return type_ == JitFrame_BaselineStub; + return type_ == FrameType::BaselineStub; } bool isRectifier() const { - return type_ == JitFrame_Rectifier; + return type_ == FrameType::Rectifier; } bool isBareExit() const; template <typename T> bool isExitFrameLayout() const; static bool isEntry(FrameType type) { - return type == JitFrame_CppToJSJit || type == JitFrame_WasmToJSJit; + return type == FrameType::CppToJSJit || type == FrameType::WasmToJSJit; } bool isEntry() const { return isEntry(type_); } bool isFunctionFrame() const; bool isConstructing() const;
--- a/js/src/jit/JitFrames-inl.h +++ b/js/src/jit/JitFrames-inl.h @@ -25,17 +25,17 @@ SafepointIndex::resolve() resolved = true; #endif } inline BaselineFrame* GetTopBaselineFrame(JSContext* cx) { JSJitFrameIter frame(cx->activation()->asJit()); - MOZ_ASSERT(frame.type() == JitFrame_Exit); + MOZ_ASSERT(frame.type() == FrameType::Exit); ++frame; if (frame.isBaselineStub()) ++frame; MOZ_ASSERT(frame.isBaselineJS()); return frame.baselineFrame(); } } // namespace jit
--- a/js/src/jit/JitFrames.cpp +++ b/js/src/jit/JitFrames.cpp @@ -860,17 +860,17 @@ TraceThisAndArguments(JSTracer* trc, con if (!CalleeTokenIsFunction(layout->calleeToken())) return; size_t nargs = layout->numActualArgs(); size_t nformals = 0; JSFunction* fun = CalleeTokenToFunction(layout->calleeToken()); - if (frame.type() != JitFrame_JSJitToWasm && + if (frame.type() != FrameType::JSJitToWasm && !frame.isExitFrameLayout<CalledFromJitExitFrameLayout>() && !fun->nonLazyScript()->mayReadFrameArgsDirectly()) { nformals = fun->nargs(); } size_t newTargetOffset = Max(nargs, fun->nargs()); @@ -1050,29 +1050,29 @@ UpdateIonJSFrameForMinorGC(JSRuntime* rt } static void TraceBaselineStubFrame(JSTracer* trc, const JSJitFrameIter& frame) { // Trace the ICStub pointer stored in the stub frame. This is necessary // so that we don't destroy the stub code after unlinking the stub. - MOZ_ASSERT(frame.type() == JitFrame_BaselineStub); + MOZ_ASSERT(frame.type() == FrameType::BaselineStub); JitStubFrameLayout* layout = (JitStubFrameLayout*)frame.fp(); if (ICStub* stub = layout->maybeStubPtr()) { MOZ_ASSERT(stub->makesGCCalls()); stub->trace(trc); } } static void TraceIonICCallFrame(JSTracer* trc, const JSJitFrameIter& frame) { - MOZ_ASSERT(frame.type() == JitFrame_IonICCall); + MOZ_ASSERT(frame.type() == FrameType::IonICCall); IonICCallFrameLayout* layout = (IonICCallFrameLayout*)frame.fp(); TraceRoot(trc, layout->stubCode(), "ion-ic-call-code"); } #ifdef JS_CODEGEN_MIPS32 uint8_t* alignDoubleSpillWithOffset(uint8_t* pointer, int32_t offset) { @@ -1292,43 +1292,43 @@ TraceJitActivation(JSTracer* trc, JitAct activation->traceRematerializedFrames(trc); activation->traceIonRecovery(trc); for (JitFrameIter frames(activation); !frames.done(); ++frames) { if (frames.isJSJit()) { const JSJitFrameIter& jitFrame = frames.asJSJit(); switch (jitFrame.type()) { - case JitFrame_Exit: + case FrameType::Exit: TraceJitExitFrame(trc, jitFrame); break; - case JitFrame_BaselineJS: + case FrameType::BaselineJS: jitFrame.baselineFrame()->trace(trc, jitFrame); break; - case JitFrame_IonJS: + case FrameType::IonJS: TraceIonJSFrame(trc, jitFrame); break; - case JitFrame_BaselineStub: + case FrameType::BaselineStub: TraceBaselineStubFrame(trc, jitFrame); break; - case JitFrame_Bailout: + case FrameType::Bailout: TraceBailoutFrame(trc, jitFrame); break; - case JitFrame_Rectifier: + case FrameType::Rectifier: TraceRectifierFrame(trc, jitFrame); break; - case JitFrame_IonICCall: + case FrameType::IonICCall: TraceIonICCallFrame(trc, jitFrame); break; - case JitFrame_WasmToJSJit: + case FrameType::WasmToJSJit: // Ignore: this is a special marker used to let the // JitFrameIter know the frame above is a wasm frame, handled // in the next iteration. break; - case JitFrame_JSJitToWasm: + case FrameType::JSJitToWasm: TraceJSJitToWasmFrame(trc, jitFrame); break; default: MOZ_CRASH("unexpected frame type"); } } else { MOZ_ASSERT(frames.isWasm()); frames.asWasm().instance()->trace(trc); @@ -1345,17 +1345,17 @@ TraceJitActivations(JSContext* cx, JSTra void UpdateJitActivationsForMinorGC(JSRuntime* rt) { MOZ_ASSERT(JS::RuntimeHeapIsMinorCollecting()); JSContext* cx = rt->mainContextFromOwnThread(); for (JitActivationIterator activations(cx); !activations.done(); ++activations) { for (OnlyJSJitFrameIter iter(activations); !iter.done(); ++iter) { - if (iter.frame().type() == JitFrame_IonJS) + if (iter.frame().type() == FrameType::IonJS) UpdateIonJSFrameForMinorGC(rt, iter.frame()); } } } void GetPcScript(JSContext* cx, JSScript** scriptRes, jsbytecode** pcRes) { @@ -2436,17 +2436,17 @@ AssertJitStackInvariants(JSContext* cx) bool isScriptedCallee = false; for (; !frames.done(); ++frames) { size_t calleeFp = reinterpret_cast<size_t>(frames.fp()); size_t callerFp = reinterpret_cast<size_t>(frames.prevFp()); MOZ_ASSERT(callerFp >= calleeFp); prevFrameSize = frameSize; frameSize = callerFp - calleeFp; - if (frames.isScripted() && frames.prevType() == JitFrame_Rectifier) { + if (frames.isScripted() && frames.prevType() == FrameType::Rectifier) { MOZ_RELEASE_ASSERT(frameSize % JitStackAlignment == 0, "The rectifier frame should keep the alignment"); size_t expectedFrameSize = 0 #if defined(JS_CODEGEN_X86) + sizeof(void*) /* frame pointer */ #endif + sizeof(Value) * (frames.callee()->nargs() + @@ -2477,22 +2477,22 @@ AssertJitStackInvariants(JSContext* cx) if (isScriptedCallee) { MOZ_RELEASE_ASSERT(prevFrameSize % JitStackAlignment == 0, "The ion frame should keep the alignment"); } } // The stack is dynamically aligned by baseline stubs before calling // any jitted code. - if (frames.prevType() == JitFrame_BaselineStub && isScriptedCallee) { + if (frames.prevType() == FrameType::BaselineStub && isScriptedCallee) { MOZ_RELEASE_ASSERT(calleeFp % JitStackAlignment == 0, "The baseline stub restores the stack alignment"); } - isScriptedCallee = frames.isScripted() || frames.type() == JitFrame_Rectifier; + isScriptedCallee = frames.isScripted() || frames.type() == FrameType::Rectifier; } MOZ_RELEASE_ASSERT(JSJitFrameIter::isEntry(frames.type()), "The first frame of a Jit activation should be an entry frame"); MOZ_RELEASE_ASSERT(reinterpret_cast<size_t>(frames.fp()) % JitStackAlignment == 0, "The entry frame should be properly aligned"); } else { MOZ_ASSERT(iter.isWasm());
--- a/js/src/jit/JitFrames.h +++ b/js/src/jit/JitFrames.h @@ -298,27 +298,28 @@ EncodeFrameHeaderSize(size_t headerSize) uint32_t headerSizeWords = headerSize / sizeof(uintptr_t); MOZ_ASSERT(headerSizeWords <= FRAME_HEADER_SIZE_MASK); return headerSizeWords; } static inline uint32_t MakeFrameDescriptor(uint32_t frameSize, FrameType type, uint32_t headerSize) { - MOZ_ASSERT(headerSize < FRAMESIZE_MASK); + MOZ_ASSERT(frameSize < FRAMESIZE_MASK); headerSize = EncodeFrameHeaderSize(headerSize); - return 0 | (frameSize << FRAMESIZE_SHIFT) | (headerSize << FRAME_HEADER_SIZE_SHIFT) | type; + return 0 | (frameSize << FRAMESIZE_SHIFT) | (headerSize << FRAME_HEADER_SIZE_SHIFT) | + uint32_t(type); } // Returns the JSScript associated with the topmost JIT frame. inline JSScript* GetTopJitJSScript(JSContext* cx) { JSJitFrameIter frame(cx->activation()->asJit()); - MOZ_ASSERT(frame.type() == JitFrame_Exit); + MOZ_ASSERT(frame.type() == FrameType::Exit); ++frame; if (frame.isBaselineStub()) { ++frame; MOZ_ASSERT(frame.isBaselineJS()); } MOZ_ASSERT(frame.isScripted()); @@ -353,17 +354,17 @@ class CommonFrameLayout static size_t offsetOfReturnAddress() { return offsetof(CommonFrameLayout, returnAddress_); } FrameType prevType() const { return FrameType(descriptor_ & FRAMETYPE_MASK); } void changePrevType(FrameType type) { descriptor_ &= ~FRAMETYPE_MASK; - descriptor_ |= type; + descriptor_ |= uintptr_t(type); } size_t prevFrameLocalSize() const { return descriptor_ >> FRAMESIZE_SHIFT; } size_t headerSize() const { return sizeof(uintptr_t) * ((descriptor_ >> FRAME_HEADER_SIZE_SHIFT) & FRAME_HEADER_SIZE_MASK); } @@ -894,17 +895,17 @@ class ICStub; class JitStubFrameLayout : public CommonFrameLayout { // Info on the stack // // -------------------- // |JitStubFrameLayout| // +------------------+ - // | - Descriptor | => Marks end of JitFrame_IonJS + // | - Descriptor | => Marks end of FrameType::IonJS // | - returnaddres | // +------------------+ // | - StubPtr | => First thing pushed in a stub only when the stub will do // -------------------- a vmcall. Else we cannot have JitStubFrame. But technically // not a member of the layout. public: static size_t Size() { @@ -923,17 +924,17 @@ class JitStubFrameLayout : public Common class BaselineStubFrameLayout : public JitStubFrameLayout { // Info on the stack // // ------------------------- // |BaselineStubFrameLayout| // +-----------------------+ - // | - Descriptor | => Marks end of JitFrame_BaselineJS + // | - Descriptor | => Marks end of FrameType::BaselineJS // | - returnaddres | // +-----------------------+ // | - StubPtr | => First thing pushed in a stub only when the stub will do // +-----------------------+ a vmcall. Else we cannot have BaselineStubFrame. // | - FramePtr | => Baseline stubs also need to push the frame ptr when doing // ------------------------- a vmcall. // Technically these last two variables are not part of the // layout.
--- a/js/src/jit/MacroAssembler-inl.h +++ b/js/src/jit/MacroAssembler-inl.h @@ -230,17 +230,17 @@ void MacroAssembler::makeFrameDescriptor(Register frameSizeReg, FrameType type, uint32_t headerSize) { // See JitFrames.h for a description of the frame descriptor format. // The saved-frame bit is zero for new frames. See js::SavedStacks. lshiftPtr(Imm32(FRAMESIZE_SHIFT), frameSizeReg); headerSize = EncodeFrameHeaderSize(headerSize); - orPtr(Imm32((headerSize << FRAME_HEADER_SIZE_SHIFT) | type), frameSizeReg); + orPtr(Imm32((headerSize << FRAME_HEADER_SIZE_SHIFT) | uint32_t(type)), frameSizeReg); } void MacroAssembler::pushStaticFrameDescriptor(FrameType type, uint32_t headerSize) { uint32_t descriptor = MakeFrameDescriptor(framePushed(), type, headerSize); Push(Imm32(descriptor)); } @@ -274,17 +274,17 @@ MacroAssembler::loadFunctionFromCalleeTo andPtr(Imm32(uint32_t(CalleeTokenMask)), dest); } uint32_t MacroAssembler::buildFakeExitFrame(Register scratch) { mozilla::DebugOnly<uint32_t> initialDepth = framePushed(); - pushStaticFrameDescriptor(JitFrame_IonJS, ExitFrameLayout::Size()); + pushStaticFrameDescriptor(FrameType::IonJS, ExitFrameLayout::Size()); uint32_t retAddr = pushFakeReturnAddress(scratch); MOZ_ASSERT(framePushed() == initialDepth + ExitFrameLayout::Size()); return retAddr; } // =============================================================== // Exit frame footer.
--- a/js/src/jit/MacroAssembler.cpp +++ b/js/src/jit/MacroAssembler.cpp @@ -1881,17 +1881,17 @@ MacroAssembler::generateBailoutTail(Regi store32(temp, Address(getStackPointer(), 0)); jump(©Loop); bind(&endOfCopy); } // Enter exit frame for the FinishBailoutToBaseline call. loadPtr(Address(bailoutInfo, offsetof(BaselineBailoutInfo, resumeFramePtr)), temp); load32(Address(temp, BaselineFrame::reverseOffsetOfFrameSize()), temp); - makeFrameDescriptor(temp, JitFrame_BaselineJS, ExitFrameLayout::Size()); + makeFrameDescriptor(temp, FrameType::BaselineJS, ExitFrameLayout::Size()); push(temp); push(Address(bailoutInfo, offsetof(BaselineBailoutInfo, resumeAddr))); // No GC things to mark on the stack, push a bare token. loadJSContext(scratch); enterFakeExitFrame(scratch, scratch, ExitFrameType::Bare); // If monitorStub is non-null, handle resumeAddr appropriately. Label noMonitor; @@ -1979,20 +1979,20 @@ MacroAssembler::generateBailoutTail(Regi void MacroAssembler::assertRectifierFrameParentType(Register frameType) { #ifdef DEBUG { // Check the possible previous frame types here. Label checkOk; - branch32(Assembler::Equal, frameType, Imm32(JitFrame_IonJS), &checkOk); - branch32(Assembler::Equal, frameType, Imm32(JitFrame_BaselineStub), &checkOk); - branch32(Assembler::Equal, frameType, Imm32(JitFrame_WasmToJSJit), &checkOk); - branch32(Assembler::Equal, frameType, Imm32(JitFrame_CppToJSJit), &checkOk); + branch32(Assembler::Equal, frameType, Imm32(FrameType::IonJS), &checkOk); + branch32(Assembler::Equal, frameType, Imm32(FrameType::BaselineStub), &checkOk); + branch32(Assembler::Equal, frameType, Imm32(FrameType::WasmToJSJit), &checkOk); + branch32(Assembler::Equal, frameType, Imm32(FrameType::CppToJSJit), &checkOk); assumeUnreachable("Unrecognized frame type preceding RectifierFrame."); bind(&checkOk); } #endif } void MacroAssembler::loadJitCodeRaw(Register func, Register dest)
--- a/js/src/jit/VMFunctions.cpp +++ b/js/src/jit/VMFunctions.cpp @@ -392,17 +392,17 @@ ArrayPushDense(JSContext* cx, HandleArra return result == DenseElementResult::Success; } // AutoDetectInvalidation uses GetTopJitJSScript(cx)->ionScript(), but it's // possible the setOrExtendDenseElements call already invalidated the // IonScript. JSJitFrameIter::ionScript works when the script is invalidated // so we use that instead. JSJitFrameIter frame(cx->activation()->asJit()); - MOZ_ASSERT(frame.type() == JitFrame_Exit); + MOZ_ASSERT(frame.type() == FrameType::Exit); ++frame; IonScript* ionScript = frame.ionScript(); JS::AutoValueArray<3> argv(cx); AutoDetectInvalidation adi(cx, argv[0], ionScript); argv[0].setUndefined(); argv[1].setObject(*arr); argv[2].set(v); @@ -1294,17 +1294,17 @@ StringReplace(JSContext* cx, HandleStrin bool RecompileImpl(JSContext* cx, bool force) { MOZ_ASSERT(cx->currentlyRunningInJit()); JitActivationIterator activations(cx); JSJitFrameIter frame(activations->asJit()); - MOZ_ASSERT(frame.type() == JitFrame_Exit); + MOZ_ASSERT(frame.type() == FrameType::Exit); ++frame; RootedScript script(cx, frame.script()); MOZ_ASSERT(script->hasIonScript()); if (!IsIonEnabled(cx)) return true;
--- a/js/src/jit/arm/MacroAssembler-arm.cpp +++ b/js/src/jit/arm/MacroAssembler-arm.cpp @@ -1786,17 +1786,17 @@ MacroAssemblerARM::ma_vstr(VFPRegister s as_add(scratch, base, lsl(index, shift), LeaveCC, cc); return as_vdtr(IsStore, src, Operand(Address(scratch, 0)).toVFPAddr(), cc); } bool MacroAssemblerARMCompat::buildOOLFakeExitFrame(void* fakeReturnAddr) { DebugOnly<uint32_t> initialDepth = asMasm().framePushed(); - uint32_t descriptor = MakeFrameDescriptor(asMasm().framePushed(), JitFrame_IonJS, + uint32_t descriptor = MakeFrameDescriptor(asMasm().framePushed(), FrameType::IonJS, ExitFrameLayout::Size()); asMasm().Push(Imm32(descriptor)); // descriptor_ asMasm().Push(ImmPtr(fakeReturnAddr)); return true; }
--- a/js/src/jit/arm/SharedICHelpers-arm-inl.h +++ b/js/src/jit/arm/SharedICHelpers-arm-inl.h @@ -33,32 +33,32 @@ EmitBaselineTailCallVM(TrampolinePtr tar } masm.store32(r1, Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfFrameSize())); // Push frame descriptor and perform the tail call. // ICTailCallReg (lr) already contains the return address (as we keep // it there through the stub calls), but the VMWrapper code being called // expects the return address to also be pushed on the stack. MOZ_ASSERT(ICTailCallReg == lr); - masm.makeFrameDescriptor(r0, JitFrame_BaselineJS, ExitFrameLayout::Size()); + masm.makeFrameDescriptor(r0, FrameType::BaselineJS, ExitFrameLayout::Size()); masm.push(r0); masm.push(lr); masm.jump(target); } inline void EmitBaselineCreateStubFrameDescriptor(MacroAssembler& masm, Register reg, uint32_t headerSize) { // Compute stub frame size. We have to add two pointers: the stub reg and // previous frame pointer pushed by EmitEnterStubFrame. masm.mov(BaselineFrameReg, reg); masm.as_add(reg, reg, Imm8(sizeof(void*) * 2)); masm.ma_sub(BaselineStackReg, reg); - masm.makeFrameDescriptor(reg, JitFrame_BaselineStub, headerSize); + masm.makeFrameDescriptor(reg, FrameType::BaselineStub, headerSize); } inline void EmitBaselineCallVM(TrampolinePtr target, MacroAssembler& masm) { EmitBaselineCreateStubFrameDescriptor(masm, r0, ExitFrameLayout::Size()); masm.push(r0); masm.call(target); @@ -79,17 +79,17 @@ EmitBaselineEnterStubFrame(MacroAssemble masm.ma_sub(BaselineStackReg, scratch); masm.store32(scratch, Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfFrameSize())); // Note: when making changes here, don't forget to update STUB_FRAME_SIZE if // needed. // Push frame descriptor and return address. - masm.makeFrameDescriptor(scratch, JitFrame_BaselineJS, BaselineStubFrameLayout::Size()); + masm.makeFrameDescriptor(scratch, FrameType::BaselineJS, BaselineStubFrameLayout::Size()); masm.Push(scratch); masm.Push(ICTailCallReg); // Save old frame pointer, stack pointer and stub reg. masm.Push(ICStubReg); masm.Push(BaselineFrameReg); masm.mov(BaselineStackReg, BaselineFrameReg);
--- a/js/src/jit/arm/Trampoline-arm.cpp +++ b/js/src/jit/arm/Trampoline-arm.cpp @@ -200,17 +200,17 @@ JitRuntime::generateEnterJIT(JSContext* // BIG FAT WARNING: this loads both r6 and r7. aasm->as_extdtr(IsLoad, 64, true, PostIndex, r6, EDtrAddr(r2, EDtrOffImm(8))); aasm->as_extdtr(IsStore, 64, true, PostIndex, r6, EDtrAddr(r4, EDtrOffImm(8))); aasm->as_b(&header, Assembler::NonZero); masm.bind(&footer); } masm.ma_sub(r8, sp, r8); - masm.makeFrameDescriptor(r8, JitFrame_CppToJSJit, JitFrameLayout::Size()); + masm.makeFrameDescriptor(r8, FrameType::CppToJSJit, JitFrameLayout::Size()); masm.startDataTransferM(IsStore, sp, IB, NoWriteBack); // [sp] = return address (written later) masm.transferReg(r8); // [sp',4] = descriptor, argc*8+20 masm.transferReg(r9); // [sp',8] = callee token masm.transferReg(r10); // [sp',12] = actual arguments masm.finishDataTransfer(); @@ -280,17 +280,17 @@ JitRuntime::generateEnterJIT(JSContext* #endif // Reserve space for locals and stack values. masm.ma_lsl(Imm32(3), numStackValues, scratch); masm.ma_sub(sp, scratch, sp); // Enter exit frame. masm.addPtr(Imm32(BaselineFrame::Size() + BaselineFrame::FramePointerOffset), scratch); - masm.makeFrameDescriptor(scratch, JitFrame_BaselineJS, ExitFrameLayout::Size()); + masm.makeFrameDescriptor(scratch, FrameType::BaselineJS, ExitFrameLayout::Size()); masm.push(scratch); masm.push(Imm32(0)); // Fake return address. // No GC things to mark on the stack, push a bare token. masm.loadJSContext(scratch); masm.enterFakeExitFrame(scratch, scratch, ExitFrameType::Bare); masm.push(framePtr); // BaselineFrame masm.push(r0); // jitcode @@ -516,17 +516,17 @@ JitRuntime::generateArgumentsRectifier(M masm.ma_b(©LoopTop, Assembler::NotSigned); } // translate the framesize from values into bytes masm.as_add(r6, r6, Imm8(1)); masm.ma_lsl(Imm32(3), r6, r6); // Construct sizeDescriptor. - masm.makeFrameDescriptor(r6, JitFrame_Rectifier, JitFrameLayout::Size()); + masm.makeFrameDescriptor(r6, FrameType::Rectifier, JitFrameLayout::Size()); // Construct JitFrameLayout. masm.ma_push(r0); // actual arguments. masm.ma_push(r1); // callee token masm.ma_push(r6); // frame descriptor. // Call the target function. masm.andPtr(Imm32(CalleeTokenMask), r1); @@ -1119,30 +1119,30 @@ JitRuntime::generateProfilerExitFrameTai // Handling of each case is dependent on FrameDescriptor.type Label handle_IonJS; Label handle_BaselineStub; Label handle_Rectifier; Label handle_IonICCall; Label handle_Entry; Label end; - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_IonJS), &handle_IonJS); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_BaselineJS), &handle_IonJS); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_BaselineStub), &handle_BaselineStub); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_Rectifier), &handle_Rectifier); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_IonICCall), &handle_IonICCall); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_CppToJSJit), &handle_Entry); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::IonJS), &handle_IonJS); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::BaselineJS), &handle_IonJS); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::BaselineStub), &handle_BaselineStub); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::Rectifier), &handle_Rectifier); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::IonICCall), &handle_IonICCall); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::CppToJSJit), &handle_Entry); // The WasmToJSJit is just another kind of entry. - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_WasmToJSJit), &handle_Entry); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::WasmToJSJit), &handle_Entry); masm.assumeUnreachable("Invalid caller frame type when exiting from Ion frame."); // - // JitFrame_IonJS + // FrameType::IonJS // // Stack layout: // ... // Ion-Descriptor // Prev-FP ---> Ion-ReturnAddr // ... previous frame data ... |- Descriptor.Size // ... arguments ... | // ActualArgc | @@ -1163,17 +1163,17 @@ JitRuntime::generateProfilerExitFrameTai // scratch2 := StackPointer + Descriptor.size*1 + JitFrameLayout::Size(); masm.ma_add(StackPointer, scratch1, scratch2); masm.as_add(scratch2, scratch2, Imm8(JitFrameLayout::Size())); masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } // - // JitFrame_BaselineStub + // FrameType::BaselineStub // // Look past the stub and store the frame pointer to // the baselineJS frame prior to it. // // Stack layout: // ... // BL-Descriptor // Prev-FP ---> BL-ReturnAddr @@ -1207,17 +1207,17 @@ JitRuntime::generateProfilerExitFrameTai masm.loadPtr(stubFrameSavedFramePtr, scratch2); masm.addPtr(Imm32(sizeof(void*)), scratch2); // Skip past BL-PrevFramePtr masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } // - // JitFrame_Rectifier + // FrameType::Rectifier // // The rectifier frame can be preceded by either an IonJS, a BaselineStub, // or a CppToJSJit/WasmToJSJit frame. // // Stack layout if caller of rectifier was Ion or CppToJSJit/WasmToJSJit: // // Ion-Descriptor // Ion-ReturnAddr @@ -1261,51 +1261,51 @@ JitRuntime::generateProfilerExitFrameTai // Now |scratch1| contains Rect-Descriptor.Size // and |scratch2| points to Rectifier frame // and |scratch3| contains Rect-Descriptor.Type masm.assertRectifierFrameParentType(scratch3); // Check for either Ion or BaselineStub frame. Label notIonFrame; - masm.branch32(Assembler::NotEqual, scratch3, Imm32(JitFrame_IonJS), ¬IonFrame); + masm.branch32(Assembler::NotEqual, scratch3, Imm32(FrameType::IonJS), ¬IonFrame); // Handle Rectifier <- IonJS // scratch3 := RectFrame[ReturnAddr] masm.loadPtr(Address(scratch2, RectifierFrameLayout::offsetOfReturnAddress()), scratch3); masm.storePtr(scratch3, lastProfilingCallSite); // scratch3 := RectFrame + Rect-Descriptor.Size + RectifierFrameLayout::Size() masm.ma_add(scratch2, scratch1, scratch3); masm.add32(Imm32(RectifierFrameLayout::Size()), scratch3); masm.storePtr(scratch3, lastProfilingFrame); masm.ret(); masm.bind(¬IonFrame); // Check for either BaselineStub or a CppToJSJit/WasmToJSJit entry // frame. - masm.branch32(Assembler::NotEqual, scratch3, Imm32(JitFrame_BaselineStub), &handle_Entry); + masm.branch32(Assembler::NotEqual, scratch3, Imm32(FrameType::BaselineStub), &handle_Entry); // Handle Rectifier <- BaselineStub <- BaselineJS masm.ma_add(scratch2, scratch1, scratch3); Address stubFrameReturnAddr(scratch3, RectifierFrameLayout::Size() + BaselineStubFrameLayout::offsetOfReturnAddress()); masm.loadPtr(stubFrameReturnAddr, scratch2); masm.storePtr(scratch2, lastProfilingCallSite); Address stubFrameSavedFramePtr(scratch3, RectifierFrameLayout::Size() - (2 * sizeof(void*))); masm.loadPtr(stubFrameSavedFramePtr, scratch2); masm.addPtr(Imm32(sizeof(void*)), scratch2); masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } - // JitFrame_IonICCall + // FrameType::IonICCall // // The caller is always an IonJS frame. // // Ion-Descriptor // Ion-ReturnAddr // ... ion frame data ... |- CallFrame-Descriptor.Size // StubCode | // ICCallFrame-Descriptor |- IonICCallFrameLayout::Size() @@ -1324,17 +1324,17 @@ JitRuntime::generateProfilerExitFrameTai // scratch3 := ICCallFrame-Descriptor.Size masm.loadPtr(Address(scratch2, IonICCallFrameLayout::offsetOfDescriptor()), scratch3); #ifdef DEBUG // Assert previous frame is an IonJS frame. masm.movePtr(scratch3, scratch1); masm.and32(Imm32((1 << FRAMETYPE_BITS) - 1), scratch1); { Label checkOk; - masm.branch32(Assembler::Equal, scratch1, Imm32(JitFrame_IonJS), &checkOk); + masm.branch32(Assembler::Equal, scratch1, Imm32(FrameType::IonJS), &checkOk); masm.assumeUnreachable("IonICCall frame must be preceded by IonJS frame"); masm.bind(&checkOk); } #endif masm.rshiftPtr(Imm32(FRAMESIZE_SHIFT), scratch3); // lastProfilingCallSite := ICCallFrame-ReturnAddr masm.loadPtr(Address(scratch2, IonICCallFrameLayout::offsetOfReturnAddress()), scratch1); @@ -1344,17 +1344,17 @@ JitRuntime::generateProfilerExitFrameTai // IonICCallFrameLayout::Size() masm.ma_add(scratch2, scratch3, scratch1); masm.addPtr(Imm32(IonICCallFrameLayout::Size()), scratch1); masm.storePtr(scratch1, lastProfilingFrame); masm.ret(); } // - // JitFrame_CppToJSJit / JitFrame_WasmToJSJit + // FrameType::CppToJSJit / FrameType::WasmToJSJit // // If at an entry frame, store null into both fields. // A fast-path wasm->jit transition frame is an entry frame from the point // of view of the JIT. // masm.bind(&handle_Entry); { masm.movePtr(ImmPtr(nullptr), scratch1);
--- a/js/src/jit/arm64/MacroAssembler-arm64.h +++ b/js/src/jit/arm64/MacroAssembler-arm64.h @@ -2004,17 +2004,17 @@ class MacroAssemblerCompat : public vixl // FIXME: Should be in Assembler? // FIXME: Should be const? uint32_t currentOffset() const { return nextOffset().getOffset(); } protected: bool buildOOLFakeExitFrame(void* fakeReturnAddr) { - uint32_t descriptor = MakeFrameDescriptor(framePushed(), JitFrame_IonJS, + uint32_t descriptor = MakeFrameDescriptor(framePushed(), FrameType::IonJS, ExitFrameLayout::Size()); Push(Imm32(descriptor)); Push(ImmPtr(fakeReturnAddr)); return true; } }; // See documentation for ScratchTagScope and ScratchTagScopeRelease in
--- a/js/src/jit/arm64/SharedICHelpers-arm64-inl.h +++ b/js/src/jit/arm64/SharedICHelpers-arm64-inl.h @@ -31,17 +31,17 @@ EmitBaselineTailCallVM(TrampolinePtr tar masm.Sub(scratch32, w0, Operand(argSize)); masm.store32(scratch32.asUnsized(), Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfFrameSize())); } // Push frame descriptor (minus the return address) and perform the tail call. MOZ_ASSERT(ICTailCallReg == lr); - masm.makeFrameDescriptor(r0, JitFrame_BaselineJS, ExitFrameLayout::Size()); + masm.makeFrameDescriptor(r0, FrameType::BaselineJS, ExitFrameLayout::Size()); masm.push(r0); // The return address will be pushed by the VM wrapper, for compatibility // with direct calls. Refer to the top of generateVMWrapper(). // ICTailCallReg (lr) already contains the return address (as we keep // it there through the stub calls). masm.jump(target); @@ -51,17 +51,17 @@ inline void EmitBaselineCreateStubFrameDescriptor(MacroAssembler& masm, Register reg, uint32_t headerSize) { ARMRegister reg64(reg, 64); // Compute stub frame size. masm.Sub(reg64, masm.GetStackPointer64(), Operand(sizeof(void*) * 2)); masm.Sub(reg64, BaselineFrameReg64, reg64); - masm.makeFrameDescriptor(reg, JitFrame_BaselineStub, headerSize); + masm.makeFrameDescriptor(reg, FrameType::BaselineStub, headerSize); } inline void EmitBaselineCallVM(TrampolinePtr target, MacroAssembler& masm) { EmitBaselineCreateStubFrameDescriptor(masm, r0, ExitFrameLayout::Size()); masm.push(r0); masm.call(target); @@ -81,17 +81,17 @@ EmitBaselineEnterStubFrame(MacroAssemble masm.Sub(ARMRegister(scratch, 64), ARMRegister(scratch, 64), masm.GetStackPointer64()); masm.store32(scratch, Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfFrameSize())); // Note: when making changes here, don't forget to update STUB_FRAME_SIZE. // Push frame descriptor and return address. // Save old frame pointer, stack pointer, and stub reg. - masm.makeFrameDescriptor(scratch, JitFrame_BaselineJS, BaselineStubFrameLayout::Size()); + masm.makeFrameDescriptor(scratch, FrameType::BaselineJS, BaselineStubFrameLayout::Size()); masm.Push(scratch, ICTailCallReg, ICStubReg, BaselineFrameReg); // Update the frame register. masm.Mov(BaselineFrameReg64, masm.GetStackPointer64()); // Stack should remain 16-byte aligned. masm.checkStackAlignment(); }
--- a/js/src/jit/arm64/Trampoline-arm64.cpp +++ b/js/src/jit/arm64/Trampoline-arm64.cpp @@ -159,17 +159,17 @@ JitRuntime::generateEnterJIT(JSContext* masm.unboxInt32(Address(reg_vp, 0x0), ip0); masm.push(ip0, reg_callee); masm.checkStackAlignment(); // Calculate the number of bytes pushed so far. masm.subStackPtrFrom(r19); // Push the frameDescriptor. - masm.makeFrameDescriptor(r19, JitFrame_CppToJSJit, JitFrameLayout::Size()); + masm.makeFrameDescriptor(r19, FrameType::CppToJSJit, JitFrameLayout::Size()); masm.Push(r19); Label osrReturnPoint; { // Check for Interpreter -> Baseline OSR. Label notOsr; masm.branchTestPtr(Assembler::Zero, OsrFrameReg, OsrFrameReg, ¬Osr); @@ -182,17 +182,17 @@ JitRuntime::generateEnterJIT(JSContext* masm.moveStackPtrTo(BaselineFrameReg); // Reserve space for locals and stack values. masm.Lsl(w19, ARMRegister(reg_osrNStack, 32), 3); // w19 = num_stack_values * sizeof(Value). masm.subFromStackPtr(r19); // Enter exit frame. masm.addPtr(Imm32(BaselineFrame::Size() + BaselineFrame::FramePointerOffset), r19); - masm.makeFrameDescriptor(r19, JitFrame_BaselineJS, ExitFrameLayout::Size()); + masm.makeFrameDescriptor(r19, FrameType::BaselineJS, ExitFrameLayout::Size()); masm.asVIXL().Push(x19, xzr); // Push xzr for a fake return address. // No GC things to mark: push a bare token. masm.loadJSContext(r19); masm.enterFakeExitFrame(r19, r19, ExitFrameType::Bare); masm.push(BaselineFrameReg, reg_code); // Initialize the frame, including filling in the slots. @@ -386,17 +386,17 @@ JitRuntime::generateArgumentsRectifier(M masm.B(©LoopTop, Assembler::NotSigned); } // Fix up the size of the stack frame. +1 accounts for |this|. masm.Add(x6, x7, Operand(1)); masm.Lsl(x6, x6, 3); // Make that into a frame descriptor. - masm.makeFrameDescriptor(r6, JitFrame_Rectifier, JitFrameLayout::Size()); + masm.makeFrameDescriptor(r6, FrameType::Rectifier, JitFrameLayout::Size()); masm.push(r0, // Number of actual arguments. r1, // Callee token. r6); // Frame descriptor. // Load the address of the code that is getting called. masm.loadJitCodeRaw(r5, r3); argumentsRectifierReturnOffset_ = masm.callJitNoProfiler(r3); @@ -928,30 +928,30 @@ JitRuntime::generateProfilerExitFrameTai // Handling of each case is dependent on FrameDescriptor.type Label handle_IonJS; Label handle_BaselineStub; Label handle_Rectifier; Label handle_IonICCall; Label handle_Entry; Label end; - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_IonJS), &handle_IonJS); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_BaselineJS), &handle_IonJS); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_BaselineStub), &handle_BaselineStub); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_Rectifier), &handle_Rectifier); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_IonICCall), &handle_IonICCall); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_CppToJSJit), &handle_Entry); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::IonJS), &handle_IonJS); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::BaselineJS), &handle_IonJS); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::BaselineStub), &handle_BaselineStub); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::Rectifier), &handle_Rectifier); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::IonICCall), &handle_IonICCall); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::CppToJSJit), &handle_Entry); // The WasmToJSJit is just another kind of entry. - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_WasmToJSJit), &handle_Entry); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::WasmToJSJit), &handle_Entry); masm.assumeUnreachable("Invalid caller frame type when exiting from Ion frame."); // - // JitFrame_IonJS + // FrameType::IonJS // // Stack layout: // ... // Ion-Descriptor // Prev-FP ---> Ion-ReturnAddr // ... previous frame data ... |- Descriptor.Size // ... arguments ... | // ActualArgc | @@ -974,17 +974,17 @@ JitRuntime::generateProfilerExitFrameTai masm.Add(ARMRegister(scratch2, 64), masm.GetStackPointer64(), ARMRegister(scratch1, 64)); masm.syncStackPtr(); masm.addPtr(Imm32(JitFrameLayout::Size()), scratch2, scratch2); masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } // - // JitFrame_BaselineStub + // FrameType::BaselineStub // // Look past the stub and store the frame pointer to // the baselineJS frame prior to it. // // Stack layout: // ... // BL-Descriptor // Prev-FP ---> BL-ReturnAddr @@ -1019,17 +1019,17 @@ JitRuntime::generateProfilerExitFrameTai masm.loadPtr(stubFrameSavedFramePtr, scratch2); masm.addPtr(Imm32(sizeof(void*)), scratch2); // Skip past BL-PrevFramePtr. masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } // - // JitFrame_Rectifier + // FrameType::Rectifier // // The rectifier frame can be preceded by either an IonJS, a BaselineStub, // or a CppToJSJit/WasmToJSJit frame. // // Stack layout if caller of rectifier was Ion or CppToJSJit/WasmToJSJit: // // Ion-Descriptor // Ion-ReturnAddr @@ -1074,51 +1074,51 @@ JitRuntime::generateProfilerExitFrameTai // Now |scratch1| contains Rect-Descriptor.Size // and |scratch2| points to Rectifier frame // and |scratch3| contains Rect-Descriptor.Type masm.assertRectifierFrameParentType(scratch3); // Check for either Ion or BaselineStub frame. Label notIonFrame; - masm.branch32(Assembler::NotEqual, scratch3, Imm32(JitFrame_IonJS), ¬IonFrame); + masm.branch32(Assembler::NotEqual, scratch3, Imm32(FrameType::IonJS), ¬IonFrame); // Handle Rectifier <- IonJS // scratch3 := RectFrame[ReturnAddr] masm.loadPtr(Address(scratch2, RectifierFrameLayout::offsetOfReturnAddress()), scratch3); masm.storePtr(scratch3, lastProfilingCallSite); // scratch3 := RectFrame + Rect-Descriptor.Size + RectifierFrameLayout::Size() masm.addPtr(scratch2, scratch1, scratch3); masm.add32(Imm32(RectifierFrameLayout::Size()), scratch3); masm.storePtr(scratch3, lastProfilingFrame); masm.ret(); masm.bind(¬IonFrame); // Check for either BaselineStub or a CppToJSJit/WasmToJSJit entry // frame. - masm.branch32(Assembler::NotEqual, scratch3, Imm32(JitFrame_BaselineStub), &handle_Entry); + masm.branch32(Assembler::NotEqual, scratch3, Imm32(FrameType::BaselineStub), &handle_Entry); // Handle Rectifier <- BaselineStub <- BaselineJS masm.addPtr(scratch2, scratch1, scratch3); Address stubFrameReturnAddr(scratch3, RectifierFrameLayout::Size() + BaselineStubFrameLayout::offsetOfReturnAddress()); masm.loadPtr(stubFrameReturnAddr, scratch2); masm.storePtr(scratch2, lastProfilingCallSite); Address stubFrameSavedFramePtr(scratch3, RectifierFrameLayout::Size() - (2 * sizeof(void*))); masm.loadPtr(stubFrameSavedFramePtr, scratch2); masm.addPtr(Imm32(sizeof(void*)), scratch2); masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } - // JitFrame_IonICCall + // FrameType::IonICCall // // The caller is always an IonJS frame. // // Ion-Descriptor // Ion-ReturnAddr // ... ion frame data ... |- CallFrame-Descriptor.Size // StubCode | // ICCallFrame-Descriptor |- IonICCallFrameLayout::Size() @@ -1138,17 +1138,17 @@ JitRuntime::generateProfilerExitFrameTai // scratch3 := ICCallFrame-Descriptor.Size masm.loadPtr(Address(scratch2, IonICCallFrameLayout::offsetOfDescriptor()), scratch3); #ifdef DEBUG // Assert previous frame is an IonJS frame. masm.movePtr(scratch3, scratch1); masm.and32(Imm32((1 << FRAMETYPE_BITS) - 1), scratch1); { Label checkOk; - masm.branch32(Assembler::Equal, scratch1, Imm32(JitFrame_IonJS), &checkOk); + masm.branch32(Assembler::Equal, scratch1, Imm32(FrameType::IonJS), &checkOk); masm.assumeUnreachable("IonICCall frame must be preceded by IonJS frame"); masm.bind(&checkOk); } #endif masm.rshiftPtr(Imm32(FRAMESIZE_SHIFT), scratch3); // lastProfilingCallSite := ICCallFrame-ReturnAddr masm.loadPtr(Address(scratch2, IonICCallFrameLayout::offsetOfReturnAddress()), scratch1); @@ -1158,17 +1158,17 @@ JitRuntime::generateProfilerExitFrameTai // IonICCallFrameLayout::Size() masm.addPtr(scratch2, scratch3, scratch1); masm.addPtr(Imm32(IonICCallFrameLayout::Size()), scratch1); masm.storePtr(scratch1, lastProfilingFrame); masm.ret(); } // - // JitFrame_CppToJSJit / JitFrame_WasmToJSJit + // FrameType::CppToJSJit / FrameType::WasmToJSJit // // If at an entry frame, store null into both fields. // A fast-path wasm->jit transition frame is an entry frame from the point // of view of the JIT. // masm.bind(&handle_Entry); { masm.movePtr(ImmPtr(nullptr), scratch1);
--- a/js/src/jit/mips-shared/SharedICHelpers-mips-shared-inl.h +++ b/js/src/jit/mips-shared/SharedICHelpers-mips-shared-inl.h @@ -29,34 +29,34 @@ EmitBaselineTailCallVM(TrampolinePtr tar masm.store32(scratch, Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfFrameSize())); masm.addPtr(Imm32(argSize), scratch); // Push frame descriptor and perform the tail call. // ICTailCallReg (ra) already contains the return address (as we // keep it there through the stub calls), but the VMWrapper code being // called expects the return address to also be pushed on the stack. MOZ_ASSERT(ICTailCallReg == ra); - masm.makeFrameDescriptor(scratch, JitFrame_BaselineJS, ExitFrameLayout::Size()); + masm.makeFrameDescriptor(scratch, FrameType::BaselineJS, ExitFrameLayout::Size()); masm.subPtr(Imm32(sizeof(CommonFrameLayout)), StackPointer); masm.storePtr(scratch, Address(StackPointer, CommonFrameLayout::offsetOfDescriptor())); masm.storePtr(ra, Address(StackPointer, CommonFrameLayout::offsetOfReturnAddress())); masm.jump(target); } inline void EmitBaselineCreateStubFrameDescriptor(MacroAssembler& masm, Register reg, uint32_t headerSize) { // Compute stub frame size. We have to add two pointers: the stub reg and // previous frame pointer pushed by EmitEnterStubFrame. masm.movePtr(BaselineFrameReg, reg); masm.addPtr(Imm32(sizeof(intptr_t) * 2), reg); masm.subPtr(BaselineStackReg, reg); - masm.makeFrameDescriptor(reg, JitFrame_BaselineStub, headerSize); + masm.makeFrameDescriptor(reg, FrameType::BaselineStub, headerSize); } inline void EmitBaselineCallVM(TrampolinePtr target, MacroAssembler& masm) { Register scratch = R2.scratchReg(); EmitBaselineCreateStubFrameDescriptor(masm, scratch, ExitFrameLayout::Size()); masm.push(scratch); @@ -74,17 +74,17 @@ EmitBaselineEnterStubFrame(MacroAssemble masm.subPtr(BaselineStackReg, scratch); masm.store32(scratch, Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfFrameSize())); // Note: when making changes here, don't forget to update // BaselineStubFrame if needed. // Push frame descriptor and return address. - masm.makeFrameDescriptor(scratch, JitFrame_BaselineJS, BaselineStubFrameLayout::Size()); + masm.makeFrameDescriptor(scratch, FrameType::BaselineJS, BaselineStubFrameLayout::Size()); masm.subPtr(Imm32(STUB_FRAME_SIZE), StackPointer); masm.storePtr(scratch, Address(StackPointer, offsetof(BaselineStubFrame, descriptor))); masm.storePtr(ICTailCallReg, Address(StackPointer, offsetof(BaselineStubFrame, returnAddress))); // Save old frame pointer, stack pointer and stub reg. masm.storePtr(ICStubReg, Address(StackPointer, offsetof(BaselineStubFrame, savedStub)));
--- a/js/src/jit/mips32/MacroAssembler-mips32.cpp +++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp @@ -957,17 +957,17 @@ MacroAssemblerMIPS::ma_push(FloatRegiste ma_sdc1WordAligned(f, StackPointer, 0); else as_swc1(f, StackPointer, 0); } bool MacroAssemblerMIPSCompat::buildOOLFakeExitFrame(void* fakeReturnAddr) { - uint32_t descriptor = MakeFrameDescriptor(asMasm().framePushed(), JitFrame_IonJS, + uint32_t descriptor = MakeFrameDescriptor(asMasm().framePushed(), FrameType::IonJS, ExitFrameLayout::Size()); asMasm().Push(Imm32(descriptor)); // descriptor_ asMasm().Push(ImmPtr(fakeReturnAddr)); return true; }
--- a/js/src/jit/mips32/Trampoline-mips32.cpp +++ b/js/src/jit/mips32/Trampoline-mips32.cpp @@ -195,17 +195,17 @@ JitRuntime::generateEnterJIT(JSContext* } masm.bind(&footer); masm.subPtr(Imm32(2 * sizeof(uintptr_t)), StackPointer); masm.storePtr(s3, Address(StackPointer, sizeof(uintptr_t))); // actual arguments masm.storePtr(s2, Address(StackPointer, 0)); // callee token masm.subPtr(StackPointer, s4); - masm.makeFrameDescriptor(s4, JitFrame_CppToJSJit, JitFrameLayout::Size()); + masm.makeFrameDescriptor(s4, FrameType::CppToJSJit, JitFrameLayout::Size()); masm.push(s4); // descriptor CodeLabel returnLabel; CodeLabel oomReturnLabel; { // Handle Interpreter -> Baseline OSR. AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All()); regs.take(OsrFrameReg); @@ -241,17 +241,17 @@ JitRuntime::generateEnterJIT(JSContext* masm.movePtr(StackPointer, framePtr); // Reserve space for locals and stack values. masm.ma_sll(scratch, numStackValues, Imm32(3)); masm.subPtr(scratch, StackPointer); // Enter exit frame. masm.addPtr(Imm32(BaselineFrame::Size() + BaselineFrame::FramePointerOffset), scratch); - masm.makeFrameDescriptor(scratch, JitFrame_BaselineJS, ExitFrameLayout::Size()); + masm.makeFrameDescriptor(scratch, FrameType::BaselineJS, ExitFrameLayout::Size()); // Push frame descriptor and fake return address. masm.reserveStack(2 * sizeof(uintptr_t)); masm.storePtr(scratch, Address(StackPointer, sizeof(uintptr_t))); // Frame descriptor masm.storePtr(zero, Address(StackPointer, 0)); // fake return address // No GC things to mark, push a bare token. masm.loadJSContext(scratch); @@ -488,17 +488,17 @@ JitRuntime::generateArgumentsRectifier(M masm.ma_b(s3, s3, ©LoopTop, Assembler::NonZero, ShortJump); } // translate the framesize from values into bytes masm.ma_addu(t0, numArgsReg, Imm32(1)); masm.lshiftPtr(Imm32(3), t0); // Construct sizeDescriptor. - masm.makeFrameDescriptor(t0, JitFrame_Rectifier, JitFrameLayout::Size()); + masm.makeFrameDescriptor(t0, FrameType::Rectifier, JitFrameLayout::Size()); // Construct JitFrameLayout. masm.subPtr(Imm32(3 * sizeof(uintptr_t)), StackPointer); // Push actual arguments. masm.storePtr(numActArgsReg, Address(StackPointer, 2 * sizeof(uintptr_t))); // Push callee token. masm.storePtr(calleeTokenReg, Address(StackPointer, sizeof(uintptr_t))); // Push frame descriptor. @@ -1097,30 +1097,30 @@ JitRuntime::generateProfilerExitFrameTai // Handling of each case is dependent on FrameDescriptor.type Label handle_IonJS; Label handle_BaselineStub; Label handle_Rectifier; Label handle_IonICCall; Label handle_Entry; Label end; - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_IonJS), &handle_IonJS); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_BaselineJS), &handle_IonJS); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_BaselineStub), &handle_BaselineStub); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_Rectifier), &handle_Rectifier); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_IonICCall), &handle_IonICCall); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_CppToJSJit), &handle_Entry); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::IonJS), &handle_IonJS); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::BaselineJS), &handle_IonJS); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::BaselineStub), &handle_BaselineStub); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::Rectifier), &handle_Rectifier); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::IonICCall), &handle_IonICCall); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::CppToJSJit), &handle_Entry); // The WasmToJSJit is just another kind of entry. - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_WasmToJSJit), &handle_Entry); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::WasmToJSJit), &handle_Entry); masm.assumeUnreachable("Invalid caller frame type when exiting from Ion frame."); // - // JitFrame_IonJS + // FrameType::IonJS // // Stack layout: // ... // Ion-Descriptor // Prev-FP ---> Ion-ReturnAddr // ... previous frame data ... |- Descriptor.Size // ... arguments ... | // ActualArgc | @@ -1141,17 +1141,17 @@ JitRuntime::generateProfilerExitFrameTai // scratch2 := StackPointer + Descriptor.size*1 + JitFrameLayout::Size(); masm.as_addu(scratch2, StackPointer, scratch1); masm.ma_addu(scratch2, scratch2, Imm32(JitFrameLayout::Size())); masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } // - // JitFrame_BaselineStub + // FrameType::BaselineStub // // Look past the stub and store the frame pointer to // the baselineJS frame prior to it. // // Stack layout: // ... // BL-Descriptor // Prev-FP ---> BL-ReturnAddr @@ -1185,17 +1185,17 @@ JitRuntime::generateProfilerExitFrameTai masm.loadPtr(stubFrameSavedFramePtr, scratch2); masm.addPtr(Imm32(sizeof(void*)), scratch2); // Skip past BL-PrevFramePtr masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } // - // JitFrame_Rectifier + // FrameType::Rectifier // // The rectifier frame can be preceded by either an IonJS, a BaselineStub, // or a CppToJSJit/WasmToJSJit frame. // // Stack layout if caller of rectifier was Ion or CppToJSJit/WasmToJSJit: // // Ion-Descriptor // Ion-ReturnAddr @@ -1239,51 +1239,51 @@ JitRuntime::generateProfilerExitFrameTai // Now |scratch1| contains Rect-Descriptor.Size // and |scratch2| points to Rectifier frame // and |scratch3| contains Rect-Descriptor.Type masm.assertRectifierFrameParentType(scratch3); // Check for either Ion or BaselineStub frame. Label notIonFrame; - masm.branch32(Assembler::NotEqual, scratch3, Imm32(JitFrame_IonJS), ¬IonFrame); + masm.branch32(Assembler::NotEqual, scratch3, Imm32(FrameType::IonJS), ¬IonFrame); // Handle Rectifier <- IonJS // scratch3 := RectFrame[ReturnAddr] masm.loadPtr(Address(scratch2, RectifierFrameLayout::offsetOfReturnAddress()), scratch3); masm.storePtr(scratch3, lastProfilingCallSite); // scratch3 := RectFrame + Rect-Descriptor.Size + RectifierFrameLayout::Size() masm.as_addu(scratch3, scratch2, scratch1); masm.add32(Imm32(RectifierFrameLayout::Size()), scratch3); masm.storePtr(scratch3, lastProfilingFrame); masm.ret(); masm.bind(¬IonFrame); // Check for either BaselineStub or a CppToJSJit/WasmToJSJit entry // frame. - masm.branch32(Assembler::NotEqual, scratch3, Imm32(JitFrame_BaselineStub), &handle_Entry); + masm.branch32(Assembler::NotEqual, scratch3, Imm32(FrameType::BaselineStub), &handle_Entry); // Handle Rectifier <- BaselineStub <- BaselineJS masm.as_addu(scratch3, scratch2, scratch1); Address stubFrameReturnAddr(scratch3, RectifierFrameLayout::Size() + BaselineStubFrameLayout::offsetOfReturnAddress()); masm.loadPtr(stubFrameReturnAddr, scratch2); masm.storePtr(scratch2, lastProfilingCallSite); Address stubFrameSavedFramePtr(scratch3, RectifierFrameLayout::Size() - (2 * sizeof(void*))); masm.loadPtr(stubFrameSavedFramePtr, scratch2); masm.addPtr(Imm32(sizeof(void*)), scratch2); masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } - // JitFrame_IonICCall + // FrameType::IonICCall // // The caller is always an IonJS frame. // // Ion-Descriptor // Ion-ReturnAddr // ... ion frame data ... |- CallFrame-Descriptor.Size // StubCode | // ICCallFrame-Descriptor |- IonICCallFrameLayout::Size() @@ -1302,17 +1302,17 @@ JitRuntime::generateProfilerExitFrameTai // scratch3 := ICCallFrame-Descriptor.Size masm.loadPtr(Address(scratch2, IonICCallFrameLayout::offsetOfDescriptor()), scratch3); #ifdef DEBUG // Assert previous frame is an IonJS frame. masm.movePtr(scratch3, scratch1); masm.and32(Imm32((1 << FRAMETYPE_BITS) - 1), scratch1); { Label checkOk; - masm.branch32(Assembler::Equal, scratch1, Imm32(JitFrame_IonJS), &checkOk); + masm.branch32(Assembler::Equal, scratch1, Imm32(FrameType::IonJS), &checkOk); masm.assumeUnreachable("IonICCall frame must be preceded by IonJS frame"); masm.bind(&checkOk); } #endif masm.rshiftPtr(Imm32(FRAMESIZE_SHIFT), scratch3); // lastProfilingCallSite := ICCallFrame-ReturnAddr masm.loadPtr(Address(scratch2, IonICCallFrameLayout::offsetOfReturnAddress()), scratch1); @@ -1322,17 +1322,17 @@ JitRuntime::generateProfilerExitFrameTai // IonICCallFrameLayout::Size() masm.as_addu(scratch1, scratch2, scratch3); masm.addPtr(Imm32(IonICCallFrameLayout::Size()), scratch1); masm.storePtr(scratch1, lastProfilingFrame); masm.ret(); } // - // JitFrame_CppToJSJit / JitFrame_WasmToJSJit + // FrameType::CppToJSJit / FrameType::WasmToJSJit // // If at an entry frame, store null into both fields. // A fast-path wasm->jit transition frame is an entry frame from the point // of view of the JIT. // masm.bind(&handle_Entry); { masm.movePtr(ImmPtr(nullptr), scratch1);
--- a/js/src/jit/mips64/MacroAssembler-mips64.cpp +++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp @@ -915,17 +915,17 @@ MacroAssemblerMIPS64::ma_push(FloatRegis { as_daddiu(StackPointer, StackPointer, (int32_t)-sizeof(double)); as_sdc1(f, StackPointer, 0); } bool MacroAssemblerMIPS64Compat::buildOOLFakeExitFrame(void* fakeReturnAddr) { - uint32_t descriptor = MakeFrameDescriptor(asMasm().framePushed(), JitFrame_IonJS, + uint32_t descriptor = MakeFrameDescriptor(asMasm().framePushed(), FrameType::IonJS, ExitFrameLayout::Size()); asMasm().Push(Imm32(descriptor)); // descriptor_ asMasm().Push(ImmPtr(fakeReturnAddr)); return true; }
--- a/js/src/jit/mips64/Trampoline-mips64.cpp +++ b/js/src/jit/mips64/Trampoline-mips64.cpp @@ -224,17 +224,17 @@ JitRuntime::generateEnterJIT(JSContext* } masm.bind(&footer); masm.subPtr(Imm32(2 * sizeof(uintptr_t)), StackPointer); masm.storePtr(s3, Address(StackPointer, sizeof(uintptr_t))); // actual arguments masm.storePtr(reg_token, Address(StackPointer, 0)); // callee token masm.subPtr(StackPointer, s4); - masm.makeFrameDescriptor(s4, JitFrame_CppToJSJit, JitFrameLayout::Size()); + masm.makeFrameDescriptor(s4, FrameType::CppToJSJit, JitFrameLayout::Size()); masm.push(s4); // descriptor CodeLabel returnLabel; CodeLabel oomReturnLabel; { // Handle Interpreter -> Baseline OSR. AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All()); regs.take(OsrFrameReg); @@ -265,17 +265,17 @@ JitRuntime::generateEnterJIT(JSContext* masm.movePtr(StackPointer, framePtr); // Reserve space for locals and stack values. masm.ma_dsll(scratch, numStackValues, Imm32(3)); masm.subPtr(scratch, StackPointer); // Enter exit frame. masm.addPtr(Imm32(BaselineFrame::Size() + BaselineFrame::FramePointerOffset), scratch); - masm.makeFrameDescriptor(scratch, JitFrame_BaselineJS, ExitFrameLayout::Size()); + masm.makeFrameDescriptor(scratch, FrameType::BaselineJS, ExitFrameLayout::Size()); // Push frame descriptor and fake return address. masm.reserveStack(2 * sizeof(uintptr_t)); masm.storePtr(scratch, Address(StackPointer, sizeof(uintptr_t))); // Frame descriptor masm.storePtr(zero, Address(StackPointer, 0)); // fake return address // No GC things to mark, push a bare token. masm.loadJSContext(scratch); @@ -532,17 +532,17 @@ JitRuntime::generateArgumentsRectifier(M // [arg2] [arg1] [this] [[argc] [callee] [descr] [raddr]] <- t2 // // // Rectifier frame: // [undef] [undef] [undef] [arg2] [arg1] [this] <- sp [[argc] [callee] [descr] [raddr]] // Construct sizeDescriptor. masm.subPtr(StackPointer, t2); - masm.makeFrameDescriptor(t2, JitFrame_Rectifier, JitFrameLayout::Size()); + masm.makeFrameDescriptor(t2, FrameType::Rectifier, JitFrameLayout::Size()); // Construct JitFrameLayout. masm.subPtr(Imm32(3 * sizeof(uintptr_t)), StackPointer); // Push actual arguments. masm.storePtr(numActArgsReg, Address(StackPointer, 2 * sizeof(uintptr_t))); // Push callee token. masm.storePtr(calleeTokenReg, Address(StackPointer, sizeof(uintptr_t))); // Push frame descriptor. @@ -1046,30 +1046,30 @@ JitRuntime::generateProfilerExitFrameTai // Handling of each case is dependent on FrameDescriptor.type Label handle_IonJS; Label handle_BaselineStub; Label handle_Rectifier; Label handle_IonICCall; Label handle_Entry; Label end; - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_IonJS), &handle_IonJS); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_BaselineJS), &handle_IonJS); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_BaselineStub), &handle_BaselineStub); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_Rectifier), &handle_Rectifier); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_IonICCall), &handle_IonICCall); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_CppToJSJit), &handle_Entry); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::IonJS), &handle_IonJS); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::BaselineJS), &handle_IonJS); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::BaselineStub), &handle_BaselineStub); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::Rectifier), &handle_Rectifier); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::IonICCall), &handle_IonICCall); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::CppToJSJit), &handle_Entry); // The WasmToJSJit is just another kind of entry. - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_WasmToJSJit), &handle_Entry); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::WasmToJSJit), &handle_Entry); masm.assumeUnreachable("Invalid caller frame type when exiting from Ion frame."); // - // JitFrame_IonJS + // FrameType::IonJS // // Stack layout: // ... // Ion-Descriptor // Prev-FP ---> Ion-ReturnAddr // ... previous frame data ... |- Descriptor.Size // ... arguments ... | // ActualArgc | @@ -1090,17 +1090,17 @@ JitRuntime::generateProfilerExitFrameTai // scratch2 := StackPointer + Descriptor.size*1 + JitFrameLayout::Size(); masm.as_daddu(scratch2, StackPointer, scratch1); masm.ma_daddu(scratch2, scratch2, Imm32(JitFrameLayout::Size())); masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } // - // JitFrame_BaselineStub + // FrameType::BaselineStub // // Look past the stub and store the frame pointer to // the baselineJS frame prior to it. // // Stack layout: // ... // BL-Descriptor // Prev-FP ---> BL-ReturnAddr @@ -1134,17 +1134,17 @@ JitRuntime::generateProfilerExitFrameTai masm.loadPtr(stubFrameSavedFramePtr, scratch2); masm.addPtr(Imm32(sizeof(void*)), scratch2); // Skip past BL-PrevFramePtr masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } // - // JitFrame_Rectifier + // FrameType::Rectifier // // The rectifier frame can be preceded by either an IonJS, a BaselineStub, // or a CppToJSJit/WasmToJSJit frame. // // Stack layout if caller of rectifier was Ion or CppToJSJit/WasmToJSJit: // // Ion-Descriptor // Ion-ReturnAddr @@ -1188,51 +1188,51 @@ JitRuntime::generateProfilerExitFrameTai // Now |scratch1| contains Rect-Descriptor.Size // and |scratch2| points to Rectifier frame // and |scratch3| contains Rect-Descriptor.Type masm.assertRectifierFrameParentType(scratch3); // Check for either Ion or BaselineStub frame. Label notIonFrame; - masm.branch32(Assembler::NotEqual, scratch3, Imm32(JitFrame_IonJS), ¬IonFrame); + masm.branch32(Assembler::NotEqual, scratch3, Imm32(FrameType::IonJS), ¬IonFrame); // Handle Rectifier <- IonJS // scratch3 := RectFrame[ReturnAddr] masm.loadPtr(Address(scratch2, RectifierFrameLayout::offsetOfReturnAddress()), scratch3); masm.storePtr(scratch3, lastProfilingCallSite); // scratch3 := RectFrame + Rect-Descriptor.Size + RectifierFrameLayout::Size() masm.as_daddu(scratch3, scratch2, scratch1); masm.addPtr(Imm32(RectifierFrameLayout::Size()), scratch3); masm.storePtr(scratch3, lastProfilingFrame); masm.ret(); masm.bind(¬IonFrame); // Check for either BaselineStub or a CppToJSJit/WasmToJSJit entry // frame. - masm.branch32(Assembler::NotEqual, scratch3, Imm32(JitFrame_BaselineStub), &handle_Entry); + masm.branch32(Assembler::NotEqual, scratch3, Imm32(FrameType::BaselineStub), &handle_Entry); // Handle Rectifier <- BaselineStub <- BaselineJS masm.as_daddu(scratch3, scratch2, scratch1); Address stubFrameReturnAddr(scratch3, RectifierFrameLayout::Size() + BaselineStubFrameLayout::offsetOfReturnAddress()); masm.loadPtr(stubFrameReturnAddr, scratch2); masm.storePtr(scratch2, lastProfilingCallSite); Address stubFrameSavedFramePtr(scratch3, RectifierFrameLayout::Size() - (2 * sizeof(void*))); masm.loadPtr(stubFrameSavedFramePtr, scratch2); masm.addPtr(Imm32(sizeof(void*)), scratch2); masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } - // JitFrame_IonICCall + // FrameType::IonICCall // // The caller is always an IonJS frame. // // Ion-Descriptor // Ion-ReturnAddr // ... ion frame data ... |- CallFrame-Descriptor.Size // StubCode | // ICCallFrame-Descriptor |- IonICCallFrameLayout::Size() @@ -1251,17 +1251,17 @@ JitRuntime::generateProfilerExitFrameTai // scratch3 := ICCallFrame-Descriptor.Size masm.loadPtr(Address(scratch2, IonICCallFrameLayout::offsetOfDescriptor()), scratch3); #ifdef DEBUG // Assert previous frame is an IonJS frame. masm.movePtr(scratch3, scratch1); masm.and32(Imm32((1 << FRAMETYPE_BITS) - 1), scratch1); { Label checkOk; - masm.branch32(Assembler::Equal, scratch1, Imm32(JitFrame_IonJS), &checkOk); + masm.branch32(Assembler::Equal, scratch1, Imm32(FrameType::IonJS), &checkOk); masm.assumeUnreachable("IonICCall frame must be preceded by IonJS frame"); masm.bind(&checkOk); } #endif masm.rshiftPtr(Imm32(FRAMESIZE_SHIFT), scratch3); // lastProfilingCallSite := ICCallFrame-ReturnAddr masm.loadPtr(Address(scratch2, IonICCallFrameLayout::offsetOfReturnAddress()), scratch1); @@ -1271,17 +1271,17 @@ JitRuntime::generateProfilerExitFrameTai // IonICCallFrameLayout::Size() masm.as_daddu(scratch1, scratch2, scratch3); masm.addPtr(Imm32(IonICCallFrameLayout::Size()), scratch1); masm.storePtr(scratch1, lastProfilingFrame); masm.ret(); } // - // JitFrame_CppToJSJit / JitFrame_WasmToJSJit + // FrameType::CppToJSJit / FrameType::WasmToJSJit // // If at an entry frame, store null into both fields. // A fast-path wasm->jit transition frame is an entry frame from the point // of view of the JIT. // masm.bind(&handle_Entry); { masm.movePtr(ImmPtr(nullptr), scratch1);
--- a/js/src/jit/shared/Assembler-shared.h +++ b/js/src/jit/shared/Assembler-shared.h @@ -99,16 +99,18 @@ ScaleFromElemWidth(int shift) // Used for 32-bit immediates which do not require relocation. struct Imm32 { int32_t value; explicit Imm32(int32_t value) : value(value) { } + explicit Imm32(FrameType type) : Imm32(int32_t(type)) + { } static inline Imm32 ShiftOf(enum Scale s) { switch (s) { case TimesOne: return Imm32(0); case TimesTwo: return Imm32(1); case TimesFour:
--- a/js/src/jit/shared/BaselineCompiler-shared.cpp +++ b/js/src/jit/shared/BaselineCompiler-shared.cpp @@ -82,23 +82,23 @@ BaselineCompilerShared::callVM(const VMF MOZ_ASSERT(masm.framePushed() - pushedBeforeCall_ == argSize); Address frameSizeAddress(BaselineFrameReg, BaselineFrame::reverseOffsetOfFrameSize()); uint32_t frameVals = frame.nlocals() + frame.stackDepth(); uint32_t frameBaseSize = BaselineFrame::FramePointerOffset + BaselineFrame::Size(); uint32_t frameFullSize = frameBaseSize + (frameVals * sizeof(Value)); if (phase == POST_INITIALIZE) { masm.store32(Imm32(frameFullSize), frameSizeAddress); - uint32_t descriptor = MakeFrameDescriptor(frameFullSize + argSize, JitFrame_BaselineJS, + uint32_t descriptor = MakeFrameDescriptor(frameFullSize + argSize, FrameType::BaselineJS, ExitFrameLayout::Size()); masm.push(Imm32(descriptor)); } else if (phase == PRE_INITIALIZE) { masm.store32(Imm32(frameBaseSize), frameSizeAddress); - uint32_t descriptor = MakeFrameDescriptor(frameBaseSize + argSize, JitFrame_BaselineJS, + uint32_t descriptor = MakeFrameDescriptor(frameBaseSize + argSize, FrameType::BaselineJS, ExitFrameLayout::Size()); masm.push(Imm32(descriptor)); } else { MOZ_ASSERT(phase == CHECK_OVER_RECURSED); Label afterWrite; Label writePostInitialize; @@ -112,17 +112,17 @@ BaselineCompilerShared::callVM(const VMF masm.jump(&afterWrite); masm.bind(&writePostInitialize); masm.move32(Imm32(frameFullSize), ICTailCallReg); masm.bind(&afterWrite); masm.store32(ICTailCallReg, frameSizeAddress); masm.add32(Imm32(argSize), ICTailCallReg); - masm.makeFrameDescriptor(ICTailCallReg, JitFrame_BaselineJS, ExitFrameLayout::Size()); + masm.makeFrameDescriptor(ICTailCallReg, FrameType::BaselineJS, ExitFrameLayout::Size()); masm.push(ICTailCallReg); } MOZ_ASSERT(fun.expectTailCall == NonTailCall); // Perform the call. masm.call(code); uint32_t callOffset = masm.currentOffset(); masm.pop(BaselineFrameReg);
--- a/js/src/jit/shared/CodeGenerator-shared.cpp +++ b/js/src/jit/shared/CodeGenerator-shared.cpp @@ -1374,20 +1374,20 @@ CodeGeneratorShared::callVM(const VMFunc StoreAllLiveRegs(masm, ins->safepoint()->liveRegs()); #endif // Push an exit frame descriptor. If |dynStack| is a valid pointer to a // register, then its value is added to the value of the |framePushed()| to // fill the frame descriptor. if (dynStack) { masm.addPtr(Imm32(masm.framePushed()), *dynStack); - masm.makeFrameDescriptor(*dynStack, JitFrame_IonJS, ExitFrameLayout::Size()); + masm.makeFrameDescriptor(*dynStack, FrameType::IonJS, ExitFrameLayout::Size()); masm.Push(*dynStack); // descriptor } else { - masm.pushStaticFrameDescriptor(JitFrame_IonJS, ExitFrameLayout::Size()); + masm.pushStaticFrameDescriptor(FrameType::IonJS, ExitFrameLayout::Size()); } // Call the wrapper function. The wrapper is in charge to unwind the stack // when returning from the call. Failures are handled with exceptions based // on the return value of the C functions. To guard the outcome of the // returned value, use another LIR instruction. uint32_t callOffset = masm.callJit(wrapper); markSafepointAt(callOffset, ins);
--- a/js/src/jit/x64/SharedICHelpers-x64-inl.h +++ b/js/src/jit/x64/SharedICHelpers-x64-inl.h @@ -25,32 +25,32 @@ EmitBaselineTailCallVM(TrampolinePtr tar masm.subq(BaselineStackReg, scratch); // Store frame size without VMFunction arguments for GC marking. masm.movq(scratch, rdx); masm.subq(Imm32(argSize), rdx); masm.store32(rdx, Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfFrameSize())); // Push frame descriptor and perform the tail call. - masm.makeFrameDescriptor(scratch, JitFrame_BaselineJS, ExitFrameLayout::Size()); + masm.makeFrameDescriptor(scratch, FrameType::BaselineJS, ExitFrameLayout::Size()); masm.push(scratch); masm.push(ICTailCallReg); masm.jump(target); } inline void EmitBaselineCreateStubFrameDescriptor(MacroAssembler& masm, Register reg, uint32_t headerSize) { // Compute stub frame size. We have to add two pointers: the stub reg and previous // frame pointer pushed by EmitEnterStubFrame. masm.movq(BaselineFrameReg, reg); masm.addq(Imm32(sizeof(void*) * 2), reg); masm.subq(BaselineStackReg, reg); - masm.makeFrameDescriptor(reg, JitFrame_BaselineStub, headerSize); + masm.makeFrameDescriptor(reg, FrameType::BaselineStub, headerSize); } inline void EmitBaselineCallVM(TrampolinePtr target, MacroAssembler& masm) { ScratchRegisterScope scratch(masm); EmitBaselineCreateStubFrameDescriptor(masm, scratch, ExitFrameLayout::Size()); masm.push(scratch); @@ -87,17 +87,17 @@ EmitBaselineEnterStubFrame(MacroAssemble // Note: when making changes here, don't forget to update STUB_FRAME_SIZE // if needed. // Push the return address that's currently on top of the stack. masm.Push(Operand(BaselineStackReg, 0)); // Replace the original return address with the frame descriptor. - masm.makeFrameDescriptor(scratch, JitFrame_BaselineJS, BaselineStubFrameLayout::Size()); + masm.makeFrameDescriptor(scratch, FrameType::BaselineJS, BaselineStubFrameLayout::Size()); masm.storePtr(scratch, Address(BaselineStackReg, sizeof(uintptr_t))); // Save old frame pointer, stack pointer and stub reg. masm.Push(ICStubReg); masm.Push(BaselineFrameReg); masm.mov(BaselineStackReg, BaselineFrameReg); }
--- a/js/src/jit/x64/Trampoline-x64.cpp +++ b/js/src/jit/x64/Trampoline-x64.cpp @@ -158,17 +158,17 @@ JitRuntime::generateEnterJIT(JSContext* masm.push(token); /***************************************************************** Push the number of bytes we've pushed so far on the stack and call *****************************************************************/ masm.subq(rsp, r14); // Create a frame descriptor. - masm.makeFrameDescriptor(r14, JitFrame_CppToJSJit, JitFrameLayout::Size()); + masm.makeFrameDescriptor(r14, FrameType::CppToJSJit, JitFrameLayout::Size()); masm.push(r14); CodeLabel returnLabel; CodeLabel oomReturnLabel; { // Handle Interpreter -> Baseline OSR. AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All()); regs.takeUnchecked(OsrFrameReg); @@ -223,17 +223,17 @@ JitRuntime::generateEnterJIT(JSContext* // Reserve space for locals and stack values. Register valuesSize = regs.takeAny(); masm.mov(numStackValues, valuesSize); masm.shll(Imm32(3), valuesSize); masm.subPtr(valuesSize, rsp); // Enter exit frame. masm.addPtr(Imm32(BaselineFrame::Size() + BaselineFrame::FramePointerOffset), valuesSize); - masm.makeFrameDescriptor(valuesSize, JitFrame_BaselineJS, ExitFrameLayout::Size()); + masm.makeFrameDescriptor(valuesSize, FrameType::BaselineJS, ExitFrameLayout::Size()); masm.push(valuesSize); masm.push(Imm32(0)); // Fake return address. // No GC things to mark, push a bare token. masm.loadJSContext(scratch); masm.enterFakeExitFrame(scratch, scratch, ExitFrameType::Bare); regs.add(valuesSize); @@ -498,17 +498,17 @@ JitRuntime::generateArgumentsRectifier(M // // // Rectifier frame: // [undef] [undef] [undef] [arg2] [arg1] [this] <- rsp [[argc] [callee] [descr] [raddr]] // // Construct descriptor. masm.subq(rsp, r9); - masm.makeFrameDescriptor(r9, JitFrame_Rectifier, JitFrameLayout::Size()); + masm.makeFrameDescriptor(r9, FrameType::Rectifier, JitFrameLayout::Size()); // Construct JitFrameLayout. masm.push(rdx); // numActualArgs masm.push(rax); // callee token masm.push(r9); // descriptor // Call the target function. masm.andq(Imm32(uint32_t(CalleeTokenMask)), rax); @@ -1008,30 +1008,30 @@ JitRuntime::generateProfilerExitFrameTai // Handling of each case is dependent on FrameDescriptor.type Label handle_IonJS; Label handle_BaselineStub; Label handle_Rectifier; Label handle_IonICCall; Label handle_Entry; Label end; - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_IonJS), &handle_IonJS); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_BaselineJS), &handle_IonJS); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_BaselineStub), &handle_BaselineStub); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_Rectifier), &handle_Rectifier); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_IonICCall), &handle_IonICCall); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_CppToJSJit), &handle_Entry); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::IonJS), &handle_IonJS); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::BaselineJS), &handle_IonJS); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::BaselineStub), &handle_BaselineStub); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::Rectifier), &handle_Rectifier); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::IonICCall), &handle_IonICCall); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::CppToJSJit), &handle_Entry); - // The WasmToJSJit is just another kind of entry. - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_WasmToJSJit), &handle_Entry); + // The WasmToJSJit is just another kind of entry + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::WasmToJSJit), &handle_Entry); masm.assumeUnreachable("Invalid caller frame type when exiting from Ion frame."); // - // JitFrame_IonJS + // FrameType::IonJS // // Stack layout: // ... // Ion-Descriptor // Prev-FP ---> Ion-ReturnAddr // ... previous frame data ... |- Descriptor.Size // ... arguments ... | // ActualArgc | @@ -1049,17 +1049,17 @@ JitRuntime::generateProfilerExitFrameTai // Store return frame in lastProfilingFrame. // scratch2 := StackPointer + Descriptor.size*1 + JitFrameLayout::Size(); masm.lea(Operand(StackPointer, scratch1, TimesOne, JitFrameLayout::Size()), scratch2); masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } // - // JitFrame_BaselineStub + // FrameType::BaselineStub // // Look past the stub and store the frame pointer to // the baselineJS frame prior to it. // // Stack layout: // ... // BL-Descriptor // Prev-FP ---> BL-ReturnAddr @@ -1092,17 +1092,17 @@ JitRuntime::generateProfilerExitFrameTai masm.loadPtr(stubFrameSavedFramePtr, scratch2); masm.addPtr(Imm32(sizeof(void*)), scratch2); // Skip past BL-PrevFramePtr masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } // - // JitFrame_Rectifier + // FrameType::Rectifier // // The rectifier frame can be preceded by either an IonJS, a BaselineStub, // or a CppToJSJit/WasmToJSJit frame. // // Stack layout if caller of rectifier was Ion or CppToJSJit/WasmToJSJit: // // Ion-Descriptor // Ion-ReturnAddr @@ -1146,50 +1146,50 @@ JitRuntime::generateProfilerExitFrameTai // Now |scratch1| contains Rect-Descriptor.Size // and |scratch2| points to Rectifier frame // and |scratch3| contains Rect-Descriptor.Type masm.assertRectifierFrameParentType(scratch3); // Check for either Ion or something else frame. Label notIonFrame; - masm.branch32(Assembler::NotEqual, scratch3, Imm32(JitFrame_IonJS), ¬IonFrame); + masm.branch32(Assembler::NotEqual, scratch3, Imm32(FrameType::IonJS), ¬IonFrame); // Handle Rectifier <- IonJS // scratch3 := RectFrame[ReturnAddr] masm.loadPtr(Address(scratch2, RectifierFrameLayout::offsetOfReturnAddress()), scratch3); masm.storePtr(scratch3, lastProfilingCallSite); // scratch3 := RectFrame + Rect-Descriptor.Size + RectifierFrameLayout::Size() masm.lea(Operand(scratch2, scratch1, TimesOne, RectifierFrameLayout::Size()), scratch3); masm.storePtr(scratch3, lastProfilingFrame); masm.ret(); masm.bind(¬IonFrame); // Check for either BaselineStub or a CppToJSJit/WasmToJSJit entry // frame. - masm.branch32(Assembler::NotEqual, scratch3, Imm32(JitFrame_BaselineStub), &handle_Entry); + masm.branch32(Assembler::NotEqual, scratch3, Imm32(FrameType::BaselineStub), &handle_Entry); // Handle Rectifier <- BaselineStub <- BaselineJS BaseIndex stubFrameReturnAddr(scratch2, scratch1, TimesOne, RectifierFrameLayout::Size() + BaselineStubFrameLayout::offsetOfReturnAddress()); masm.loadPtr(stubFrameReturnAddr, scratch3); masm.storePtr(scratch3, lastProfilingCallSite); BaseIndex stubFrameSavedFramePtr(scratch2, scratch1, TimesOne, RectifierFrameLayout::Size() - (2 * sizeof(void*))); masm.loadPtr(stubFrameSavedFramePtr, scratch3); masm.addPtr(Imm32(sizeof(void*)), scratch3); masm.storePtr(scratch3, lastProfilingFrame); masm.ret(); } - // JitFrame_IonICCall + // FrameType::IonICCall // // The caller is always an IonJS frame. // // Ion-Descriptor // Ion-ReturnAddr // ... ion frame data ... |- CallFrame-Descriptor.Size // StubCode | // ICCallFrame-Descriptor |- IonICCallFrameLayout::Size() @@ -1207,17 +1207,17 @@ JitRuntime::generateProfilerExitFrameTai // scratch3 := ICCallFrame-Descriptor.Size masm.loadPtr(Address(scratch2, IonICCallFrameLayout::offsetOfDescriptor()), scratch3); #ifdef DEBUG // Assert previous frame is an IonJS frame. masm.movePtr(scratch3, scratch1); masm.and32(Imm32((1 << FRAMETYPE_BITS) - 1), scratch1); { Label checkOk; - masm.branch32(Assembler::Equal, scratch1, Imm32(JitFrame_IonJS), &checkOk); + masm.branch32(Assembler::Equal, scratch1, Imm32(FrameType::IonJS), &checkOk); masm.assumeUnreachable("IonICCall frame must be preceded by IonJS frame"); masm.bind(&checkOk); } #endif masm.rshiftPtr(Imm32(FRAMESIZE_SHIFT), scratch3); // lastProfilingCallSite := ICCallFrame-ReturnAddr masm.loadPtr(Address(scratch2, IonICCallFrameLayout::offsetOfReturnAddress()), scratch1); @@ -1226,17 +1226,17 @@ JitRuntime::generateProfilerExitFrameTai // lastProfilingFrame := ICCallFrame + ICCallFrame-Descriptor.Size + // IonICCallFrameLayout::Size() masm.lea(Operand(scratch2, scratch3, TimesOne, IonICCallFrameLayout::Size()), scratch1); masm.storePtr(scratch1, lastProfilingFrame); masm.ret(); } // - // JitFrame_CppToJSJit / JitFrame_WasmToJSJit + // FrameType::CppToJSJit / FrameType::WasmToJSJit // // If at an entry frame, store null into both fields. // A fast-path wasm->jit transition frame is an entry frame from the point // of view of the JIT. // masm.bind(&handle_Entry); { masm.movePtr(ImmPtr(nullptr), scratch1);
--- a/js/src/jit/x86-shared/MacroAssembler-x86-shared.cpp +++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared.cpp @@ -62,17 +62,17 @@ MacroAssembler::clampDoubleToUint8(Float } bind(&done); } bool MacroAssemblerX86Shared::buildOOLFakeExitFrame(void* fakeReturnAddr) { - uint32_t descriptor = MakeFrameDescriptor(asMasm().framePushed(), JitFrame_IonJS, + uint32_t descriptor = MakeFrameDescriptor(asMasm().framePushed(), FrameType::IonJS, ExitFrameLayout::Size()); asMasm().Push(Imm32(descriptor)); asMasm().Push(ImmPtr(fakeReturnAddr)); return true; } void MacroAssemblerX86Shared::branchNegativeZero(FloatRegister reg,
--- a/js/src/jit/x86/SharedICHelpers-x86-inl.h +++ b/js/src/jit/x86/SharedICHelpers-x86-inl.h @@ -25,32 +25,32 @@ EmitBaselineTailCallVM(TrampolinePtr tar masm.subl(BaselineStackReg, eax); // Store frame size without VMFunction arguments for GC marking. masm.movl(eax, ebx); masm.subl(Imm32(argSize), ebx); masm.store32(ebx, Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfFrameSize())); // Push frame descriptor and perform the tail call. - masm.makeFrameDescriptor(eax, JitFrame_BaselineJS, ExitFrameLayout::Size()); + masm.makeFrameDescriptor(eax, FrameType::BaselineJS, ExitFrameLayout::Size()); masm.push(eax); masm.push(ICTailCallReg); masm.jump(target); } inline void EmitBaselineCreateStubFrameDescriptor(MacroAssembler& masm, Register reg, uint32_t headerSize) { // Compute stub frame size. We have to add two pointers: the stub reg and previous // frame pointer pushed by EmitEnterStubFrame. masm.movl(BaselineFrameReg, reg); masm.addl(Imm32(sizeof(void*) * 2), reg); masm.subl(BaselineStackReg, reg); - masm.makeFrameDescriptor(reg, JitFrame_BaselineStub, headerSize); + masm.makeFrameDescriptor(reg, FrameType::BaselineStub, headerSize); } inline void EmitBaselineCallVM(TrampolinePtr target, MacroAssembler& masm) { EmitBaselineCreateStubFrameDescriptor(masm, eax, ExitFrameLayout::Size()); masm.push(eax); masm.call(target); @@ -84,17 +84,17 @@ EmitBaselineEnterStubFrame(MacroAssemble // Note: when making changes here, don't forget to update STUB_FRAME_SIZE // if needed. // Push the return address that's currently on top of the stack. masm.Push(Operand(BaselineStackReg, 0)); // Replace the original return address with the frame descriptor. - masm.makeFrameDescriptor(scratch, JitFrame_BaselineJS, BaselineStubFrameLayout::Size()); + masm.makeFrameDescriptor(scratch, FrameType::BaselineJS, BaselineStubFrameLayout::Size()); masm.storePtr(scratch, Address(BaselineStackReg, sizeof(uintptr_t))); // Save old frame pointer, stack pointer and stub reg. masm.Push(ICStubReg); masm.Push(BaselineFrameReg); masm.mov(BaselineStackReg, BaselineFrameReg); }
--- a/js/src/jit/x86/Trampoline-x86.cpp +++ b/js/src/jit/x86/Trampoline-x86.cpp @@ -152,17 +152,17 @@ JitRuntime::generateEnterJIT(JSContext* // This address is also used for setting the constructing bit on all paths. masm.loadPtr(Address(ebp, ARG_STACKFRAME), OsrFrameReg); /***************************************************************** Push the number of bytes we've pushed so far on the stack and call *****************************************************************/ // Create a frame descriptor. masm.subl(esp, esi); - masm.makeFrameDescriptor(esi, JitFrame_CppToJSJit, JitFrameLayout::Size()); + masm.makeFrameDescriptor(esi, FrameType::CppToJSJit, JitFrameLayout::Size()); masm.push(esi); CodeLabel returnLabel; CodeLabel oomReturnLabel; { // Handle Interpreter -> Baseline OSR. AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All()); regs.take(JSReturnOperand); @@ -216,17 +216,17 @@ JitRuntime::generateEnterJIT(JSContext* // Reserve space for locals and stack values. masm.mov(numStackValues, scratch); masm.shll(Imm32(3), scratch); masm.subPtr(scratch, esp); // Enter exit frame. masm.addPtr(Imm32(BaselineFrame::Size() + BaselineFrame::FramePointerOffset), scratch); - masm.makeFrameDescriptor(scratch, JitFrame_BaselineJS, ExitFrameLayout::Size()); + masm.makeFrameDescriptor(scratch, FrameType::BaselineJS, ExitFrameLayout::Size()); masm.push(scratch); // Fake return address. masm.push(Imm32(0)); // No GC things to mark on the stack, push a bare token. masm.loadJSContext(scratch); masm.enterFakeExitFrame(scratch, scratch, ExitFrameType::Bare); masm.push(framePtr); masm.push(jitcode); @@ -489,17 +489,17 @@ JitRuntime::generateArgumentsRectifier(M masm.storeValue(newTarget, dst); masm.bind(¬Constructing); } // Construct descriptor, accounting for pushed frame pointer above masm.lea(Operand(FramePointer, sizeof(void*)), ebx); masm.subl(esp, ebx); - masm.makeFrameDescriptor(ebx, JitFrame_Rectifier, JitFrameLayout::Size()); + masm.makeFrameDescriptor(ebx, FrameType::Rectifier, JitFrameLayout::Size()); // Construct JitFrameLayout. masm.push(edx); // number of actual arguments masm.push(eax); // callee token masm.push(ebx); // descriptor // Call the target function. masm.andl(Imm32(CalleeTokenMask), eax); @@ -1029,30 +1029,30 @@ JitRuntime::generateProfilerExitFrameTai // Handling of each case is dependent on FrameDescriptor.type Label handle_IonJS; Label handle_BaselineStub; Label handle_Rectifier; Label handle_IonICCall; Label handle_Entry; Label end; - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_IonJS), &handle_IonJS); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_BaselineJS), &handle_IonJS); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_BaselineStub), &handle_BaselineStub); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_Rectifier), &handle_Rectifier); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_IonICCall), &handle_IonICCall); - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_CppToJSJit), &handle_Entry); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::IonJS), &handle_IonJS); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::BaselineJS), &handle_IonJS); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::BaselineStub), &handle_BaselineStub); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::Rectifier), &handle_Rectifier); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::IonICCall), &handle_IonICCall); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::CppToJSJit), &handle_Entry); // The WasmToJSJit is just another kind of entry. - masm.branch32(Assembler::Equal, scratch2, Imm32(JitFrame_WasmToJSJit), &handle_Entry); + masm.branch32(Assembler::Equal, scratch2, Imm32(FrameType::WasmToJSJit), &handle_Entry); masm.assumeUnreachable("Invalid caller frame type when exiting from Ion frame."); // - // JitFrame_IonJS + // FrameType::IonJS // // Stack layout: // ... // Ion-Descriptor // Prev-FP ---> Ion-ReturnAddr // ... previous frame data ... |- Descriptor.Size // ... arguments ... | // ActualArgc | @@ -1072,17 +1072,17 @@ JitRuntime::generateProfilerExitFrameTai // Store return frame in lastProfilingFrame. // scratch2 := StackPointer + Descriptor.size*1 + JitFrameLayout::Size(); masm.lea(Operand(StackPointer, scratch1, TimesOne, JitFrameLayout::Size()), scratch2); masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } // - // JitFrame_BaselineStub + // FrameType::BaselineStub // // Look past the stub and store the frame pointer to // the baselineJS frame prior to it. // // Stack layout: // ... // BL-Descriptor // Prev-FP ---> BL-ReturnAddr @@ -1115,17 +1115,17 @@ JitRuntime::generateProfilerExitFrameTai masm.loadPtr(stubFrameSavedFramePtr, scratch2); masm.addPtr(Imm32(sizeof(void*)), scratch2); // Skip past BL-PrevFramePtr masm.storePtr(scratch2, lastProfilingFrame); masm.ret(); } // - // JitFrame_Rectifier + // FrameType::Rectifier // // The rectifier frame can be preceded by either an IonJS, a BaselineStub, // or a CppToJSJit/WasmToJSJit frame. // // Stack layout if caller of rectifier was Ion or CppToJSJit/WasmToJSJit: // // Ion-Descriptor // Ion-ReturnAddr @@ -1169,50 +1169,50 @@ JitRuntime::generateProfilerExitFrameTai // Now |scratch1| contains Rect-Descriptor.Size // and |scratch2| points to Rectifier frame // and |scratch3| contains Rect-Descriptor.Type masm.assertRectifierFrameParentType(scratch3); // Check for either Ion or BaselineStub frame. Label notIonFrame; - masm.branch32(Assembler::NotEqual, scratch3, Imm32(JitFrame_IonJS), ¬IonFrame); + masm.branch32(Assembler::NotEqual, scratch3, Imm32(FrameType::IonJS), ¬IonFrame); // Handle Rectifier <- IonJS // scratch3 := RectFrame[ReturnAddr] masm.loadPtr(Address(scratch2, RectifierFrameLayout::offsetOfReturnAddress()), scratch3); masm.storePtr(scratch3, lastProfilingCallSite); // scratch3 := RectFrame + Rect-Descriptor.Size + RectifierFrameLayout::Size() masm.lea(Operand(scratch2, scratch1, TimesOne, RectifierFrameLayout::Size()), scratch3); masm.storePtr(scratch3, lastProfilingFrame); masm.ret(); masm.bind(¬IonFrame); // Check for either BaselineStub or a CppToJSJit/WasmToJSJit entry // frame. - masm.branch32(Assembler::NotEqual, scratch3, Imm32(JitFrame_BaselineStub), &handle_Entry); + masm.branch32(Assembler::NotEqual, scratch3, Imm32(FrameType::BaselineStub), &handle_Entry); // Handle Rectifier <- BaselineStub <- BaselineJS BaseIndex stubFrameReturnAddr(scratch2, scratch1, TimesOne, RectifierFrameLayout::Size() + BaselineStubFrameLayout::offsetOfReturnAddress()); masm.loadPtr(stubFrameReturnAddr, scratch3); masm.storePtr(scratch3, lastProfilingCallSite); BaseIndex stubFrameSavedFramePtr(scratch2, scratch1, TimesOne, RectifierFrameLayout::Size() - (2 * sizeof(void*))); masm.loadPtr(stubFrameSavedFramePtr, scratch3); masm.addPtr(Imm32(sizeof(void*)), scratch3); masm.storePtr(scratch3, lastProfilingFrame); masm.ret(); } - // JitFrame_IonICCall + // FrameType::IonICCall // // The caller is always an IonJS frame. // // Ion-Descriptor // Ion-ReturnAddr // ... ion frame data ... |- CallFrame-Descriptor.Size // StubCode | // ICCallFrame-Descriptor |- IonICCallFrameLayout::Size() @@ -1230,17 +1230,17 @@ JitRuntime::generateProfilerExitFrameTai // scratch3 := ICCallFrame-Descriptor.Size masm.loadPtr(Address(scratch2, IonICCallFrameLayout::offsetOfDescriptor()), scratch3); #ifdef DEBUG // Assert previous frame is an IonJS frame. masm.movePtr(scratch3, scratch1); masm.and32(Imm32((1 << FRAMETYPE_BITS) - 1), scratch1); { Label checkOk; - masm.branch32(Assembler::Equal, scratch1, Imm32(JitFrame_IonJS), &checkOk); + masm.branch32(Assembler::Equal, scratch1, Imm32(FrameType::IonJS), &checkOk); masm.assumeUnreachable("IonICCall frame must be preceded by IonJS frame"); masm.bind(&checkOk); } #endif masm.rshiftPtr(Imm32(FRAMESIZE_SHIFT), scratch3); // lastProfilingCallSite := ICCallFrame-ReturnAddr masm.loadPtr(Address(scratch2, IonICCallFrameLayout::offsetOfReturnAddress()), scratch1); @@ -1249,17 +1249,17 @@ JitRuntime::generateProfilerExitFrameTai // lastProfilingFrame := ICCallFrame + ICCallFrame-Descriptor.Size + // IonICCallFrameLayout::Size() masm.lea(Operand(scratch2, scratch3, TimesOne, IonICCallFrameLayout::Size()), scratch1); masm.storePtr(scratch1, lastProfilingFrame); masm.ret(); } // - // JitFrame_CppToJSJit / JitFrame_WasmToJSJit + // FrameType::CppToJSJit / FrameType::WasmToJSJit // // If at an entry frame, store null into both fields. // A fast-path wasm->jit transition frame is an entry frame from the point // of view of the JIT. // masm.bind(&handle_Entry); { masm.movePtr(ImmPtr(nullptr), scratch1);
--- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -2620,20 +2620,20 @@ UpdateExecutionObservabilityOfScriptsInZ // get discarded. They will be recompiled. for (JitActivationIterator actIter(cx); !actIter.done(); ++actIter) { if (actIter->compartment()->zone() != zone) continue; for (OnlyJSJitFrameIter iter(actIter); !iter.done(); ++iter) { const jit::JSJitFrameIter& frame = iter.frame(); switch (frame.type()) { - case JitFrame_BaselineJS: + case FrameType::BaselineJS: MarkBaselineScriptActiveIfObservable(frame.script(), obs); break; - case JitFrame_IonJS: + case FrameType::IonJS: MarkBaselineScriptActiveIfObservable(frame.script(), obs); for (InlineFrameIterator inlineIter(cx, &frame); inlineIter.more(); ++inlineIter) MarkBaselineScriptActiveIfObservable(inlineIter.script(), obs); break; default:; } } }
--- a/js/src/vm/Stack.cpp +++ b/js/src/vm/Stack.cpp @@ -565,17 +565,17 @@ JitFrameIter::done() const MOZ_CRASH("unhandled case"); } void JitFrameIter::settle() { if (isJSJit()) { const jit::JSJitFrameIter& jitFrame = asJSJit(); - if (jitFrame.type() != jit::JitFrame_WasmToJSJit) + if (jitFrame.type() != jit::FrameType::WasmToJSJit) return; // Transition from js jit frames to wasm frames: we're on the // wasm-to-jit fast path. The current stack layout is as follows: // (stack grows downward) // // [--------------------] // [WASM FUNC ] @@ -1908,17 +1908,18 @@ JS::ProfilingFrameIterator::operator++() ++jsJitIter(); settle(); } void JS::ProfilingFrameIterator::settleFrames() { // Handle transition frames (see comment in JitFrameIter::operator++). - if (isJSJit() && !jsJitIter().done() && jsJitIter().frameType() == jit::JitFrame_WasmToJSJit) { + if (isJSJit() && !jsJitIter().done() && jsJitIter().frameType() == jit::FrameType::WasmToJSJit) + { wasm::Frame* fp = (wasm::Frame*) jsJitIter().fp(); iteratorDestroy(); new (storage()) wasm::ProfilingFrameIterator(*activation_->asJit(), fp); kind_ = Kind::Wasm; MOZ_ASSERT(!wasmIter().done()); return; }
--- a/js/src/wasm/WasmFrameIter.cpp +++ b/js/src/wasm/WasmFrameIter.cpp @@ -127,17 +127,17 @@ WasmFrameIter::popFrame() // // fp_ points to the fake exit frame set up by the jit caller, and the // return-address-to-fp is in JIT code, thus doesn't belong to any wasm // instance's code (in particular, there's no associated CodeRange). // Mark the frame as such and untag FP. MOZ_ASSERT(!LookupCode(prevFP->returnAddress)); unwoundIonCallerFP_ = (uint8_t*)(uintptr_t(fp_) & ~uintptr_t(ExitOrJitEntryFPTag)); - unwoundIonFrameType_ = JitFrame_Exit; + unwoundIonFrameType_ = FrameType::Exit; fp_ = nullptr; code_ = nullptr; codeRange_ = nullptr; if (unwind_ == Unwind::True) { activation_->setJSExitFP(unwoundIonCallerFP_); unwoundAddressOfReturnAddress_ = &prevFP->returnAddress; @@ -176,17 +176,17 @@ WasmFrameIter::popFrame() // | JSJIT TO WASM EXIT | <-- fp_ // | WASM JIT ENTRY | <-- prevFP (already unwound) // | WASM FRAME | (already unwound) // |---------------------| // // The next value of FP is just a regular jit frame used marked to // know that we should transition to a JSJit frame iterator. unwoundIonCallerFP_ = (uint8_t*) fp_; - unwoundIonFrameType_ = JitFrame_JSJitToWasm; + unwoundIonFrameType_ = FrameType::JSJitToWasm; fp_ = nullptr; code_ = nullptr; codeRange_ = nullptr; if (unwind_ == Unwind::True) { activation_->setJSExitFP(unwoundIonCallerFP_); unwoundAddressOfReturnAddress_ = &prevFP->returnAddress;
--- a/js/src/wasm/WasmFrameIter.h +++ b/js/src/wasm/WasmFrameIter.h @@ -14,27 +14,27 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef wasm_frame_iter_h #define wasm_frame_iter_h -#include "jit/JSJitFrameIter.h" #include "js/ProfilingFrameIterator.h" #include "js/TypeDecls.h" #include "wasm/WasmTypes.h" namespace js { namespace jit { class MacroAssembler; struct Register; class Label; +enum class FrameType; } // namespace jit namespace wasm { class Code; class CodeRange; class DebugFrame; class FuncTypeIdDesc;
--- a/js/src/wasm/WasmStubs.cpp +++ b/js/src/wasm/WasmStubs.cpp @@ -1368,17 +1368,17 @@ GenerateImportJitExit(MacroAssembler& ma #else const unsigned frameAlignExtra = 0; #endif GenerateJitExitPrologue(masm, jitFramePushed + frameAlignExtra, offsets); // 1. Descriptor size_t argOffset = frameAlignExtra; - uint32_t descriptor = MakeFrameDescriptor(sizeOfThisAndArgsAndPadding, JitFrame_WasmToJSJit, + uint32_t descriptor = MakeFrameDescriptor(sizeOfThisAndArgsAndPadding, FrameType::WasmToJSJit, WasmToJSJitFrameLayout::Size()); masm.storePtr(ImmWord(uintptr_t(descriptor)), Address(masm.getStackPointer(), argOffset)); argOffset += sizeof(size_t); // 2. Callee Register callee = ABINonArgReturnReg0; // live until call Register scratch = ABINonArgReturnReg1; // repeatedly clobbered