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.h" | 9 #include "src/compiler.h" |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 BasicBlock* block = (*it); | 78 BasicBlock* block = (*it); |
79 data->SetBlockId(block_number, block->id().ToSize()); | 79 data->SetBlockId(block_number, block->id().ToSize()); |
80 // TODO(dcarney): wire effect and control deps for load and store. | 80 // TODO(dcarney): wire effect and control deps for load and store. |
81 // Construct increment operation. | 81 // Construct increment operation. |
82 Node* base = graph->NewNode( | 82 Node* base = graph->NewNode( |
83 PointerConstant(&common, data->GetCounterAddress(block_number))); | 83 PointerConstant(&common, data->GetCounterAddress(block_number))); |
84 Node* load = graph->NewNode(machine.Load(MachineType::Uint32()), base, zero, | 84 Node* load = graph->NewNode(machine.Load(MachineType::Uint32()), base, zero, |
85 graph->start(), graph->start()); | 85 graph->start(), graph->start()); |
86 Node* inc = graph->NewNode(machine.Int32Add(), load, one); | 86 Node* inc = graph->NewNode(machine.Int32Add(), load, one); |
87 Node* store = | 87 Node* store = |
88 graph->NewNode(machine.Store(StoreRepresentation(MachineType::Uint32(), | 88 graph->NewNode(machine.Store(StoreRepresentation( |
89 kNoWriteBarrier)), | 89 MachineRepresentation::kWord32, kNoWriteBarrier)), |
90 base, zero, inc, graph->start(), graph->start()); | 90 base, zero, inc, graph->start(), graph->start()); |
91 // Insert the new nodes. | 91 // Insert the new nodes. |
92 static const int kArraySize = 6; | 92 static const int kArraySize = 6; |
93 Node* to_insert[kArraySize] = {zero, one, base, load, inc, store}; | 93 Node* to_insert[kArraySize] = {zero, one, base, load, inc, store}; |
94 int insertion_start = block_number == 0 ? 0 : 2; | 94 int insertion_start = block_number == 0 ? 0 : 2; |
95 NodeVector::iterator insertion_point = FindInsertionPoint(block); | 95 NodeVector::iterator insertion_point = FindInsertionPoint(block); |
96 block->InsertNodes(insertion_point, &to_insert[insertion_start], | 96 block->InsertNodes(insertion_point, &to_insert[insertion_start], |
97 &to_insert[kArraySize]); | 97 &to_insert[kArraySize]); |
98 // Tell the scheduler about the new nodes. | 98 // Tell the scheduler about the new nodes. |
99 for (int i = insertion_start; i < kArraySize; ++i) { | 99 for (int i = insertion_start; i < kArraySize; ++i) { |
100 schedule->SetBlockForNode(block, to_insert[i]); | 100 schedule->SetBlockForNode(block, to_insert[i]); |
101 } | 101 } |
102 } | 102 } |
103 return data; | 103 return data; |
104 } | 104 } |
105 | 105 |
106 } // namespace compiler | 106 } // namespace compiler |
107 } // namespace internal | 107 } // namespace internal |
108 } // namespace v8 | 108 } // namespace v8 |
OLD | NEW |