Commit 44225e60 authored by fpizlo@apple.com's avatar fpizlo@apple.com

run-fast-jsc should work with new-school fast/js tests that loop until the DFG tiers up

https://bugs.webkit.org/show_bug.cgi?id=120697

Reviewed by Mark Hahnenberg.

Source/JavaScriptCore: 

* API/JSCTestRunnerUtils.cpp:
(JSC::numberOfDFGCompiles):
(JSC::setNeverInline):
* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* jsc.cpp:
(GlobalObject::finishCreation):
(functionNeverInlineFunction):
(functionNumberOfDFGCompiles):
* runtime/TestRunnerUtils.cpp: Added.
(JSC::getExecutable):
(JSC::numberOfDFGCompiles):
(JSC::setNeverInline):
* runtime/TestRunnerUtils.h: Added.

LayoutTests: 

* fast/js/resources/standalone-pre.js:
(testPassed):
(testFailed):
(dfgCompiled):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 22cadaf7
2013-09-04 Filip Pizlo <fpizlo@apple.com>
run-fast-jsc should work with new-school fast/js tests that loop until the DFG tiers up
https://bugs.webkit.org/show_bug.cgi?id=120697
Reviewed by Mark Hahnenberg.
* fast/js/resources/standalone-pre.js:
(testPassed):
(testFailed):
(dfgCompiled):
2013-09-04 Samuel White <samuel_white@apple.com>
AX: when no other label on provided on form elements, WebKit should fall back to using @title
......@@ -2,6 +2,16 @@ var wasPostTestScriptParsed = false;
var errorMessage;
var self = this;
self.testRunner = {
neverInlineFunction: neverInlineFunction,
numberOfDFGCompiles: numberOfDFGCompiles
};
var silentTestPass, didPassSomeTestsSilently, didFailSomeTests;
silentTestPass = false;
didPassSomeTestsSilenty = false;
didFaileSomeTests = false;
function description(msg)
{
print(msg);
......@@ -21,11 +31,15 @@ function escapeString(text)
function testPassed(msg)
{
print("PASS", escapeString(msg));
if (silentTestPass)
didPassSomeTestsSilently = true;
else
print("PASS", escapeString(msg));
}
function testFailed(msg)
{
didFailSomeTests = true;
errorMessage = msg;
print("FAIL", escapeString(msg));
}
......@@ -183,6 +197,10 @@ function isSuccessfullyParsed()
if (!errorMessage)
successfullyParsed = true;
shouldBeTrue("successfullyParsed");
if (silentTestPass && didPassSomeTestsSilently)
debug("Passed some tests silently.");
if (silentTestPass && didFailSomeTests)
debug("Some tests failed.");
debug("\nTEST COMPLETE\n");
}
......
......@@ -27,55 +27,21 @@
#include "JSCTestRunnerUtils.h"
#include "APICast.h"
#include "CodeBlock.h"
#include "Operations.h"
#include "TestRunnerUtils.h"
namespace JSC {
static FunctionExecutable* getExecutable(JSContextRef context, JSValueRef theFunctionValueRef)
{
ExecState* exec = toJS(context);
JSValue theFunctionValue = toJS(exec, theFunctionValueRef);
JSFunction* theFunction = jsDynamicCast<JSFunction*>(theFunctionValue);
if (!theFunction)
return 0;
FunctionExecutable* executable = jsDynamicCast<FunctionExecutable*>(
theFunction->executable());
return executable;
}
JSValueRef numberOfDFGCompiles(JSContextRef context, JSValueRef theFunctionValueRef)
{
bool pretendToHaveManyCompiles = false;
#if ENABLE(DFG_JIT)
if (!Options::useJIT() || !Options::useDFGJIT())
pretendToHaveManyCompiles = true;
#else
pretendToHaveManyCompiles = true;
#endif
if (FunctionExecutable* executable = getExecutable(context, theFunctionValueRef)) {
CodeBlock* baselineCodeBlock = executable->baselineCodeBlockFor(CodeForCall);
if (!baselineCodeBlock)
return JSValueMakeNumber(context, 0);
if (pretendToHaveManyCompiles)
return JSValueMakeNumber(context, 1000000.0);
return JSValueMakeNumber(context, baselineCodeBlock->numberOfDFGCompiles());
}
return JSValueMakeUndefined(context);
ExecState* exec= toJS(context);
return toRef(exec, numberOfDFGCompiles(toJS(exec, theFunctionValueRef)));
}
JSValueRef setNeverInline(JSContextRef context, JSValueRef theFunctionValueRef)
{
if (FunctionExecutable* executable = getExecutable(context, theFunctionValueRef))
executable->setNeverInline(true);
return JSValueMakeUndefined(context);
ExecState* exec= toJS(context);
return toRef(exec, setNeverInline(toJS(exec, theFunctionValueRef)));
}
} // namespace JSC
......
......@@ -390,6 +390,7 @@ set(JavaScriptCore_SOURCES
runtime/StructureChain.cpp
runtime/StructureRareData.cpp
runtime/SymbolTable.cpp
runtime/TestRunnerUtils.cpp
runtime/TypedArrayController.cpp
runtime/TypedArrayType.cpp
runtime/VM.cpp
......
2013-09-04 Filip Pizlo <fpizlo@apple.com>
run-fast-jsc should work with new-school fast/js tests that loop until the DFG tiers up
https://bugs.webkit.org/show_bug.cgi?id=120697
Reviewed by Mark Hahnenberg.
* API/JSCTestRunnerUtils.cpp:
(JSC::numberOfDFGCompiles):
(JSC::setNeverInline):
* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* jsc.cpp:
(GlobalObject::finishCreation):
(functionNeverInlineFunction):
(functionNumberOfDFGCompiles):
* runtime/TestRunnerUtils.cpp: Added.
(JSC::getExecutable):
(JSC::numberOfDFGCompiles):
(JSC::setNeverInline):
* runtime/TestRunnerUtils.h: Added.
2013-09-04 Mark Lam <mark.lam@apple.com>
Renamed StackIterator to StackVisitor.
......
......@@ -1040,6 +1040,8 @@ javascriptcore_sources += \
Source/JavaScriptCore/runtime/StructureTransitionTable.h \
Source/JavaScriptCore/runtime/SymbolTable.cpp \
Source/JavaScriptCore/runtime/SymbolTable.h \
Source/JavaScriptCore/runtime/TestRunnerUtils.cpp \
Source/JavaScriptCore/runtime/TestRunnerUtils.h \
Source/JavaScriptCore/runtime/ToNativeFromValue.h \
Source/JavaScriptCore/runtime/Tracing.h \
Source/JavaScriptCore/runtime/TypedArrayAdaptors.h \
......
......@@ -540,6 +540,7 @@
<ClCompile Include="..\runtime\StructureChain.cpp" />
<ClCompile Include="..\runtime\StructureRareData.cpp" />
<ClCompile Include="..\runtime\SymbolTable.cpp" />
<ClCompile Include="..\runtime\TestRunnerUtils.cpp" />
<ClCompile Include="..\runtime\TypedArrayController.cpp" />
<ClCompile Include="..\runtime\TypedArrayType.cpp" />
<ClCompile Include="..\runtime\VM.cpp" />
......@@ -993,6 +994,7 @@
<ClInclude Include="..\runtime\StructureRareDataInlines.h" />
<ClInclude Include="..\runtime\StructureTransitionTable.h" />
<ClInclude Include="..\runtime\SymbolTable.h" />
<ClInclude Include="..\runtime\TestRunnerUtils.h" />
<ClInclude Include="..\runtime\Tracing.h" />
<ClInclude Include="..\runtime\ToNativeFromValue.h" />
<ClInclude Include="..\runtime\TypedArrayAdaptors.h" />
......
......@@ -303,6 +303,8 @@
0F9FC8C314E1B5FE00D52AE0 /* PolymorphicPutByIdList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F9FC8BF14E1B5FB00D52AE0 /* PolymorphicPutByIdList.cpp */; };
0F9FC8C414E1B60000D52AE0 /* PolymorphicPutByIdList.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9FC8C014E1B5FB00D52AE0 /* PolymorphicPutByIdList.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F9FC8C514E1B60400D52AE0 /* PutKind.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9FC8C114E1B5FB00D52AE0 /* PutKind.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FA2C17B17D7CF84009D015F /* TestRunnerUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FA2C17917D7CF84009D015F /* TestRunnerUtils.cpp */; };
0FA2C17C17D7CF84009D015F /* TestRunnerUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FA2C17A17D7CF84009D015F /* TestRunnerUtils.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FA581BA150E952C00B9A2D9 /* DFGNodeFlags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FA581B7150E952A00B9A2D9 /* DFGNodeFlags.cpp */; };
0FA581BB150E953000B9A2D9 /* DFGNodeFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FA581B8150E952A00B9A2D9 /* DFGNodeFlags.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FA581BC150E953000B9A2D9 /* DFGNodeType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FA581B9150E952A00B9A2D9 /* DFGNodeType.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -1490,6 +1492,8 @@
0F9FC8BF14E1B5FB00D52AE0 /* PolymorphicPutByIdList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolymorphicPutByIdList.cpp; sourceTree = "<group>"; };
0F9FC8C014E1B5FB00D52AE0 /* PolymorphicPutByIdList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolymorphicPutByIdList.h; sourceTree = "<group>"; };
0F9FC8C114E1B5FB00D52AE0 /* PutKind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PutKind.h; sourceTree = "<group>"; };
0FA2C17917D7CF84009D015F /* TestRunnerUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestRunnerUtils.cpp; sourceTree = "<group>"; };
0FA2C17A17D7CF84009D015F /* TestRunnerUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestRunnerUtils.h; sourceTree = "<group>"; };
0FA581B7150E952A00B9A2D9 /* DFGNodeFlags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGNodeFlags.cpp; path = dfg/DFGNodeFlags.cpp; sourceTree = "<group>"; };
0FA581B8150E952A00B9A2D9 /* DFGNodeFlags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGNodeFlags.h; path = dfg/DFGNodeFlags.h; sourceTree = "<group>"; };
0FA581B9150E952A00B9A2D9 /* DFGNodeType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGNodeType.h; path = dfg/DFGNodeType.h; sourceTree = "<group>"; };
......@@ -3350,6 +3354,8 @@
BC9041470EB9250900FE26FA /* StructureTransitionTable.h */,
0F919D2715856770004A4E7D /* SymbolTable.cpp */,
14A396A60CD2933100B5B4FF /* SymbolTable.h */,
0FA2C17917D7CF84009D015F /* TestRunnerUtils.cpp */,
0FA2C17A17D7CF84009D015F /* TestRunnerUtils.h */,
0F55989717C86C5600A1E543 /* ToNativeFromValue.h */,
5D53726D0E1C546B0021E549 /* Tracing.d */,
5D53726E0E1C54880021E549 /* Tracing.h */,
......@@ -3836,6 +3842,7 @@
0F63945515D07057006A597C /* ArrayProfile.h in Headers */,
BC18C3E70E16F5CD00B34460 /* ArrayPrototype.h in Headers */,
BC18C5240E16FC8A00B34460 /* ArrayPrototype.lut.h in Headers */,
0FA2C17C17D7CF84009D015F /* TestRunnerUtils.h in Headers */,
0FB7F39615ED8E4600F167B2 /* ArrayStorage.h in Headers */,
9688CB150ED12B4E001D649F /* AssemblerBuffer.h in Headers */,
86D3B2C510156BDE002865E7 /* AssemblerBufferWithConstantPool.h in Headers */,
......@@ -5140,6 +5147,7 @@
0FF729AF166AD35C000F5BA3 /* ProfilerCompilation.cpp in Sources */,
0FF729B0166AD35C000F5BA3 /* ProfilerCompilationKind.cpp in Sources */,
0FF729B1166AD35C000F5BA3 /* ProfilerCompiledBytecode.cpp in Sources */,
0FA2C17B17D7CF84009D015F /* TestRunnerUtils.cpp in Sources */,
0FF729B2166AD35C000F5BA3 /* ProfilerDatabase.cpp in Sources */,
0FF729B3166AD35C000F5BA3 /* ProfilerOrigin.cpp in Sources */,
0FF729B4166AD35C000F5BA3 /* ProfilerOriginStack.cpp in Sources */,
......
......@@ -398,6 +398,7 @@ SOURCES += \
runtime/StructureChain.cpp \
runtime/StructureRareData.cpp \
runtime/SymbolTable.cpp \
runtime/TestRunnerUtils.cpp \
runtime/TypedArrayController.cpp \
runtime/TypedArrayType.cpp \
runtime/VM.cpp \
......
......@@ -41,6 +41,7 @@
#include "SamplingTool.h"
#include "StackVisitor.h"
#include "StructureRareDataInlines.h"
#include "TestRunnerUtils.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -115,6 +116,8 @@ static EncodedJSValue JSC_HOST_CALL functionLoad(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionReadline(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionPreciseTime(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionNeverInlineFunction(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionNumberOfDFGCompiles(ExecState*);
static NO_RETURN_WITH_VALUE EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*);
#if ENABLE(SAMPLING_FLAGS)
......@@ -232,6 +235,8 @@ protected:
addFunction(vm, "jscStack", functionJSCStack, 1);
addFunction(vm, "readline", functionReadline, 0);
addFunction(vm, "preciseTime", functionPreciseTime, 0);
addFunction(vm, "neverInlineFunction", functionNeverInlineFunction, 1);
addFunction(vm, "numberOfDFGCompiles", functionNumberOfDFGCompiles, 1);
#if ENABLE(SAMPLING_FLAGS)
addFunction(vm, "setSamplingFlags", functionSetSamplingFlags, 1);
addFunction(vm, "clearSamplingFlags", functionClearSamplingFlags, 1);
......@@ -478,6 +483,16 @@ EncodedJSValue JSC_HOST_CALL functionPreciseTime(ExecState*)
return JSValue::encode(jsNumber(currentTime()));
}
EncodedJSValue JSC_HOST_CALL functionNeverInlineFunction(ExecState* exec)
{
return JSValue::encode(setNeverInline(exec));
}
EncodedJSValue JSC_HOST_CALL functionNumberOfDFGCompiles(ExecState* exec)
{
return JSValue::encode(numberOfDFGCompiles(exec));
}
EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*)
{
exit(EXIT_SUCCESS);
......
/*
* 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 "TestRunnerUtils.h"
#include "CodeBlock.h"
#include "Operations.h"
namespace JSC {
static FunctionExecutable* getExecutable(JSValue theFunctionValue)
{
JSFunction* theFunction = jsDynamicCast<JSFunction*>(theFunctionValue);
if (!theFunction)
return 0;
FunctionExecutable* executable = jsDynamicCast<FunctionExecutable*>(
theFunction->executable());
return executable;
}
JSValue numberOfDFGCompiles(JSValue theFunctionValue)
{
bool pretendToHaveManyCompiles = false;
#if ENABLE(DFG_JIT)
if (!Options::useJIT() || !Options::useDFGJIT())
pretendToHaveManyCompiles = true;
#else
pretendToHaveManyCompiles = true;
#endif
if (FunctionExecutable* executable = getExecutable(theFunctionValue)) {
CodeBlock* baselineCodeBlock = executable->baselineCodeBlockFor(CodeForCall);
if (!baselineCodeBlock)
return jsNumber(0);
if (pretendToHaveManyCompiles)
return jsNumber(1000000.0);
return jsNumber(baselineCodeBlock->numberOfDFGCompiles());
}
return jsUndefined();
}
JSValue setNeverInline(JSValue theFunctionValue)
{
if (FunctionExecutable* executable = getExecutable(theFunctionValue))
executable->setNeverInline(true);
return jsUndefined();
}
JSValue numberOfDFGCompiles(ExecState* exec)
{
if (exec->argumentCount() < 1)
return jsUndefined();
return numberOfDFGCompiles(exec->argument(0));
}
JSValue setNeverInline(ExecState* exec)
{
if (exec->argumentCount() < 1)
return jsUndefined();
return setNeverInline(exec->argument(0));
}
} // namespace JSC
/*
* 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 TestRunnerUtils_h
#define TestRunnerUtils_h
#include "JSCJSValue.h"
namespace JSC {
JS_EXPORT_PRIVATE JSValue numberOfDFGCompiles(JSValue function);
JS_EXPORT_PRIVATE JSValue setNeverInline(JSValue function);
JS_EXPORT_PRIVATE JSValue numberOfDFGCompiles(ExecState*);
JS_EXPORT_PRIVATE JSValue setNeverInline(ExecState*);
} // namespace JSC
#endif // TestRunnerUtils_h
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment