Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1200)

Unified Diff: test/cctest/compiler/test-run-deopt.cc

Issue 468153002: Move %IsOptimized runtime helper into test case. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/runtime-gen/isoptimized.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/runtime-gen/isoptimized.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698