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

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

Issue 2226893002: Optimize AOT's switchable calls for the monomorphic case. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 4 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/profiler.cc ('k') | runtime/vm/profiler_test.cc » ('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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 "vm/profiler_service.h" 5 #include "vm/profiler_service.h"
6 6
7 #include "vm/growable_array.h" 7 #include "vm/growable_array.h"
8 #include "vm/hash_map.h" 8 #include "vm/hash_map.h"
9 #include "vm/log.h" 9 #include "vm/log.h"
10 #include "vm/native_symbol.h" 10 #include "vm/native_symbol.h"
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 1174
1175 intptr_t NextFreeIndex() { 1175 intptr_t NextFreeIndex() {
1176 cache_cursor_ = (cache_cursor_ + 1) % kCacheSize; 1176 cache_cursor_ = (cache_cursor_ + 1) % kCacheSize;
1177 return cache_cursor_; 1177 return cache_cursor_;
1178 } 1178 }
1179 1179
1180 intptr_t OffsetForPC(uword pc, 1180 intptr_t OffsetForPC(uword pc,
1181 const Code& code, 1181 const Code& code,
1182 ProcessedSample* sample, 1182 ProcessedSample* sample,
1183 intptr_t frame_index) { 1183 intptr_t frame_index) {
1184 intptr_t offset = pc - code.EntryPoint(); 1184 intptr_t offset = pc - code.PayloadStart();
1185 if (frame_index != 0) { 1185 if (frame_index != 0) {
1186 // The PC of frames below the top frame is a call's return address, 1186 // The PC of frames below the top frame is a call's return address,
1187 // which can belong to a different inlining interval than the call. 1187 // which can belong to a different inlining interval than the call.
1188 offset--; 1188 offset--;
1189 } else if (sample->IsAllocationSample()) { 1189 } else if (sample->IsAllocationSample()) {
1190 // Allocation samples skip the top frame, so the top frame's pc is 1190 // Allocation samples skip the top frame, so the top frame's pc is
1191 // also a call's return address. 1191 // also a call's return address.
1192 offset--; 1192 offset--;
1193 } else if (!sample->first_frame_executing()) { 1193 } else if (!sample->first_frame_executing()) {
1194 // If the first frame wasn't executing code (i.e. we started to collect 1194 // If the first frame wasn't executing code (i.e. we started to collect
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 // Build the live code table eagerly by populating it with code objects 1334 // Build the live code table eagerly by populating it with code objects
1335 // from the processed sample buffer. 1335 // from the processed sample buffer.
1336 const CodeLookupTable& code_lookup_table = samples_->code_lookup_table(); 1336 const CodeLookupTable& code_lookup_table = samples_->code_lookup_table();
1337 for (intptr_t i = 0; i < code_lookup_table.length(); i++) { 1337 for (intptr_t i = 0; i < code_lookup_table.length(); i++) {
1338 const CodeDescriptor* descriptor = code_lookup_table.At(i); 1338 const CodeDescriptor* descriptor = code_lookup_table.At(i);
1339 ASSERT(descriptor != NULL); 1339 ASSERT(descriptor != NULL);
1340 const Code& code = Code::Handle(descriptor->code()); 1340 const Code& code = Code::Handle(descriptor->code());
1341 ASSERT(!code.IsNull()); 1341 ASSERT(!code.IsNull());
1342 RegisterLiveProfileCode( 1342 RegisterLiveProfileCode(
1343 new ProfileCode(ProfileCode::kDartCode, 1343 new ProfileCode(ProfileCode::kDartCode,
1344 code.EntryPoint(), 1344 code.PayloadStart(),
1345 code.EntryPoint() + code.Size(), 1345 code.PayloadStart() + code.Size(),
1346 code.compile_timestamp(), 1346 code.compile_timestamp(),
1347 code)); 1347 code));
1348 } 1348 }
1349 1349
1350 // Iterate over samples. 1350 // Iterate over samples.
1351 for (intptr_t sample_index = 0; 1351 for (intptr_t sample_index = 0;
1352 sample_index < samples_->length(); 1352 sample_index < samples_->length();
1353 sample_index++) { 1353 sample_index++) {
1354 ProcessedSample* sample = samples_->At(sample_index); 1354 ProcessedSample* sample = samples_->At(sample_index);
1355 const int64_t timestamp = sample->timestamp(); 1355 const int64_t timestamp = sample->timestamp();
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after
2895 // Disable thread interrupts while processing the buffer. 2895 // Disable thread interrupts while processing the buffer.
2896 DisableThreadInterruptsScope dtis(thread); 2896 DisableThreadInterruptsScope dtis(thread);
2897 2897
2898 ClearProfileVisitor clear_profile(isolate); 2898 ClearProfileVisitor clear_profile(isolate);
2899 sample_buffer->VisitSamples(&clear_profile); 2899 sample_buffer->VisitSamples(&clear_profile);
2900 } 2900 }
2901 2901
2902 #endif // !PRODUCT 2902 #endif // !PRODUCT
2903 2903
2904 } // namespace dart 2904 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/profiler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698