Title: [153188] trunk
Revision
153188
Author
oli...@apple.com
Date
2013-07-24 21:01:17 -0700 (Wed, 24 Jul 2013)

Log Message

fourthTier: testRunner should be able to tell you if a function is DFG compiled
https://bugs.webkit.org/show_bug.cgi?id=116847

Reviewed by Mark Hahnenberg.

Source/_javascript_Core:

* API/JSCTestRunnerUtils.cpp: Added.
(JSC):
(JSC::numberOfDFGCompiles):
* API/JSCTestRunnerUtils.h: Added.
(JSC):
* _javascript_Core.xcodeproj/project.pbxproj:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::numberOfDFGCompiles):
(JSC):
* bytecode/CodeBlock.h:
(CodeBlock):
* dfg/DFGWorklist.cpp:
(JSC::DFG::Worklist::runThread):
* runtime/Executable.h:
(JSC):
* runtime/JSFunctionInlines.h: Added.
(JSC):
(JSC::JSFunction::JSFunction):
(JSC::JSFunction::jsExecutable):
(JSC::JSFunction::isHostFunction):
(JSC::JSFunction::nativeFunction):
(JSC::JSFunction::nativeConstructor):
* runtime/Operations.h:

Source/WebCore:

Bail early if we're in the compilation thread. This is only relevant for
debug dumps.

No new tests becase no new behavior.

* loader/cache/CachedScript.cpp:
(WebCore::CachedScript::script):

Tools:

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

LayoutTests:

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (153187 => 153188)


--- trunk/LayoutTests/ChangeLog	2013-07-25 04:01:14 UTC (rev 153187)
+++ trunk/LayoutTests/ChangeLog	2013-07-25 04:01:17 UTC (rev 153188)
@@ -1,5 +1,14 @@
 2013-05-27  Filip Pizlo  <fpi...@apple.com>
 
+        testRunner should be able to tell you if a function is DFG compiled
+        https://bugs.webkit.org/show_bug.cgi?id=116847
+
+        Reviewed by Mark Hahnenberg.
+
+        * fast/js/script-tests/dfg-min-max.js:
+
+2013-05-27  Filip Pizlo  <fpi...@apple.com>
+
         fourthTier: DFG ArithMod should have the !nodeUsedAsNumber optimizations that ArithDiv has
         https://bugs.webkit.org/show_bug.cgi?id=116841
 

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


--- trunk/LayoutTests/fast/js/script-tests/dfg-min-max.js	2013-07-25 04:01:14 UTC (rev 153187)
+++ trunk/LayoutTests/fast/js/script-tests/dfg-min-max.js	2013-07-25 04:01:17 UTC (rev 153188)
@@ -10,9 +10,11 @@
     return Math.max(a, b);
 }
 
-for (var i = 0; i < 1000; ++i) {
+var count = 0;
+while (!testRunner.numberOfDFGCompiles(doMin) || !testRunner.numberOfDFGCompiles(doMax)) {
     doMin(1.5, 2.5);
     doMax(1.5, 2.5);
+    count++;
 }
 
 shouldBe("doMin(1.5, 2.5)", "1.5");

Added: trunk/Source/_javascript_Core/API/JSCTestRunnerUtils.cpp (0 => 153188)


--- trunk/Source/_javascript_Core/API/JSCTestRunnerUtils.cpp	                        (rev 0)
+++ trunk/Source/_javascript_Core/API/JSCTestRunnerUtils.cpp	2013-07-25 04:01:17 UTC (rev 153188)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "JSCTestRunnerUtils.h"
+
+#include "APICast.h"
+#include "CodeBlock.h"
+#include "Operations.h"
+
+namespace JSC {
+
+JSValueRef numberOfDFGCompiles(JSContextRef context, JSValueRef theFunctionValueRef)
+{
+    ExecState* exec = toJS(context);
+    JSValue theFunctionValue = toJS(exec, theFunctionValueRef);
+    
+    JSFunction* theFunction = jsDynamicCast<JSFunction*>(theFunctionValue);
+    if (!theFunction)
+        return JSValueMakeUndefined(context);
+    
+    FunctionExecutable* executable = jsDynamicCast<FunctionExecutable*>(
+        theFunction->executable());
+    if (!executable)
+        return JSValueMakeUndefined(context);
+    
+    CodeBlock* baselineCodeBlock = executable->baselineCodeBlockFor(CodeForCall);
+    
+    if (!baselineCodeBlock)
+        return JSValueMakeNumber(context, 0);
+    
+    return JSValueMakeNumber(context, baselineCodeBlock->numberOfDFGCompiles());
+}
+
+} // namespace JSC
+

Added: trunk/Source/_javascript_Core/API/JSCTestRunnerUtils.h (0 => 153188)


--- trunk/Source/_javascript_Core/API/JSCTestRunnerUtils.h	                        (rev 0)
+++ trunk/Source/_javascript_Core/API/JSCTestRunnerUtils.h	2013-07-25 04:01:17 UTC (rev 153188)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef JSCTestRunnerUtils_h
+#define JSCTestRunnerUtils_h
+
+#include <_javascript_Core/JSContextRef.h>
+#include <_javascript_Core/JSValueRef.h>
+
+namespace JSC {
+
+JS_EXPORT_PRIVATE JSValueRef numberOfDFGCompiles(JSContextRef, JSValueRef theFunction);
+
+} // namespace JSC
+
+#endif // JSCTestRunnerUtils_h

Modified: trunk/Source/_javascript_Core/ChangeLog (153187 => 153188)


--- trunk/Source/_javascript_Core/ChangeLog	2013-07-25 04:01:14 UTC (rev 153187)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-07-25 04:01:17 UTC (rev 153188)
@@ -1,5 +1,36 @@
 2013-05-27  Filip Pizlo  <fpi...@apple.com>
 
+        testRunner should be able to tell you if a function is DFG compiled
+        https://bugs.webkit.org/show_bug.cgi?id=116847
+
+        Reviewed by Mark Hahnenberg.
+
+        * API/JSCTestRunnerUtils.cpp: Added.
+        (JSC):
+        (JSC::numberOfDFGCompiles):
+        * API/JSCTestRunnerUtils.h: Added.
+        (JSC):
+        * _javascript_Core.xcodeproj/project.pbxproj:
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::numberOfDFGCompiles):
+        (JSC):
+        * bytecode/CodeBlock.h:
+        (CodeBlock):
+        * dfg/DFGWorklist.cpp:
+        (JSC::DFG::Worklist::runThread):
+        * runtime/Executable.h:
+        (JSC):
+        * runtime/JSFunctionInlines.h: Added.
+        (JSC):
+        (JSC::JSFunction::JSFunction):
+        (JSC::JSFunction::jsExecutable):
+        (JSC::JSFunction::isHostFunction):
+        (JSC::JSFunction::nativeFunction):
+        (JSC::JSFunction::nativeConstructor):
+        * runtime/Operations.h:
+
+2013-05-27  Filip Pizlo  <fpi...@apple.com>
+
         fourthTier: DFG ArithMod should have the !nodeUsedAsNumber optimizations that ArithDiv has
         https://bugs.webkit.org/show_bug.cgi?id=116841
 

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (153187 => 153188)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2013-07-25 04:01:14 UTC (rev 153187)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2013-07-25 04:01:17 UTC (rev 153188)
@@ -740,6 +740,9 @@
 		A1712B3F11C7B228007A5315 /* RegExpCache.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B3E11C7B228007A5315 /* RegExpCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A1712B4111C7B235007A5315 /* RegExpKey.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B4011C7B235007A5315 /* RegExpKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A71236E51195F33C00BD2174 /* JITOpcodes32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A71236E41195F33C00BD2174 /* JITOpcodes32_64.cpp */; };
+		A72028B61797601E0098028C /* JSCTestRunnerUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A72028B41797601E0098028C /* JSCTestRunnerUtils.cpp */; };
+		A72028B81797601E0098028C /* JSCTestRunnerUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = A72028B51797601E0098028C /* JSCTestRunnerUtils.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		A72028BA1797603D0098028C /* JSFunctionInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = A72028B91797603D0098028C /* JSFunctionInlines.h */; };
 		A72700900DAC6BBC00E548D7 /* JSNotAnObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A72700780DAC605600E548D7 /* JSNotAnObject.cpp */; };
 		A72701B90DADE94900E548D7 /* ExceptionHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = A72701B30DADE94900E548D7 /* ExceptionHelpers.h */; };
 		A727FF6B0DA3092200E548D7 /* JSPropertyNameIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A727FF660DA3053B00E548D7 /* JSPropertyNameIterator.cpp */; };
@@ -1764,6 +1767,9 @@
 		A71236E41195F33C00BD2174 /* JITOpcodes32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITOpcodes32_64.cpp; sourceTree = "<group>"; };
 		A718F61A11754A21002465A7 /* RegExpJitTables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpJitTables.h; sourceTree = "<group>"; };
 		A718F8211178EB4B002465A7 /* create_regex_tables */ = {isa = PBXFileReference; explicitFileType = text.script.python; fileEncoding = 4; path = create_regex_tables; sourceTree = "<group>"; };
+		A72028B41797601E0098028C /* JSCTestRunnerUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCTestRunnerUtils.cpp; sourceTree = "<group>"; };
+		A72028B51797601E0098028C /* JSCTestRunnerUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCTestRunnerUtils.h; sourceTree = "<group>"; };
+		A72028B91797603D0098028C /* JSFunctionInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFunctionInlines.h; sourceTree = "<group>"; };
 		A72700770DAC605600E548D7 /* JSNotAnObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNotAnObject.h; sourceTree = "<group>"; };
 		A72700780DAC605600E548D7 /* JSNotAnObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotAnObject.cpp; sourceTree = "<group>"; };
 		A72701B30DADE94900E548D7 /* ExceptionHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionHelpers.h; sourceTree = "<group>"; };
@@ -2457,6 +2463,8 @@
 		1432EBD70A34CAD400717B9F /* API */ = {
 			isa = PBXGroup;
 			children = (
+				A72028B41797601E0098028C /* JSCTestRunnerUtils.cpp */,
+				A72028B51797601E0098028C /* JSCTestRunnerUtils.h */,
 				1482B78A0A4305AB00517CFC /* APICast.h */,
 				865F408710E7D56300947361 /* APIShims.h */,
 				1CAA8B4A0D32C39A0041BCFF /* _javascript_.h */,
@@ -2653,6 +2661,7 @@
 		7EF6E0BB0EB7A1EC0079AFAF /* runtime */ = {
 			isa = PBXGroup;
 			children = (
+				A72028B91797603D0098028C /* JSFunctionInlines.h */,
 				A7E5A3A51797432D00E893C0 /* CompilationResult.cpp */,
 				A7E5A3A61797432D00E893C0 /* CompilationResult.h */,
 				BCF605110E203EF800B9A64D /* ArgList.cpp */,
@@ -3320,7 +3329,6 @@
 				0F73D7AF165A143000ACAB71 /* ClosureCallStubRoutine.h in Headers */,
 				969A07970ED1D3AE00F1F681 /* CodeBlock.h in Headers */,
 				0F8F94411667633200D61971 /* CodeBlockHash.h in Headers */,
-				0F0D85B21723455400338210 /* CodeBlockLock.h in Headers */,
 				0F96EBB316676EF6008BADE3 /* CodeBlockWithJITType.h in Headers */,
 				A77F1822164088B200640A47 /* CodeCache.h in Headers */,
 				86E116B10FE75AC800B512BC /* CodeLocation.h in Headers */,
@@ -3366,6 +3374,7 @@
 				A7A4AE0D17973B4D005612B1 /* JITStubsMIPS.h in Headers */,
 				0F620176143FCD3B0068B77C /* DFGBasicBlock.h in Headers */,
 				0FFB921A16D02EC50055A5DB /* DFGBasicBlockInlines.h in Headers */,
+				A72028B81797601E0098028C /* JSCTestRunnerUtils.h in Headers */,
 				0F8364B7164B0C110053329A /* DFGBranchDirection.h in Headers */,
 				86EC9DC51328DF82002B2AD7 /* DFGByteCodeParser.h in Headers */,
 				0F256C361627B0AD007F2783 /* DFGCallArrayAllocatorSlowPathGenerator.h in Headers */,
@@ -3697,6 +3706,7 @@
 				0F13912A16771C36009CCB07 /* ProfilerBytecodeSequence.h in Headers */,
 				0FF729BA166AD360000F5BA3 /* ProfilerCompilation.h in Headers */,
 				0FF729BB166AD360000F5BA3 /* ProfilerCompilationKind.h in Headers */,
+				A72028BA1797603D0098028C /* JSFunctionInlines.h in Headers */,
 				0FF729BC166AD360000F5BA3 /* ProfilerCompiledBytecode.h in Headers */,
 				0FF729BD166AD360000F5BA3 /* ProfilerDatabase.h in Headers */,
 				0FF729BE166AD360000F5BA3 /* ProfilerExecutionCounter.h in Headers */,
@@ -4332,6 +4342,7 @@
 				0F766D2815A8CC1E008F363E /* JITStubRoutine.cpp in Sources */,
 				0F766D2B15A8CC38008F363E /* JITStubRoutineSet.cpp in Sources */,
 				14A23D750F4E1ABB0023CDAD /* JITStubs.cpp in Sources */,
+				A72028B61797601E0098028C /* JSCTestRunnerUtils.cpp in Sources */,
 				0F5EF91E16878F7A003E5C25 /* JITThunks.cpp in Sources */,
 				140B7D1D0DC69AF7009C42B8 /* JSActivation.cpp in Sources */,
 				140566C4107EC255005DBC8D /* JSAPIValueWrapper.cpp in Sources */,

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (153187 => 153188)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2013-07-25 04:01:14 UTC (rev 153187)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2013-07-25 04:01:17 UTC (rev 153188)
@@ -3057,6 +3057,12 @@
         m_reoptimizationRetryCounter = Options::reoptimizationRetryCounterMax();
 }
 
+unsigned CodeBlock::numberOfDFGCompiles()
+{
+    ASSERT(JITCode::isBaselineCode(jitType()));
+    return (JITCode::isOptimizingJIT(replacement()->jitType()) ? 1 : 0) + m_reoptimizationRetryCounter;
+}
+
 int32_t CodeBlock::codeTypeThresholdMultiplier() const
 {
     if (codeType() == EvalCode)

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (153187 => 153188)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2013-07-25 04:01:14 UTC (rev 153187)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2013-07-25 04:01:17 UTC (rev 153188)
@@ -779,6 +779,8 @@
     // to avoid thrashing.
     unsigned reoptimizationRetryCounter() const;
     void countReoptimization();
+    
+    unsigned numberOfDFGCompiles();
 
     int32_t codeTypeThresholdMultiplier() const;
 

Modified: trunk/Source/_javascript_Core/dfg/DFGWorklist.cpp (153187 => 153188)


--- trunk/Source/_javascript_Core/dfg/DFGWorklist.cpp	2013-07-25 04:01:14 UTC (rev 153187)
+++ trunk/Source/_javascript_Core/dfg/DFGWorklist.cpp	2013-07-25 04:01:17 UTC (rev 153188)
@@ -211,6 +211,8 @@
 
 void Worklist::runThread()
 {
+    CompilationScope compilationScope;
+    
     if (Options::verboseCompilationQueue())
         dataLog(*this, ": Thread started\n");
     

Modified: trunk/Source/_javascript_Core/runtime/Executable.h (153187 => 153188)


--- trunk/Source/_javascript_Core/runtime/Executable.h	2013-07-25 04:01:14 UTC (rev 153187)
+++ trunk/Source/_javascript_Core/runtime/Executable.h	2013-07-25 04:01:17 UTC (rev 153188)
@@ -784,38 +784,6 @@
         RefPtr<FunctionCodeBlock> m_codeBlockForConstruct;
     };
 
-    inline JSFunction::JSFunction(VM& vm, FunctionExecutable* executable, JSScope* scope)
-        : Base(vm, scope->globalObject()->functionStructure())
-        , m_executable(vm, this, executable)
-        , m_scope(vm, this, scope)
-        , m_allocationProfileWatchpoint(InitializedBlind) // See comment in JSFunction.cpp concerning the reason for using InitializedBlind as opposed to InitializedWatching.
-    {
-    }
-
-    inline FunctionExecutable* JSFunction::jsExecutable() const
-    {
-        ASSERT(!isHostFunctionNonInline());
-        return static_cast<FunctionExecutable*>(m_executable.get());
-    }
-
-    inline bool JSFunction::isHostFunction() const
-    {
-        ASSERT(m_executable);
-        return m_executable->isHostFunction();
-    }
-
-    inline NativeFunction JSFunction::nativeFunction()
-    {
-        ASSERT(isHostFunction());
-        return static_cast<NativeExecutable*>(m_executable.get())->function();
-    }
-
-    inline NativeFunction JSFunction::nativeConstructor()
-    {
-        ASSERT(isHostFunction());
-        return static_cast<NativeExecutable*>(m_executable.get())->constructor();
-    }
-
     inline bool isHostFunction(JSValue value, NativeFunction nativeFunction)
     {
         JSFunction* function = jsCast<JSFunction*>(getJSFunction(value));

Added: trunk/Source/_javascript_Core/runtime/JSFunctionInlines.h (0 => 153188)


--- trunk/Source/_javascript_Core/runtime/JSFunctionInlines.h	                        (rev 0)
+++ trunk/Source/_javascript_Core/runtime/JSFunctionInlines.h	2013-07-25 04:01:17 UTC (rev 153188)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef JSFunctionInlines_h
+#define JSFunctionInlines_h
+
+#include "Executable.h"
+#include "JSFunction.h"
+
+namespace JSC {
+
+inline JSFunction::JSFunction(VM& vm, FunctionExecutable* executable, JSScope* scope)
+    : Base(vm, scope->globalObject()->functionStructure())
+    , m_executable(vm, this, executable)
+    , m_scope(vm, this, scope)
+    , m_allocationProfileWatchpoint(InitializedBlind) // See comment in JSFunction.cpp concerning the reason for using InitializedBlind as opposed to InitializedWatching.
+{
+}
+
+inline FunctionExecutable* JSFunction::jsExecutable() const
+{
+    ASSERT(!isHostFunctionNonInline());
+    return static_cast<FunctionExecutable*>(m_executable.get());
+}
+
+inline bool JSFunction::isHostFunction() const
+{
+    ASSERT(m_executable);
+    return m_executable->isHostFunction();
+}
+
+inline NativeFunction JSFunction::nativeFunction()
+{
+    ASSERT(isHostFunction());
+    return static_cast<NativeExecutable*>(m_executable.get())->function();
+}
+
+inline NativeFunction JSFunction::nativeConstructor()
+{
+    ASSERT(isHostFunction());
+    return static_cast<NativeExecutable*>(m_executable.get())->constructor();
+}
+
+} // namespace JSC
+
+#endif // JSFunctionInlines_h
+

Modified: trunk/Source/_javascript_Core/runtime/Operations.h (153187 => 153188)


--- trunk/Source/_javascript_Core/runtime/Operations.h	2013-07-25 04:01:14 UTC (rev 153187)
+++ trunk/Source/_javascript_Core/runtime/Operations.h	2013-07-25 04:01:17 UTC (rev 153188)
@@ -25,6 +25,7 @@
 #include "ExceptionHelpers.h"
 #include "Interpreter.h"
 #include "JSCJSValueInlines.h"
+#include "JSFunctionInlines.h"
 #include "JSProxy.h"
 #include "JSString.h"
 #include "StructureInlines.h"

Modified: trunk/Source/WebCore/ChangeLog (153187 => 153188)


--- trunk/Source/WebCore/ChangeLog	2013-07-25 04:01:14 UTC (rev 153187)
+++ trunk/Source/WebCore/ChangeLog	2013-07-25 04:01:17 UTC (rev 153188)
@@ -1,3 +1,18 @@
+2013-05-27  Filip Pizlo  <fpi...@apple.com>
+
+        testRunner should be able to tell you if a function is DFG compiled
+        https://bugs.webkit.org/show_bug.cgi?id=116847
+
+        Reviewed by Mark Hahnenberg.
+
+        Bail early if we're in the compilation thread. This is only relevant for
+        debug dumps.
+
+        No new tests becase no new behavior.
+
+        * loader/cache/CachedScript.cpp:
+        (WebCore::CachedScript::script):
+
 2013-05-25  Mark Lam  <mark....@apple.com>
 
         Remove Interpreter::retrieveLastCaller().

Modified: trunk/Source/WebCore/loader/cache/CachedScript.cpp (153187 => 153188)


--- trunk/Source/WebCore/loader/cache/CachedScript.cpp	2013-07-25 04:01:14 UTC (rev 153187)
+++ trunk/Source/WebCore/loader/cache/CachedScript.cpp	2013-07-25 04:01:17 UTC (rev 153188)
@@ -70,6 +70,11 @@
 
 const String& CachedScript::script()
 {
+    if (isCompilationThread()) {
+        RELEASE_ASSERT(m_script);
+        return m_script;
+    }
+    
     ASSERT(!isPurgeable());
 
     if (!m_script && m_data) {

Modified: trunk/Tools/ChangeLog (153187 => 153188)


--- trunk/Tools/ChangeLog	2013-07-25 04:01:14 UTC (rev 153187)
+++ trunk/Tools/ChangeLog	2013-07-25 04:01:17 UTC (rev 153188)
@@ -1,3 +1,14 @@
+2013-05-27  Filip Pizlo  <fpi...@apple.com>
+
+        testRunner should be able to tell you if a function is DFG compiled
+        https://bugs.webkit.org/show_bug.cgi?id=116847
+
+        Reviewed by Mark Hahnenberg.
+
+        * DumpRenderTree/TestRunner.cpp:
+        (numberOfDFGCompiles):
+        (TestRunner::staticFunctions):
+
 2013-05-21  Filip Pizlo  <fpi...@apple.com>
 
         fourthTier: display-profiler-output should make it even easier to diff the compilation story between two different runs

Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (153187 => 153188)


--- trunk/Tools/DumpRenderTree/TestRunner.cpp	2013-07-25 04:01:14 UTC (rev 153187)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp	2013-07-25 04:01:17 UTC (rev 153188)
@@ -32,10 +32,11 @@
 
 #include "WorkQueue.h"
 #include "WorkQueueItem.h"
-#include <cstring>
 #include <_javascript_Core/JSContextRef.h>
+#include <_javascript_Core/JSCTestRunnerUtils.h>
 #include <_javascript_Core/JSObjectRef.h>
 #include <_javascript_Core/JSRetainPtr.h>
+#include <cstring>
 #include <locale.h>
 #include <stdio.h>
 #include <wtf/Assertions.h>
@@ -1974,6 +1975,14 @@
     return JSValueMakeUndefined(context);
 }
 
+static JSValueRef numberOfDFGCompiles(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 1)
+        return JSValueMakeUndefined(context);
+    
+    return JSC::numberOfDFGCompiles(context, arguments[0]);
+}
+
 static void testRunnerObjectFinalize(JSObjectRef object)
 {
     TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(object));
@@ -2175,6 +2184,7 @@
         { "denyWebNotificationPermission", denyWebNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "removeAllWebNotificationPermissions", removeAllWebNotificationPermissionsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "simulateWebNotificationClick", simulateWebNotificationClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "numberOfDFGCompiles", numberOfDFGCompiles, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { 0, 0, 0 }
     };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to