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 "src/frames-inl.h" | 7 #include "src/frames-inl.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; |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 void InstallAssertInlineCountHelper(v8::Isolate* isolate) { | 37 void InstallAssertInlineCountHelper(v8::Isolate* isolate) { |
38 v8::Local<v8::Context> context = isolate->GetCurrentContext(); | 38 v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
39 v8::Local<v8::FunctionTemplate> t = | 39 v8::Local<v8::FunctionTemplate> t = |
40 v8::FunctionTemplate::New(isolate, AssertInlineCount); | 40 v8::FunctionTemplate::New(isolate, AssertInlineCount); |
41 context->Global()->Set(v8_str("AssertInlineCount"), t->GetFunction()); | 41 context->Global()->Set(v8_str("AssertInlineCount"), t->GetFunction()); |
42 } | 42 } |
43 | 43 |
44 | 44 |
45 const uint32_t kRestrictedInliningFlags = | 45 const uint32_t kRestrictedInliningFlags = |
46 CompilationInfo::kContextSpecializing | CompilationInfo::kTypingEnabled; | 46 CompilationInfo::kFunctionContextSpecializing | |
| 47 CompilationInfo::kTypingEnabled; |
47 | 48 |
48 const uint32_t kInlineFlags = CompilationInfo::kInliningEnabled | | 49 const uint32_t kInlineFlags = CompilationInfo::kInliningEnabled | |
49 CompilationInfo::kContextSpecializing | | 50 CompilationInfo::kFunctionContextSpecializing | |
50 CompilationInfo::kTypingEnabled; | 51 CompilationInfo::kTypingEnabled; |
51 | 52 |
52 } // namespace | 53 } // namespace |
53 | 54 |
54 | 55 |
55 TEST(SimpleInlining) { | 56 TEST(SimpleInlining) { |
56 FunctionTester T( | 57 FunctionTester T( |
57 "(function(){" | 58 "(function(){" |
58 " function foo(s) { AssertInlineCount(2); return s; };" | 59 " function foo(s) { AssertInlineCount(2); return s; };" |
59 " function bar(s, t) { return foo(s); };" | 60 " function bar(s, t) { return foo(s); };" |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 " if (x == 1) return bar(42);" | 588 " if (x == 1) return bar(42);" |
588 " return x;" | 589 " return x;" |
589 " }" | 590 " }" |
590 " return foo;" | 591 " return foo;" |
591 "})();", | 592 "})();", |
592 kInlineFlags); | 593 kInlineFlags); |
593 | 594 |
594 InstallAssertInlineCountHelper(CcTest::isolate()); | 595 InstallAssertInlineCountHelper(CcTest::isolate()); |
595 T.CheckCall(T.Val(42), T.Val(1)); | 596 T.CheckCall(T.Val(42), T.Val(1)); |
596 } | 597 } |
OLD | NEW |