OLD | NEW |
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/compiler/basic-block-instrumentor.h" | 5 #include "src/compiler/basic-block-instrumentor.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Capture the schedule string before instrumentation. | 62 // Capture the schedule string before instrumentation. |
63 { | 63 { |
64 std::ostringstream os; | 64 std::ostringstream os; |
65 os << *schedule; | 65 os << *schedule; |
66 data->SetSchedule(&os); | 66 data->SetSchedule(&os); |
67 } | 67 } |
68 // Add the increment instructions to the start of every block. | 68 // Add the increment instructions to the start of every block. |
69 CommonOperatorBuilder common(graph->zone()); | 69 CommonOperatorBuilder common(graph->zone()); |
70 Node* zero = graph->NewNode(common.Int32Constant(0)); | 70 Node* zero = graph->NewNode(common.Int32Constant(0)); |
71 Node* one = graph->NewNode(common.Int32Constant(1)); | 71 Node* one = graph->NewNode(common.Int32Constant(1)); |
72 MachineOperatorBuilder machine; | 72 MachineOperatorBuilder machine(graph->zone()); |
73 BasicBlockVector* blocks = schedule->rpo_order(); | 73 BasicBlockVector* blocks = schedule->rpo_order(); |
74 size_t block_number = 0; | 74 size_t block_number = 0; |
75 for (BasicBlockVector::iterator it = blocks->begin(); block_number < n_blocks; | 75 for (BasicBlockVector::iterator it = blocks->begin(); block_number < n_blocks; |
76 ++it, ++block_number) { | 76 ++it, ++block_number) { |
77 BasicBlock* block = (*it); | 77 BasicBlock* block = (*it); |
78 data->SetBlockId(block_number, block->id().ToSize()); | 78 data->SetBlockId(block_number, block->id().ToSize()); |
79 // TODO(dcarney): wire effect and control deps for load and store. | 79 // TODO(dcarney): wire effect and control deps for load and store. |
80 // Construct increment operation. | 80 // Construct increment operation. |
81 Node* base = graph->NewNode( | 81 Node* base = graph->NewNode( |
82 PointerConstant(&common, data->GetCounterAddress(block_number))); | 82 PointerConstant(&common, data->GetCounterAddress(block_number))); |
(...skipping 13 matching lines...) Expand all Loading... |
96 for (int i = insertion_start; i < kArraySize; ++i) { | 96 for (int i = insertion_start; i < kArraySize; ++i) { |
97 schedule->SetBlockForNode(block, to_insert[i]); | 97 schedule->SetBlockForNode(block, to_insert[i]); |
98 } | 98 } |
99 } | 99 } |
100 return data; | 100 return data; |
101 } | 101 } |
102 | 102 |
103 } // namespace compiler | 103 } // namespace compiler |
104 } // namespace internal | 104 } // namespace internal |
105 } // namespace v8 | 105 } // namespace v8 |
OLD | NEW |