| 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; | |
| 11 using namespace v8::internal; | 10 using namespace v8::internal; |
| 12 using namespace v8::internal::compiler; | 11 using namespace v8::internal::compiler; |
| 13 | 12 |
| 14 #if V8_TURBOFAN_TARGET | 13 #if V8_TURBOFAN_TARGET |
| 15 | 14 |
| 16 static void IsOptimized(const FunctionCallbackInfo<v8::Value>& args) { | 15 static void IsOptimized(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 17 JavaScriptFrameIterator it(CcTest::i_isolate()); | 16 JavaScriptFrameIterator it(CcTest::i_isolate()); |
| 18 JavaScriptFrame* frame = it.frame(); | 17 JavaScriptFrame* frame = it.frame(); |
| 19 return args.GetReturnValue().Set(frame->is_optimized()); | 18 return args.GetReturnValue().Set(frame->is_optimized()); |
| 20 } | 19 } |
| 21 | 20 |
| 22 | 21 |
| 23 static void InstallIsOptimizedHelper(v8::Isolate* isolate) { | 22 static void InstallIsOptimizedHelper(v8::Isolate* isolate) { |
| 24 Local<v8::Context> context = isolate->GetCurrentContext(); | 23 v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
| 25 Local<v8::FunctionTemplate> t = FunctionTemplate::New(isolate, IsOptimized); | 24 v8::Local<v8::FunctionTemplate> t = |
| 25 v8::FunctionTemplate::New(isolate, IsOptimized); |
| 26 context->Global()->Set(v8_str("IsOptimized"), t->GetFunction()); | 26 context->Global()->Set(v8_str("IsOptimized"), t->GetFunction()); |
| 27 } | 27 } |
| 28 | 28 |
| 29 | 29 |
| 30 TEST(TurboSimpleDeopt) { | 30 TEST(TurboSimpleDeopt) { |
| 31 FLAG_allow_natives_syntax = true; | 31 FLAG_allow_natives_syntax = true; |
| 32 | 32 |
| 33 FunctionTester T( | 33 FunctionTester T( |
| 34 "(function f(a) {" | 34 "(function f(a) {" |
| 35 "var b = 1;" | 35 "var b = 1;" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 64 TEST(TurboTrivialDeopt) { | 64 TEST(TurboTrivialDeopt) { |
| 65 FLAG_allow_natives_syntax = true; | 65 FLAG_allow_natives_syntax = true; |
| 66 | 66 |
| 67 FunctionTester T( | 67 FunctionTester T( |
| 68 "(function foo() {" | 68 "(function foo() {" |
| 69 "%DeoptimizeFunction(foo);" | 69 "%DeoptimizeFunction(foo);" |
| 70 "return 1; })"); | 70 "return 1; })"); |
| 71 | 71 |
| 72 T.CheckCall(T.Val(1)); | 72 T.CheckCall(T.Val(1)); |
| 73 } | 73 } |
| OLD | NEW |