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

Side by Side Diff: runtime/vm/profiler.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.h ('k') | runtime/vm/profiler_service.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) 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/address_sanitizer.h" 5 #include "platform/address_sanitizer.h"
6 #include "platform/memory_sanitizer.h" 6 #include "platform/memory_sanitizer.h"
7 #include "platform/utils.h" 7 #include "platform/utils.h"
8 8
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/atomic.h" 10 #include "vm/atomic.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 uword pc() { 197 uword pc() {
198 return pc_; 198 return pc_;
199 } 199 }
200 200
201 // Returns false on failure. 201 // Returns false on failure.
202 bool LocateReturnAddress(uword* return_address); 202 bool LocateReturnAddress(uword* return_address);
203 203
204 // Returns offset into code object. 204 // Returns offset into code object.
205 intptr_t RelativePC() { 205 intptr_t RelativePC() {
206 ASSERT(pc() >= code_.EntryPoint()); 206 ASSERT(pc() >= code_.PayloadStart());
207 return static_cast<intptr_t>(pc() - code_.EntryPoint()); 207 return static_cast<intptr_t>(pc() - code_.PayloadStart());
208 } 208 }
209 209
210 uint8_t* CodePointer(intptr_t offset) { 210 uint8_t* CodePointer(intptr_t offset) {
211 const intptr_t size = code_.Size(); 211 const intptr_t size = code_.Size();
212 ASSERT(offset < size); 212 ASSERT(offset < size);
213 uint8_t* code_pointer = reinterpret_cast<uint8_t*>(code_.EntryPoint()); 213 uint8_t* code_pointer = reinterpret_cast<uint8_t*>(code_.PayloadStart());
214 code_pointer += offset; 214 code_pointer += offset;
215 return code_pointer; 215 return code_pointer;
216 } 216 }
217 217
218 uword StackAt(intptr_t i) { 218 uword StackAt(intptr_t i) {
219 ASSERT(i >= 0); 219 ASSERT(i >= 0);
220 ASSERT(i < Sample::kStackBufferSizeInWords); 220 ASSERT(i < Sample::kStackBufferSizeInWords);
221 return stack_buffer_[i]; 221 return stack_buffer_[i];
222 } 222 }
223 223
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 &counters_); 1254 &counters_);
1255 } 1255 }
1256 1256
1257 1257
1258 1258
1259 CodeDescriptor::CodeDescriptor(const Code& code) : code_(code) { 1259 CodeDescriptor::CodeDescriptor(const Code& code) : code_(code) {
1260 ASSERT(!code_.IsNull()); 1260 ASSERT(!code_.IsNull());
1261 } 1261 }
1262 1262
1263 1263
1264 uword CodeDescriptor::Entry() const { 1264 uword CodeDescriptor::Start() const {
1265 return code_.EntryPoint(); 1265 return code_.PayloadStart();
1266 } 1266 }
1267 1267
1268 1268
1269 uword CodeDescriptor::Size() const { 1269 uword CodeDescriptor::Size() const {
1270 return code_.Size(); 1270 return code_.Size();
1271 } 1271 }
1272 1272
1273 1273
1274 int64_t CodeDescriptor::CompileTimestamp() const { 1274 int64_t CodeDescriptor::CompileTimestamp() const {
1275 return code_.compile_timestamp(); 1275 return code_.compile_timestamp();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 if (length() <= 1) { 1330 if (length() <= 1) {
1331 return; 1331 return;
1332 } 1332 }
1333 ASSERT(FindCode(0) == NULL); 1333 ASSERT(FindCode(0) == NULL);
1334 ASSERT(FindCode(~0) == NULL); 1334 ASSERT(FindCode(~0) == NULL);
1335 // Sanity check that we don't have duplicate entries and that the entries 1335 // Sanity check that we don't have duplicate entries and that the entries
1336 // are sorted. 1336 // are sorted.
1337 for (intptr_t i = 0; i < length() - 1; i++) { 1337 for (intptr_t i = 0; i < length() - 1; i++) {
1338 const CodeDescriptor* a = At(i); 1338 const CodeDescriptor* a = At(i);
1339 const CodeDescriptor* b = At(i + 1); 1339 const CodeDescriptor* b = At(i + 1);
1340 ASSERT(a->Entry() < b->Entry()); 1340 ASSERT(a->Start() < b->Start());
1341 ASSERT(FindCode(a->Entry()) == a); 1341 ASSERT(FindCode(a->Start()) == a);
1342 ASSERT(FindCode(b->Entry()) == b); 1342 ASSERT(FindCode(b->Start()) == b);
1343 ASSERT(FindCode(a->Entry() + a->Size() - 1) == a); 1343 ASSERT(FindCode(a->Start() + a->Size() - 1) == a);
1344 ASSERT(FindCode(b->Entry() + b->Size() - 1) == b); 1344 ASSERT(FindCode(b->Start() + b->Size() - 1) == b);
1345 } 1345 }
1346 #endif 1346 #endif
1347 } 1347 }
1348 1348
1349 1349
1350 void CodeLookupTable::Add(const Code& code) { 1350 void CodeLookupTable::Add(const Code& code) {
1351 ASSERT(!code.IsNull()); 1351 ASSERT(!code.IsNull());
1352 CodeDescriptor* cd = new CodeDescriptor(code); 1352 CodeDescriptor* cd = new CodeDescriptor(code);
1353 code_objects_.Add(cd); 1353 code_objects_.Add(cd);
1354 } 1354 }
1355 1355
1356 1356
1357 const CodeDescriptor* CodeLookupTable::FindCode(uword pc) const { 1357 const CodeDescriptor* CodeLookupTable::FindCode(uword pc) const {
1358 intptr_t first = 0; 1358 intptr_t first = 0;
1359 intptr_t count = length(); 1359 intptr_t count = length();
1360 while (count > 0) { 1360 while (count > 0) {
1361 intptr_t current = first; 1361 intptr_t current = first;
1362 intptr_t step = count / 2; 1362 intptr_t step = count / 2;
1363 current += step; 1363 current += step;
1364 const CodeDescriptor* cd = At(current); 1364 const CodeDescriptor* cd = At(current);
1365 if (pc >= cd->Entry()) { 1365 if (pc >= cd->Start()) {
1366 first = ++current; 1366 first = ++current;
1367 count -= step + 1; 1367 count -= step + 1;
1368 } else { 1368 } else {
1369 count = step; 1369 count = step;
1370 } 1370 }
1371 } 1371 }
1372 // First points to the first code object whose entry is greater than PC. 1372 // First points to the first code object whose entry is greater than PC.
1373 // That means the code object we need to check is first - 1. 1373 // That means the code object we need to check is first - 1.
1374 if (first == 0) { 1374 if (first == 0) {
1375 return NULL; 1375 return NULL;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 1581
1582 1582
1583 ProcessedSampleBuffer::ProcessedSampleBuffer() 1583 ProcessedSampleBuffer::ProcessedSampleBuffer()
1584 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { 1584 : code_lookup_table_(new CodeLookupTable(Thread::Current())) {
1585 ASSERT(code_lookup_table_ != NULL); 1585 ASSERT(code_lookup_table_ != NULL);
1586 } 1586 }
1587 1587
1588 #endif // !PRODUCT 1588 #endif // !PRODUCT
1589 1589
1590 } // namespace dart 1590 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/profiler.h ('k') | runtime/vm/profiler_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698