Reviewers: jarin,

Message:
Committed patchset #1 manually as 23107 (presubmit successful).

Description:
Move %IsOptimized runtime helper into test case.

[email protected]
TEST=cctest/test-run-deopt

Committed: https://code.google.com/p/v8/source/detail?r=23107

Please review this at https://codereview.chromium.org/468153002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+23, -20 lines):
  M src/runtime.h
  M src/runtime.cc
  M test/cctest/compiler/test-run-deopt.cc
  D test/mjsunit/runtime-gen/isoptimized.js
  M tools/generate-runtime-tests.py


Index: test/mjsunit/runtime-gen/isoptimized.js
diff --git a/test/mjsunit/runtime-gen/isoptimized.js b/test/mjsunit/runtime-gen/isoptimized.js
deleted file mode 100644
index e1daf0da88c43b5d3a0607fbbab4423193ab3d13..0000000000000000000000000000000000000000
--- a/test/mjsunit/runtime-gen/isoptimized.js
+++ /dev/null
@@ -1,4 +0,0 @@
-// 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();
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 50a4cc9598cdd60d22d6a7c7dc7d0b7564e0aa69..97a52710a5c82cf8a0931ef612d3befb141088e3 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -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) {
Index: src/runtime.h
diff --git a/src/runtime.h b/src/runtime.h
index 4a78edb897d45036a9618182802299d79469ca5c..2ef6d8009fd2b0f85e97c393b1a0bab1fe0e44bf 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -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)                     \
Index: test/cctest/compiler/test-run-deopt.cc
diff --git a/test/cctest/compiler/test-run-deopt.cc b/test/cctest/compiler/test-run-deopt.cc index af173d6be6e5b917393ab4205b227902fb1f0798..069aa0369c9965a1de66cfc4a2dea8af115c875b 100644
--- a/test/cctest/compiler/test-run-deopt.cc
+++ b/test/cctest/compiler/test-run-deopt.cc
@@ -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));
 }

Index: tools/generate-runtime-tests.py
diff --git a/tools/generate-runtime-tests.py b/tools/generate-runtime-tests.py index b5f61a84227b3b15dd63be8beab887405f855c48..30816672fd9509a59b671c57009bb6b6e8296eaf 100755
--- a/tools/generate-runtime-tests.py
+++ b/tools/generate-runtime-tests.py
@@ -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


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to