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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 EXPECT(walker.Down()); | 532 EXPECT(walker.Down()); |
533 EXPECT_STREQ("_Float32Array._new", walker.CurrentName()); | 533 EXPECT_STREQ("_Float32Array._new", walker.CurrentName()); |
534 EXPECT(walker.Down()); | 534 EXPECT(walker.Down()); |
535 EXPECT_STREQ("_Float32Array._Float32Array", walker.CurrentName()); | 535 EXPECT_STREQ("_Float32Array._Float32Array", walker.CurrentName()); |
536 EXPECT(walker.Down()); | 536 EXPECT(walker.Down()); |
537 EXPECT_STREQ("Float32List.Float32List", walker.CurrentName()); | 537 EXPECT_STREQ("Float32List.Float32List", walker.CurrentName()); |
538 EXPECT(walker.Down()); | 538 EXPECT(walker.Down()); |
539 EXPECT_STREQ("foo", walker.CurrentName()); | 539 EXPECT_STREQ("foo", walker.CurrentName()); |
540 EXPECT(!walker.Down()); | 540 EXPECT(!walker.Down()); |
541 } | 541 } |
| 542 |
| 543 float32_list_class.SetTraceAllocation(false); |
| 544 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
| 545 EXPECT_VALID(result); |
| 546 |
| 547 { |
| 548 StackZone zone(isolate); |
| 549 HANDLESCOPE(isolate); |
| 550 Profile profile(isolate); |
| 551 AllocationFilter filter(isolate, float32_list_class.id()); |
| 552 profile.Build(&filter, Profile::kNoTags); |
| 553 // We should still only have one allocation sample. |
| 554 EXPECT_EQ(1, profile.sample_count()); |
| 555 } |
| 556 |
| 557 float32_list_class.SetTraceAllocation(true); |
| 558 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
| 559 EXPECT_VALID(result); |
| 560 |
| 561 { |
| 562 StackZone zone(isolate); |
| 563 HANDLESCOPE(isolate); |
| 564 Profile profile(isolate); |
| 565 AllocationFilter filter(isolate, float32_list_class.id()); |
| 566 profile.Build(&filter, Profile::kNoTags); |
| 567 // We should now have two allocation samples. |
| 568 EXPECT_EQ(2, profile.sample_count()); |
| 569 } |
542 } | 570 } |
543 | 571 |
544 } // namespace dart | 572 } // namespace dart |
OLD | NEW |