| 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/compilation-info.h" | 5 #include "src/compilation-info.h" |
| 6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
| 7 #include "test/cctest/compiler/function-tester.h" | 7 #include "test/cctest/compiler/function-tester.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 void InstallAssertInlineCountHelper(v8::Isolate* isolate) { | 41 void InstallAssertInlineCountHelper(v8::Isolate* isolate) { |
| 42 v8::Local<v8::Context> context = isolate->GetCurrentContext(); | 42 v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
| 43 v8::Local<v8::FunctionTemplate> t = | 43 v8::Local<v8::FunctionTemplate> t = |
| 44 v8::FunctionTemplate::New(isolate, AssertInlineCount); | 44 v8::FunctionTemplate::New(isolate, AssertInlineCount); |
| 45 CHECK(context->Global() | 45 CHECK(context->Global() |
| 46 ->Set(context, v8_str("AssertInlineCount"), | 46 ->Set(context, v8_str("AssertInlineCount"), |
| 47 t->GetFunction(context).ToLocalChecked()) | 47 t->GetFunction(context).ToLocalChecked()) |
| 48 .FromJust()); | 48 .FromJust()); |
| 49 } | 49 } |
| 50 | 50 |
| 51 const uint32_t kRestrictedInliningFlags = | 51 const uint32_t kRestrictedInliningFlags = 0; |
| 52 CompilationInfo::kNativeContextSpecializing; | |
| 53 | 52 |
| 54 const uint32_t kInlineFlags = CompilationInfo::kInliningEnabled | | 53 const uint32_t kInlineFlags = CompilationInfo::kInliningEnabled; |
| 55 CompilationInfo::kNativeContextSpecializing; | |
| 56 | 54 |
| 57 } // namespace | 55 } // namespace |
| 58 | 56 |
| 59 | 57 |
| 60 TEST(SimpleInlining) { | 58 TEST(SimpleInlining) { |
| 61 FunctionTester T( | 59 FunctionTester T( |
| 62 "function foo(s) { AssertInlineCount(2); return s; };" | 60 "function foo(s) { AssertInlineCount(2); return s; };" |
| 63 "function bar(s, t) { return foo(s); };" | 61 "function bar(s, t) { return foo(s); };" |
| 64 "bar;", | 62 "bar;", |
| 65 kInlineFlags); | 63 kInlineFlags); |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 "foo;", | 462 "foo;", |
| 465 kInlineFlags); | 463 kInlineFlags); |
| 466 | 464 |
| 467 InstallAssertInlineCountHelper(CcTest::isolate()); | 465 InstallAssertInlineCountHelper(CcTest::isolate()); |
| 468 T.CheckCall(T.Val(42), T.Val(1)); | 466 T.CheckCall(T.Val(42), T.Val(1)); |
| 469 } | 467 } |
| 470 | 468 |
| 471 } // namespace compiler | 469 } // namespace compiler |
| 472 } // namespace internal | 470 } // namespace internal |
| 473 } // namespace v8 | 471 } // namespace v8 |
| OLD | NEW |