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

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

Issue 2590483002: Revert of [profiler] fix memory leak for code entries for runtime callstats. (Closed)
Patch Set: 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
« no previous file with comments | « src/profiler/profile-generator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 642
643 ProfileGenerator::ProfileGenerator(Isolate* isolate, 643 ProfileGenerator::ProfileGenerator(Isolate* isolate,
644 CpuProfilesCollection* profiles) 644 CpuProfilesCollection* profiles)
645 : isolate_(isolate), profiles_(profiles) { 645 : isolate_(isolate), profiles_(profiles) {
646 RuntimeCallStats* rcs = isolate_->counters()->runtime_call_stats(); 646 RuntimeCallStats* rcs = isolate_->counters()->runtime_call_stats();
647 for (int i = 0; i < RuntimeCallStats::counters_count; ++i) { 647 for (int i = 0; i < RuntimeCallStats::counters_count; ++i) {
648 RuntimeCallCounter* counter = &(rcs->*(RuntimeCallStats::counters[i])); 648 RuntimeCallCounter* counter = &(rcs->*(RuntimeCallStats::counters[i]));
649 DCHECK(counter->name()); 649 DCHECK(counter->name());
650 auto entry = new CodeEntry(CodeEventListener::FUNCTION_TAG, counter->name(), 650 auto entry = new CodeEntry(CodeEventListener::FUNCTION_TAG, counter->name(),
651 CodeEntry::kEmptyNamePrefix, "native V8Runtime"); 651 CodeEntry::kEmptyNamePrefix, "native V8Runtime");
652 code_entries_.push_back(entry);
653 code_map_.AddCode(reinterpret_cast<Address>(counter), entry, 1); 652 code_map_.AddCode(reinterpret_cast<Address>(counter), entry, 1);
654 } 653 }
655 } 654 }
656 655
657 ProfileGenerator::~ProfileGenerator() {
658 for (auto code_entry : code_entries_) delete code_entry;
659 }
660
661 void ProfileGenerator::RecordTickSample(const TickSample& sample) { 656 void ProfileGenerator::RecordTickSample(const TickSample& sample) {
662 std::vector<CodeEntry*> entries; 657 std::vector<CodeEntry*> entries;
663 // Conservatively reserve space for stack frames + pc + function + vm-state. 658 // Conservatively reserve space for stack frames + pc + function + vm-state.
664 // There could in fact be more of them because of inlined entries. 659 // There could in fact be more of them because of inlined entries.
665 entries.reserve(sample.frames_count + 3); 660 entries.reserve(sample.frames_count + 3);
666 661
667 // The ProfileNode knows nothing about all versions of generated code for 662 // The ProfileNode knows nothing about all versions of generated code for
668 // the same JS function. The line number information associated with 663 // the same JS function. The line number information associated with
669 // the latest version of generated code is used to find a source line number 664 // the latest version of generated code is used to find a source line number
670 // for a JS function. Then, the detected source line is passed to 665 // for a JS function. Then, the detected source line is passed to
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 case EXTERNAL: 772 case EXTERNAL:
778 return CodeEntry::program_entry(); 773 return CodeEntry::program_entry();
779 case IDLE: 774 case IDLE:
780 return CodeEntry::idle_entry(); 775 return CodeEntry::idle_entry();
781 default: return NULL; 776 default: return NULL;
782 } 777 }
783 } 778 }
784 779
785 } // namespace internal 780 } // namespace internal
786 } // namespace v8 781 } // namespace v8
OLDNEW
« no previous file with comments | « src/profiler/profile-generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698