Title: [244811] trunk/Source/_javascript_Core
Revision
244811
Author
sbar...@apple.com
Date
2019-04-30 16:37:27 -0700 (Tue, 30 Apr 2019)

Log Message

CodeBlock::m_instructionCount is wrong
https://bugs.webkit.org/show_bug.cgi?id=197304

Reviewed by Yusuke Suzuki.

What we were calling instructionCount() was wrong, as evidenced by
us using it incorrectly both in the sampling profiler and when we
dumped bytecode for a given CodeBlock. Prior to the bytecode rewrite,
instructionCount() was probably valid to do bounds checks against.
However, this is no longer the case. This patch renames what we called
instructionCount() to bytecodeCost(). It is now only used to make decisions
about inlining and tier up heuristics. I've also named options related to
this appropriately.
        
This patch also introduces instructionsSize(). The result of this method
is valid to do bounds checks against.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpAssumingJITType const):
(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::finishCreation):
(JSC::CodeBlock::optimizationThresholdScalingFactor):
(JSC::CodeBlock::predictedMachineCodeSize):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::instructionsSize const):
(JSC::CodeBlock::bytecodeCost const):
(JSC::CodeBlock::instructionCount const): Deleted.
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::inliningCost):
(JSC::DFG::ByteCodeParser::getInliningBalance):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::mightCompileEval):
(JSC::DFG::mightCompileProgram):
(JSC::DFG::mightCompileFunctionForCall):
(JSC::DFG::mightCompileFunctionForConstruct):
(JSC::DFG::mightInlineFunctionForCall):
(JSC::DFG::mightInlineFunctionForClosureCall):
(JSC::DFG::mightInlineFunctionForConstruct):
* dfg/DFGCapabilities.h:
(JSC::DFG::isSmallEnoughToInlineCodeInto):
* dfg/DFGDisassembler.cpp:
(JSC::DFG::Disassembler::dumpHeader):
* dfg/DFGDriver.cpp:
(JSC::DFG::compileImpl):
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::compileInThread):
* dfg/DFGTierUpCheckInjectionPhase.cpp:
(JSC::DFG::TierUpCheckInjectionPhase::run):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLCompile.cpp:
(JSC::FTL::compile):
* ftl/FTLLink.cpp:
(JSC::FTL::link):
* jit/JIT.cpp:
(JSC::JIT::link):
* jit/JITDisassembler.cpp:
(JSC::JITDisassembler::dumpHeader):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::shouldJIT):
* profiler/ProfilerBytecodes.cpp:
(JSC::Profiler::Bytecodes::Bytecodes):
* runtime/Options.h:
* runtime/SamplingProfiler.cpp:
(JSC::tryGetBytecodeIndex):
(JSC::SamplingProfiler::processUnverifiedStackTraces):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (244810 => 244811)


--- trunk/Source/_javascript_Core/ChangeLog	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-04-30 23:37:27 UTC (rev 244811)
@@ -1,3 +1,72 @@
+2019-04-30  Saam barati  <sbar...@apple.com>
+
+        CodeBlock::m_instructionCount is wrong
+        https://bugs.webkit.org/show_bug.cgi?id=197304
+
+        Reviewed by Yusuke Suzuki.
+
+        What we were calling instructionCount() was wrong, as evidenced by
+        us using it incorrectly both in the sampling profiler and when we
+        dumped bytecode for a given CodeBlock. Prior to the bytecode rewrite,
+        instructionCount() was probably valid to do bounds checks against.
+        However, this is no longer the case. This patch renames what we called
+        instructionCount() to bytecodeCost(). It is now only used to make decisions
+        about inlining and tier up heuristics. I've also named options related to
+        this appropriately.
+        
+        This patch also introduces instructionsSize(). The result of this method
+        is valid to do bounds checks against.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::dumpAssumingJITType const):
+        (JSC::CodeBlock::CodeBlock):
+        (JSC::CodeBlock::finishCreation):
+        (JSC::CodeBlock::optimizationThresholdScalingFactor):
+        (JSC::CodeBlock::predictedMachineCodeSize):
+        * bytecode/CodeBlock.h:
+        (JSC::CodeBlock::instructionsSize const):
+        (JSC::CodeBlock::bytecodeCost const):
+        (JSC::CodeBlock::instructionCount const): Deleted.
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::inliningCost):
+        (JSC::DFG::ByteCodeParser::getInliningBalance):
+        * dfg/DFGCapabilities.cpp:
+        (JSC::DFG::mightCompileEval):
+        (JSC::DFG::mightCompileProgram):
+        (JSC::DFG::mightCompileFunctionForCall):
+        (JSC::DFG::mightCompileFunctionForConstruct):
+        (JSC::DFG::mightInlineFunctionForCall):
+        (JSC::DFG::mightInlineFunctionForClosureCall):
+        (JSC::DFG::mightInlineFunctionForConstruct):
+        * dfg/DFGCapabilities.h:
+        (JSC::DFG::isSmallEnoughToInlineCodeInto):
+        * dfg/DFGDisassembler.cpp:
+        (JSC::DFG::Disassembler::dumpHeader):
+        * dfg/DFGDriver.cpp:
+        (JSC::DFG::compileImpl):
+        * dfg/DFGPlan.cpp:
+        (JSC::DFG::Plan::compileInThread):
+        * dfg/DFGTierUpCheckInjectionPhase.cpp:
+        (JSC::DFG::TierUpCheckInjectionPhase::run):
+        * ftl/FTLCapabilities.cpp:
+        (JSC::FTL::canCompile):
+        * ftl/FTLCompile.cpp:
+        (JSC::FTL::compile):
+        * ftl/FTLLink.cpp:
+        (JSC::FTL::link):
+        * jit/JIT.cpp:
+        (JSC::JIT::link):
+        * jit/JITDisassembler.cpp:
+        (JSC::JITDisassembler::dumpHeader):
+        * llint/LLIntSlowPaths.cpp:
+        (JSC::LLInt::shouldJIT):
+        * profiler/ProfilerBytecodes.cpp:
+        (JSC::Profiler::Bytecodes::Bytecodes):
+        * runtime/Options.h:
+        * runtime/SamplingProfiler.cpp:
+        (JSC::tryGetBytecodeIndex):
+        (JSC::SamplingProfiler::processUnverifiedStackTraces):
+
 2019-04-30  Tadeu Zagallo  <tzaga...@apple.com>
 
         TypeArrays should not store properties that are canonical numeric indices

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -190,7 +190,7 @@
 
     if (codeType() == FunctionCode)
         out.print(specializationKind());
-    out.print(", ", instructionCount());
+    out.print(", ", instructionsSize());
     if (this->jitType() == JITType::BaselineJIT && m_shouldAlwaysBeInlined)
         out.print(" (ShouldAlwaysBeInlined)");
     if (ownerExecutable()->neverInline())
@@ -298,7 +298,7 @@
     , m_hasDebuggerStatement(false)
     , m_steppingMode(SteppingModeDisabled)
     , m_numBreakpoints(0)
-    , m_instructionCount(other.m_instructionCount)
+    , m_bytecodeCost(other.m_bytecodeCost)
     , m_scopeRegister(other.m_scopeRegister)
     , m_hash(other.m_hash)
     , m_unlinkedCode(*other.vm(), this, other.m_unlinkedCode.get())
@@ -524,7 +524,7 @@
     const InstructionStream& instructionStream = instructions();
     for (const auto& instruction : instructionStream) {
         OpcodeID opcodeID = instruction->opcodeID();
-        m_instructionCount += opcodeLengths[opcodeID];
+        m_bytecodeCost += opcodeLengths[opcodeID];
         switch (opcodeID) {
         LINK(OpHasIndexedProperty, arrayProfile)
 
@@ -2335,17 +2335,17 @@
     const double c = 0.0;
     const double d = 0.825914;
     
-    double instructionCount = this->instructionCount();
+    double bytecodeCost = this->bytecodeCost();
     
-    ASSERT(instructionCount); // Make sure this is called only after we have an instruction stream; otherwise it'll just return the value of d, which makes no sense.
+    ASSERT(bytecodeCost); // Make sure this is called only after we have an instruction stream; otherwise it'll just return the value of d, which makes no sense.
     
-    double result = d + a * sqrt(instructionCount + b) + c * instructionCount;
+    double result = d + a * sqrt(bytecodeCost + b) + c * bytecodeCost;
     
     result *= codeTypeThresholdMultiplier();
     
     if (Options::verboseOSR()) {
         dataLog(
-            *this, ": instruction count is ", instructionCount,
+            *this, ": bytecode cost is ", bytecodeCost,
             ", scaling execution counter by ", result, " * ", codeTypeThresholdMultiplier(),
             "\n");
     }
@@ -2870,7 +2870,7 @@
     if (multiplier < 0 || multiplier > 1000)
         return 0;
     
-    double doubleResult = multiplier * instructionCount();
+    double doubleResult = multiplier * bytecodeCost();
     
     // Be even more paranoid: silently reject values that won't fit into a size_t. If
     // the function is so huge that we can't even fit it into virtual memory then we

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (244810 => 244811)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2019-04-30 23:37:27 UTC (rev 244811)
@@ -384,7 +384,8 @@
 
     size_t predictedMachineCodeSize();
 
-    unsigned instructionCount() const { return m_instructionCount; }
+    unsigned instructionsSize() const { return instructions().size(); }
+    unsigned bytecodeCost() const { return m_bytecodeCost; }
 
     // Exactly equivalent to codeBlock->ownerExecutable()->newReplacementCodeBlockFor(codeBlock->specializationKind())
     CodeBlock* newReplacement();
@@ -963,7 +964,7 @@
             unsigned m_numBreakpoints : 30;
         };
     };
-    unsigned m_instructionCount { 0 };
+    unsigned m_bytecodeCost { 0 };
     VirtualRegister m_scopeRegister;
     mutable CodeBlockHash m_hash;
 

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -1559,7 +1559,7 @@
     VERBOSE_LOG("    Inlining should be possible.\n");
     
     // It might be possible to inline.
-    return codeBlock->instructionCount();
+    return codeBlock->bytecodeCost();
 }
 
 template<typename ChecksFunctor>
@@ -1904,11 +1904,11 @@
 
 unsigned ByteCodeParser::getInliningBalance(const CallLinkStatus& callLinkStatus, CodeSpecializationKind specializationKind)
 {
-    unsigned inliningBalance = Options::maximumFunctionForCallInlineCandidateInstructionCount();
+    unsigned inliningBalance = Options::maximumFunctionForCallInlineCandidateBytecodeCost();
     if (specializationKind == CodeForConstruct)
-        inliningBalance = std::min(inliningBalance, Options::maximumFunctionForConstructInlineCandidateInstructionCount());
+        inliningBalance = std::min(inliningBalance, Options::maximumFunctionForConstructInlineCandidateBytecoodeCost());
     if (callLinkStatus.isClosureCall())
-        inliningBalance = std::min(inliningBalance, Options::maximumFunctionForClosureCallInlineCandidateInstructionCount());
+        inliningBalance = std::min(inliningBalance, Options::maximumFunctionForClosureCallInlineCandidateBytecodeCost());
     return inliningBalance;
 }
 

Modified: trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -49,41 +49,41 @@
 bool mightCompileEval(CodeBlock* codeBlock)
 {
     return isSupported()
-        && codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount()
+        && codeBlock->bytecodeCost() <= Options::maximumOptimizationCandidateBytecodeCost()
         && codeBlock->ownerExecutable()->isOkToOptimize();
 }
 bool mightCompileProgram(CodeBlock* codeBlock)
 {
     return isSupported()
-        && codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount()
+        && codeBlock->bytecodeCost() <= Options::maximumOptimizationCandidateBytecodeCost()
         && codeBlock->ownerExecutable()->isOkToOptimize();
 }
 bool mightCompileFunctionForCall(CodeBlock* codeBlock)
 {
     return isSupported()
-        && codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount()
+        && codeBlock->bytecodeCost() <= Options::maximumOptimizationCandidateBytecodeCost()
         && codeBlock->ownerExecutable()->isOkToOptimize();
 }
 bool mightCompileFunctionForConstruct(CodeBlock* codeBlock)
 {
     return isSupported()
-        && codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount()
+        && codeBlock->bytecodeCost() <= Options::maximumOptimizationCandidateBytecodeCost()
         && codeBlock->ownerExecutable()->isOkToOptimize();
 }
 
 bool mightInlineFunctionForCall(CodeBlock* codeBlock)
 {
-    return codeBlock->instructionCount() <= Options::maximumFunctionForCallInlineCandidateInstructionCount()
+    return codeBlock->bytecodeCost() <= Options::maximumFunctionForCallInlineCandidateBytecodeCost()
         && isSupportedForInlining(codeBlock);
 }
 bool mightInlineFunctionForClosureCall(CodeBlock* codeBlock)
 {
-    return codeBlock->instructionCount() <= Options::maximumFunctionForClosureCallInlineCandidateInstructionCount()
+    return codeBlock->bytecodeCost() <= Options::maximumFunctionForClosureCallInlineCandidateBytecodeCost()
         && isSupportedForInlining(codeBlock);
 }
 bool mightInlineFunctionForConstruct(CodeBlock* codeBlock)
 {
-    return codeBlock->instructionCount() <= Options::maximumFunctionForConstructInlineCandidateInstructionCount()
+    return codeBlock->bytecodeCost() <= Options::maximumFunctionForConstructInlineCandidateBytecoodeCost()
         && isSupportedForInlining(codeBlock);
 }
 bool canUseOSRExitFuzzing(CodeBlock* codeBlock)

Modified: trunk/Source/_javascript_Core/dfg/DFGCapabilities.h (244810 => 244811)


--- trunk/Source/_javascript_Core/dfg/DFGCapabilities.h	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/dfg/DFGCapabilities.h	2019-04-30 23:37:27 UTC (rev 244811)
@@ -166,7 +166,7 @@
 
 inline bool isSmallEnoughToInlineCodeInto(CodeBlock* codeBlock)
 {
-    return codeBlock->instructionCount() <= Options::maximumInliningCallerSize();
+    return codeBlock->bytecodeCost() <= Options::maximumInliningCallerBytecodeCost();
 }
 
 } } // namespace JSC::DFG

Modified: trunk/Source/_javascript_Core/dfg/DFGDisassembler.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/dfg/DFGDisassembler.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/dfg/DFGDisassembler.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -74,7 +74,7 @@
 
 void Disassembler::dumpHeader(PrintStream& out, LinkBuffer& linkBuffer)
 {
-    out.print("Generated DFG JIT code for ", CodeBlockWithJITType(m_graph.m_codeBlock, JITType::DFGJIT), ", instruction count = ", m_graph.m_codeBlock->instructionCount(), ":\n");
+    out.print("Generated DFG JIT code for ", CodeBlockWithJITType(m_graph.m_codeBlock, JITType::DFGJIT), ", instructions size = ", m_graph.m_codeBlock->instructionsSize(), ":\n");
     out.print("    Optimized with execution counter = ", m_graph.m_profiledBlock->jitExecuteCounter(), "\n");
     out.print("    Code at [", RawPointer(linkBuffer.debugAddress()), ", ", RawPointer(static_cast<char*>(linkBuffer.debugAddress()) + linkBuffer.size()), "):\n");
 }

Modified: trunk/Source/_javascript_Core/dfg/DFGDriver.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/dfg/DFGDriver.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/dfg/DFGDriver.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -73,7 +73,7 @@
     unsigned osrEntryBytecodeIndex, const Operands<Optional<JSValue>>& mustHandleValues,
     Ref<DeferredCompilationCallback>&& callback)
 {
-    if (!Options::bytecodeRangeToDFGCompile().isInRange(codeBlock->instructionCount())
+    if (!Options::bytecodeRangeToDFGCompile().isInRange(codeBlock->instructionsSize())
         || !ensureGlobalDFGWhitelist().contains(codeBlock))
         return CompilationFailed;
     
@@ -85,7 +85,7 @@
     ASSERT(!profiledDFGCodeBlock || profiledDFGCodeBlock->jitType() == JITType::DFGJIT);
     
     if (logCompilationChanges(mode))
-        dataLog("DFG(Driver) compiling ", *codeBlock, " with ", mode, ", number of instructions = ", codeBlock->instructionCount(), "\n");
+        dataLog("DFG(Driver) compiling ", *codeBlock, " with ", mode, ", instructions size = ", codeBlock->instructionsSize(), "\n");
     
     // Make sure that any stubs that the DFG is going to use are initialized. We want to
     // make sure that all JIT code generation does finalization on the main thread.

Modified: trunk/Source/_javascript_Core/dfg/DFGPlan.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/dfg/DFGPlan.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/dfg/DFGPlan.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -184,7 +184,7 @@
     CompilationScope compilationScope;
 
     if (logCompilationChanges(m_mode) || Options::logPhaseTimes())
-        dataLog("DFG(Plan) compiling ", *m_codeBlock, " with ", m_mode, ", number of instructions = ", m_codeBlock->instructionCount(), "\n");
+        dataLog("DFG(Plan) compiling ", *m_codeBlock, " with ", m_mode, ", instructions size = ", m_codeBlock->instructionsSize(), "\n");
 
     CompilationPath path = compileInThreadImpl();
 

Modified: trunk/Source/_javascript_Core/dfg/DFGTierUpCheckInjectionPhase.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/dfg/DFGTierUpCheckInjectionPhase.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/dfg/DFGTierUpCheckInjectionPhase.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -69,7 +69,7 @@
         if (m_graph.m_profiledBlock->m_didFailFTLCompilation)
             return false;
 
-        if (!Options::bytecodeRangeToFTLCompile().isInRange(m_graph.m_profiledBlock->instructionCount()))
+        if (!Options::bytecodeRangeToFTLCompile().isInRange(m_graph.m_profiledBlock->instructionsSize()))
             return false;
 
         if (!ensureGlobalFTLWhitelist().contains(m_graph.m_profiledBlock))

Modified: trunk/Source/_javascript_Core/ftl/FTLCapabilities.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/ftl/FTLCapabilities.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/ftl/FTLCapabilities.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -401,7 +401,7 @@
 
 CapabilityLevel canCompile(Graph& graph)
 {
-    if (graph.m_codeBlock->instructionCount() > Options::maximumFTLCandidateInstructionCount()) {
+    if (graph.m_codeBlock->bytecodeCost() > Options::maximumFTLCandidateBytecodeCost()) {
         if (verboseCapabilities())
             dataLog("FTL rejecting ", *graph.m_codeBlock, " because it's too big.\n");
         return CannotCompile;

Modified: trunk/Source/_javascript_Core/ftl/FTLCompile.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/ftl/FTLCompile.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/ftl/FTLCompile.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -168,7 +168,7 @@
     if (B3::Air::Disassembler* disassembler = state.proc->code().disassembler()) {
         PrintStream& out = WTF::dataFile();
 
-        out.print("Generated ", state.graph.m_plan.mode(), " code for ", CodeBlockWithJITType(state.graph.m_codeBlock, JITType::FTLJIT), ", instruction count = ", state.graph.m_codeBlock->instructionCount(), ":\n");
+        out.print("Generated ", state.graph.m_plan.mode(), " code for ", CodeBlockWithJITType(state.graph.m_codeBlock, JITType::FTLJIT), ", instructions size = ", state.graph.m_codeBlock->instructionsSize(), ":\n");
 
         LinkBuffer& linkBuffer = *state.finalizer->b3CodeLinkBuffer;
         B3::Value* currentB3Value = nullptr;

Modified: trunk/Source/_javascript_Core/ftl/FTLLink.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/ftl/FTLLink.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/ftl/FTLLink.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -71,7 +71,7 @@
     if (UNLIKELY(compilation)) {
         compilation->addDescription(
             Profiler::OriginStack(),
-            toCString("Generated FTL JIT code for ", CodeBlockWithJITType(codeBlock, JITType::FTLJIT), ", instruction count = ", graph.m_codeBlock->instructionCount(), ":\n"));
+            toCString("Generated FTL JIT code for ", CodeBlockWithJITType(codeBlock, JITType::FTLJIT), ", instructions size = ", graph.m_codeBlock->instructionsSize(), ":\n"));
         
         graph.ensureSSADominators();
         graph.ensureSSANaturalLoops();

Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/jit/JIT.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -907,7 +907,7 @@
     
     m_vm->machineCodeBytesPerBytecodeWordForBaselineJIT->add(
         static_cast<double>(result.size()) /
-        static_cast<double>(m_codeBlock->instructionCount()));
+        static_cast<double>(m_codeBlock->instructionsSize()));
 
     m_codeBlock->shrinkToFit(CodeBlock::LateShrink);
     m_codeBlock->setJITCode(

Modified: trunk/Source/_javascript_Core/jit/JITDisassembler.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/jit/JITDisassembler.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/jit/JITDisassembler.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -89,7 +89,7 @@
 
 void JITDisassembler::dumpHeader(PrintStream& out, LinkBuffer& linkBuffer)
 {
-    out.print("Generated Baseline JIT code for ", CodeBlockWithJITType(m_codeBlock, JITType::BaselineJIT), ", instruction count = ", m_codeBlock->instructionCount(), "\n");
+    out.print("Generated Baseline JIT code for ", CodeBlockWithJITType(m_codeBlock, JITType::BaselineJIT), ", instructions size = ", m_codeBlock->instructionsSize(), "\n");
     out.print("   Source: ", m_codeBlock->sourceCodeOnOneLine(), "\n");
     out.print("   Code at [", RawPointer(linkBuffer.debugAddress()), ", ", RawPointer(static_cast<char*>(linkBuffer.debugAddress()) + linkBuffer.size()), "):\n");
 }

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -357,7 +357,7 @@
 
 inline bool shouldJIT(CodeBlock* codeBlock)
 {
-    if (!Options::bytecodeRangeToJITCompile().isInRange(codeBlock->instructionCount())
+    if (!Options::bytecodeRangeToJITCompile().isInRange(codeBlock->instructionsSize())
         || !ensureGlobalJITWhitelist().contains(codeBlock))
         return false;
 

Modified: trunk/Source/_javascript_Core/profiler/ProfilerBytecodes.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/profiler/ProfilerBytecodes.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/profiler/ProfilerBytecodes.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -40,7 +40,7 @@
     , m_inferredName(codeBlock->inferredName())
     , m_sourceCode(codeBlock->sourceCodeForTools())
     , m_hash(codeBlock->hash())
-    , m_instructionCount(codeBlock->instructionCount())
+    , m_instructionCount(codeBlock->instructionsSize())
 {
 }
 

Modified: trunk/Source/_javascript_Core/runtime/Options.h (244810 => 244811)


--- trunk/Source/_javascript_Core/runtime/Options.h	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/runtime/Options.h	2019-04-30 23:37:27 UTC (rev 244811)
@@ -300,13 +300,13 @@
     \
     v(bool, breakOnThrow, false, Normal, nullptr) \
     \
-    v(unsigned, maximumOptimizationCandidateInstructionCount, 100000, Normal, nullptr) \
+    v(unsigned, maximumOptimizationCandidateBytecodeCost, 100000, Normal, nullptr) \
     \
-    v(unsigned, maximumFunctionForCallInlineCandidateInstructionCount, 120, Normal, nullptr) \
-    v(unsigned, maximumFunctionForClosureCallInlineCandidateInstructionCount, 100, Normal, nullptr) \
-    v(unsigned, maximumFunctionForConstructInlineCandidateInstructionCount, 100, Normal, nullptr) \
+    v(unsigned, maximumFunctionForCallInlineCandidateBytecodeCost, 120, Normal, nullptr) \
+    v(unsigned, maximumFunctionForClosureCallInlineCandidateBytecodeCost, 100, Normal, nullptr) \
+    v(unsigned, maximumFunctionForConstructInlineCandidateBytecoodeCost, 100, Normal, nullptr) \
     \
-    v(unsigned, maximumFTLCandidateInstructionCount, 20000, Normal, nullptr) \
+    v(unsigned, maximumFTLCandidateBytecodeCost, 20000, Normal, nullptr) \
     \
     /* Depth of inline stack, so 1 = no inlining, 2 = one level, etc. */ \
     v(unsigned, maximumInliningDepth, 5, Normal, "maximum allowed inlining depth.  Depth of 1 means no inlining") \
@@ -314,7 +314,7 @@
     \
     /* Maximum size of a caller for enabling inlining. This is purely to protect us */\
     /* from super long compiles that take a lot of memory. */\
-    v(unsigned, maximumInliningCallerSize, 10000, Normal, nullptr) \
+    v(unsigned, maximumInliningCallerBytecodeCost, 10000, Normal, nullptr) \
     \
     v(unsigned, maximumVarargsForInlining, 100, Normal, nullptr) \
     \
@@ -558,6 +558,12 @@
     v(enableDollarVM, useDollarVM, SameOption) \
     v(enableWebAssembly, useWebAssembly, SameOption) \
     v(verboseDFGByteCodeParsing, verboseDFGBytecodeParsing, SameOption) \
+    v(maximumOptimizationCandidateInstructionCount, maximumOptimizationCandidateBytecodeCost, SameOption) \
+    v(maximumFunctionForCallInlineCandidateInstructionCount, maximumFunctionForCallInlineCandidateBytecodeCost, SameOption) \
+    v(maximumFunctionForClosureCallInlineCandidateInstructionCount, maximumFunctionForClosureCallInlineCandidateBytecodeCost, SameOption) \
+    v(maximumFunctionForConstructInlineCandidateInstructionCount, maximumFunctionForConstructInlineCandidateBytecoodeCost, SameOption) \
+    v(maximumFTLCandidateInstructionCount, maximumFTLCandidateBytecodeCost, SameOption) \
+    v(maximumInliningCallerSize, maximumInliningCallerBytecodeCost, SameOption) \
 
 
 class Options {

Modified: trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp (244810 => 244811)


--- trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp	2019-04-30 23:18:44 UTC (rev 244810)
+++ trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp	2019-04-30 23:37:27 UTC (rev 244811)
@@ -434,7 +434,7 @@
 
 #if USE(JSVALUE64)
     unsigned bytecodeIndex = llintPC;
-    if (bytecodeIndex < codeBlock->instructionCount()) {
+    if (bytecodeIndex < codeBlock->instructionsSize()) {
         isValid = true;
         return bytecodeIndex;
     }
@@ -465,7 +465,7 @@
         stackTrace.timestamp = unprocessedStackTrace.timestamp;
 
         auto populateCodeLocation = [] (CodeBlock* codeBlock, unsigned bytecodeIndex, StackFrame::CodeLocation& location) {
-            if (bytecodeIndex < codeBlock->instructionCount()) {
+            if (bytecodeIndex < codeBlock->instructionsSize()) {
                 int divot;
                 int startOffset;
                 int endOffset;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to