Title: [153191] trunk
Revision
153191
Author
[email protected]
Date
2013-07-24 21:01:24 -0700 (Wed, 24 Jul 2013)

Log Message

fourthTier: testRunner should have a way of disabling inlining of functions
https://bugs.webkit.org/show_bug.cgi?id=116875

Reviewed by Mark Hahnenberg.

Source/_javascript_Core:

* API/JSCTestRunnerUtils.cpp:
(JSC::getExecutable):
(JSC):
(JSC::numberOfDFGCompiles):
(JSC::setNeverInline):
* API/JSCTestRunnerUtils.h:
(JSC):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpAssumingJITType):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::mightInlineFunctionForCall):
(JSC::DFG::mightInlineFunctionForClosureCall):
(JSC::DFG::mightInlineFunctionForConstruct):
* runtime/Executable.h:
(JSC::ScriptExecutable::ScriptExecutable):
(ScriptExecutable):
(JSC::ScriptExecutable::setNeverInline):
(JSC::ScriptExecutable::neverInline):
(JSC::ScriptExecutable::isInliningCandidate):

Tools:

* DumpRenderTree/TestRunner.cpp:
(neverInlineFunction):
(TestRunner::staticFunctions):

LayoutTests:

* fast/js/script-tests/dfg-min-max.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (153190 => 153191)


--- trunk/LayoutTests/ChangeLog	2013-07-25 04:01:22 UTC (rev 153190)
+++ trunk/LayoutTests/ChangeLog	2013-07-25 04:01:24 UTC (rev 153191)
@@ -1,3 +1,12 @@
+2013-05-28  Filip Pizlo  <[email protected]>
+
+        testRunner should have a way of disabling inlining of functions
+        https://bugs.webkit.org/show_bug.cgi?id=116875
+
+        Reviewed by Mark Hahnenberg.
+
+        * fast/js/script-tests/dfg-min-max.js:
+
 2013-05-27  Filip Pizlo  <[email protected]>
 
         testRunner should be able to tell you if a function is DFG compiled

Modified: trunk/LayoutTests/fast/js/script-tests/dfg-min-max.js (153190 => 153191)


--- trunk/LayoutTests/fast/js/script-tests/dfg-min-max.js	2013-07-25 04:01:22 UTC (rev 153190)
+++ trunk/LayoutTests/fast/js/script-tests/dfg-min-max.js	2013-07-25 04:01:24 UTC (rev 153191)
@@ -10,6 +10,9 @@
     return Math.max(a, b);
 }
 
+testRunner.neverInlineFunction(doMin);
+testRunner.neverInlineFunction(doMax);
+
 var count = 0;
 while (!testRunner.numberOfDFGCompiles(doMin) || !testRunner.numberOfDFGCompiles(doMax)) {
     doMin(1.5, 2.5);

Modified: trunk/Source/_javascript_Core/API/JSCTestRunnerUtils.cpp (153190 => 153191)


--- trunk/Source/_javascript_Core/API/JSCTestRunnerUtils.cpp	2013-07-25 04:01:22 UTC (rev 153190)
+++ trunk/Source/_javascript_Core/API/JSCTestRunnerUtils.cpp	2013-07-25 04:01:24 UTC (rev 153191)
@@ -32,26 +32,40 @@
 
 namespace JSC {
 
-JSValueRef numberOfDFGCompiles(JSContextRef context, JSValueRef theFunctionValueRef)
+static FunctionExecutable* getExecutable(JSContextRef context, JSValueRef theFunctionValueRef)
 {
     ExecState* exec = toJS(context);
     JSValue theFunctionValue = toJS(exec, theFunctionValueRef);
     
     JSFunction* theFunction = jsDynamicCast<JSFunction*>(theFunctionValue);
     if (!theFunction)
-        return JSValueMakeUndefined(context);
+        return 0;
     
     FunctionExecutable* executable = jsDynamicCast<FunctionExecutable*>(
         theFunction->executable());
-    if (!executable)
-        return JSValueMakeUndefined(context);
+    return executable;
+}
+
+JSValueRef numberOfDFGCompiles(JSContextRef context, JSValueRef theFunctionValueRef)
+{
+    if (FunctionExecutable* executable = getExecutable(context, theFunctionValueRef)) {
+        CodeBlock* baselineCodeBlock = executable->baselineCodeBlockFor(CodeForCall);
+        
+        if (!baselineCodeBlock)
+            return JSValueMakeNumber(context, 0);
+        
+        return JSValueMakeNumber(context, baselineCodeBlock->numberOfDFGCompiles());
+    }
     
-    CodeBlock* baselineCodeBlock = executable->baselineCodeBlockFor(CodeForCall);
+    return JSValueMakeUndefined(context);
+}
+
+JSValueRef setNeverInline(JSContextRef context, JSValueRef theFunctionValueRef)
+{
+    if (FunctionExecutable* executable = getExecutable(context, theFunctionValueRef))
+        executable->setNeverInline(true);
     
-    if (!baselineCodeBlock)
-        return JSValueMakeNumber(context, 0);
-    
-    return JSValueMakeNumber(context, baselineCodeBlock->numberOfDFGCompiles());
+    return JSValueMakeUndefined(context);
 }
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/API/JSCTestRunnerUtils.h (153190 => 153191)


--- trunk/Source/_javascript_Core/API/JSCTestRunnerUtils.h	2013-07-25 04:01:22 UTC (rev 153190)
+++ trunk/Source/_javascript_Core/API/JSCTestRunnerUtils.h	2013-07-25 04:01:24 UTC (rev 153191)
@@ -32,6 +32,7 @@
 namespace JSC {
 
 JS_EXPORT_PRIVATE JSValueRef numberOfDFGCompiles(JSContextRef, JSValueRef theFunction);
+JS_EXPORT_PRIVATE JSValueRef setNeverInline(JSContextRef, JSValueRef theFunction);
 
 } // namespace JSC
 

Modified: trunk/Source/_javascript_Core/ChangeLog (153190 => 153191)


--- trunk/Source/_javascript_Core/ChangeLog	2013-07-25 04:01:22 UTC (rev 153190)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-07-25 04:01:24 UTC (rev 153191)
@@ -1,3 +1,30 @@
+2013-05-28  Filip Pizlo  <[email protected]>
+
+        testRunner should have a way of disabling inlining of functions
+        https://bugs.webkit.org/show_bug.cgi?id=116875
+
+        Reviewed by Mark Hahnenberg.
+
+        * API/JSCTestRunnerUtils.cpp:
+        (JSC::getExecutable):
+        (JSC):
+        (JSC::numberOfDFGCompiles):
+        (JSC::setNeverInline):
+        * API/JSCTestRunnerUtils.h:
+        (JSC):
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::dumpAssumingJITType):
+        * dfg/DFGCapabilities.cpp:
+        (JSC::DFG::mightInlineFunctionForCall):
+        (JSC::DFG::mightInlineFunctionForClosureCall):
+        (JSC::DFG::mightInlineFunctionForConstruct):
+        * runtime/Executable.h:
+        (JSC::ScriptExecutable::ScriptExecutable):
+        (ScriptExecutable):
+        (JSC::ScriptExecutable::setNeverInline):
+        (JSC::ScriptExecutable::neverInline):
+        (JSC::ScriptExecutable::isInliningCandidate):
+
 2013-05-27  Filip Pizlo  <[email protected]>
 
         fourthTier: FTL should support ArithMod

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (153190 => 153191)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2013-07-25 04:01:22 UTC (rev 153190)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2013-07-25 04:01:24 UTC (rev 153191)
@@ -114,6 +114,8 @@
         out.print(specializationKind());
     if (m_shouldAlwaysBeInlined)
         out.print(" (SABI)");
+    if (ownerExecutable()->neverInline())
+        out.print(" (NeverInline)");
     out.print("]");
 }
 

Modified: trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp (153190 => 153191)


--- trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp	2013-07-25 04:01:22 UTC (rev 153190)
+++ trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp	2013-07-25 04:01:24 UTC (rev 153191)
@@ -53,17 +53,20 @@
 bool mightInlineFunctionForCall(CodeBlock* codeBlock)
 {
     return codeBlock->instructionCount() <= Options::maximumFunctionForCallInlineCandidateInstructionCount()
-        && !codeBlock->ownerExecutable()->needsActivation();
+        && !codeBlock->ownerExecutable()->needsActivation()
+        && codeBlock->ownerExecutable()->isInliningCandidate();
 }
 bool mightInlineFunctionForClosureCall(CodeBlock* codeBlock)
 {
     return codeBlock->instructionCount() <= Options::maximumFunctionForClosureCallInlineCandidateInstructionCount()
-        && !codeBlock->ownerExecutable()->needsActivation();
+        && !codeBlock->ownerExecutable()->needsActivation()
+        && codeBlock->ownerExecutable()->isInliningCandidate();
 }
 bool mightInlineFunctionForConstruct(CodeBlock* codeBlock)
 {
     return codeBlock->instructionCount() <= Options::maximumFunctionForConstructInlineCandidateInstructionCount()
-        && !codeBlock->ownerExecutable()->needsActivation();
+        && !codeBlock->ownerExecutable()->needsActivation()
+        && codeBlock->ownerExecutable()->isInliningCandidate();
 }
 
 inline void debugFail(CodeBlock* codeBlock, OpcodeID opcodeID, CapabilityLevel result)

Modified: trunk/Source/_javascript_Core/runtime/Executable.h (153190 => 153191)


--- trunk/Source/_javascript_Core/runtime/Executable.h	2013-07-25 04:01:22 UTC (rev 153190)
+++ trunk/Source/_javascript_Core/runtime/Executable.h	2013-07-25 04:01:24 UTC (rev 153191)
@@ -355,6 +355,7 @@
             : ExecutableBase(vm, structure, NUM_PARAMETERS_NOT_COMPILED)
             , m_source(source)
             , m_features(isInStrictContext ? StrictModeFeature : 0)
+            , m_neverInline(false)
         {
         }
 
@@ -362,6 +363,7 @@
             : ExecutableBase(exec->vm(), structure, NUM_PARAMETERS_NOT_COMPILED)
             , m_source(source)
             , m_features(isInStrictContext ? StrictModeFeature : 0)
+            , m_neverInline(false)
         {
         }
 
@@ -382,6 +384,10 @@
         bool usesArguments() const { return m_features & ArgumentsFeature; }
         bool needsActivation() const { return m_hasCapturedVariables || m_features & (EvalFeature | WithFeature | CatchFeature); }
         bool isStrictMode() const { return m_features & StrictModeFeature; }
+        
+        void setNeverInline(bool value) { m_neverInline = value; }
+        bool neverInline() const { return m_neverInline; }
+        bool isInliningCandidate() const { return !neverInline(); }
 
         void unlinkCalls();
         
@@ -413,6 +419,7 @@
         SourceCode m_source;
         CodeFeatures m_features;
         bool m_hasCapturedVariables;
+        bool m_neverInline;
         int m_firstLine;
         int m_lastLine;
         unsigned m_startColumn;

Modified: trunk/Tools/ChangeLog (153190 => 153191)


--- trunk/Tools/ChangeLog	2013-07-25 04:01:22 UTC (rev 153190)
+++ trunk/Tools/ChangeLog	2013-07-25 04:01:24 UTC (rev 153191)
@@ -1,3 +1,14 @@
+2013-05-28  Filip Pizlo  <[email protected]>
+
+        testRunner should have a way of disabling inlining of functions
+        https://bugs.webkit.org/show_bug.cgi?id=116875
+
+        Reviewed by Mark Hahnenberg.
+
+        * DumpRenderTree/TestRunner.cpp:
+        (neverInlineFunction):
+        (TestRunner::staticFunctions):
+
 2013-05-27  Filip Pizlo  <[email protected]>
 
         testRunner should be able to tell you if a function is DFG compiled

Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (153190 => 153191)


--- trunk/Tools/DumpRenderTree/TestRunner.cpp	2013-07-25 04:01:22 UTC (rev 153190)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp	2013-07-25 04:01:24 UTC (rev 153191)
@@ -1983,6 +1983,14 @@
     return JSC::numberOfDFGCompiles(context, arguments[0]);
 }
 
+static JSValueRef neverInlineFunction(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 1)
+        return JSValueMakeUndefined(context);
+    
+    return JSC::setNeverInline(context, arguments[0]);
+}
+
 static void testRunnerObjectFinalize(JSObjectRef object)
 {
     TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(object));
@@ -2185,6 +2193,7 @@
         { "removeAllWebNotificationPermissions", removeAllWebNotificationPermissionsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "simulateWebNotificationClick", simulateWebNotificationClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "numberOfDFGCompiles", numberOfDFGCompiles, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "neverInlineFunction", neverInlineFunction, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { 0, 0, 0 }
     };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to