Move %IsOptimized runtime helper into test case.

R=jarin@chromium.org
TEST=cctest/test-run-deopt

Review URL: https://codereview.chromium.org/468153002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23107 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e3d028f5
......@@ -11209,15 +11209,6 @@ static SaveContext* FindSavedContextForFrame(Isolate* isolate,
}
RUNTIME_FUNCTION(Runtime_IsOptimized) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 0);
JavaScriptFrameIterator it(isolate);
JavaScriptFrame* frame = it.frame();
return isolate->heap()->ToBoolean(frame->is_optimized());
}
// Advances the iterator to the frame that matches the index and returns the
// inlined frame index, or -1 if not found. Skips native JS functions.
static int FindIndexedNonNativeFrame(JavaScriptFrameIterator* it, int index) {
......
......@@ -68,7 +68,6 @@ namespace internal {
F(OptimizeFunctionOnNextCall, -1, 1) \
F(NeverOptimizeFunction, 1, 1) \
F(GetOptimizationStatus, -1, 1) \
F(IsOptimized, 0, 1) /* TODO(turbofan): Only temporary */ \
F(GetOptimizationCount, 1, 1) \
F(UnblockConcurrentRecompilation, 0, 1) \
F(CompileForOnStackReplacement, 1, 1) \
......
......@@ -4,11 +4,26 @@
#include "src/v8.h"
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/function-tester.h"
using namespace v8;
using namespace v8::internal;
using namespace v8::internal::compiler;
static void IsOptimized(const FunctionCallbackInfo<v8::Value>& args) {
JavaScriptFrameIterator it(CcTest::i_isolate());
JavaScriptFrame* frame = it.frame();
return args.GetReturnValue().Set(frame->is_optimized());
}
static void InstallIsOptimizedHelper(v8::Isolate* isolate) {
Local<v8::Context> context = isolate->GetCurrentContext();
Local<v8::FunctionTemplate> t = FunctionTemplate::New(isolate, IsOptimized);
context->Global()->Set(v8_str("IsOptimized"), t->GetFunction());
}
#if V8_TURBOFAN_TARGET
TEST(TurboSimpleDeopt) {
......@@ -18,11 +33,12 @@ TEST(TurboSimpleDeopt) {
FunctionTester T(
"(function f(a) {"
"var b = 1;"
"if (!%IsOptimized()) return 0;"
"if (!IsOptimized()) return 0;"
"%DeoptimizeFunction(f);"
"if (%IsOptimized()) return 0;"
"if (IsOptimized()) return 0;"
"return a + b; })");
InstallIsOptimizedHelper(CcTest::isolate());
T.CheckCall(T.Val(2), T.Val(1));
}
......@@ -35,11 +51,12 @@ TEST(TurboSimpleDeoptInExpr) {
"(function f(a) {"
"var b = 1;"
"var c = 2;"
"if (!%IsOptimized()) return 0;"
"if (!IsOptimized()) return 0;"
"var d = b + (%DeoptimizeFunction(f), c);"
"if (%IsOptimized()) return 0;"
"if (IsOptimized()) return 0;"
"return d + a; })");
InstallIsOptimizedHelper(CcTest::isolate());
T.CheckCall(T.Val(6), T.Val(3));
}
......
// Copyright 2014 the V8 project authors. All rights reserved.
// AUTO-GENERATED BY tools/generate-runtime-tests.py, DO NOT MODIFY
// Flags: --allow-natives-syntax --harmony --harmony-proxies
%IsOptimized();
......@@ -47,8 +47,8 @@ EXPAND_MACROS = [
# that the parser doesn't bit-rot. Change the values as needed when you add,
# remove or change runtime functions, but make sure we don't lose our ability
# to parse them!
EXPECTED_FUNCTION_COUNT = 429
EXPECTED_FUZZABLE_COUNT = 332
EXPECTED_FUNCTION_COUNT = 428
EXPECTED_FUZZABLE_COUNT = 331
EXPECTED_CCTEST_COUNT = 7
EXPECTED_UNKNOWN_COUNT = 16
EXPECTED_BUILTINS_COUNT = 808
......
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