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

Side by Side Diff: src/compiler/schedule.h

Issue 593563005: [turbofan] basic block profiler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: unit test file Created 6 years, 3 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #ifndef V8_COMPILER_SCHEDULE_H_ 5 #ifndef V8_COMPILER_SCHEDULE_H_
6 #define V8_COMPILER_SCHEDULE_H_ 6 #define V8_COMPILER_SCHEDULE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "src/v8.h" 10 #include "src/v8.h"
11 11
12 #include "src/compiler/generic-algorithm.h" 12 #include "src/compiler/generic-algorithm.h"
13 #include "src/compiler/generic-graph.h" 13 #include "src/compiler/generic-graph.h"
14 #include "src/compiler/generic-node.h" 14 #include "src/compiler/generic-node.h"
15 #include "src/compiler/generic-node-inl.h" 15 #include "src/compiler/generic-node-inl.h"
16 #include "src/compiler/node.h" 16 #include "src/compiler/node.h"
17 #include "src/compiler/opcodes.h" 17 #include "src/compiler/opcodes.h"
18 #include "src/zone.h" 18 #include "src/zone.h"
19 19
20 namespace v8 { 20 namespace v8 {
21 namespace internal { 21 namespace internal {
22 namespace compiler { 22 namespace compiler {
23 23
24 class BasicBlock; 24 class BasicBlock;
25 class BasicBlockInstrumentor;
25 class Graph; 26 class Graph;
26 class ConstructScheduleData; 27 class ConstructScheduleData;
27 class CodeGenerator; // Because of a namespace bug in clang. 28 class CodeGenerator; // Because of a namespace bug in clang.
28 29
29 class BasicBlockData { 30 class BasicBlockData {
30 public: 31 public:
31 // Possible control nodes that can end a block. 32 // Possible control nodes that can end a block.
32 enum Control { 33 enum Control {
33 kNone, // Control not initialized yet. 34 kNone, // Control not initialized yet.
34 kGoto, // Goto a single successor block. 35 kGoto, // Goto a single successor block.
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 friend class CodeGenerator; 272 friend class CodeGenerator;
272 273
273 void AddSuccessor(BasicBlock* block, BasicBlock* succ) { 274 void AddSuccessor(BasicBlock* block, BasicBlock* succ) {
274 succ->AppendInput(zone_, block); 275 succ->AppendInput(zone_, block);
275 } 276 }
276 277
277 BasicBlockVector* rpo_order() { return &rpo_order_; } 278 BasicBlockVector* rpo_order() { return &rpo_order_; }
278 279
279 private: 280 private:
280 friend class ScheduleVisualizer; 281 friend class ScheduleVisualizer;
282 friend class BasicBlockInstrumentor;
281 283
282 void SetControlInput(BasicBlock* block, Node* node) { 284 void SetControlInput(BasicBlock* block, Node* node) {
283 block->control_input_ = node; 285 block->control_input_ = node;
284 SetBlockForNode(block, node); 286 SetBlockForNode(block, node);
285 } 287 }
286 288
287 void SetBlockForNode(BasicBlock* block, Node* node) { 289 void SetBlockForNode(BasicBlock* block, Node* node) {
288 int length = static_cast<int>(nodeid_to_block_.size()); 290 int length = static_cast<int>(nodeid_to_block_.size());
289 if (node->id() >= length) { 291 if (node->id() >= length) {
290 nodeid_to_block_.resize(node->id() + 1); 292 nodeid_to_block_.resize(node->id() + 1);
291 } 293 }
292 nodeid_to_block_[node->id()] = block; 294 nodeid_to_block_[node->id()] = block;
293 } 295 }
294 296
295 Zone* zone_; 297 Zone* zone_;
296 BasicBlockVector all_blocks_; // All basic blocks in the schedule. 298 BasicBlockVector all_blocks_; // All basic blocks in the schedule.
297 BasicBlockVector nodeid_to_block_; // Map from node to containing block. 299 BasicBlockVector nodeid_to_block_; // Map from node to containing block.
298 BasicBlockVector rpo_order_; // Reverse-post-order block list. 300 BasicBlockVector rpo_order_; // Reverse-post-order block list.
299 }; 301 };
300 302
301 OStream& operator<<(OStream& os, const Schedule& s); 303 OStream& operator<<(OStream& os, const Schedule& s);
302 } 304 }
303 } 305 }
304 } // namespace v8::internal::compiler 306 } // namespace v8::internal::compiler
305 307
306 #endif // V8_COMPILER_SCHEDULE_H_ 308 #endif // V8_COMPILER_SCHEDULE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698