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

Side by Side Diff: src/profiler/profile-generator.cc

Issue 2511093002: [counters] RuntimeStats: fix wrong bookkeeping when dynamically changing counters. (Closed)
Patch Set: merge with master Created 4 years 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/profiler/profile-generator.h" 5 #include "src/profiler/profile-generator.h"
6 6
7 #include "src/base/adapters.h" 7 #include "src/base/adapters.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/global-handles.h" 10 #include "src/global-handles.h"
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 743
744 CodeEntry* ProfileGenerator::FindEntry(void* address) { 744 CodeEntry* ProfileGenerator::FindEntry(void* address) {
745 CodeEntry* entry = code_map_.FindEntry(reinterpret_cast<Address>(address)); 745 CodeEntry* entry = code_map_.FindEntry(reinterpret_cast<Address>(address));
746 if (!entry) { 746 if (!entry) {
747 RuntimeCallStats* rcs = isolate_->counters()->runtime_call_stats(); 747 RuntimeCallStats* rcs = isolate_->counters()->runtime_call_stats();
748 void* start = reinterpret_cast<void*>(rcs); 748 void* start = reinterpret_cast<void*>(rcs);
749 void* end = reinterpret_cast<void*>(rcs + 1); 749 void* end = reinterpret_cast<void*>(rcs + 1);
750 if (start <= address && address < end) { 750 if (start <= address && address < end) {
751 RuntimeCallCounter* counter = 751 RuntimeCallCounter* counter =
752 reinterpret_cast<RuntimeCallCounter*>(address); 752 reinterpret_cast<RuntimeCallCounter*>(address);
753 CHECK(counter->name); 753 CHECK(counter->name());
754 entry = new CodeEntry(CodeEventListener::FUNCTION_TAG, counter->name, 754 entry = new CodeEntry(CodeEventListener::FUNCTION_TAG, counter->name(),
755 CodeEntry::kEmptyNamePrefix, "native V8Runtime"); 755 CodeEntry::kEmptyNamePrefix, "native V8Runtime");
756 code_map_.AddCode(reinterpret_cast<Address>(address), entry, 1); 756 code_map_.AddCode(reinterpret_cast<Address>(address), entry, 1);
757 } 757 }
758 } 758 }
759 return entry; 759 return entry;
760 } 760 }
761 761
762 CodeEntry* ProfileGenerator::EntryForVMState(StateTag tag) { 762 CodeEntry* ProfileGenerator::EntryForVMState(StateTag tag) {
763 switch (tag) { 763 switch (tag) {
764 case GC: 764 case GC:
765 return CodeEntry::gc_entry(); 765 return CodeEntry::gc_entry();
766 case JS: 766 case JS:
767 case COMPILER: 767 case COMPILER:
768 // DOM events handlers are reported as OTHER / EXTERNAL entries. 768 // DOM events handlers are reported as OTHER / EXTERNAL entries.
769 // To avoid confusing people, let's put all these entries into 769 // To avoid confusing people, let's put all these entries into
770 // one bucket. 770 // one bucket.
771 case OTHER: 771 case OTHER:
772 case EXTERNAL: 772 case EXTERNAL:
773 return CodeEntry::program_entry(); 773 return CodeEntry::program_entry();
774 case IDLE: 774 case IDLE:
775 return CodeEntry::idle_entry(); 775 return CodeEntry::idle_entry();
776 default: return NULL; 776 default: return NULL;
777 } 777 }
778 } 778 }
779 779
780 } // namespace internal 780 } // namespace internal
781 } // namespace v8 781 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698