Changeset 162940 in webkit
- Timestamp:
- Jan 28, 2014 9:43:07 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r162933 r162940 1 2014-01-28 Mark Lam <mark.lam@apple.com> 2 3 Jettison DFG code when neither breakpoints or the profiler are active. 4 <https://webkit.org/b/127766> 5 6 Reviewed by Geoffrey Garen. 7 8 Added a test to exercise setting a breakpoint in 2 DFG compiled functions: 9 1 not inlined, and 1 inlined. 10 11 * inspector-protocol/debugger/resources/breakpoint.js: 12 (notInlineable): 13 (inlineable): 14 (notInliningFoo): 15 (inliningFoo): 16 (dfgWithoutInline): 17 (dfgWithInline): 18 * inspector-protocol/debugger/setBreakpoint-dfg-expected.txt: Added. 19 * inspector-protocol/debugger/setBreakpoint-dfg.html: Added. 20 1 21 2014-01-28 Gurpreet Kaur <k.gurpreet@samsung.com> 2 22 -
trunk/LayoutTests/inspector-protocol/debugger/resources/breakpoint.js
r155132 r162940 18 18 log("inside breakpointActions a:(" + a + ") b:(" + b + ")"); 19 19 } 20 21 function notInlineable(x) 22 { 23 var func = new Function("return x + 100;"); 24 return x + 3; 25 } 26 27 function inlineable(x) 28 { 29 return x + 5; 30 } 31 32 function notInliningFoo(x) 33 { 34 return notInlineable(x); 35 } 36 37 function inliningFoo(x) 38 { 39 return inlineable(x); 40 } 41 42 function dfgWithoutInline() 43 { 44 var i; 45 var result = 0; 46 for (i = 0; i < 1000; i++) 47 result += notInliningFoo(i); 48 log("dfgWithoutInline result: " + result); 49 } 50 51 function dfgWithInline() 52 { 53 var i; 54 var result = 0; 55 for (i = 0; i < 1000; i++) 56 result += inliningFoo(i); 57 log("dfgWithInline result: " + result); 58 } -
trunk/Source/JavaScriptCore/ChangeLog
r162918 r162940 1 2014-01-28 Mark Lam <mark.lam@apple.com> 2 3 Jettison DFG code when neither breakpoints or the profiler are active. 4 <https://webkit.org/b/127766> 5 6 Reviewed by Geoffrey Garen. 7 8 We need to jettison the DFG CodeBlocks under the following circumstances: 9 1. When adding breakpoints to a CodeBlock, jettison it if it is a DFG CodeBlock. 10 2. When enabling stepping mode in a CodeBlock, jettison it if it a DFG CodeBlock. 11 3. When settign the enabled profiler in the VM, we need to jettison all DFG 12 CodeBlocks. 13 14 Instead of emitting speculation checks, the DFG code will now treat Breakpoint, 15 ProfileWillCall, and ProfileDidCall as no-ops similar to a Phantom node. We 16 still need to track these nodes so that they match the corresponding opcodes 17 in the baseline JIT when we jettison and OSR exit. Without them, we would OSR 18 exit to the wrong location in the baseline JIT code. 19 20 In DFGDriver's compileImpl() and DFGPlan's finalizeWithoutNotifyingCallback() 21 we fail the compilation effort with a CompilationInvalidated result. This allows 22 the DFG compiler to re-attampt the compilation of the function after some time 23 if it is hot. The CompilationInvalidated result is supposed to cause the DFG 24 to exercise an exponential back off before re-attempting compilation again 25 (see runtime/CompilationResult.h). 26 27 This patch improves the Octane score from ~2950 to ~3067. 28 29 * bytecode/CodeBlock.cpp: 30 (JSC::CodeBlock::addBreakpoint): 31 (JSC::CodeBlock::setSteppingMode): 32 * bytecode/CodeBlock.h: 33 * debugger/Debugger.h: 34 * dfg/DFGAbstractInterpreterInlines.h: 35 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): 36 * dfg/DFGClobberize.h: 37 (JSC::DFG::clobberize): 38 * dfg/DFGDriver.cpp: 39 (JSC::DFG::compileImpl): 40 * dfg/DFGPlan.cpp: 41 (JSC::DFG::Plan::finalizeWithoutNotifyingCallback): 42 * dfg/DFGSpeculativeJIT32_64.cpp: 43 (JSC::DFG::SpeculativeJIT::compile): 44 * dfg/DFGSpeculativeJIT64.cpp: 45 (JSC::DFG::SpeculativeJIT::compile): 46 * profiler/LegacyProfiler.cpp: 47 (JSC::LegacyProfiler::startProfiling): 48 (JSC::LegacyProfiler::stopProfiling): 49 * runtime/VM.cpp: 50 (JSC::VM::VM): 51 (JSC::SetEnabledProfilerFunctor::operator()): 52 (JSC::VM::setEnabledProfiler): 53 * runtime/VM.h: 54 (JSC::VM::enabledProfiler): 55 1 56 2014-01-27 Joseph Pecoraro <pecoraro@apple.com> 2 57 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r162906 r162940 3532 3532 } 3533 3533 3534 void CodeBlock::addBreakpoint(unsigned numBreakpoints) 3535 { 3536 m_numBreakpoints += numBreakpoints; 3537 ASSERT(m_numBreakpoints); 3538 if (jitType() == JITCode::DFGJIT) 3539 jettison(); 3540 } 3541 3542 void CodeBlock::setSteppingMode(CodeBlock::SteppingMode mode) 3543 { 3544 m_steppingMode = mode; 3545 if (mode == SteppingModeEnabled && jitType() == JITCode::DFGJIT) 3546 jettison(); 3547 } 3548 3534 3549 } // namespace JSC -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r162845 r162940 873 873 void* debuggerRequestsAddress() { return &m_debuggerRequests; } 874 874 875 void addBreakpoint(unsigned numBreakpoints) { m_numBreakpoints += numBreakpoints; }875 void addBreakpoint(unsigned numBreakpoints); 876 876 void removeBreakpoint(unsigned numBreakpoints) 877 877 { … … 884 884 SteppingModeEnabled 885 885 }; 886 void setSteppingMode(SteppingMode mode) { m_steppingMode = mode; }886 void setSteppingMode(SteppingMode); 887 887 888 888 void clearDebuggerRequests() { m_debuggerRequests = 0; } -
trunk/Source/JavaScriptCore/debugger/Debugger.h
r162735 r162940 91 91 92 92 bool isPaused() { return m_isPaused; } 93 bool isStepping() const { return m_steppingMode == SteppingModeEnabled; } 93 94 94 95 virtual void sourceParsed(ExecState*, SourceProvider*, int errorLineNumber, const WTF::String& errorMessage) = 0; … … 171 172 }; 172 173 void setSteppingMode(SteppingMode); 173 bool isStepping() const { return m_steppingMode == SteppingModeEnabled; }174 174 175 175 enum BreakpointState { -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r162718 r162940 1755 1755 break; 1756 1756 1757 case CheckWatchdogTimer: 1758 node->setCanExit(true); 1759 break; 1760 1757 1761 case Breakpoint: 1758 1762 case ProfileWillCall: 1759 1763 case ProfileDidCall: 1760 case CheckWatchdogTimer:1761 node->setCanExit(true);1762 break;1763 1764 1764 case Phantom: 1765 1765 case Check: -
trunk/Source/JavaScriptCore/dfg/DFGClobberize.h
r162718 r162940 89 89 case Identity: 90 90 case Phantom: 91 case Breakpoint: 92 case ProfileWillCall: 93 case ProfileDidCall: 91 94 case BitAnd: 92 95 case BitOr: … … 619 622 return; 620 623 621 case Breakpoint:622 case ProfileWillCall:623 case ProfileDidCall:624 624 case CountExecution: 625 625 case CheckWatchdogTimer: -
trunk/Source/JavaScriptCore/dfg/DFGDriver.cpp
r159276 r162940 35 35 #include "DFGThunks.h" 36 36 #include "DFGWorklist.h" 37 #include "Debugger.h" 37 38 #include "JITCode.h" 38 39 #include "Operations.h" … … 74 75 return CompilationFailed; 75 76 77 if (vm.enabledProfiler()) 78 return CompilationInvalidated; 79 80 Debugger* debugger = codeBlock->globalObject()->debugger(); 81 if (debugger && (debugger->isStepping() || codeBlock->baselineAlternative()->hasDebuggerRequests())) 82 return CompilationInvalidated; 83 76 84 if (logCompilationChanges()) 77 85 dataLog("DFG(Driver) compiling ", *codeBlock, " with ", mode, ", number of instructions = ", codeBlock->instructionCount(), "\n"); -
trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp
r160796 r162940 63 63 #include "DFGVirtualRegisterAllocationPhase.h" 64 64 #include "DFGWatchpointCollectionPhase.h" 65 #include "Debugger.h" 65 66 #include "OperandsInlines.h" 66 67 #include "Operations.h" … … 347 348 if (!isStillValid()) 348 349 return CompilationInvalidated; 349 350 351 if (vm.enabledProfiler()) 352 return CompilationInvalidated; 353 354 Debugger* debugger = codeBlock->globalObject()->debugger(); 355 if (debugger && (debugger->isStepping() || codeBlock->baselineAlternative()->hasDebuggerRequests())) 356 return CompilationInvalidated; 357 350 358 bool result; 351 359 if (codeBlock->codeType() == FunctionCode) -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r162718 r162940 4233 4233 break; 4234 4234 4235 case Breakpoint: {4236 GPRTemporary temp(this);4237 GPRReg debuggerRequestsGPR = temp.gpr();4238 m_jit.load32(m_jit.codeBlock()->debuggerRequestsAddress(), debuggerRequestsGPR);4239 speculationCheck(4240 DebuggerEvent, JSValueRegs(), 0,4241 m_jit.branchTest32(JITCompiler::NonZero, debuggerRequestsGPR));4242 break;4243 }4244 4245 case ProfileWillCall:4246 case ProfileDidCall: {4247 GPRTemporary temp(this);4248 m_jit.loadPtr(m_jit.vm()->enabledProfilerAddress(), temp.gpr());4249 speculationCheck(4250 DebuggerEvent, JSValueRegs(), 0,4251 m_jit.branchTestPtr(JITCompiler::NonZero, temp.gpr()));4252 break;4253 }4254 4255 4235 case Call: 4256 4236 case Construct: … … 4691 4671 break; 4692 4672 4673 case Breakpoint: 4674 case ProfileWillCall: 4675 case ProfileDidCall: 4693 4676 case PhantomLocal: 4694 4677 case LoopHint: -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r162906 r162940 4525 4525 break; 4526 4526 4527 case Breakpoint: {4528 GPRTemporary temp(this);4529 GPRReg debuggerRequestsGPR = temp.gpr();4530 m_jit.load32(m_jit.codeBlock()->debuggerRequestsAddress(), debuggerRequestsGPR);4531 speculationCheck(4532 DebuggerEvent, JSValueRegs(), 0,4533 m_jit.branchTest32(JITCompiler::NonZero, debuggerRequestsGPR));4534 break;4535 }4536 4537 case ProfileWillCall:4538 case ProfileDidCall:4539 speculationCheck(4540 DebuggerEvent, JSValueRegs(), 0,4541 m_jit.branchTestPtr(4542 JITCompiler::NonZero,4543 JITCompiler::AbsoluteAddress(m_jit.vm()->enabledProfilerAddress())));4544 break;4545 4546 4527 case Call: 4547 4528 case Construct: … … 4940 4921 break; 4941 4922 4923 case Breakpoint: 4924 case ProfileWillCall: 4925 case ProfileDidCall: 4942 4926 case PhantomLocal: 4943 4927 case LoopHint: -
trunk/Source/JavaScriptCore/profiler/LegacyProfiler.cpp
r159937 r162940 76 76 } 77 77 78 exec->vm(). m_enabledProfiler = this;78 exec->vm().setEnabledProfiler(this); 79 79 RefPtr<ProfileGenerator> profileGenerator = ProfileGenerator::create(exec, title, ++ProfilesUID); 80 80 m_currentProfiles.append(profileGenerator); … … 95 95 m_currentProfiles.remove(i); 96 96 if (!m_currentProfiles.size()) 97 exec->vm(). m_enabledProfiler = 0;97 exec->vm().setEnabledProfiler(nullptr); 98 98 99 99 return returnProfile; … … 112 112 m_currentProfiles.remove(i); 113 113 if (!m_currentProfiles.size()) 114 origin->vm(). m_enabledProfiler = 0;114 origin->vm().setEnabledProfiler(nullptr); 115 115 } 116 116 } -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r161241 r162940 198 198 , sizeOfLastScratchBuffer(0) 199 199 , entryScope(0) 200 , m_enabledProfiler(0)201 200 , m_regExpCache(new RegExpCache(this)) 202 201 #if ENABLE(REGEXP_TRACING) … … 223 222 , m_inDefineOwnProperty(false) 224 223 , m_codeCache(CodeCache::create()) 224 , m_enabledProfiler(nullptr) 225 225 { 226 226 interpreter = new Interpreter(*this); … … 781 781 } 782 782 783 class SetEnabledProfilerFunctor { 784 public: 785 bool operator()(CodeBlock* codeBlock) 786 { 787 if (codeBlock->jitType() == JITCode::DFGJIT) 788 codeBlock->jettison(); 789 return false; 790 } 791 }; 792 793 void VM::setEnabledProfiler(LegacyProfiler* profiler) 794 { 795 m_enabledProfiler = profiler; 796 if (m_enabledProfiler) { 797 SetEnabledProfilerFunctor functor; 798 heap.forEachCodeBlock(functor); 799 } 800 } 801 783 802 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/VM.h
r162718 r162940 305 305 } 306 306 307 LegacyProfiler* enabledProfiler() 308 { 309 return m_enabledProfiler; 310 } 307 LegacyProfiler* enabledProfiler() { return m_enabledProfiler; } 308 void setEnabledProfiler(LegacyProfiler*); 309 311 310 void* enabledProfilerAddress() { return &m_enabledProfiler; } 312 311 … … 433 432 double cachedDateStringValue; 434 433 435 LegacyProfiler* m_enabledProfiler;436 434 OwnPtr<Profiler::Database> m_perBytecodeProfiler; 437 435 RefPtr<TypedArrayController> m_typedArrayController; … … 525 523 RefCountedArray<StackFrame> m_exceptionStack; 526 524 525 LegacyProfiler* m_enabledProfiler; 526 527 527 HashMap<String, RefPtr<WatchpointSet>> m_impurePropertyWatchpointSets; 528 528 };
Note: See TracChangeset
for help on using the changeset viewer.