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 |
new file mode 100644 |
index 0000000000000000000000000000000000000000..36998d00050e149ab4329d26da545ad2437a0584 |
--- /dev/null |
+++ b/test/cctest/compiler/test-run-deopt.cc |
@@ -0,0 +1,39 @@ |
+// Copyright 2014 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "v8.h" |
+ |
+#include "function-tester.h" |
+ |
+using namespace v8::internal; |
+using namespace v8::internal::compiler; |
+ |
+ |
+TEST(TurboSimpleDeopt) { |
+ FLAG_allow_natives_syntax = true; |
+ FLAG_turbo_deoptimization = true; |
+ |
+ FunctionTester T( |
+ "(function f(a) {" |
+ "var b = 1;" |
+ "if (!%IsOptimized()) return 0;" |
+ "%DeoptimizeFunction(f);" |
+ "if (%IsOptimized()) return 0;" |
+ "return a + b; })"); |
+ |
+ T.CheckCall(T.Val(2), T.Val(1)); |
+} |
+ |
+ |
+TEST(TurboTrivialDeopt) { |
+ FLAG_allow_natives_syntax = true; |
+ FLAG_turbo_deoptimization = true; |
+ |
+ FunctionTester T( |
+ "(function foo() {" |
+ "%DeoptimizeFunction(foo);" |
+ "return 1; })"); |
+ |
+ T.CheckCall(T.Val(1)); |
+} |