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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 BasicBlockVector* blocks = schedule->rpo_order(); | 74 BasicBlockVector* blocks = schedule->rpo_order(); |
75 size_t block_number = 0; | 75 size_t block_number = 0; |
76 for (BasicBlockVector::iterator it = blocks->begin(); block_number < n_blocks; | 76 for (BasicBlockVector::iterator it = blocks->begin(); block_number < n_blocks; |
77 ++it, ++block_number) { | 77 ++it, ++block_number) { |
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(kMachUint32), 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 = graph->NewNode( | 87 Node* store = |
88 machine.Store(StoreRepresentation(kMachUint32, kNoWriteBarrier)), base, | 88 graph->NewNode(machine.Store(StoreRepresentation(MachineType::Uint32(), |
89 zero, inc, graph->start(), graph->start()); | 89 kNoWriteBarrier)), |
| 90 base, zero, inc, graph->start(), graph->start()); |
90 // Insert the new nodes. | 91 // Insert the new nodes. |
91 static const int kArraySize = 6; | 92 static const int kArraySize = 6; |
92 Node* to_insert[kArraySize] = {zero, one, base, load, inc, store}; | 93 Node* to_insert[kArraySize] = {zero, one, base, load, inc, store}; |
93 int insertion_start = block_number == 0 ? 0 : 2; | 94 int insertion_start = block_number == 0 ? 0 : 2; |
94 NodeVector::iterator insertion_point = FindInsertionPoint(block); | 95 NodeVector::iterator insertion_point = FindInsertionPoint(block); |
95 block->InsertNodes(insertion_point, &to_insert[insertion_start], | 96 block->InsertNodes(insertion_point, &to_insert[insertion_start], |
96 &to_insert[kArraySize]); | 97 &to_insert[kArraySize]); |
97 // Tell the scheduler about the new nodes. | 98 // Tell the scheduler about the new nodes. |
98 for (int i = insertion_start; i < kArraySize; ++i) { | 99 for (int i = insertion_start; i < kArraySize; ++i) { |
99 schedule->SetBlockForNode(block, to_insert[i]); | 100 schedule->SetBlockForNode(block, to_insert[i]); |
100 } | 101 } |
101 } | 102 } |
102 return data; | 103 return data; |
103 } | 104 } |
104 | 105 |
105 } // namespace compiler | 106 } // namespace compiler |
106 } // namespace internal | 107 } // namespace internal |
107 } // namespace v8 | 108 } // namespace v8 |
OLD | NEW |