Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: runtime/vm/profiler_test.cc

Issue 2949803002: New growth strategy for growable arrays (Closed)
Patch Set: Branch-free grow size computation. Renamed function names to be clearer. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/precompiler.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 // Run bar. 1020 // Run bar.
1021 result = Dart_Invoke(lib, NewString("bar"), 0, NULL); 1021 result = Dart_Invoke(lib, NewString("bar"), 0, NULL);
1022 EXPECT_VALID(result); 1022 EXPECT_VALID(result);
1023 1023
1024 { 1024 {
1025 StackZone zone(thread); 1025 StackZone zone(thread);
1026 HANDLESCOPE(thread); 1026 HANDLESCOPE(thread);
1027 Profile profile(isolate); 1027 Profile profile(isolate);
1028 AllocationFilter filter(isolate->main_port(), array_class.id()); 1028 AllocationFilter filter(isolate->main_port(), array_class.id());
1029 profile.Build(thread, &filter, Profile::kNoTags); 1029 profile.Build(thread, &filter, Profile::kNoTags);
1030 // We should still only have one allocation sample. 1030 // We should have no allocation samples, since empty
1031 EXPECT_EQ(1, profile.sample_count()); 1031 // growable lists use a shared backing.
1032 ProfileTrieWalker walker(&profile); 1032 EXPECT_EQ(0, profile.sample_count());
1033
1034 walker.Reset(Profile::kExclusiveCode);
1035 EXPECT(walker.Down());
1036 EXPECT_STREQ("DRT_AllocateArray", walker.CurrentName());
1037 EXPECT(walker.Down());
1038 EXPECT_STREQ("[Stub] AllocateArray", walker.CurrentName());
1039 EXPECT(walker.Down());
1040 EXPECT_STREQ("new _List", walker.CurrentName());
1041 EXPECT(walker.Down());
1042 EXPECT_STREQ("new _GrowableList", walker.CurrentName());
1043 EXPECT(walker.Down());
1044 EXPECT_STREQ("new List._internal", walker.CurrentName());
1045 EXPECT(walker.Down());
1046 EXPECT_STREQ("bar", walker.CurrentName());
1047 EXPECT(!walker.Down());
1048 } 1033 }
1049 } 1034 }
1050 1035
1051 1036
1052 TEST_CASE(Profiler_ContextAllocation) { 1037 TEST_CASE(Profiler_ContextAllocation) {
1053 DisableNativeProfileScope dnps; 1038 DisableNativeProfileScope dnps;
1054 const char* kScript = 1039 const char* kScript =
1055 "var msg1 = 'a';\n" 1040 "var msg1 = 'a';\n"
1056 "foo() {\n" 1041 "foo() {\n"
1057 " var msg = msg1 + msg1;\n" 1042 " var msg = msg1 + msg1;\n"
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after
2911 EXPECT_EQ(table->FindCodeForPC(45), code1); // Merged right. 2896 EXPECT_EQ(table->FindCodeForPC(45), code1); // Merged right.
2912 EXPECT_EQ(table->FindCodeForPC(54), code1); // Merged right. 2897 EXPECT_EQ(table->FindCodeForPC(54), code1); // Merged right.
2913 EXPECT_EQ(table->FindCodeForPC(20), code2); // Merged left. 2898 EXPECT_EQ(table->FindCodeForPC(20), code2); // Merged left.
2914 EXPECT_EQ(table->FindCodeForPC(49), code1); // Truncated. 2899 EXPECT_EQ(table->FindCodeForPC(49), code1); // Truncated.
2915 EXPECT_EQ(table->FindCodeForPC(50), code1); 2900 EXPECT_EQ(table->FindCodeForPC(50), code1);
2916 } 2901 }
2917 2902
2918 #endif // !PRODUCT 2903 #endif // !PRODUCT
2919 2904
2920 } // namespace dart 2905 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/precompiler.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698