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

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

Issue 1247783002: Make array allocation stub shared between isolates. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 } 457 }
458 458
459 void walk() { 459 void walk() {
460 sample_->set_exit_frame_sample(false); 460 sample_->set_exit_frame_sample(false);
461 if (!ValidFramePointer()) { 461 if (!ValidFramePointer()) {
462 sample_->set_ignore_sample(true); 462 sample_->set_ignore_sample(true);
463 return; 463 return;
464 } 464 }
465 ASSERT(ValidFramePointer()); 465 ASSERT(ValidFramePointer());
466 uword return_pc = InitialReturnAddress(); 466 uword return_pc = InitialReturnAddress();
467 if (StubCode::InInvocationStubForIsolate(isolate_, return_pc)) { 467 if (StubCode::InInvocationStub(return_pc)) {
468 // Edge case- we have called out from the Invocation Stub but have not 468 // Edge case- we have called out from the Invocation Stub but have not
469 // created the stack frame of the callee. Attempt to locate the exit 469 // created the stack frame of the callee. Attempt to locate the exit
470 // frame before walking the stack. 470 // frame before walking the stack.
471 if (!NextExit() || !ValidFramePointer()) { 471 if (!NextExit() || !ValidFramePointer()) {
472 // Nothing to sample. 472 // Nothing to sample.
473 sample_->set_ignore_sample(true); 473 sample_->set_ignore_sample(true);
474 return; 474 return;
475 } 475 }
476 } 476 }
477 for (int i = 0; i < NumberOfFramesToCollect(); i++) { 477 for (int i = 0; i < NumberOfFramesToCollect(); i++) {
478 sample_->SetAt(i, reinterpret_cast<uword>(pc_)); 478 sample_->SetAt(i, reinterpret_cast<uword>(pc_));
479 if (!Next()) { 479 if (!Next()) {
480 return; 480 return;
481 } 481 }
482 } 482 }
483 sample_->set_truncated_trace(true); 483 sample_->set_truncated_trace(true);
484 } 484 }
485 485
486 private: 486 private:
487 bool Next() { 487 bool Next() {
488 if (!ValidFramePointer()) { 488 if (!ValidFramePointer()) {
489 return false; 489 return false;
490 } 490 }
491 if (StubCode::InInvocationStubForIsolate(isolate_, 491 if (StubCode::InInvocationStub(reinterpret_cast<uword>(pc_))) {
492 reinterpret_cast<uword>(pc_))) {
493 // In invocation stub. 492 // In invocation stub.
494 return NextExit(); 493 return NextExit();
495 } 494 }
496 // In regular Dart frame. 495 // In regular Dart frame.
497 uword* new_pc = CallerPC(); 496 uword* new_pc = CallerPC();
498 // Check if we've moved into the invocation stub. 497 // Check if we've moved into the invocation stub.
499 if (StubCode::InInvocationStubForIsolate(isolate_, 498 if (StubCode::InInvocationStub(reinterpret_cast<uword>(new_pc))) {
500 reinterpret_cast<uword>(new_pc))) {
501 // New PC is inside invocation stub, skip. 499 // New PC is inside invocation stub, skip.
502 return NextExit(); 500 return NextExit();
503 } 501 }
504 uword* new_fp = CallerFP(); 502 uword* new_fp = CallerFP();
505 if (new_fp <= fp_) { 503 if (new_fp <= fp_) {
506 // FP didn't move to a higher address. 504 // FP didn't move to a higher address.
507 return false; 505 return false;
508 } 506 }
509 // Success, update fp and pc. 507 // Success, update fp and pc.
510 fp_ = new_fp; 508 fp_ = new_fp;
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 } 818 }
821 819
822 820
823 void Profiler::RecordAllocation(Isolate* isolate, intptr_t cid) { 821 void Profiler::RecordAllocation(Isolate* isolate, intptr_t cid) {
824 if ((isolate == NULL) || (Dart::vm_isolate() == NULL)) { 822 if ((isolate == NULL) || (Dart::vm_isolate() == NULL)) {
825 // No isolate. 823 // No isolate.
826 return; 824 return;
827 } 825 }
828 ASSERT(isolate != Dart::vm_isolate()); 826 ASSERT(isolate != Dart::vm_isolate());
829 827
830 const bool exited_dart_code = (isolate->stub_code() != NULL) && 828 const bool exited_dart_code = (isolate->top_exit_frame_info() != 0) &&
831 (isolate->top_exit_frame_info() != 0) &&
832 (isolate->vm_tag() != VMTag::kDartTagId); 829 (isolate->vm_tag() != VMTag::kDartTagId);
833 830
834 if (!exited_dart_code) { 831 if (!exited_dart_code) {
835 // No Dart frames on stack. 832 // No Dart frames on stack.
836 // TODO(johnmccutchan): Support collecting native stack. 833 // TODO(johnmccutchan): Support collecting native stack.
837 return; 834 return;
838 } 835 }
839 836
840 IsolateProfilerData* profiler_data = isolate->profiler_data(); 837 IsolateProfilerData* profiler_data = isolate->profiler_data();
841 if (profiler_data == NULL) { 838 if (profiler_data == NULL) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 const InterruptedThreadState& state, 873 const InterruptedThreadState& state,
877 void* data) { 874 void* data) {
878 Isolate* isolate = reinterpret_cast<Isolate*>(data); 875 Isolate* isolate = reinterpret_cast<Isolate*>(data);
879 if ((isolate == NULL) || (Dart::vm_isolate() == NULL)) { 876 if ((isolate == NULL) || (Dart::vm_isolate() == NULL)) {
880 // No isolate. 877 // No isolate.
881 return; 878 return;
882 } 879 }
883 880
884 ASSERT(isolate != Dart::vm_isolate()); 881 ASSERT(isolate != Dart::vm_isolate());
885 882
886 const bool exited_dart_code = (isolate->stub_code() != NULL) && 883 const bool exited_dart_code = (isolate->top_exit_frame_info() != 0) &&
887 (isolate->top_exit_frame_info() != 0) &&
888 (isolate->vm_tag() != VMTag::kDartTagId); 884 (isolate->vm_tag() != VMTag::kDartTagId);
889 const bool in_dart_code = (isolate->stub_code() != NULL) && 885 const bool in_dart_code = (isolate->top_exit_frame_info() == 0) &&
890 (isolate->top_exit_frame_info() == 0) &&
891 (isolate->vm_tag() == VMTag::kDartTagId); 886 (isolate->vm_tag() == VMTag::kDartTagId);
892 887
893 uintptr_t sp = 0; 888 uintptr_t sp = 0;
894 uintptr_t fp = state.fp; 889 uintptr_t fp = state.fp;
895 uintptr_t pc = state.pc; 890 uintptr_t pc = state.pc;
896 uintptr_t lr = state.lr; 891 uintptr_t lr = state.lr;
897 #if defined(USING_SIMULATOR) 892 #if defined(USING_SIMULATOR)
898 Simulator* simulator = NULL; 893 Simulator* simulator = NULL;
899 #endif 894 #endif
900 895
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 uword pc) { 1227 uword pc) {
1233 return vm_isolate->heap()->CodeContains(pc) 1228 return vm_isolate->heap()->CodeContains(pc)
1234 || isolate->heap()->CodeContains(pc); 1229 || isolate->heap()->CodeContains(pc);
1235 } 1230 }
1236 1231
1237 1232
1238 ProcessedSampleBuffer::ProcessedSampleBuffer() { 1233 ProcessedSampleBuffer::ProcessedSampleBuffer() {
1239 } 1234 }
1240 1235
1241 } // namespace dart 1236 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698