summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/TestRunnerUtils.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-05-24 08:28:08 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-05-24 08:28:08 +0000
commita4e969f4965059196ca948db781e52f7cfebf19e (patch)
tree6ca352808c8fdc52006a0f33f6ae3c593b23867d /Source/JavaScriptCore/runtime/TestRunnerUtils.cpp
parent41386e9cb918eed93b3f13648cbef387e371e451 (diff)
downloadWebKitGtk-tarball-a4e969f4965059196ca948db781e52f7cfebf19e.tar.gz
webkitgtk-2.12.3webkitgtk-2.12.3
Diffstat (limited to 'Source/JavaScriptCore/runtime/TestRunnerUtils.cpp')
-rw-r--r--Source/JavaScriptCore/runtime/TestRunnerUtils.cpp75
1 files changed, 61 insertions, 14 deletions
diff --git a/Source/JavaScriptCore/runtime/TestRunnerUtils.cpp b/Source/JavaScriptCore/runtime/TestRunnerUtils.cpp
index 337c00e6e..d13090fed 100644
--- a/Source/JavaScriptCore/runtime/TestRunnerUtils.cpp
+++ b/Source/JavaScriptCore/runtime/TestRunnerUtils.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,11 @@
#include "TestRunnerUtils.h"
#include "CodeBlock.h"
-#include "Operations.h"
+#include "JSCInlines.h"
namespace JSC {
-static FunctionExecutable* getExecutable(JSValue theFunctionValue)
+FunctionExecutable* getExecutableForFunction(JSValue theFunctionValue)
{
JSFunction* theFunction = jsDynamicCast<JSFunction*>(theFunctionValue);
if (!theFunction)
@@ -42,6 +42,20 @@ static FunctionExecutable* getExecutable(JSValue theFunctionValue)
return executable;
}
+CodeBlock* getSomeBaselineCodeBlockForFunction(JSValue theFunctionValue)
+{
+ FunctionExecutable* executable = getExecutableForFunction(theFunctionValue);
+ if (!executable)
+ return 0;
+
+ CodeBlock* baselineCodeBlock = executable->baselineCodeBlockFor(CodeForCall);
+
+ if (!baselineCodeBlock)
+ baselineCodeBlock = executable->baselineCodeBlockFor(CodeForConstruct);
+
+ return baselineCodeBlock;
+}
+
JSValue numberOfDFGCompiles(JSValue theFunctionValue)
{
bool pretendToHaveManyCompiles = false;
@@ -51,32 +65,51 @@ JSValue numberOfDFGCompiles(JSValue theFunctionValue)
#else
pretendToHaveManyCompiles = true;
#endif
-
- if (FunctionExecutable* executable = getExecutable(theFunctionValue)) {
- CodeBlock* baselineCodeBlock = executable->baselineCodeBlockFor(CodeForCall);
-
- if (!baselineCodeBlock)
- baselineCodeBlock = executable->baselineCodeBlockFor(CodeForConstruct);
-
- if (!baselineCodeBlock)
- return jsNumber(0);
+ if (CodeBlock* baselineCodeBlock = getSomeBaselineCodeBlockForFunction(theFunctionValue)) {
if (pretendToHaveManyCompiles)
return jsNumber(1000000.0);
return jsNumber(baselineCodeBlock->numberOfDFGCompiles());
}
- return jsUndefined();
+ return jsNumber(0);
}
JSValue setNeverInline(JSValue theFunctionValue)
{
- if (FunctionExecutable* executable = getExecutable(theFunctionValue))
+ if (FunctionExecutable* executable = getExecutableForFunction(theFunctionValue))
executable->setNeverInline(true);
return jsUndefined();
}
+JSValue setNeverOptimize(JSValue theFunctionValue)
+{
+ if (FunctionExecutable* executable = getExecutableForFunction(theFunctionValue))
+ executable->setNeverOptimize(true);
+
+ return jsUndefined();
+}
+
+JSValue optimizeNextInvocation(JSValue theFunctionValue)
+{
+#if ENABLE(JIT)
+ if (CodeBlock* baselineCodeBlock = getSomeBaselineCodeBlockForFunction(theFunctionValue))
+ baselineCodeBlock->optimizeNextInvocation();
+#else
+ UNUSED_PARAM(theFunctionValue);
+#endif
+
+ return jsUndefined();
+}
+
+JSValue failNextNewCodeBlock(ExecState* exec)
+{
+ exec->vm().setFailNextNewCodeBlock();
+
+ return jsUndefined();
+}
+
JSValue numberOfDFGCompiles(ExecState* exec)
{
if (exec->argumentCount() < 1)
@@ -91,5 +124,19 @@ JSValue setNeverInline(ExecState* exec)
return setNeverInline(exec->uncheckedArgument(0));
}
+JSValue setNeverOptimize(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return jsUndefined();
+ return setNeverOptimize(exec->uncheckedArgument(0));
+}
+
+JSValue optimizeNextInvocation(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return jsUndefined();
+ return optimizeNextInvocation(exec->uncheckedArgument(0));
+}
+
} // namespace JSC