Changeset 260803 in webkit
- Timestamp:
- Apr 27, 2020 5:51:50 PM (4 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r260802 r260803 1 2020-04-27 Keith Miller <keith_miller@apple.com> 2 3 OSR Exit compiler should know and print the exiting DFG node's index 4 https://bugs.webkit.org/show_bug.cgi?id=210998 5 6 Reviewed by Mark Lam. 7 8 The only interesting thing here is that we set the node to index 0 if there is no node. 9 AFAICT, we only don't have a node when we are checking arguments. 10 11 * dfg/DFGOSRExit.cpp: 12 (JSC::DFG::OSRExit::OSRExit): 13 (JSC::DFG::operationCompileOSRExit): 14 * dfg/DFGOSRExitBase.h: 15 (JSC::DFG::OSRExitBase::OSRExitBase): 16 * ftl/FTLLowerDFGToB3.cpp: 17 (JSC::FTL::DFG::LowerDFGToB3::compileInvalidationPoint): 18 (JSC::FTL::DFG::LowerDFGToB3::compileCheckSubClass): 19 (JSC::FTL::DFG::LowerDFGToB3::blessSpeculation): 20 * ftl/FTLOSRExit.cpp: 21 (JSC::FTL::OSRExitDescriptor::emitOSRExit): 22 (JSC::FTL::OSRExitDescriptor::emitOSRExitLater): 23 (JSC::FTL::OSRExitDescriptor::prepareOSRExitHandle): 24 (JSC::FTL::OSRExit::OSRExit): 25 * ftl/FTLOSRExit.h: 26 * ftl/FTLOSRExitCompiler.cpp: 27 (JSC::FTL::compileStub): 28 1 29 2020-04-27 Saam Barati <sbarati@apple.com> 2 30 -
trunk/Source/JavaScriptCore/dfg/DFGOSRExit.cpp
r260799 r260803 50 50 51 51 OSRExit::OSRExit(ExitKind kind, JSValueSource jsValueSource, MethodOfGettingAValueProfile valueProfile, SpeculativeJIT* jit, unsigned streamIndex, unsigned recoveryIndex) 52 : OSRExitBase(kind, jit->m_origin.forExit, jit->m_origin.semantic, jit->m_origin.wasHoisted )52 : OSRExitBase(kind, jit->m_origin.forExit, jit->m_origin.semantic, jit->m_origin.wasHoisted, jit->m_currentNode ? jit->m_currentNode->index() : 0) 53 53 , m_jsValueSource(jsValueSource) 54 54 , m_valueProfile(valueProfile) … … 210 210 shouldDumpDisassembly() || Options::verboseOSR() || Options::verboseDFGOSRExit(), 211 211 patchBuffer, OSRExitPtrTag, 212 "DFG OSR exit #%u ( %s, %s) from %s, with operands = %s",213 exitIndex, toCString(exit.m_codeOrigin).data(),212 "DFG OSR exit #%u (D@%u, %s, %s) from %s, with operands = %s", 213 exitIndex, exit.m_dfgNodeIndex, toCString(exit.m_codeOrigin).data(), 214 214 exitKindToString(exit.m_kind), toCString(*codeBlock).data(), 215 215 toCString(ignoringContext<DumpContext>(operands)).data()); -
trunk/Source/JavaScriptCore/dfg/DFGOSRExitBase.h
r260799 r260803 40 40 41 41 struct OSRExitBase { 42 OSRExitBase(ExitKind kind, CodeOrigin origin, CodeOrigin originForProfile, bool wasHoisted )42 OSRExitBase(ExitKind kind, CodeOrigin origin, CodeOrigin originForProfile, bool wasHoisted, uint32_t dfgNodeIndex) 43 43 : m_kind(kind) 44 44 , m_wasHoisted(wasHoisted) 45 45 , m_codeOrigin(origin) 46 46 , m_codeOriginForExitProfile(originForProfile) 47 , m_dfgNodeIndex(dfgNodeIndex) 47 48 { 48 49 ASSERT(m_codeOrigin.isSet()); … … 57 58 CodeOrigin m_codeOriginForExitProfile; 58 59 CallSiteIndex m_exceptionHandlerCallSiteIndex; 60 uint32_t m_dfgNodeIndex; 59 61 60 62 ALWAYS_INLINE bool isExceptionHandler() const -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r260799 r260803 354 354 355 355 m_node = nullptr; 356 m_nodeIndexInGraph = 0; 356 357 m_origin = NodeOrigin(CodeOrigin(BytecodeIndex(0)), CodeOrigin(BytecodeIndex(0)), true); 357 358 … … 512 513 m_state.beginBasicBlock(m_highBlock); 513 514 514 for ( m_nodeIndex = 0; m_nodeIndex < m_highBlock->size(); ++m_nodeIndex) {515 if (!compileNode( m_nodeIndex))515 for (unsigned nodeIndex = 0; nodeIndex < m_highBlock->size(); ++nodeIndex) { 516 if (!compileNode(nodeIndex)) 516 517 break; 517 518 } … … 676 677 677 678 m_node = m_highBlock->at(nodeIndex); 679 m_nodeIndexInGraph = m_node->index(); 678 680 m_origin = m_node->origin; 679 681 m_out.setOrigin(m_node); … … 10815 10817 State* state = &m_ftlState; 10816 10818 10819 auto nodeIndex = m_nodeIndexInGraph; 10817 10820 patchpoint->setGenerator( 10818 10821 [=] (CCallHelpers& jit, const B3::StackmapGenerationParams& params) { … … 10823 10826 10824 10827 RefPtr<OSRExitHandle> handle = descriptor->emitOSRExitLater( 10825 *state, UncountableInvalidation, origin, params );10828 *state, UncountableInvalidation, origin, params, nodeIndex, 0); 10826 10829 10827 10830 RefPtr<JITCode> jitCode = state->jitCode.get(); … … 13881 13884 JSValue child1Constant = m_state.forNode(m_node->child1()).value(); 13882 13885 13886 auto nodeIndex = m_nodeIndexInGraph; 13883 13887 patchpoint->setGenerator( 13884 13888 [=] (CCallHelpers& jit, const StackmapGenerationParams& params) { … … 13897 13901 fpScratch.append(params.fpScratch(i)); 13898 13902 13899 RefPtr<OSRExitHandle> handle = exitDescriptor->emitOSRExitLater(*state, BadType, origin, params, osrExitArgumentOffset);13903 RefPtr<OSRExitHandle> handle = exitDescriptor->emitOSRExitLater(*state, BadType, origin, params, nodeIndex, osrExitArgumentOffset); 13900 13904 13901 13905 SnippetParams domJITParams(*state, params, node, nullptr, WTFMove(regs), WTFMove(gpScratch), WTFMove(fpScratch)); … … 18587 18591 bool willCatchException = m_graph.willCatchExceptionInMachineFrame(m_origin.forExit, opCatchOrigin, exceptionHandler); 18588 18592 if (!willCatchException) 18589 return PatchpointExceptionHandle::defaultHandle(m_ftlState );18593 return PatchpointExceptionHandle::defaultHandle(m_ftlState, m_nodeIndexInGraph); 18590 18594 18591 18595 dataLogLnIf(verboseCompilationEnabled(), " Patchpoint exception OSR exit #", m_ftlState.jitCode->osrExitDescriptors.size(), " with availability: ", availabilityMap()); … … 18610 18614 18611 18615 return PatchpointExceptionHandle::create( 18612 m_ftlState, exitDescriptor, origin, offset, *exceptionHandler);18616 m_ftlState, exitDescriptor, origin, m_nodeIndexInGraph, offset, *exceptionHandler); 18613 18617 } 18614 18618 … … 18689 18693 18690 18694 State* state = &m_ftlState; 18695 auto nodeIndex = m_nodeIndexInGraph; 18691 18696 value->setGenerator( 18692 18697 [=] (CCallHelpers& jit, const B3::StackmapGenerationParams& params) { 18693 18698 exitDescriptor->emitOSRExit( 18694 *state, kind, origin, jit, params, 0);18699 *state, kind, origin, jit, params, nodeIndex, 0); 18695 18700 }); 18696 18701 } … … 19187 19192 19188 19193 NodeOrigin m_origin; 19189 unsigned m_nodeIndex ;19194 unsigned m_nodeIndexInGraph { 0 }; 19190 19195 Node* m_node; 19191 19196 -
trunk/Source/JavaScriptCore/ftl/FTLOSRExit.cpp
r260799 r260803 66 66 Ref<OSRExitHandle> OSRExitDescriptor::emitOSRExit( 67 67 State& state, ExitKind exitKind, const NodeOrigin& nodeOrigin, CCallHelpers& jit, 68 const StackmapGenerationParams& params, u nsigned offset)68 const StackmapGenerationParams& params, uint32_t dfgNodeIndex, unsigned offset) 69 69 { 70 70 Ref<OSRExitHandle> handle = 71 prepareOSRExitHandle(state, exitKind, nodeOrigin, params, offset);71 prepareOSRExitHandle(state, exitKind, nodeOrigin, params, dfgNodeIndex, offset); 72 72 handle->emitExitThunk(state, jit); 73 73 return handle; … … 76 76 Ref<OSRExitHandle> OSRExitDescriptor::emitOSRExitLater( 77 77 State& state, ExitKind exitKind, const NodeOrigin& nodeOrigin, 78 const StackmapGenerationParams& params, u nsigned offset)78 const StackmapGenerationParams& params, uint32_t dfgNodeIndex, unsigned offset) 79 79 { 80 80 RefPtr<OSRExitHandle> handle = 81 prepareOSRExitHandle(state, exitKind, nodeOrigin, params, offset);81 prepareOSRExitHandle(state, exitKind, nodeOrigin, params, dfgNodeIndex, offset); 82 82 params.addLatePath( 83 83 [handle, &state] (CCallHelpers& jit) { … … 89 89 Ref<OSRExitHandle> OSRExitDescriptor::prepareOSRExitHandle( 90 90 State& state, ExitKind exitKind, const NodeOrigin& nodeOrigin, 91 const StackmapGenerationParams& params, u nsigned offset)91 const StackmapGenerationParams& params, uint32_t dfgNodeIndex, unsigned offset) 92 92 { 93 93 unsigned index = state.jitCode->osrExit.size(); 94 94 OSRExit& exit = state.jitCode->osrExit.alloc( 95 this, exitKind, nodeOrigin.forExit, nodeOrigin.semantic, nodeOrigin.wasHoisted );95 this, exitKind, nodeOrigin.forExit, nodeOrigin.semantic, nodeOrigin.wasHoisted, dfgNodeIndex); 96 96 Ref<OSRExitHandle> handle = adoptRef(*new OSRExitHandle(index, exit)); 97 97 for (unsigned i = offset; i < params.size(); ++i) … … 103 103 OSRExit::OSRExit( 104 104 OSRExitDescriptor* descriptor, ExitKind exitKind, CodeOrigin codeOrigin, 105 CodeOrigin codeOriginForExitProfile, bool wasHoisted )106 : OSRExitBase(exitKind, codeOrigin, codeOriginForExitProfile, wasHoisted )105 CodeOrigin codeOriginForExitProfile, bool wasHoisted, uint32_t dfgNodeIndex) 106 : OSRExitBase(exitKind, codeOrigin, codeOriginForExitProfile, wasHoisted, dfgNodeIndex) 107 107 , m_descriptor(descriptor) 108 108 { -
trunk/Source/JavaScriptCore/ftl/FTLOSRExit.h
r260799 r260803 93 93 Ref<OSRExitHandle> emitOSRExit( 94 94 State&, ExitKind, const DFG::NodeOrigin&, CCallHelpers&, const B3::StackmapGenerationParams&, 95 u nsigned offset = 0);95 uint32_t dfgNodeIndex, unsigned offset); 96 96 97 97 // In some cases you want an OSRExit to come into existence, but you don't want to emit it right now. … … 105 105 Ref<OSRExitHandle> emitOSRExitLater( 106 106 State&, ExitKind, const DFG::NodeOrigin&, const B3::StackmapGenerationParams&, 107 u nsigned offset = 0);107 uint32_t dfgNodeIndex, unsigned offset); 108 108 109 109 private: … … 113 113 Ref<OSRExitHandle> prepareOSRExitHandle( 114 114 State&, ExitKind, const DFG::NodeOrigin&, const B3::StackmapGenerationParams&, 115 u nsigned offset = 0);115 uint32_t dfgNodeIndex, unsigned offset); 116 116 }; 117 117 118 118 struct OSRExit : public DFG::OSRExitBase { 119 OSRExit(OSRExitDescriptor*, ExitKind, CodeOrigin, CodeOrigin codeOriginForExitProfile, bool wasHoisted );119 OSRExit(OSRExitDescriptor*, ExitKind, CodeOrigin, CodeOrigin codeOriginForExitProfile, bool wasHoisted, uint32_t dfgNodeIndex); 120 120 121 121 OSRExitDescriptor* m_descriptor; -
trunk/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
r260799 r260803 533 533 shouldDumpDisassembly() || Options::verboseOSR() || Options::verboseFTLOSRExit(), 534 534 patchBuffer, OSRExitPtrTag, 535 "FTL OSR exit #%u ( %s, %s) from %s, with operands = %s",536 exitID, toCString(exit.m_codeOrigin).data(),535 "FTL OSR exit #%u (D@%u, %s, %s) from %s, with operands = %s", 536 exitID, exit.m_dfgNodeIndex, toCString(exit.m_codeOrigin).data(), 537 537 exitKindToString(exit.m_kind), toCString(*codeBlock).data(), 538 538 toCString(ignoringContext<DumpContext>(exit.m_descriptor->m_values)).data() -
trunk/Source/JavaScriptCore/ftl/FTLPatchpointExceptionHandle.cpp
r260799 r260803 40 40 41 41 Ref<PatchpointExceptionHandle> PatchpointExceptionHandle::create( 42 State& state, OSRExitDescriptor* descriptor, NodeOrigin origin, unsigned offset,42 State& state, OSRExitDescriptor* descriptor, NodeOrigin origin, unsigned dfgNodeIndex, unsigned offset, 43 43 const HandlerInfo& handler) 44 44 { 45 return adoptRef(*new PatchpointExceptionHandle(state, descriptor, origin, offset, handler));45 return adoptRef(*new PatchpointExceptionHandle(state, descriptor, origin, dfgNodeIndex, offset, handler)); 46 46 } 47 47 48 RefPtr<PatchpointExceptionHandle> PatchpointExceptionHandle::defaultHandle(State& state )48 RefPtr<PatchpointExceptionHandle> PatchpointExceptionHandle::defaultHandle(State& state, unsigned dfgNodeIndex) 49 49 { 50 50 if (!state.defaultExceptionHandle) { 51 51 state.defaultExceptionHandle = adoptRef( 52 new PatchpointExceptionHandle(state, nullptr, NodeOrigin(), 0, HandlerInfo()));52 new PatchpointExceptionHandle(state, nullptr, NodeOrigin(), dfgNodeIndex, 0, HandlerInfo())); 53 53 } 54 54 return state.defaultExceptionHandle; … … 99 99 100 100 PatchpointExceptionHandle::PatchpointExceptionHandle( 101 State& state, OSRExitDescriptor* descriptor, NodeOrigin origin, unsigned offset,101 State& state, OSRExitDescriptor* descriptor, NodeOrigin origin, unsigned dfgNodeIndex, unsigned offset, 102 102 const HandlerInfo& handler) 103 103 : m_state(state) 104 104 , m_descriptor(descriptor) 105 105 , m_origin(origin) 106 , m_dfgNodeIndex(dfgNodeIndex) 106 107 , m_offset(offset) 107 108 , m_handler(handler) … … 113 114 { 114 115 return m_descriptor->emitOSRExitLater( 115 m_state, kind, m_origin, params, m_ offset);116 m_state, kind, m_origin, params, m_dfgNodeIndex, m_offset); 116 117 } 117 118 -
trunk/Source/JavaScriptCore/ftl/FTLPatchpointExceptionHandle.h
r260799 r260803 53 53 public: 54 54 static Ref<PatchpointExceptionHandle> create( 55 State&, OSRExitDescriptor*, DFG::NodeOrigin, unsigned offset, const HandlerInfo&);55 State&, OSRExitDescriptor*, DFG::NodeOrigin, unsigned dfgNodeIndex, unsigned offset, const HandlerInfo&); 56 56 57 static RefPtr<PatchpointExceptionHandle> defaultHandle(State& );57 static RefPtr<PatchpointExceptionHandle> defaultHandle(State&, unsigned dfgNodeIndex); 58 58 59 59 ~PatchpointExceptionHandle(); … … 88 88 private: 89 89 PatchpointExceptionHandle( 90 State&, OSRExitDescriptor*, DFG::NodeOrigin, unsigned offset, const HandlerInfo&);90 State&, OSRExitDescriptor*, DFG::NodeOrigin, unsigned dfgNodeIndex, unsigned offset, const HandlerInfo&); 91 91 92 92 Ref<OSRExitHandle> createHandle(ExitKind, const B3::StackmapGenerationParams&); … … 95 95 OSRExitDescriptor* m_descriptor; 96 96 DFG::NodeOrigin m_origin; 97 unsigned m_dfgNodeIndex; 97 98 unsigned m_offset; 98 99 HandlerInfo m_handler;
Note: See TracChangeset
for help on using the changeset viewer.