| 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 { |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 // Helper to determine inline count via JavaScriptFrame::GetFunctions. | 14 // Helper to determine inline count via JavaScriptFrame::GetFunctions. |
| 15 // Note that a count of 1 indicates that no inlining has occured. | 15 // Note that a count of 1 indicates that no inlining has occured. |
| 16 void AssertInlineCount(const v8::FunctionCallbackInfo<v8::Value>& args) { | 16 void AssertInlineCount(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 17 StackTraceFrameIterator it(CcTest::i_isolate()); | 17 StackTraceFrameIterator it(CcTest::i_isolate()); |
| 18 int frames_seen = 0; | 18 int frames_seen = 0; |
| 19 JavaScriptFrame* topmost = it.frame(); | 19 JavaScriptFrame* topmost = it.jsFrame(); |
| 20 while (!it.done()) { | 20 while (!it.done()) { |
| 21 JavaScriptFrame* frame = it.frame(); | 21 JavaScriptFrame* frame = it.jsFrame(); |
| 22 List<JSFunction*> functions(2); | 22 List<JSFunction*> functions(2); |
| 23 frame->GetFunctions(&functions); | 23 frame->GetFunctions(&functions); |
| 24 PrintF("%d %s, inline count: %d\n", frames_seen, | 24 PrintF("%d %s, inline count: %d\n", frames_seen, |
| 25 frame->function()->shared()->DebugName()->ToCString().get(), | 25 frame->function()->shared()->DebugName()->ToCString().get(), |
| 26 functions.length()); | 26 functions.length()); |
| 27 frames_seen++; | 27 frames_seen++; |
| 28 it.Advance(); | 28 it.Advance(); |
| 29 } | 29 } |
| 30 List<JSFunction*> functions(2); | 30 List<JSFunction*> functions(2); |
| 31 topmost->GetFunctions(&functions); | 31 topmost->GetFunctions(&functions); |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 "})();", | 572 "})();", |
| 573 kInlineFlags); | 573 kInlineFlags); |
| 574 | 574 |
| 575 InstallAssertInlineCountHelper(CcTest::isolate()); | 575 InstallAssertInlineCountHelper(CcTest::isolate()); |
| 576 T.CheckCall(T.Val(42), T.Val(1)); | 576 T.CheckCall(T.Val(42), T.Val(1)); |
| 577 } | 577 } |
| 578 | 578 |
| 579 } // namespace compiler | 579 } // namespace compiler |
| 580 } // namespace internal | 580 } // namespace internal |
| 581 } // namespace v8 | 581 } // namespace v8 |
| OLD | NEW |