OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "test/cctest/cctest.h" | 7 #include "test/cctest/cctest.h" |
8 #include "test/cctest/compiler/function-tester.h" | 8 #include "test/cctest/compiler/function-tester.h" |
9 | 9 |
10 using namespace v8::internal; | 10 using namespace v8::internal; |
11 using namespace v8::internal::compiler; | 11 using namespace v8::internal::compiler; |
12 | 12 |
13 #if V8_TURBOFAN_TARGET | |
14 | |
15 static void IsOptimized(const v8::FunctionCallbackInfo<v8::Value>& args) { | 13 static void IsOptimized(const v8::FunctionCallbackInfo<v8::Value>& args) { |
16 JavaScriptFrameIterator it(CcTest::i_isolate()); | 14 JavaScriptFrameIterator it(CcTest::i_isolate()); |
17 JavaScriptFrame* frame = it.frame(); | 15 JavaScriptFrame* frame = it.frame(); |
18 return args.GetReturnValue().Set(frame->is_optimized()); | 16 return args.GetReturnValue().Set(frame->is_optimized()); |
19 } | 17 } |
20 | 18 |
21 | 19 |
22 static void InstallIsOptimizedHelper(v8::Isolate* isolate) { | 20 static void InstallIsOptimizedHelper(v8::Isolate* isolate) { |
23 v8::Local<v8::Context> context = isolate->GetCurrentContext(); | 21 v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
24 v8::Local<v8::FunctionTemplate> t = | 22 v8::Local<v8::FunctionTemplate> t = |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 " }" | 94 " }" |
97 "})"); | 95 "})"); |
98 | 96 |
99 CompileRun("function DeoptAndThrow(f) { %DeoptimizeFunction(f); throw 0; }"); | 97 CompileRun("function DeoptAndThrow(f) { %DeoptimizeFunction(f); throw 0; }"); |
100 InstallIsOptimizedHelper(CcTest::isolate()); | 98 InstallIsOptimizedHelper(CcTest::isolate()); |
101 #if 0 // TODO(4195,mstarzinger): Reproduces on MIPS64, re-enable once fixed. | 99 #if 0 // TODO(4195,mstarzinger): Reproduces on MIPS64, re-enable once fixed. |
102 T.CheckCall(T.false_value()); | 100 T.CheckCall(T.false_value()); |
103 #endif | 101 #endif |
104 } | 102 } |
105 | 103 |
106 #endif | |
107 | 104 |
108 TEST(DeoptTrivial) { | 105 TEST(DeoptTrivial) { |
109 FLAG_allow_natives_syntax = true; | 106 FLAG_allow_natives_syntax = true; |
110 | 107 |
111 FunctionTester T( | 108 FunctionTester T( |
112 "(function foo() {" | 109 "(function foo() {" |
113 " %DeoptimizeFunction(foo);" | 110 " %DeoptimizeFunction(foo);" |
114 " return 1;" | 111 " return 1;" |
115 "})"); | 112 "})"); |
116 | 113 |
117 T.CheckCall(T.Val(1)); | 114 T.CheckCall(T.Val(1)); |
118 } | 115 } |
OLD | NEW |