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

Side by Side Diff: src/basic-block-profiler.cc

Issue 606403003: Refactor BasicBlock, no inheritance from GenericNode (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Attempt n+1 to address the size_t madness Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/basic-block-profiler.h ('k') | src/compiler/basic-block-instrumentor.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/basic-block-profiler.h" 5 #include "src/basic-block-profiler.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 9
10 BasicBlockProfiler::Data::Data(size_t n_blocks) 10 BasicBlockProfiler::Data::Data(size_t n_blocks)
11 : n_blocks_(n_blocks), block_ids_(n_blocks_, -1), counts_(n_blocks_, 0) {} 11 : n_blocks_(n_blocks), block_ids_(n_blocks_), counts_(n_blocks_, 0) {}
12 12
13 13
14 BasicBlockProfiler::Data::~Data() {} 14 BasicBlockProfiler::Data::~Data() {}
15 15
16 16
17 static void InsertIntoString(OStringStream* os, std::string* string) { 17 static void InsertIntoString(OStringStream* os, std::string* string) {
18 string->insert(string->begin(), os->c_str(), &os->c_str()[os->size()]); 18 string->insert(string->begin(), os->c_str(), &os->c_str()[os->size()]);
19 } 19 }
20 20
21 21
22 void BasicBlockProfiler::Data::SetCode(OStringStream* os) { 22 void BasicBlockProfiler::Data::SetCode(OStringStream* os) {
23 InsertIntoString(os, &code_); 23 InsertIntoString(os, &code_);
24 } 24 }
25 25
26 26
27 void BasicBlockProfiler::Data::SetFunctionName(OStringStream* os) { 27 void BasicBlockProfiler::Data::SetFunctionName(OStringStream* os) {
28 InsertIntoString(os, &function_name_); 28 InsertIntoString(os, &function_name_);
29 } 29 }
30 30
31 31
32 void BasicBlockProfiler::Data::SetSchedule(OStringStream* os) { 32 void BasicBlockProfiler::Data::SetSchedule(OStringStream* os) {
33 InsertIntoString(os, &schedule_); 33 InsertIntoString(os, &schedule_);
34 } 34 }
35 35
36 36
37 void BasicBlockProfiler::Data::SetBlockId(size_t offset, int block_id) { 37 void BasicBlockProfiler::Data::SetBlockId(size_t offset, size_t block_id) {
38 DCHECK(offset < n_blocks_); 38 DCHECK(offset < n_blocks_);
39 block_ids_[offset] = block_id; 39 block_ids_[offset] = block_id;
40 } 40 }
41 41
42 42
43 uint32_t* BasicBlockProfiler::Data::GetCounterAddress(size_t offset) { 43 uint32_t* BasicBlockProfiler::Data::GetCounterAddress(size_t offset) {
44 DCHECK(offset < n_blocks_); 44 DCHECK(offset < n_blocks_);
45 return &counts_[offset]; 45 return &counts_[offset];
46 } 46 }
47 47
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 os << endl; 104 os << endl;
105 if (!d.code_.empty()) { 105 if (!d.code_.empty()) {
106 os << d.code_.c_str() << endl; 106 os << d.code_.c_str() << endl;
107 } 107 }
108 return os; 108 return os;
109 } 109 }
110 110
111 } // namespace internal 111 } // namespace internal
112 } // namespace v8 112 } // namespace v8
OLDNEW
« no previous file with comments | « src/basic-block-profiler.h ('k') | src/compiler/basic-block-instrumentor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698