fourthTier: testRunner should be able to tell you if a function is DFG compiled
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Jul 2013 04:01:17 +0000 (04:01 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Jul 2013 04:01:17 +0000 (04:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=116847

Reviewed by Mark Hahnenberg.

Source/JavaScriptCore:

* API/JSCTestRunnerUtils.cpp: Added.
(JSC):
(JSC::numberOfDFGCompiles):
* API/JSCTestRunnerUtils.h: Added.
(JSC):
* JavaScriptCore.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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153188 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/js/script-tests/dfg-min-max.js
Source/JavaScriptCore/API/JSCTestRunnerUtils.cpp [new file with mode: 0644]
Source/JavaScriptCore/API/JSCTestRunnerUtils.h [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/bytecode/CodeBlock.cpp
Source/JavaScriptCore/bytecode/CodeBlock.h
Source/JavaScriptCore/dfg/DFGWorklist.cpp
Source/JavaScriptCore/runtime/Executable.h
Source/JavaScriptCore/runtime/JSFunctionInlines.h [new file with mode: 0644]
Source/JavaScriptCore/runtime/Operations.h
Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedScript.cpp
Tools/ChangeLog
Tools/DumpRenderTree/TestRunner.cpp

index 8aee4f2..d6c8157 100644 (file)
@@ -1,5 +1,14 @@
 2013-05-27  Filip Pizlo  <fpizlo@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  <fpizlo@apple.com>
+
         fourthTier: DFG ArithMod should have the !nodeUsedAsNumber optimizations that ArithDiv has
         https://bugs.webkit.org/show_bug.cgi?id=116841
 
index 9d5164c..1f2b701 100644 (file)
@@ -10,9 +10,11 @@ function doMax(a, b) {
     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");
diff --git a/Source/JavaScriptCore/API/JSCTestRunnerUtils.cpp b/Source/JavaScriptCore/API/JSCTestRunnerUtils.cpp
new file mode 100644 (file)
index 0000000..5fad981
--- /dev/null
@@ -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
+
diff --git a/Source/JavaScriptCore/API/JSCTestRunnerUtils.h b/Source/JavaScriptCore/API/JSCTestRunnerUtils.h
new file mode 100644 (file)
index 0000000..aa8fefe
--- /dev/null
@@ -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 <JavaScriptCore/JSContextRef.h>
+#include <JavaScriptCore/JSValueRef.h>
+
+namespace JSC {
+
+JS_EXPORT_PRIVATE JSValueRef numberOfDFGCompiles(JSContextRef, JSValueRef theFunction);
+
+} // namespace JSC
+
+#endif // JSCTestRunnerUtils_h
index 3cce80f..5fda9ec 100644 (file)
@@ -1,5 +1,36 @@
 2013-05-27  Filip Pizlo  <fpizlo@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):
+        * JavaScriptCore.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  <fpizlo@apple.com>
+
         fourthTier: DFG ArithMod should have the !nodeUsedAsNumber optimizations that ArithDiv has
         https://bugs.webkit.org/show_bug.cgi?id=116841
 
index 3f80cff..8783b66 100644 (file)
                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 */; };
                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>"; };
                1432EBD70A34CAD400717B9F /* API */ = {
                        isa = PBXGroup;
                        children = (
+                               A72028B41797601E0098028C /* JSCTestRunnerUtils.cpp */,
+                               A72028B51797601E0098028C /* JSCTestRunnerUtils.h */,
                                1482B78A0A4305AB00517CFC /* APICast.h */,
                                865F408710E7D56300947361 /* APIShims.h */,
                                1CAA8B4A0D32C39A0041BCFF /* JavaScript.h */,
                7EF6E0BB0EB7A1EC0079AFAF /* runtime */ = {
                        isa = PBXGroup;
                        children = (
+                               A72028B91797603D0098028C /* JSFunctionInlines.h */,
                                A7E5A3A51797432D00E893C0 /* CompilationResult.cpp */,
                                A7E5A3A61797432D00E893C0 /* CompilationResult.h */,
                                BCF605110E203EF800B9A64D /* ArgList.cpp */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
index 931a521..bcb9510 100644 (file)
@@ -3057,6 +3057,12 @@ void CodeBlock::countReoptimization()
         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)
index 1b5f54f..45643bd 100644 (file)
@@ -779,6 +779,8 @@ public:
     // to avoid thrashing.
     unsigned reoptimizationRetryCounter() const;
     void countReoptimization();
+    
+    unsigned numberOfDFGCompiles();
 
     int32_t codeTypeThresholdMultiplier() const;
 
index a786e0f..0c95fd1 100644 (file)
@@ -211,6 +211,8 @@ void Worklist::dump(const MutexLocker&, PrintStream& out) const
 
 void Worklist::runThread()
 {
+    CompilationScope compilationScope;
+    
     if (Options::verboseCompilationQueue())
         dataLog(*this, ": Thread started\n");
     
index 233fb12..8370465 100644 (file)
@@ -784,38 +784,6 @@ namespace JSC {
         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));
diff --git a/Source/JavaScriptCore/runtime/JSFunctionInlines.h b/Source/JavaScriptCore/runtime/JSFunctionInlines.h
new file mode 100644 (file)
index 0000000..4f89acd
--- /dev/null
@@ -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
+
index 14557c7..afac130 100644 (file)
@@ -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"
index d2908dd..6c66fb7 100644 (file)
@@ -1,3 +1,18 @@
+2013-05-27  Filip Pizlo  <fpizlo@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.lam@apple.com>
 
         Remove Interpreter::retrieveLastCaller().
index 48facd7..03e4fcb 100644 (file)
@@ -70,6 +70,11 @@ String CachedScript::mimeType() const
 
 const String& CachedScript::script()
 {
+    if (isCompilationThread()) {
+        RELEASE_ASSERT(m_script);
+        return m_script;
+    }
+    
     ASSERT(!isPurgeable());
 
     if (!m_script && m_data) {
index 7d964ec..5d53116 100644 (file)
@@ -1,3 +1,14 @@
+2013-05-27  Filip Pizlo  <fpizlo@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  <fpizlo@apple.com>
 
         fourthTier: display-profiler-output should make it even easier to diff the compilation story between two different runs
index b546343..aeca4da 100644 (file)
 
 #include "WorkQueue.h"
 #include "WorkQueueItem.h"
-#include <cstring>
 #include <JavaScriptCore/JSContextRef.h>
+#include <JavaScriptCore/JSCTestRunnerUtils.h>
 #include <JavaScriptCore/JSObjectRef.h>
 #include <JavaScriptCore/JSRetainPtr.h>
+#include <cstring>
 #include <locale.h>
 #include <stdio.h>
 #include <wtf/Assertions.h>
@@ -1974,6 +1975,14 @@ static JSValueRef simulateWebNotificationClickCallback(JSContextRef context, JSO
     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 @@ JSStaticFunction* TestRunner::staticFunctions()
         { "denyWebNotificationPermission", denyWebNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "removeAllWebNotificationPermissions", removeAllWebNotificationPermissionsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "simulateWebNotificationClick", simulateWebNotificationClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "numberOfDFGCompiles", numberOfDFGCompiles, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { 0, 0, 0 }
     };