| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 | 6 |
| 7 #include "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
| 8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/profiler.h" | 10 #include "vm/profiler.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 218 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 219 EXPECT_VALID(result); | 219 EXPECT_VALID(result); |
| 220 | 220 |
| 221 const int64_t after_allocations_micros = Dart_TimelineGetMicros(); | 221 const int64_t after_allocations_micros = Dart_TimelineGetMicros(); |
| 222 const int64_t allocation_extent_micros = | 222 const int64_t allocation_extent_micros = |
| 223 after_allocations_micros - before_allocations_micros; | 223 after_allocations_micros - before_allocations_micros; |
| 224 { | 224 { |
| 225 Thread* thread = Thread::Current(); | 225 Thread* thread = Thread::Current(); |
| 226 Isolate* isolate = thread->isolate(); | 226 Isolate* isolate = thread->isolate(); |
| 227 TransitionNativeToVM transition(thread); |
| 227 StackZone zone(thread); | 228 StackZone zone(thread); |
| 228 HANDLESCOPE(thread); | 229 HANDLESCOPE(thread); |
| 229 Profile profile(isolate); | 230 Profile profile(isolate); |
| 230 // Filter for the class in the time range. | 231 // Filter for the class in the time range. |
| 231 AllocationFilter filter(isolate->main_port(), class_a.id(), | 232 AllocationFilter filter(isolate->main_port(), class_a.id(), |
| 232 before_allocations_micros, | 233 before_allocations_micros, |
| 233 allocation_extent_micros); | 234 allocation_extent_micros); |
| 234 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 235 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 235 // We should have 1 allocation sample. | 236 // We should have 1 allocation sample. |
| 236 EXPECT_EQ(1, profile.sample_count()); | 237 EXPECT_EQ(1, profile.sample_count()); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName()); | 287 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName()); |
| 287 EXPECT(walker.Down()); | 288 EXPECT(walker.Down()); |
| 288 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); | 289 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); |
| 289 EXPECT(!walker.Down()); | 290 EXPECT(!walker.Down()); |
| 290 } | 291 } |
| 291 | 292 |
| 292 // Query with a time filter where no allocations occurred. | 293 // Query with a time filter where no allocations occurred. |
| 293 { | 294 { |
| 294 Thread* thread = Thread::Current(); | 295 Thread* thread = Thread::Current(); |
| 295 Isolate* isolate = thread->isolate(); | 296 Isolate* isolate = thread->isolate(); |
| 297 TransitionNativeToVM transition(thread); |
| 296 StackZone zone(thread); | 298 StackZone zone(thread); |
| 297 HANDLESCOPE(thread); | 299 HANDLESCOPE(thread); |
| 298 Profile profile(isolate); | 300 Profile profile(isolate); |
| 299 AllocationFilter filter(isolate->main_port(), class_a.id(), | 301 AllocationFilter filter(isolate->main_port(), class_a.id(), |
| 300 Dart_TimelineGetMicros(), 16000); | 302 Dart_TimelineGetMicros(), 16000); |
| 301 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 303 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 302 // We should have no allocation samples because none occured within | 304 // We should have no allocation samples because none occured within |
| 303 // the specified time range. | 305 // the specified time range. |
| 304 EXPECT_EQ(0, profile.sample_count()); | 306 EXPECT_EQ(0, profile.sample_count()); |
| 305 } | 307 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 332 MallocHooks::set_stack_trace_collection_enabled(false); | 334 MallocHooks::set_stack_trace_collection_enabled(false); |
| 333 const int64_t after_allocations_micros = Dart_TimelineGetMicros(); | 335 const int64_t after_allocations_micros = Dart_TimelineGetMicros(); |
| 334 const int64_t allocation_extent_micros = | 336 const int64_t allocation_extent_micros = |
| 335 after_allocations_micros - before_allocations_micros; | 337 after_allocations_micros - before_allocations_micros; |
| 336 | 338 |
| 337 // Walk the trie and do a sanity check of the allocation values associated | 339 // Walk the trie and do a sanity check of the allocation values associated |
| 338 // with each node. | 340 // with each node. |
| 339 { | 341 { |
| 340 Thread* thread = Thread::Current(); | 342 Thread* thread = Thread::Current(); |
| 341 Isolate* isolate = thread->isolate(); | 343 Isolate* isolate = thread->isolate(); |
| 344 TransitionNativeToVM transition(thread); |
| 342 StackZone zone(thread); | 345 StackZone zone(thread); |
| 343 HANDLESCOPE(thread); | 346 HANDLESCOPE(thread); |
| 344 Profile profile(isolate); | 347 Profile profile(isolate); |
| 345 | 348 |
| 346 // Filter for the class in the time range. | 349 // Filter for the class in the time range. |
| 347 NativeAllocationSampleFilter filter(before_allocations_micros, | 350 NativeAllocationSampleFilter filter(before_allocations_micros, |
| 348 allocation_extent_micros); | 351 allocation_extent_micros); |
| 349 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 352 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 350 // We should have 1 allocation sample. | 353 // We should have 1 allocation sample. |
| 351 EXPECT_EQ(1, profile.sample_count()); | 354 EXPECT_EQ(1, profile.sample_count()); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 | 477 |
| 475 MallocHooks::set_stack_trace_collection_enabled(true); | 478 MallocHooks::set_stack_trace_collection_enabled(true); |
| 476 free(result); | 479 free(result); |
| 477 MallocHooks::set_stack_trace_collection_enabled(false); | 480 MallocHooks::set_stack_trace_collection_enabled(false); |
| 478 | 481 |
| 479 // Check to see that the native allocation sample associated with the memory | 482 // Check to see that the native allocation sample associated with the memory |
| 480 // freed above is marked as free and is no longer reported. | 483 // freed above is marked as free and is no longer reported. |
| 481 { | 484 { |
| 482 Thread* thread = Thread::Current(); | 485 Thread* thread = Thread::Current(); |
| 483 Isolate* isolate = thread->isolate(); | 486 Isolate* isolate = thread->isolate(); |
| 487 TransitionNativeToVM transition(thread); |
| 484 StackZone zone(thread); | 488 StackZone zone(thread); |
| 485 HANDLESCOPE(thread); | 489 HANDLESCOPE(thread); |
| 486 Profile profile(isolate); | 490 Profile profile(isolate); |
| 487 | 491 |
| 488 // Filter for the class in the time range. | 492 // Filter for the class in the time range. |
| 489 NativeAllocationSampleFilter filter(before_allocations_micros, | 493 NativeAllocationSampleFilter filter(before_allocations_micros, |
| 490 allocation_extent_micros); | 494 allocation_extent_micros); |
| 491 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 495 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 492 // We should have 0 allocation samples since we freed the memory. | 496 // We should have 0 allocation samples since we freed the memory. |
| 493 EXPECT_EQ(0, profile.sample_count()); | 497 EXPECT_EQ(0, profile.sample_count()); |
| 494 } | 498 } |
| 495 | 499 |
| 496 // Query with a time filter where no allocations occurred. | 500 // Query with a time filter where no allocations occurred. |
| 497 { | 501 { |
| 498 Thread* thread = Thread::Current(); | 502 Thread* thread = Thread::Current(); |
| 499 Isolate* isolate = thread->isolate(); | 503 Isolate* isolate = thread->isolate(); |
| 504 TransitionNativeToVM transition(thread); |
| 500 StackZone zone(thread); | 505 StackZone zone(thread); |
| 501 HANDLESCOPE(thread); | 506 HANDLESCOPE(thread); |
| 502 Profile profile(isolate); | 507 Profile profile(isolate); |
| 503 NativeAllocationSampleFilter filter(Dart_TimelineGetMicros(), 16000); | 508 NativeAllocationSampleFilter filter(Dart_TimelineGetMicros(), 16000); |
| 504 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 509 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 505 // We should have no allocation samples because none occured within | 510 // We should have no allocation samples because none occured within |
| 506 // the specified time range. | 511 // the specified time range. |
| 507 EXPECT_EQ(0, profile.sample_count()); | 512 EXPECT_EQ(0, profile.sample_count()); |
| 508 } | 513 } |
| 509 | 514 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 538 | 543 |
| 539 const Class& class_a = Class::Handle(GetClass(root_library, "A")); | 544 const Class& class_a = Class::Handle(GetClass(root_library, "A")); |
| 540 EXPECT(!class_a.IsNull()); | 545 EXPECT(!class_a.IsNull()); |
| 541 | 546 |
| 542 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 547 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 543 EXPECT_VALID(result); | 548 EXPECT_VALID(result); |
| 544 | 549 |
| 545 { | 550 { |
| 546 Thread* thread = Thread::Current(); | 551 Thread* thread = Thread::Current(); |
| 547 Isolate* isolate = thread->isolate(); | 552 Isolate* isolate = thread->isolate(); |
| 553 TransitionNativeToVM transition(thread); |
| 548 StackZone zone(thread); | 554 StackZone zone(thread); |
| 549 HANDLESCOPE(thread); | 555 HANDLESCOPE(thread); |
| 550 Profile profile(isolate); | 556 Profile profile(isolate); |
| 551 AllocationFilter filter(isolate->main_port(), class_a.id()); | 557 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 552 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 558 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 553 // We should have no allocation samples. | 559 // We should have no allocation samples. |
| 554 EXPECT_EQ(0, profile.sample_count()); | 560 EXPECT_EQ(0, profile.sample_count()); |
| 555 } | 561 } |
| 556 | 562 |
| 557 // Turn on allocation tracing for A. | 563 // Turn on allocation tracing for A. |
| 558 class_a.SetTraceAllocation(true); | 564 class_a.SetTraceAllocation(true); |
| 559 | 565 |
| 560 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 566 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 561 EXPECT_VALID(result); | 567 EXPECT_VALID(result); |
| 562 | 568 |
| 563 { | 569 { |
| 564 Thread* thread = Thread::Current(); | 570 Thread* thread = Thread::Current(); |
| 565 Isolate* isolate = thread->isolate(); | 571 Isolate* isolate = thread->isolate(); |
| 572 TransitionNativeToVM transition(thread); |
| 566 StackZone zone(thread); | 573 StackZone zone(thread); |
| 567 HANDLESCOPE(thread); | 574 HANDLESCOPE(thread); |
| 568 Profile profile(isolate); | 575 Profile profile(isolate); |
| 569 AllocationFilter filter(isolate->main_port(), class_a.id()); | 576 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 570 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 577 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 571 // We should have one allocation sample. | 578 // We should have one allocation sample. |
| 572 EXPECT_EQ(1, profile.sample_count()); | 579 EXPECT_EQ(1, profile.sample_count()); |
| 573 ProfileTrieWalker walker(&profile); | 580 ProfileTrieWalker walker(&profile); |
| 574 | 581 |
| 575 // Exclusive code: B.boo -> main. | 582 // Exclusive code: B.boo -> main. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 | 634 |
| 628 // Turn off allocation tracing for A. | 635 // Turn off allocation tracing for A. |
| 629 class_a.SetTraceAllocation(false); | 636 class_a.SetTraceAllocation(false); |
| 630 | 637 |
| 631 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 638 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 632 EXPECT_VALID(result); | 639 EXPECT_VALID(result); |
| 633 | 640 |
| 634 { | 641 { |
| 635 Thread* thread = Thread::Current(); | 642 Thread* thread = Thread::Current(); |
| 636 Isolate* isolate = thread->isolate(); | 643 Isolate* isolate = thread->isolate(); |
| 644 TransitionNativeToVM transition(thread); |
| 637 StackZone zone(thread); | 645 StackZone zone(thread); |
| 638 HANDLESCOPE(thread); | 646 HANDLESCOPE(thread); |
| 639 Profile profile(isolate); | 647 Profile profile(isolate); |
| 640 AllocationFilter filter(isolate->main_port(), class_a.id()); | 648 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 641 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 649 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 642 // We should still only have one allocation sample. | 650 // We should still only have one allocation sample. |
| 643 EXPECT_EQ(1, profile.sample_count()); | 651 EXPECT_EQ(1, profile.sample_count()); |
| 644 } | 652 } |
| 645 } | 653 } |
| 646 | 654 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 667 | 675 |
| 668 const Class& class_a = Class::Handle(GetClass(root_library, "A")); | 676 const Class& class_a = Class::Handle(GetClass(root_library, "A")); |
| 669 EXPECT(!class_a.IsNull()); | 677 EXPECT(!class_a.IsNull()); |
| 670 | 678 |
| 671 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 679 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 672 EXPECT_VALID(result); | 680 EXPECT_VALID(result); |
| 673 | 681 |
| 674 { | 682 { |
| 675 Thread* thread = Thread::Current(); | 683 Thread* thread = Thread::Current(); |
| 676 Isolate* isolate = thread->isolate(); | 684 Isolate* isolate = thread->isolate(); |
| 685 TransitionNativeToVM transition(thread); |
| 677 StackZone zone(thread); | 686 StackZone zone(thread); |
| 678 HANDLESCOPE(thread); | 687 HANDLESCOPE(thread); |
| 679 Profile profile(isolate); | 688 Profile profile(isolate); |
| 680 AllocationFilter filter(isolate->main_port(), class_a.id()); | 689 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 681 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 690 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 682 // We should have no allocation samples. | 691 // We should have no allocation samples. |
| 683 EXPECT_EQ(0, profile.sample_count()); | 692 EXPECT_EQ(0, profile.sample_count()); |
| 684 } | 693 } |
| 685 | 694 |
| 686 // Turn on allocation tracing for A. | 695 // Turn on allocation tracing for A. |
| 687 class_a.SetTraceAllocation(true); | 696 class_a.SetTraceAllocation(true); |
| 688 | 697 |
| 689 // Allocate three times. | 698 // Allocate three times. |
| 690 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 699 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 691 EXPECT_VALID(result); | 700 EXPECT_VALID(result); |
| 692 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 701 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 693 EXPECT_VALID(result); | 702 EXPECT_VALID(result); |
| 694 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 703 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 695 EXPECT_VALID(result); | 704 EXPECT_VALID(result); |
| 696 | 705 |
| 697 { | 706 { |
| 698 Thread* thread = Thread::Current(); | 707 Thread* thread = Thread::Current(); |
| 699 Isolate* isolate = thread->isolate(); | 708 Isolate* isolate = thread->isolate(); |
| 709 TransitionNativeToVM transition(thread); |
| 700 StackZone zone(thread); | 710 StackZone zone(thread); |
| 701 HANDLESCOPE(thread); | 711 HANDLESCOPE(thread); |
| 702 Profile profile(isolate); | 712 Profile profile(isolate); |
| 703 AllocationFilter filter(isolate->main_port(), class_a.id()); | 713 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 704 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 714 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 705 // We should have three allocation samples. | 715 // We should have three allocation samples. |
| 706 EXPECT_EQ(3, profile.sample_count()); | 716 EXPECT_EQ(3, profile.sample_count()); |
| 707 ProfileTrieWalker walker(&profile); | 717 ProfileTrieWalker walker(&profile); |
| 708 | 718 |
| 709 // Exclusive code: B.boo -> main. | 719 // Exclusive code: B.boo -> main. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 | 779 |
| 770 const Class& class_a = Class::Handle(GetClass(root_library, "A")); | 780 const Class& class_a = Class::Handle(GetClass(root_library, "A")); |
| 771 EXPECT(!class_a.IsNull()); | 781 EXPECT(!class_a.IsNull()); |
| 772 | 782 |
| 773 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 783 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 774 EXPECT_VALID(result); | 784 EXPECT_VALID(result); |
| 775 | 785 |
| 776 { | 786 { |
| 777 Thread* thread = Thread::Current(); | 787 Thread* thread = Thread::Current(); |
| 778 Isolate* isolate = thread->isolate(); | 788 Isolate* isolate = thread->isolate(); |
| 789 TransitionNativeToVM transition(thread); |
| 779 StackZone zone(thread); | 790 StackZone zone(thread); |
| 780 HANDLESCOPE(thread); | 791 HANDLESCOPE(thread); |
| 781 Profile profile(isolate); | 792 Profile profile(isolate); |
| 782 AllocationFilter filter(isolate->main_port(), class_a.id()); | 793 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 783 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 794 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 784 // We should have no allocation samples. | 795 // We should have no allocation samples. |
| 785 EXPECT_EQ(0, profile.sample_count()); | 796 EXPECT_EQ(0, profile.sample_count()); |
| 786 } | 797 } |
| 787 | 798 |
| 788 // Turn on allocation tracing for A. | 799 // Turn on allocation tracing for A. |
| 789 class_a.SetTraceAllocation(true); | 800 class_a.SetTraceAllocation(true); |
| 790 | 801 |
| 791 // Allocate three times. | 802 // Allocate three times. |
| 792 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 803 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 793 EXPECT_VALID(result); | 804 EXPECT_VALID(result); |
| 794 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 805 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 795 EXPECT_VALID(result); | 806 EXPECT_VALID(result); |
| 796 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 807 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 797 EXPECT_VALID(result); | 808 EXPECT_VALID(result); |
| 798 | 809 |
| 799 { | 810 { |
| 800 Thread* thread = Thread::Current(); | 811 Thread* thread = Thread::Current(); |
| 801 Isolate* isolate = thread->isolate(); | 812 Isolate* isolate = thread->isolate(); |
| 813 TransitionNativeToVM transition(thread); |
| 802 StackZone zone(thread); | 814 StackZone zone(thread); |
| 803 HANDLESCOPE(thread); | 815 HANDLESCOPE(thread); |
| 804 Profile profile(isolate); | 816 Profile profile(isolate); |
| 805 AllocationFilter filter(isolate->main_port(), class_a.id()); | 817 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 806 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 818 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 807 // We should have three allocation samples. | 819 // We should have three allocation samples. |
| 808 EXPECT_EQ(3, profile.sample_count()); | 820 EXPECT_EQ(3, profile.sample_count()); |
| 809 ProfileTrieWalker walker(&profile); | 821 ProfileTrieWalker walker(&profile); |
| 810 | 822 |
| 811 // Exclusive function: B.boo -> main. | 823 // Exclusive function: B.boo -> main. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 EXPECT(!double_class.IsNull()); | 874 EXPECT(!double_class.IsNull()); |
| 863 | 875 |
| 864 Dart_Handle args[2] = { | 876 Dart_Handle args[2] = { |
| 865 Dart_NewDouble(1.0), Dart_NewDouble(2.0), | 877 Dart_NewDouble(1.0), Dart_NewDouble(2.0), |
| 866 }; | 878 }; |
| 867 | 879 |
| 868 Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); | 880 Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); |
| 869 EXPECT_VALID(result); | 881 EXPECT_VALID(result); |
| 870 | 882 |
| 871 { | 883 { |
| 884 TransitionNativeToVM transition(thread); |
| 872 StackZone zone(thread); | 885 StackZone zone(thread); |
| 873 HANDLESCOPE(thread); | 886 HANDLESCOPE(thread); |
| 874 Profile profile(isolate); | 887 Profile profile(isolate); |
| 875 AllocationFilter filter(isolate->main_port(), double_class.id()); | 888 AllocationFilter filter(isolate->main_port(), double_class.id()); |
| 876 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 889 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 877 // We should have no allocation samples. | 890 // We should have no allocation samples. |
| 878 EXPECT_EQ(0, profile.sample_count()); | 891 EXPECT_EQ(0, profile.sample_count()); |
| 879 } | 892 } |
| 880 | 893 |
| 881 double_class.SetTraceAllocation(true); | 894 double_class.SetTraceAllocation(true); |
| 882 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); | 895 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); |
| 883 EXPECT_VALID(result); | 896 EXPECT_VALID(result); |
| 884 | 897 |
| 885 { | 898 { |
| 899 TransitionNativeToVM transition(thread); |
| 886 StackZone zone(thread); | 900 StackZone zone(thread); |
| 887 HANDLESCOPE(thread); | 901 HANDLESCOPE(thread); |
| 888 Profile profile(isolate); | 902 Profile profile(isolate); |
| 889 AllocationFilter filter(isolate->main_port(), double_class.id()); | 903 AllocationFilter filter(isolate->main_port(), double_class.id()); |
| 890 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 904 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 891 // We should have one allocation sample. | 905 // We should have one allocation sample. |
| 892 EXPECT_EQ(1, profile.sample_count()); | 906 EXPECT_EQ(1, profile.sample_count()); |
| 893 ProfileTrieWalker walker(&profile); | 907 ProfileTrieWalker walker(&profile); |
| 894 | 908 |
| 895 walker.Reset(Profile::kExclusiveCode); | 909 walker.Reset(Profile::kExclusiveCode); |
| 896 EXPECT(walker.Down()); | 910 EXPECT(walker.Down()); |
| 897 EXPECT_STREQ("Double_add", walker.CurrentName()); | 911 EXPECT_STREQ("Double_add", walker.CurrentName()); |
| 898 EXPECT(walker.Down()); | 912 EXPECT(walker.Down()); |
| 899 EXPECT_STREQ("_Double._add", walker.CurrentName()); | 913 EXPECT_STREQ("_Double._add", walker.CurrentName()); |
| 900 EXPECT(walker.Down()); | 914 EXPECT(walker.Down()); |
| 901 EXPECT_STREQ("_Double.+", walker.CurrentName()); | 915 EXPECT_STREQ("_Double.+", walker.CurrentName()); |
| 902 EXPECT(walker.Down()); | 916 EXPECT(walker.Down()); |
| 903 EXPECT_STREQ("foo", walker.CurrentName()); | 917 EXPECT_STREQ("foo", walker.CurrentName()); |
| 904 EXPECT(!walker.Down()); | 918 EXPECT(!walker.Down()); |
| 905 } | 919 } |
| 906 | 920 |
| 907 double_class.SetTraceAllocation(false); | 921 double_class.SetTraceAllocation(false); |
| 908 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); | 922 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); |
| 909 EXPECT_VALID(result); | 923 EXPECT_VALID(result); |
| 910 | 924 |
| 911 { | 925 { |
| 926 TransitionNativeToVM transition(thread); |
| 912 StackZone zone(thread); | 927 StackZone zone(thread); |
| 913 HANDLESCOPE(thread); | 928 HANDLESCOPE(thread); |
| 914 Profile profile(isolate); | 929 Profile profile(isolate); |
| 915 AllocationFilter filter(isolate->main_port(), double_class.id()); | 930 AllocationFilter filter(isolate->main_port(), double_class.id()); |
| 916 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 931 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 917 // We should still only have one allocation sample. | 932 // We should still only have one allocation sample. |
| 918 EXPECT_EQ(1, profile.sample_count()); | 933 EXPECT_EQ(1, profile.sample_count()); |
| 919 } | 934 } |
| 920 } | 935 } |
| 921 | 936 |
| 922 TEST_CASE(Profiler_ArrayAllocation) { | 937 TEST_CASE(Profiler_ArrayAllocation) { |
| 923 DisableNativeProfileScope dnps; | 938 DisableNativeProfileScope dnps; |
| 924 const char* kScript = | 939 const char* kScript = |
| 925 "List foo() => new List(4);\n" | 940 "List foo() => new List(4);\n" |
| 926 "List bar() => new List();\n"; | 941 "List bar() => new List();\n"; |
| 927 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); | 942 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); |
| 928 EXPECT_VALID(lib); | 943 EXPECT_VALID(lib); |
| 929 Library& root_library = Library::Handle(); | 944 Library& root_library = Library::Handle(); |
| 930 root_library ^= Api::UnwrapHandle(lib); | 945 root_library ^= Api::UnwrapHandle(lib); |
| 931 Isolate* isolate = thread->isolate(); | 946 Isolate* isolate = thread->isolate(); |
| 932 | 947 |
| 933 const Class& array_class = | 948 const Class& array_class = |
| 934 Class::Handle(isolate->object_store()->array_class()); | 949 Class::Handle(isolate->object_store()->array_class()); |
| 935 EXPECT(!array_class.IsNull()); | 950 EXPECT(!array_class.IsNull()); |
| 936 | 951 |
| 937 Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 0, NULL); | 952 Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
| 938 EXPECT_VALID(result); | 953 EXPECT_VALID(result); |
| 939 | 954 |
| 940 { | 955 { |
| 956 TransitionNativeToVM transition(thread); |
| 941 StackZone zone(thread); | 957 StackZone zone(thread); |
| 942 HANDLESCOPE(thread); | 958 HANDLESCOPE(thread); |
| 943 Profile profile(isolate); | 959 Profile profile(isolate); |
| 944 AllocationFilter filter(isolate->main_port(), array_class.id()); | 960 AllocationFilter filter(isolate->main_port(), array_class.id()); |
| 945 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 961 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 946 // We should have no allocation samples. | 962 // We should have no allocation samples. |
| 947 EXPECT_EQ(0, profile.sample_count()); | 963 EXPECT_EQ(0, profile.sample_count()); |
| 948 } | 964 } |
| 949 | 965 |
| 950 array_class.SetTraceAllocation(true); | 966 array_class.SetTraceAllocation(true); |
| 951 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); | 967 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
| 952 EXPECT_VALID(result); | 968 EXPECT_VALID(result); |
| 953 | 969 |
| 954 { | 970 { |
| 971 TransitionNativeToVM transition(thread); |
| 955 StackZone zone(thread); | 972 StackZone zone(thread); |
| 956 HANDLESCOPE(thread); | 973 HANDLESCOPE(thread); |
| 957 Profile profile(isolate); | 974 Profile profile(isolate); |
| 958 AllocationFilter filter(isolate->main_port(), array_class.id()); | 975 AllocationFilter filter(isolate->main_port(), array_class.id()); |
| 959 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 976 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 960 // We should have one allocation sample. | 977 // We should have one allocation sample. |
| 961 EXPECT_EQ(1, profile.sample_count()); | 978 EXPECT_EQ(1, profile.sample_count()); |
| 962 ProfileTrieWalker walker(&profile); | 979 ProfileTrieWalker walker(&profile); |
| 963 | 980 |
| 964 walker.Reset(Profile::kExclusiveCode); | 981 walker.Reset(Profile::kExclusiveCode); |
| 965 EXPECT(walker.Down()); | 982 EXPECT(walker.Down()); |
| 966 EXPECT_STREQ("DRT_AllocateArray", walker.CurrentName()); | 983 EXPECT_STREQ("DRT_AllocateArray", walker.CurrentName()); |
| 967 EXPECT(walker.Down()); | 984 EXPECT(walker.Down()); |
| 968 EXPECT_STREQ("[Stub] AllocateArray", walker.CurrentName()); | 985 EXPECT_STREQ("[Stub] AllocateArray", walker.CurrentName()); |
| 969 EXPECT(walker.Down()); | 986 EXPECT(walker.Down()); |
| 970 EXPECT_STREQ("new _List", walker.CurrentName()); | 987 EXPECT_STREQ("new _List", walker.CurrentName()); |
| 971 EXPECT(walker.Down()); | 988 EXPECT(walker.Down()); |
| 972 EXPECT_STREQ("new List._internal", walker.CurrentName()); | 989 EXPECT_STREQ("new List._internal", walker.CurrentName()); |
| 973 EXPECT(walker.Down()); | 990 EXPECT(walker.Down()); |
| 974 EXPECT_STREQ("foo", walker.CurrentName()); | 991 EXPECT_STREQ("foo", walker.CurrentName()); |
| 975 EXPECT(!walker.Down()); | 992 EXPECT(!walker.Down()); |
| 976 } | 993 } |
| 977 | 994 |
| 978 array_class.SetTraceAllocation(false); | 995 array_class.SetTraceAllocation(false); |
| 979 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); | 996 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
| 980 EXPECT_VALID(result); | 997 EXPECT_VALID(result); |
| 981 | 998 |
| 982 { | 999 { |
| 1000 TransitionNativeToVM transition(thread); |
| 983 StackZone zone(thread); | 1001 StackZone zone(thread); |
| 984 HANDLESCOPE(thread); | 1002 HANDLESCOPE(thread); |
| 985 Profile profile(isolate); | 1003 Profile profile(isolate); |
| 986 AllocationFilter filter(isolate->main_port(), array_class.id()); | 1004 AllocationFilter filter(isolate->main_port(), array_class.id()); |
| 987 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1005 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 988 // We should still only have one allocation sample. | 1006 // We should still only have one allocation sample. |
| 989 EXPECT_EQ(1, profile.sample_count()); | 1007 EXPECT_EQ(1, profile.sample_count()); |
| 990 } | 1008 } |
| 991 | 1009 |
| 992 // Clear the samples. | 1010 // Clear the samples. |
| 993 ProfilerService::ClearSamples(); | 1011 ProfilerService::ClearSamples(); |
| 994 | 1012 |
| 995 // Compile bar (many List objects allocated). | 1013 // Compile bar (many List objects allocated). |
| 996 result = Dart_Invoke(lib, NewString("bar"), 0, NULL); | 1014 result = Dart_Invoke(lib, NewString("bar"), 0, NULL); |
| 997 EXPECT_VALID(result); | 1015 EXPECT_VALID(result); |
| 998 | 1016 |
| 999 // Enable again. | 1017 // Enable again. |
| 1000 array_class.SetTraceAllocation(true); | 1018 array_class.SetTraceAllocation(true); |
| 1001 | 1019 |
| 1002 // Run bar. | 1020 // Run bar. |
| 1003 result = Dart_Invoke(lib, NewString("bar"), 0, NULL); | 1021 result = Dart_Invoke(lib, NewString("bar"), 0, NULL); |
| 1004 EXPECT_VALID(result); | 1022 EXPECT_VALID(result); |
| 1005 | 1023 |
| 1006 { | 1024 { |
| 1025 TransitionNativeToVM transition(thread); |
| 1007 StackZone zone(thread); | 1026 StackZone zone(thread); |
| 1008 HANDLESCOPE(thread); | 1027 HANDLESCOPE(thread); |
| 1009 Profile profile(isolate); | 1028 Profile profile(isolate); |
| 1010 AllocationFilter filter(isolate->main_port(), array_class.id()); | 1029 AllocationFilter filter(isolate->main_port(), array_class.id()); |
| 1011 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1030 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1012 // We should have no allocation samples, since empty | 1031 // We should have no allocation samples, since empty |
| 1013 // growable lists use a shared backing. | 1032 // growable lists use a shared backing. |
| 1014 EXPECT_EQ(0, profile.sample_count()); | 1033 EXPECT_EQ(0, profile.sample_count()); |
| 1015 } | 1034 } |
| 1016 } | 1035 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1029 root_library ^= Api::UnwrapHandle(lib); | 1048 root_library ^= Api::UnwrapHandle(lib); |
| 1030 Isolate* isolate = thread->isolate(); | 1049 Isolate* isolate = thread->isolate(); |
| 1031 | 1050 |
| 1032 const Class& context_class = Class::Handle(Object::context_class()); | 1051 const Class& context_class = Class::Handle(Object::context_class()); |
| 1033 EXPECT(!context_class.IsNull()); | 1052 EXPECT(!context_class.IsNull()); |
| 1034 | 1053 |
| 1035 Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 0, NULL); | 1054 Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
| 1036 EXPECT_VALID(result); | 1055 EXPECT_VALID(result); |
| 1037 | 1056 |
| 1038 { | 1057 { |
| 1058 TransitionNativeToVM transition(thread); |
| 1039 StackZone zone(thread); | 1059 StackZone zone(thread); |
| 1040 HANDLESCOPE(thread); | 1060 HANDLESCOPE(thread); |
| 1041 Profile profile(isolate); | 1061 Profile profile(isolate); |
| 1042 AllocationFilter filter(isolate->main_port(), context_class.id()); | 1062 AllocationFilter filter(isolate->main_port(), context_class.id()); |
| 1043 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1063 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1044 // We should have no allocation samples. | 1064 // We should have no allocation samples. |
| 1045 EXPECT_EQ(0, profile.sample_count()); | 1065 EXPECT_EQ(0, profile.sample_count()); |
| 1046 } | 1066 } |
| 1047 | 1067 |
| 1048 context_class.SetTraceAllocation(true); | 1068 context_class.SetTraceAllocation(true); |
| 1049 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); | 1069 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
| 1050 EXPECT_VALID(result); | 1070 EXPECT_VALID(result); |
| 1051 | 1071 |
| 1052 { | 1072 { |
| 1073 TransitionNativeToVM transition(thread); |
| 1053 StackZone zone(thread); | 1074 StackZone zone(thread); |
| 1054 HANDLESCOPE(thread); | 1075 HANDLESCOPE(thread); |
| 1055 Profile profile(isolate); | 1076 Profile profile(isolate); |
| 1056 AllocationFilter filter(isolate->main_port(), context_class.id()); | 1077 AllocationFilter filter(isolate->main_port(), context_class.id()); |
| 1057 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1078 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1058 // We should have one allocation sample. | 1079 // We should have one allocation sample. |
| 1059 EXPECT_EQ(1, profile.sample_count()); | 1080 EXPECT_EQ(1, profile.sample_count()); |
| 1060 ProfileTrieWalker walker(&profile); | 1081 ProfileTrieWalker walker(&profile); |
| 1061 | 1082 |
| 1062 walker.Reset(Profile::kExclusiveCode); | 1083 walker.Reset(Profile::kExclusiveCode); |
| 1063 EXPECT(walker.Down()); | 1084 EXPECT(walker.Down()); |
| 1064 EXPECT_STREQ("DRT_AllocateContext", walker.CurrentName()); | 1085 EXPECT_STREQ("DRT_AllocateContext", walker.CurrentName()); |
| 1065 EXPECT(walker.Down()); | 1086 EXPECT(walker.Down()); |
| 1066 EXPECT_STREQ("[Stub] AllocateContext", walker.CurrentName()); | 1087 EXPECT_STREQ("[Stub] AllocateContext", walker.CurrentName()); |
| 1067 EXPECT(walker.Down()); | 1088 EXPECT(walker.Down()); |
| 1068 EXPECT_STREQ("foo", walker.CurrentName()); | 1089 EXPECT_STREQ("foo", walker.CurrentName()); |
| 1069 EXPECT(!walker.Down()); | 1090 EXPECT(!walker.Down()); |
| 1070 } | 1091 } |
| 1071 | 1092 |
| 1072 context_class.SetTraceAllocation(false); | 1093 context_class.SetTraceAllocation(false); |
| 1073 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); | 1094 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
| 1074 EXPECT_VALID(result); | 1095 EXPECT_VALID(result); |
| 1075 | 1096 |
| 1076 { | 1097 { |
| 1098 TransitionNativeToVM transition(thread); |
| 1077 StackZone zone(thread); | 1099 StackZone zone(thread); |
| 1078 HANDLESCOPE(thread); | 1100 HANDLESCOPE(thread); |
| 1079 Profile profile(isolate); | 1101 Profile profile(isolate); |
| 1080 AllocationFilter filter(isolate->main_port(), context_class.id()); | 1102 AllocationFilter filter(isolate->main_port(), context_class.id()); |
| 1081 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1103 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1082 // We should still only have one allocation sample. | 1104 // We should still only have one allocation sample. |
| 1083 EXPECT_EQ(1, profile.sample_count()); | 1105 EXPECT_EQ(1, profile.sample_count()); |
| 1084 } | 1106 } |
| 1085 } | 1107 } |
| 1086 | 1108 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1109 const Class& closure_class = | 1131 const Class& closure_class = |
| 1110 Class::Handle(Isolate::Current()->object_store()->closure_class()); | 1132 Class::Handle(Isolate::Current()->object_store()->closure_class()); |
| 1111 EXPECT(!closure_class.IsNull()); | 1133 EXPECT(!closure_class.IsNull()); |
| 1112 closure_class.SetTraceAllocation(true); | 1134 closure_class.SetTraceAllocation(true); |
| 1113 | 1135 |
| 1114 // Invoke "foo" which during compilation, triggers a closure allocation. | 1136 // Invoke "foo" which during compilation, triggers a closure allocation. |
| 1115 Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 0, NULL); | 1137 Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
| 1116 EXPECT_VALID(result); | 1138 EXPECT_VALID(result); |
| 1117 | 1139 |
| 1118 { | 1140 { |
| 1141 TransitionNativeToVM transition(thread); |
| 1119 StackZone zone(thread); | 1142 StackZone zone(thread); |
| 1120 HANDLESCOPE(thread); | 1143 HANDLESCOPE(thread); |
| 1121 Profile profile(isolate); | 1144 Profile profile(isolate); |
| 1122 AllocationFilter filter(isolate->main_port(), closure_class.id()); | 1145 AllocationFilter filter(isolate->main_port(), closure_class.id()); |
| 1123 filter.set_enable_vm_ticks(true); | 1146 filter.set_enable_vm_ticks(true); |
| 1124 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1147 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1125 // We should have one allocation sample. | 1148 // We should have one allocation sample. |
| 1126 EXPECT_EQ(1, profile.sample_count()); | 1149 EXPECT_EQ(1, profile.sample_count()); |
| 1127 ProfileTrieWalker walker(&profile); | 1150 ProfileTrieWalker walker(&profile); |
| 1128 | 1151 |
| 1129 walker.Reset(Profile::kExclusiveCode); | 1152 walker.Reset(Profile::kExclusiveCode); |
| 1130 EXPECT(walker.Down()); | 1153 EXPECT(walker.Down()); |
| 1131 EXPECT_SUBSTRING("DRT_AllocateObject", walker.CurrentName()); | 1154 EXPECT_SUBSTRING("DRT_AllocateObject", walker.CurrentName()); |
| 1132 EXPECT(walker.Down()); | 1155 EXPECT(walker.Down()); |
| 1133 EXPECT_STREQ("[Stub] Allocate _Closure", walker.CurrentName()); | 1156 EXPECT_STREQ("[Stub] Allocate _Closure", walker.CurrentName()); |
| 1134 EXPECT(walker.Down()); | 1157 EXPECT(walker.Down()); |
| 1135 EXPECT_SUBSTRING("foo", walker.CurrentName()); | 1158 EXPECT_SUBSTRING("foo", walker.CurrentName()); |
| 1136 EXPECT(!walker.Down()); | 1159 EXPECT(!walker.Down()); |
| 1137 } | 1160 } |
| 1138 | 1161 |
| 1139 // Disable allocation tracing for Closure. | 1162 // Disable allocation tracing for Closure. |
| 1140 closure_class.SetTraceAllocation(false); | 1163 closure_class.SetTraceAllocation(false); |
| 1141 | 1164 |
| 1142 // Invoke "bar" which during compilation, triggers a closure allocation. | 1165 // Invoke "bar" which during compilation, triggers a closure allocation. |
| 1143 result = Dart_Invoke(lib, NewString("bar"), 0, NULL); | 1166 result = Dart_Invoke(lib, NewString("bar"), 0, NULL); |
| 1144 EXPECT_VALID(result); | 1167 EXPECT_VALID(result); |
| 1145 | 1168 |
| 1146 { | 1169 { |
| 1170 TransitionNativeToVM transition(thread); |
| 1147 StackZone zone(thread); | 1171 StackZone zone(thread); |
| 1148 HANDLESCOPE(thread); | 1172 HANDLESCOPE(thread); |
| 1149 Profile profile(isolate); | 1173 Profile profile(isolate); |
| 1150 AllocationFilter filter(isolate->main_port(), closure_class.id()); | 1174 AllocationFilter filter(isolate->main_port(), closure_class.id()); |
| 1151 filter.set_enable_vm_ticks(true); | 1175 filter.set_enable_vm_ticks(true); |
| 1152 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1176 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1153 // We should still only have one allocation sample. | 1177 // We should still only have one allocation sample. |
| 1154 EXPECT_EQ(1, profile.sample_count()); | 1178 EXPECT_EQ(1, profile.sample_count()); |
| 1155 } | 1179 } |
| 1156 } | 1180 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1170 Library::Handle(isolate->object_store()->typed_data_library()); | 1194 Library::Handle(isolate->object_store()->typed_data_library()); |
| 1171 | 1195 |
| 1172 const Class& float32_list_class = | 1196 const Class& float32_list_class = |
| 1173 Class::Handle(GetClass(typed_data_library, "_Float32List")); | 1197 Class::Handle(GetClass(typed_data_library, "_Float32List")); |
| 1174 EXPECT(!float32_list_class.IsNull()); | 1198 EXPECT(!float32_list_class.IsNull()); |
| 1175 | 1199 |
| 1176 Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 0, NULL); | 1200 Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
| 1177 EXPECT_VALID(result); | 1201 EXPECT_VALID(result); |
| 1178 | 1202 |
| 1179 { | 1203 { |
| 1204 TransitionNativeToVM transition(thread); |
| 1180 StackZone zone(thread); | 1205 StackZone zone(thread); |
| 1181 HANDLESCOPE(thread); | 1206 HANDLESCOPE(thread); |
| 1182 Profile profile(isolate); | 1207 Profile profile(isolate); |
| 1183 AllocationFilter filter(isolate->main_port(), float32_list_class.id()); | 1208 AllocationFilter filter(isolate->main_port(), float32_list_class.id()); |
| 1184 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1209 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1185 // We should have no allocation samples. | 1210 // We should have no allocation samples. |
| 1186 EXPECT_EQ(0, profile.sample_count()); | 1211 EXPECT_EQ(0, profile.sample_count()); |
| 1187 } | 1212 } |
| 1188 | 1213 |
| 1189 float32_list_class.SetTraceAllocation(true); | 1214 float32_list_class.SetTraceAllocation(true); |
| 1190 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); | 1215 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
| 1191 EXPECT_VALID(result); | 1216 EXPECT_VALID(result); |
| 1192 | 1217 |
| 1193 { | 1218 { |
| 1219 TransitionNativeToVM transition(thread); |
| 1194 StackZone zone(thread); | 1220 StackZone zone(thread); |
| 1195 HANDLESCOPE(thread); | 1221 HANDLESCOPE(thread); |
| 1196 Profile profile(isolate); | 1222 Profile profile(isolate); |
| 1197 AllocationFilter filter(isolate->main_port(), float32_list_class.id()); | 1223 AllocationFilter filter(isolate->main_port(), float32_list_class.id()); |
| 1198 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1224 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1199 // We should have one allocation sample. | 1225 // We should have one allocation sample. |
| 1200 EXPECT_EQ(1, profile.sample_count()); | 1226 EXPECT_EQ(1, profile.sample_count()); |
| 1201 ProfileTrieWalker walker(&profile); | 1227 ProfileTrieWalker walker(&profile); |
| 1202 | 1228 |
| 1203 walker.Reset(Profile::kExclusiveCode); | 1229 walker.Reset(Profile::kExclusiveCode); |
| 1204 EXPECT(walker.Down()); | 1230 EXPECT(walker.Down()); |
| 1205 EXPECT_STREQ("TypedData_Float32Array_new", walker.CurrentName()); | 1231 EXPECT_STREQ("TypedData_Float32Array_new", walker.CurrentName()); |
| 1206 EXPECT(walker.Down()); | 1232 EXPECT(walker.Down()); |
| 1207 EXPECT_STREQ("new Float32List", walker.CurrentName()); | 1233 EXPECT_STREQ("new Float32List", walker.CurrentName()); |
| 1208 EXPECT(walker.Down()); | 1234 EXPECT(walker.Down()); |
| 1209 EXPECT_STREQ("foo", walker.CurrentName()); | 1235 EXPECT_STREQ("foo", walker.CurrentName()); |
| 1210 EXPECT(!walker.Down()); | 1236 EXPECT(!walker.Down()); |
| 1211 } | 1237 } |
| 1212 | 1238 |
| 1213 float32_list_class.SetTraceAllocation(false); | 1239 float32_list_class.SetTraceAllocation(false); |
| 1214 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); | 1240 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
| 1215 EXPECT_VALID(result); | 1241 EXPECT_VALID(result); |
| 1216 | 1242 |
| 1217 { | 1243 { |
| 1244 TransitionNativeToVM transition(thread); |
| 1218 StackZone zone(thread); | 1245 StackZone zone(thread); |
| 1219 HANDLESCOPE(thread); | 1246 HANDLESCOPE(thread); |
| 1220 Profile profile(isolate); | 1247 Profile profile(isolate); |
| 1221 AllocationFilter filter(isolate->main_port(), float32_list_class.id()); | 1248 AllocationFilter filter(isolate->main_port(), float32_list_class.id()); |
| 1222 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1249 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1223 // We should still only have one allocation sample. | 1250 // We should still only have one allocation sample. |
| 1224 EXPECT_EQ(1, profile.sample_count()); | 1251 EXPECT_EQ(1, profile.sample_count()); |
| 1225 } | 1252 } |
| 1226 | 1253 |
| 1227 float32_list_class.SetTraceAllocation(true); | 1254 float32_list_class.SetTraceAllocation(true); |
| 1228 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); | 1255 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
| 1229 EXPECT_VALID(result); | 1256 EXPECT_VALID(result); |
| 1230 | 1257 |
| 1231 { | 1258 { |
| 1259 TransitionNativeToVM transition(thread); |
| 1232 StackZone zone(thread); | 1260 StackZone zone(thread); |
| 1233 HANDLESCOPE(thread); | 1261 HANDLESCOPE(thread); |
| 1234 Profile profile(isolate); | 1262 Profile profile(isolate); |
| 1235 AllocationFilter filter(isolate->main_port(), float32_list_class.id()); | 1263 AllocationFilter filter(isolate->main_port(), float32_list_class.id()); |
| 1236 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1264 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1237 // We should now have two allocation samples. | 1265 // We should now have two allocation samples. |
| 1238 EXPECT_EQ(2, profile.sample_count()); | 1266 EXPECT_EQ(2, profile.sample_count()); |
| 1239 } | 1267 } |
| 1240 } | 1268 } |
| 1241 | 1269 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1253 EXPECT(!one_byte_string_class.IsNull()); | 1281 EXPECT(!one_byte_string_class.IsNull()); |
| 1254 | 1282 |
| 1255 Dart_Handle args[2] = { | 1283 Dart_Handle args[2] = { |
| 1256 NewString("a"), NewString("b"), | 1284 NewString("a"), NewString("b"), |
| 1257 }; | 1285 }; |
| 1258 | 1286 |
| 1259 Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); | 1287 Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); |
| 1260 EXPECT_VALID(result); | 1288 EXPECT_VALID(result); |
| 1261 | 1289 |
| 1262 { | 1290 { |
| 1291 TransitionNativeToVM transition(thread); |
| 1263 StackZone zone(thread); | 1292 StackZone zone(thread); |
| 1264 HANDLESCOPE(thread); | 1293 HANDLESCOPE(thread); |
| 1265 Profile profile(isolate); | 1294 Profile profile(isolate); |
| 1266 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); | 1295 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); |
| 1267 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1296 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1268 // We should have no allocation samples. | 1297 // We should have no allocation samples. |
| 1269 EXPECT_EQ(0, profile.sample_count()); | 1298 EXPECT_EQ(0, profile.sample_count()); |
| 1270 } | 1299 } |
| 1271 | 1300 |
| 1272 one_byte_string_class.SetTraceAllocation(true); | 1301 one_byte_string_class.SetTraceAllocation(true); |
| 1273 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); | 1302 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); |
| 1274 EXPECT_VALID(result); | 1303 EXPECT_VALID(result); |
| 1275 | 1304 |
| 1276 { | 1305 { |
| 1306 TransitionNativeToVM transition(thread); |
| 1277 StackZone zone(thread); | 1307 StackZone zone(thread); |
| 1278 HANDLESCOPE(thread); | 1308 HANDLESCOPE(thread); |
| 1279 Profile profile(isolate); | 1309 Profile profile(isolate); |
| 1280 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); | 1310 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); |
| 1281 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1311 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1282 // We should still only have one allocation sample. | 1312 // We should still only have one allocation sample. |
| 1283 EXPECT_EQ(1, profile.sample_count()); | 1313 EXPECT_EQ(1, profile.sample_count()); |
| 1284 ProfileTrieWalker walker(&profile); | 1314 ProfileTrieWalker walker(&profile); |
| 1285 | 1315 |
| 1286 walker.Reset(Profile::kExclusiveCode); | 1316 walker.Reset(Profile::kExclusiveCode); |
| 1287 EXPECT(walker.Down()); | 1317 EXPECT(walker.Down()); |
| 1288 EXPECT_STREQ("String_concat", walker.CurrentName()); | 1318 EXPECT_STREQ("String_concat", walker.CurrentName()); |
| 1289 EXPECT(walker.Down()); | 1319 EXPECT(walker.Down()); |
| 1290 #if 1 | 1320 #if 1 |
| 1291 EXPECT_STREQ("_StringBase.+", walker.CurrentName()); | 1321 EXPECT_STREQ("_StringBase.+", walker.CurrentName()); |
| 1292 EXPECT(walker.Down()); | 1322 EXPECT(walker.Down()); |
| 1293 #endif | 1323 #endif |
| 1294 EXPECT_STREQ("foo", walker.CurrentName()); | 1324 EXPECT_STREQ("foo", walker.CurrentName()); |
| 1295 EXPECT(!walker.Down()); | 1325 EXPECT(!walker.Down()); |
| 1296 } | 1326 } |
| 1297 | 1327 |
| 1298 one_byte_string_class.SetTraceAllocation(false); | 1328 one_byte_string_class.SetTraceAllocation(false); |
| 1299 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); | 1329 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); |
| 1300 EXPECT_VALID(result); | 1330 EXPECT_VALID(result); |
| 1301 | 1331 |
| 1302 { | 1332 { |
| 1333 TransitionNativeToVM transition(thread); |
| 1303 StackZone zone(thread); | 1334 StackZone zone(thread); |
| 1304 HANDLESCOPE(thread); | 1335 HANDLESCOPE(thread); |
| 1305 Profile profile(isolate); | 1336 Profile profile(isolate); |
| 1306 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); | 1337 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); |
| 1307 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1338 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1308 // We should still only have one allocation sample. | 1339 // We should still only have one allocation sample. |
| 1309 EXPECT_EQ(1, profile.sample_count()); | 1340 EXPECT_EQ(1, profile.sample_count()); |
| 1310 } | 1341 } |
| 1311 | 1342 |
| 1312 one_byte_string_class.SetTraceAllocation(true); | 1343 one_byte_string_class.SetTraceAllocation(true); |
| 1313 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); | 1344 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); |
| 1314 EXPECT_VALID(result); | 1345 EXPECT_VALID(result); |
| 1315 | 1346 |
| 1316 { | 1347 { |
| 1348 TransitionNativeToVM transition(thread); |
| 1317 StackZone zone(thread); | 1349 StackZone zone(thread); |
| 1318 HANDLESCOPE(thread); | 1350 HANDLESCOPE(thread); |
| 1319 Profile profile(isolate); | 1351 Profile profile(isolate); |
| 1320 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); | 1352 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); |
| 1321 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1353 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1322 // We should now have two allocation samples. | 1354 // We should now have two allocation samples. |
| 1323 EXPECT_EQ(2, profile.sample_count()); | 1355 EXPECT_EQ(2, profile.sample_count()); |
| 1324 } | 1356 } |
| 1325 } | 1357 } |
| 1326 | 1358 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1339 EXPECT(!one_byte_string_class.IsNull()); | 1371 EXPECT(!one_byte_string_class.IsNull()); |
| 1340 | 1372 |
| 1341 Dart_Handle args[2] = { | 1373 Dart_Handle args[2] = { |
| 1342 NewString("a"), NewString("b"), | 1374 NewString("a"), NewString("b"), |
| 1343 }; | 1375 }; |
| 1344 | 1376 |
| 1345 Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); | 1377 Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); |
| 1346 EXPECT_VALID(result); | 1378 EXPECT_VALID(result); |
| 1347 | 1379 |
| 1348 { | 1380 { |
| 1381 TransitionNativeToVM transition(thread); |
| 1349 StackZone zone(thread); | 1382 StackZone zone(thread); |
| 1350 HANDLESCOPE(thread); | 1383 HANDLESCOPE(thread); |
| 1351 Profile profile(isolate); | 1384 Profile profile(isolate); |
| 1352 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); | 1385 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); |
| 1353 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1386 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1354 // We should have no allocation samples. | 1387 // We should have no allocation samples. |
| 1355 EXPECT_EQ(0, profile.sample_count()); | 1388 EXPECT_EQ(0, profile.sample_count()); |
| 1356 } | 1389 } |
| 1357 | 1390 |
| 1358 one_byte_string_class.SetTraceAllocation(true); | 1391 one_byte_string_class.SetTraceAllocation(true); |
| 1359 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); | 1392 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); |
| 1360 EXPECT_VALID(result); | 1393 EXPECT_VALID(result); |
| 1361 | 1394 |
| 1362 { | 1395 { |
| 1396 TransitionNativeToVM transition(thread); |
| 1363 StackZone zone(thread); | 1397 StackZone zone(thread); |
| 1364 HANDLESCOPE(thread); | 1398 HANDLESCOPE(thread); |
| 1365 Profile profile(isolate); | 1399 Profile profile(isolate); |
| 1366 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); | 1400 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); |
| 1367 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1401 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1368 // We should still only have one allocation sample. | 1402 // We should still only have one allocation sample. |
| 1369 EXPECT_EQ(1, profile.sample_count()); | 1403 EXPECT_EQ(1, profile.sample_count()); |
| 1370 ProfileTrieWalker walker(&profile); | 1404 ProfileTrieWalker walker(&profile); |
| 1371 | 1405 |
| 1372 walker.Reset(Profile::kExclusiveCode); | 1406 walker.Reset(Profile::kExclusiveCode); |
| 1373 EXPECT(walker.Down()); | 1407 EXPECT(walker.Down()); |
| 1374 EXPECT_STREQ("OneByteString_allocate", walker.CurrentName()); | 1408 EXPECT_STREQ("OneByteString_allocate", walker.CurrentName()); |
| 1375 EXPECT(walker.Down()); | 1409 EXPECT(walker.Down()); |
| 1376 EXPECT_STREQ("_OneByteString._allocate", walker.CurrentName()); | 1410 EXPECT_STREQ("_OneByteString._allocate", walker.CurrentName()); |
| 1377 EXPECT(walker.Down()); | 1411 EXPECT(walker.Down()); |
| 1378 EXPECT_STREQ("_OneByteString._concatAll", walker.CurrentName()); | 1412 EXPECT_STREQ("_OneByteString._concatAll", walker.CurrentName()); |
| 1379 EXPECT(walker.Down()); | 1413 EXPECT(walker.Down()); |
| 1380 EXPECT_STREQ("_StringBase._interpolate", walker.CurrentName()); | 1414 EXPECT_STREQ("_StringBase._interpolate", walker.CurrentName()); |
| 1381 EXPECT(walker.Down()); | 1415 EXPECT(walker.Down()); |
| 1382 EXPECT_STREQ("foo", walker.CurrentName()); | 1416 EXPECT_STREQ("foo", walker.CurrentName()); |
| 1383 EXPECT(!walker.Down()); | 1417 EXPECT(!walker.Down()); |
| 1384 } | 1418 } |
| 1385 | 1419 |
| 1386 one_byte_string_class.SetTraceAllocation(false); | 1420 one_byte_string_class.SetTraceAllocation(false); |
| 1387 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); | 1421 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); |
| 1388 EXPECT_VALID(result); | 1422 EXPECT_VALID(result); |
| 1389 | 1423 |
| 1390 { | 1424 { |
| 1425 TransitionNativeToVM transition(thread); |
| 1391 StackZone zone(thread); | 1426 StackZone zone(thread); |
| 1392 HANDLESCOPE(thread); | 1427 HANDLESCOPE(thread); |
| 1393 Profile profile(isolate); | 1428 Profile profile(isolate); |
| 1394 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); | 1429 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); |
| 1395 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1430 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1396 // We should still only have one allocation sample. | 1431 // We should still only have one allocation sample. |
| 1397 EXPECT_EQ(1, profile.sample_count()); | 1432 EXPECT_EQ(1, profile.sample_count()); |
| 1398 } | 1433 } |
| 1399 | 1434 |
| 1400 one_byte_string_class.SetTraceAllocation(true); | 1435 one_byte_string_class.SetTraceAllocation(true); |
| 1401 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); | 1436 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); |
| 1402 EXPECT_VALID(result); | 1437 EXPECT_VALID(result); |
| 1403 | 1438 |
| 1404 { | 1439 { |
| 1440 TransitionNativeToVM transition(thread); |
| 1405 StackZone zone(thread); | 1441 StackZone zone(thread); |
| 1406 HANDLESCOPE(thread); | 1442 HANDLESCOPE(thread); |
| 1407 Profile profile(isolate); | 1443 Profile profile(isolate); |
| 1408 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); | 1444 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id()); |
| 1409 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1445 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1410 // We should now have two allocation samples. | 1446 // We should now have two allocation samples. |
| 1411 EXPECT_EQ(2, profile.sample_count()); | 1447 EXPECT_EQ(2, profile.sample_count()); |
| 1412 } | 1448 } |
| 1413 } | 1449 } |
| 1414 | 1450 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 1490 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 1455 EXPECT_VALID(result); | 1491 EXPECT_VALID(result); |
| 1456 // Compile "mainA". | 1492 // Compile "mainA". |
| 1457 result = Dart_Invoke(lib, NewString("mainA"), 0, NULL); | 1493 result = Dart_Invoke(lib, NewString("mainA"), 0, NULL); |
| 1458 EXPECT_VALID(result); | 1494 EXPECT_VALID(result); |
| 1459 // At this point B.boo should be optimized and inlined B.foo and B.choo. | 1495 // At this point B.boo should be optimized and inlined B.foo and B.choo. |
| 1460 | 1496 |
| 1461 { | 1497 { |
| 1462 Thread* thread = Thread::Current(); | 1498 Thread* thread = Thread::Current(); |
| 1463 Isolate* isolate = thread->isolate(); | 1499 Isolate* isolate = thread->isolate(); |
| 1500 TransitionNativeToVM transition(thread); |
| 1464 StackZone zone(thread); | 1501 StackZone zone(thread); |
| 1465 HANDLESCOPE(thread); | 1502 HANDLESCOPE(thread); |
| 1466 Profile profile(isolate); | 1503 Profile profile(isolate); |
| 1467 AllocationFilter filter(isolate->main_port(), class_a.id()); | 1504 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 1468 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1505 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1469 // We should have no allocation samples. | 1506 // We should have no allocation samples. |
| 1470 EXPECT_EQ(0, profile.sample_count()); | 1507 EXPECT_EQ(0, profile.sample_count()); |
| 1471 } | 1508 } |
| 1472 | 1509 |
| 1473 // Turn on allocation tracing for A. | 1510 // Turn on allocation tracing for A. |
| 1474 class_a.SetTraceAllocation(true); | 1511 class_a.SetTraceAllocation(true); |
| 1475 | 1512 |
| 1476 // Allocate 50,000 instances of A. | 1513 // Allocate 50,000 instances of A. |
| 1477 result = Dart_Invoke(lib, NewString("mainA"), 0, NULL); | 1514 result = Dart_Invoke(lib, NewString("mainA"), 0, NULL); |
| 1478 EXPECT_VALID(result); | 1515 EXPECT_VALID(result); |
| 1479 | 1516 |
| 1480 { | 1517 { |
| 1481 Thread* thread = Thread::Current(); | 1518 Thread* thread = Thread::Current(); |
| 1482 Isolate* isolate = thread->isolate(); | 1519 Isolate* isolate = thread->isolate(); |
| 1520 TransitionNativeToVM transition(thread); |
| 1483 StackZone zone(thread); | 1521 StackZone zone(thread); |
| 1484 HANDLESCOPE(thread); | 1522 HANDLESCOPE(thread); |
| 1485 Profile profile(isolate); | 1523 Profile profile(isolate); |
| 1486 AllocationFilter filter(isolate->main_port(), class_a.id()); | 1524 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 1487 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1525 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1488 // We should have 50,000 allocation samples. | 1526 // We should have 50,000 allocation samples. |
| 1489 EXPECT_EQ(50000, profile.sample_count()); | 1527 EXPECT_EQ(50000, profile.sample_count()); |
| 1490 ProfileTrieWalker walker(&profile); | 1528 ProfileTrieWalker walker(&profile); |
| 1491 // We have two code objects: mainA and B.boo. | 1529 // We have two code objects: mainA and B.boo. |
| 1492 walker.Reset(Profile::kExclusiveCode); | 1530 walker.Reset(Profile::kExclusiveCode); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1591 EXPECT_EQ(50000, walker.CurrentExclusiveTicks()); | 1629 EXPECT_EQ(50000, walker.CurrentExclusiveTicks()); |
| 1592 EXPECT(walker.Down()); | 1630 EXPECT(walker.Down()); |
| 1593 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); | 1631 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); |
| 1594 EXPECT(!walker.Down()); | 1632 EXPECT(!walker.Down()); |
| 1595 } | 1633 } |
| 1596 | 1634 |
| 1597 // Test code transition tags. | 1635 // Test code transition tags. |
| 1598 { | 1636 { |
| 1599 Thread* thread = Thread::Current(); | 1637 Thread* thread = Thread::Current(); |
| 1600 Isolate* isolate = thread->isolate(); | 1638 Isolate* isolate = thread->isolate(); |
| 1639 TransitionNativeToVM transition(thread); |
| 1601 StackZone zone(thread); | 1640 StackZone zone(thread); |
| 1602 HANDLESCOPE(thread); | 1641 HANDLESCOPE(thread); |
| 1603 Profile profile(isolate); | 1642 Profile profile(isolate); |
| 1604 AllocationFilter filter(isolate->main_port(), class_a.id()); | 1643 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 1605 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags, | 1644 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags, |
| 1606 ProfilerService::kCodeTransitionTagsBit); | 1645 ProfilerService::kCodeTransitionTagsBit); |
| 1607 // We should have 50,000 allocation samples. | 1646 // We should have 50,000 allocation samples. |
| 1608 EXPECT_EQ(50000, profile.sample_count()); | 1647 EXPECT_EQ(50000, profile.sample_count()); |
| 1609 ProfileTrieWalker walker(&profile); | 1648 ProfileTrieWalker walker(&profile); |
| 1610 // We have two code objects: mainA and B.boo. | 1649 // We have two code objects: mainA and B.boo. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1763 func = GetFunction(root_library, "wrong"); | 1802 func = GetFunction(root_library, "wrong"); |
| 1764 EXPECT(func.is_inlinable()); | 1803 EXPECT(func.is_inlinable()); |
| 1765 func = GetFunction(root_library, "doNothing"); | 1804 func = GetFunction(root_library, "doNothing"); |
| 1766 EXPECT(!func.is_inlinable()); | 1805 EXPECT(!func.is_inlinable()); |
| 1767 func = GetFunction(root_library, "maybeAlloc"); | 1806 func = GetFunction(root_library, "maybeAlloc"); |
| 1768 EXPECT(!func.is_inlinable()); | 1807 EXPECT(!func.is_inlinable()); |
| 1769 | 1808 |
| 1770 { | 1809 { |
| 1771 Thread* thread = Thread::Current(); | 1810 Thread* thread = Thread::Current(); |
| 1772 Isolate* isolate = thread->isolate(); | 1811 Isolate* isolate = thread->isolate(); |
| 1812 TransitionNativeToVM transition(thread); |
| 1773 StackZone zone(thread); | 1813 StackZone zone(thread); |
| 1774 HANDLESCOPE(thread); | 1814 HANDLESCOPE(thread); |
| 1775 Profile profile(isolate); | 1815 Profile profile(isolate); |
| 1776 AllocationFilter filter(isolate->main_port(), class_a.id()); | 1816 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 1777 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1817 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1778 // We should have no allocation samples. | 1818 // We should have no allocation samples. |
| 1779 EXPECT_EQ(0, profile.sample_count()); | 1819 EXPECT_EQ(0, profile.sample_count()); |
| 1780 } | 1820 } |
| 1781 | 1821 |
| 1782 // Turn on allocation tracing for A. | 1822 // Turn on allocation tracing for A. |
| 1783 class_a.SetTraceAllocation(true); | 1823 class_a.SetTraceAllocation(true); |
| 1784 | 1824 |
| 1785 result = Dart_Invoke(lib, NewString("mainAlloc"), 0, NULL); | 1825 result = Dart_Invoke(lib, NewString("mainAlloc"), 0, NULL); |
| 1786 EXPECT_VALID(result); | 1826 EXPECT_VALID(result); |
| 1787 | 1827 |
| 1788 { | 1828 { |
| 1789 Thread* thread = Thread::Current(); | 1829 Thread* thread = Thread::Current(); |
| 1790 Isolate* isolate = thread->isolate(); | 1830 Isolate* isolate = thread->isolate(); |
| 1831 TransitionNativeToVM transition(thread); |
| 1791 StackZone zone(thread); | 1832 StackZone zone(thread); |
| 1792 HANDLESCOPE(thread); | 1833 HANDLESCOPE(thread); |
| 1793 Profile profile(isolate); | 1834 Profile profile(isolate); |
| 1794 AllocationFilter filter(isolate->main_port(), class_a.id()); | 1835 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 1795 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1836 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1796 EXPECT_EQ(1, profile.sample_count()); | 1837 EXPECT_EQ(1, profile.sample_count()); |
| 1797 ProfileTrieWalker walker(&profile); | 1838 ProfileTrieWalker walker(&profile); |
| 1798 | 1839 |
| 1799 // Inline expansion should show us the complete call chain: | 1840 // Inline expansion should show us the complete call chain: |
| 1800 walker.Reset(Profile::kExclusiveFunction); | 1841 walker.Reset(Profile::kExclusiveFunction); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1878 const Class& class_a = Class::Handle(GetClass(root_library, "A")); | 1919 const Class& class_a = Class::Handle(GetClass(root_library, "A")); |
| 1879 EXPECT(!class_a.IsNull()); | 1920 EXPECT(!class_a.IsNull()); |
| 1880 class_a.SetTraceAllocation(true); | 1921 class_a.SetTraceAllocation(true); |
| 1881 | 1922 |
| 1882 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 1923 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 1883 EXPECT_VALID(result); | 1924 EXPECT_VALID(result); |
| 1884 | 1925 |
| 1885 { | 1926 { |
| 1886 Thread* thread = Thread::Current(); | 1927 Thread* thread = Thread::Current(); |
| 1887 Isolate* isolate = thread->isolate(); | 1928 Isolate* isolate = thread->isolate(); |
| 1929 TransitionNativeToVM transition(thread); |
| 1888 StackZone zone(thread); | 1930 StackZone zone(thread); |
| 1889 HANDLESCOPE(thread); | 1931 HANDLESCOPE(thread); |
| 1890 Profile profile(isolate); | 1932 Profile profile(isolate); |
| 1891 AllocationFilter filter(isolate->main_port(), class_a.id()); | 1933 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 1892 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 1934 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1893 // We should have 1 allocation sample. | 1935 // We should have 1 allocation sample. |
| 1894 EXPECT_EQ(1, profile.sample_count()); | 1936 EXPECT_EQ(1, profile.sample_count()); |
| 1895 ProfileTrieWalker walker(&profile); | 1937 ProfileTrieWalker walker(&profile); |
| 1896 | 1938 |
| 1897 walker.Reset(Profile::kExclusiveCode); | 1939 walker.Reset(Profile::kExclusiveCode); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1979 // Turn on allocation tracing for A. | 2021 // Turn on allocation tracing for A. |
| 1980 class_a.SetTraceAllocation(true); | 2022 class_a.SetTraceAllocation(true); |
| 1981 | 2023 |
| 1982 // Allocate one time. | 2024 // Allocate one time. |
| 1983 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 2025 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 1984 EXPECT_VALID(result); | 2026 EXPECT_VALID(result); |
| 1985 | 2027 |
| 1986 { | 2028 { |
| 1987 Thread* thread = Thread::Current(); | 2029 Thread* thread = Thread::Current(); |
| 1988 Isolate* isolate = thread->isolate(); | 2030 Isolate* isolate = thread->isolate(); |
| 2031 TransitionNativeToVM transition(thread); |
| 1989 StackZone zone(thread); | 2032 StackZone zone(thread); |
| 1990 HANDLESCOPE(thread); | 2033 HANDLESCOPE(thread); |
| 1991 Profile profile(isolate); | 2034 Profile profile(isolate); |
| 1992 AllocationFilter filter(isolate->main_port(), class_a.id()); | 2035 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 1993 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 2036 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 1994 // We should have one allocation samples. | 2037 // We should have one allocation samples. |
| 1995 EXPECT_EQ(1, profile.sample_count()); | 2038 EXPECT_EQ(1, profile.sample_count()); |
| 1996 ProfileTrieWalker walker(&profile); | 2039 ProfileTrieWalker walker(&profile); |
| 1997 | 2040 |
| 1998 // Exclusive function: B.boo -> main. | 2041 // Exclusive function: B.boo -> main. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 2115 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 2073 EXPECT_VALID(result); | 2116 EXPECT_VALID(result); |
| 2074 | 2117 |
| 2075 // Still optimized. | 2118 // Still optimized. |
| 2076 const Code& code = Code::Handle(main.CurrentCode()); | 2119 const Code& code = Code::Handle(main.CurrentCode()); |
| 2077 EXPECT(code.is_optimized()); | 2120 EXPECT(code.is_optimized()); |
| 2078 | 2121 |
| 2079 { | 2122 { |
| 2080 Thread* thread = Thread::Current(); | 2123 Thread* thread = Thread::Current(); |
| 2081 Isolate* isolate = thread->isolate(); | 2124 Isolate* isolate = thread->isolate(); |
| 2125 TransitionNativeToVM transition(thread); |
| 2082 StackZone zone(thread); | 2126 StackZone zone(thread); |
| 2083 HANDLESCOPE(thread); | 2127 HANDLESCOPE(thread); |
| 2084 Profile profile(isolate); | 2128 Profile profile(isolate); |
| 2085 AllocationFilter filter(isolate->main_port(), class_a.id()); | 2129 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 2086 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 2130 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 2087 // We should have one allocation samples. | 2131 // We should have one allocation samples. |
| 2088 EXPECT_EQ(1, profile.sample_count()); | 2132 EXPECT_EQ(1, profile.sample_count()); |
| 2089 ProfileTrieWalker walker(&profile); | 2133 ProfileTrieWalker walker(&profile); |
| 2090 | 2134 |
| 2091 // Exclusive function: B.boo -> main. | 2135 // Exclusive function: B.boo -> main. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2158 // Turn on allocation tracing for A. | 2202 // Turn on allocation tracing for A. |
| 2159 class_a.SetTraceAllocation(true); | 2203 class_a.SetTraceAllocation(true); |
| 2160 | 2204 |
| 2161 // Allocate one time. | 2205 // Allocate one time. |
| 2162 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 2206 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 2163 EXPECT_VALID(result); | 2207 EXPECT_VALID(result); |
| 2164 | 2208 |
| 2165 { | 2209 { |
| 2166 Thread* thread = Thread::Current(); | 2210 Thread* thread = Thread::Current(); |
| 2167 Isolate* isolate = thread->isolate(); | 2211 Isolate* isolate = thread->isolate(); |
| 2212 TransitionNativeToVM transition(thread); |
| 2168 StackZone zone(thread); | 2213 StackZone zone(thread); |
| 2169 HANDLESCOPE(thread); | 2214 HANDLESCOPE(thread); |
| 2170 Profile profile(isolate); | 2215 Profile profile(isolate); |
| 2171 AllocationFilter filter(isolate->main_port(), class_a.id()); | 2216 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 2172 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 2217 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 2173 // We should have one allocation samples. | 2218 // We should have one allocation samples. |
| 2174 EXPECT_EQ(1, profile.sample_count()); | 2219 EXPECT_EQ(1, profile.sample_count()); |
| 2175 ProfileTrieWalker walker(&profile); | 2220 ProfileTrieWalker walker(&profile); |
| 2176 | 2221 |
| 2177 // Exclusive function: B.boo -> main. | 2222 // Exclusive function: B.boo -> main. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2282 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 2327 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 2283 EXPECT_VALID(result); | 2328 EXPECT_VALID(result); |
| 2284 | 2329 |
| 2285 // Still optimized. | 2330 // Still optimized. |
| 2286 const Code& code = Code::Handle(main.CurrentCode()); | 2331 const Code& code = Code::Handle(main.CurrentCode()); |
| 2287 EXPECT(code.is_optimized()); | 2332 EXPECT(code.is_optimized()); |
| 2288 | 2333 |
| 2289 { | 2334 { |
| 2290 Thread* thread = Thread::Current(); | 2335 Thread* thread = Thread::Current(); |
| 2291 Isolate* isolate = thread->isolate(); | 2336 Isolate* isolate = thread->isolate(); |
| 2337 TransitionNativeToVM transition(thread); |
| 2292 StackZone zone(thread); | 2338 StackZone zone(thread); |
| 2293 HANDLESCOPE(thread); | 2339 HANDLESCOPE(thread); |
| 2294 Profile profile(isolate); | 2340 Profile profile(isolate); |
| 2295 AllocationFilter filter(isolate->main_port(), class_a.id()); | 2341 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 2296 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 2342 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 2297 // We should have one allocation samples. | 2343 // We should have one allocation samples. |
| 2298 EXPECT_EQ(1, profile.sample_count()); | 2344 EXPECT_EQ(1, profile.sample_count()); |
| 2299 ProfileTrieWalker walker(&profile); | 2345 ProfileTrieWalker walker(&profile); |
| 2300 | 2346 |
| 2301 // Exclusive function: B.boo -> main. | 2347 // Exclusive function: B.boo -> main. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2389 // Turn on allocation tracing for A. | 2435 // Turn on allocation tracing for A. |
| 2390 class_a.SetTraceAllocation(true); | 2436 class_a.SetTraceAllocation(true); |
| 2391 | 2437 |
| 2392 // Allocate one time. | 2438 // Allocate one time. |
| 2393 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 2439 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 2394 EXPECT_VALID(result); | 2440 EXPECT_VALID(result); |
| 2395 | 2441 |
| 2396 { | 2442 { |
| 2397 Thread* thread = Thread::Current(); | 2443 Thread* thread = Thread::Current(); |
| 2398 Isolate* isolate = thread->isolate(); | 2444 Isolate* isolate = thread->isolate(); |
| 2445 TransitionNativeToVM transition(thread); |
| 2399 StackZone zone(thread); | 2446 StackZone zone(thread); |
| 2400 HANDLESCOPE(thread); | 2447 HANDLESCOPE(thread); |
| 2401 Profile profile(isolate); | 2448 Profile profile(isolate); |
| 2402 AllocationFilter filter(isolate->main_port(), class_a.id()); | 2449 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 2403 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 2450 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 2404 // We should have one allocation samples. | 2451 // We should have one allocation samples. |
| 2405 EXPECT_EQ(1, profile.sample_count()); | 2452 EXPECT_EQ(1, profile.sample_count()); |
| 2406 ProfileTrieWalker walker(&profile); | 2453 ProfileTrieWalker walker(&profile); |
| 2407 | 2454 |
| 2408 // Exclusive function: B.boo -> main. | 2455 // Exclusive function: B.boo -> main. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2522 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 2569 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 2523 EXPECT_VALID(result); | 2570 EXPECT_VALID(result); |
| 2524 | 2571 |
| 2525 // Still optimized. | 2572 // Still optimized. |
| 2526 const Code& code = Code::Handle(main.CurrentCode()); | 2573 const Code& code = Code::Handle(main.CurrentCode()); |
| 2527 EXPECT(code.is_optimized()); | 2574 EXPECT(code.is_optimized()); |
| 2528 | 2575 |
| 2529 { | 2576 { |
| 2530 Thread* thread = Thread::Current(); | 2577 Thread* thread = Thread::Current(); |
| 2531 Isolate* isolate = thread->isolate(); | 2578 Isolate* isolate = thread->isolate(); |
| 2579 TransitionNativeToVM transition(thread); |
| 2532 StackZone zone(thread); | 2580 StackZone zone(thread); |
| 2533 HANDLESCOPE(thread); | 2581 HANDLESCOPE(thread); |
| 2534 Profile profile(isolate); | 2582 Profile profile(isolate); |
| 2535 AllocationFilter filter(isolate->main_port(), class_a.id()); | 2583 AllocationFilter filter(isolate->main_port(), class_a.id()); |
| 2536 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); | 2584 profile.Build(thread, &filter, Profiler::sample_buffer(), Profile::kNoTags); |
| 2537 // We should have one allocation samples. | 2585 // We should have one allocation samples. |
| 2538 EXPECT_EQ(1, profile.sample_count()); | 2586 EXPECT_EQ(1, profile.sample_count()); |
| 2539 ProfileTrieWalker walker(&profile); | 2587 ProfileTrieWalker walker(&profile); |
| 2540 | 2588 |
| 2541 // Exclusive function: B.boo -> main. | 2589 // Exclusive function: B.boo -> main. |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2730 // tempMovePc exclusive. | 2778 // tempMovePc exclusive. |
| 2731 uword sample4[] = {tempMovePc, // main. | 2779 uword sample4[] = {tempMovePc, // main. |
| 2732 0}; | 2780 0}; |
| 2733 | 2781 |
| 2734 InsertFakeSample(sample_buffer, &sample1[0]); | 2782 InsertFakeSample(sample_buffer, &sample1[0]); |
| 2735 InsertFakeSample(sample_buffer, &sample2[0]); | 2783 InsertFakeSample(sample_buffer, &sample2[0]); |
| 2736 InsertFakeSample(sample_buffer, &sample3[0]); | 2784 InsertFakeSample(sample_buffer, &sample3[0]); |
| 2737 InsertFakeSample(sample_buffer, &sample4[0]); | 2785 InsertFakeSample(sample_buffer, &sample4[0]); |
| 2738 | 2786 |
| 2739 // Generate source report for main. | 2787 // Generate source report for main. |
| 2740 SourceReport sourceReport(SourceReport::kProfile); | |
| 2741 JSONStream js; | 2788 JSONStream js; |
| 2742 sourceReport.PrintJSON(&js, script, do_work.token_pos(), | 2789 { |
| 2743 main.end_token_pos()); | 2790 TransitionNativeToVM transition(thread); |
| 2791 SourceReport sourceReport(SourceReport::kProfile); |
| 2792 sourceReport.PrintJSON(&js, script, do_work.token_pos(), |
| 2793 main.end_token_pos()); |
| 2794 } |
| 2744 | 2795 |
| 2745 // Verify positions in do_work. | 2796 // Verify positions in do_work. |
| 2746 EXPECT_SUBSTRING("\"positions\":[\"ControlFlow\",6]", js.ToCString()); | 2797 EXPECT_SUBSTRING("\"positions\":[\"ControlFlow\",6]", js.ToCString()); |
| 2747 // Verify exclusive ticks in do_work. | 2798 // Verify exclusive ticks in do_work. |
| 2748 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,2]", js.ToCString()); | 2799 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,2]", js.ToCString()); |
| 2749 // Verify inclusive ticks in do_work. | 2800 // Verify inclusive ticks in do_work. |
| 2750 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString()); | 2801 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString()); |
| 2751 | 2802 |
| 2752 // Verify positions in main. | 2803 // Verify positions in main. |
| 2753 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString()); | 2804 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString()); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2858 EXPECT_EQ(table->FindCodeForPC(45), code1); // Merged right. | 2909 EXPECT_EQ(table->FindCodeForPC(45), code1); // Merged right. |
| 2859 EXPECT_EQ(table->FindCodeForPC(54), code1); // Merged right. | 2910 EXPECT_EQ(table->FindCodeForPC(54), code1); // Merged right. |
| 2860 EXPECT_EQ(table->FindCodeForPC(20), code2); // Merged left. | 2911 EXPECT_EQ(table->FindCodeForPC(20), code2); // Merged left. |
| 2861 EXPECT_EQ(table->FindCodeForPC(49), code1); // Truncated. | 2912 EXPECT_EQ(table->FindCodeForPC(49), code1); // Truncated. |
| 2862 EXPECT_EQ(table->FindCodeForPC(50), code1); | 2913 EXPECT_EQ(table->FindCodeForPC(50), code1); |
| 2863 } | 2914 } |
| 2864 | 2915 |
| 2865 #endif // !PRODUCT | 2916 #endif // !PRODUCT |
| 2866 | 2917 |
| 2867 } // namespace dart | 2918 } // namespace dart |
| OLD | NEW |