| 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/frames-inl.h" | 5 #include "src/frames-inl.h" |
| 6 #include "test/cctest/compiler/function-tester.h" | 6 #include "test/cctest/compiler/function-tester.h" |
| 7 | 7 |
| 8 namespace v8 { | 8 namespace v8 { |
| 9 namespace internal { | 9 namespace internal { |
| 10 namespace compiler { | 10 namespace compiler { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 void InstallAssertInlineCountHelper(v8::Isolate* isolate) { | 40 void InstallAssertInlineCountHelper(v8::Isolate* isolate) { |
| 41 v8::Local<v8::Context> context = isolate->GetCurrentContext(); | 41 v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
| 42 v8::Local<v8::FunctionTemplate> t = | 42 v8::Local<v8::FunctionTemplate> t = |
| 43 v8::FunctionTemplate::New(isolate, AssertInlineCount); | 43 v8::FunctionTemplate::New(isolate, AssertInlineCount); |
| 44 CHECK(context->Global() | 44 CHECK(context->Global() |
| 45 ->Set(context, v8_str("AssertInlineCount"), | 45 ->Set(context, v8_str("AssertInlineCount"), |
| 46 t->GetFunction(context).ToLocalChecked()) | 46 t->GetFunction(context).ToLocalChecked()) |
| 47 .FromJust()); | 47 .FromJust()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 | |
| 51 const uint32_t kRestrictedInliningFlags = | 50 const uint32_t kRestrictedInliningFlags = |
| 52 CompilationInfo::kFunctionContextSpecializing | | 51 CompilationInfo::kFunctionContextSpecializing; |
| 53 CompilationInfo::kTypingEnabled; | |
| 54 | 52 |
| 55 const uint32_t kInlineFlags = CompilationInfo::kInliningEnabled | | 53 const uint32_t kInlineFlags = CompilationInfo::kInliningEnabled | |
| 56 CompilationInfo::kFunctionContextSpecializing | | 54 CompilationInfo::kFunctionContextSpecializing; |
| 57 CompilationInfo::kTypingEnabled; | |
| 58 | 55 |
| 59 } // namespace | 56 } // namespace |
| 60 | 57 |
| 61 | 58 |
| 62 TEST(SimpleInlining) { | 59 TEST(SimpleInlining) { |
| 63 FunctionTester T( | 60 FunctionTester T( |
| 64 "(function(){" | 61 "(function(){" |
| 65 " function foo(s) { AssertInlineCount(2); return s; };" | 62 " function foo(s) { AssertInlineCount(2); return s; };" |
| 66 " function bar(s, t) { return foo(s); };" | 63 " function bar(s, t) { return foo(s); };" |
| 67 " return bar;" | 64 " return bar;" |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 "})();", | 569 "})();", |
| 573 kInlineFlags); | 570 kInlineFlags); |
| 574 | 571 |
| 575 InstallAssertInlineCountHelper(CcTest::isolate()); | 572 InstallAssertInlineCountHelper(CcTest::isolate()); |
| 576 T.CheckCall(T.Val(42), T.Val(1)); | 573 T.CheckCall(T.Val(42), T.Val(1)); |
| 577 } | 574 } |
| 578 | 575 |
| 579 } // namespace compiler | 576 } // namespace compiler |
| 580 } // namespace internal | 577 } // namespace internal |
| 581 } // namespace v8 | 578 } // namespace v8 |
| OLD | NEW |