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(kMachUint32), base, zero); |
85 graph->start(), graph->start()); | |
86 Node* inc = graph->NewNode(machine.Int32Add(), load, one); | 85 Node* inc = graph->NewNode(machine.Int32Add(), load, one); |
87 Node* store = graph->NewNode( | 86 Node* store = graph->NewNode( |
88 machine.Store(StoreRepresentation(kMachUint32, kNoWriteBarrier)), base, | 87 machine.Store(StoreRepresentation(kMachUint32, kNoWriteBarrier)), base, |
89 zero, inc, graph->start(), graph->start()); | 88 zero, inc); |
90 // Insert the new nodes. | 89 // Insert the new nodes. |
91 static const int kArraySize = 6; | 90 static const int kArraySize = 6; |
92 Node* to_insert[kArraySize] = {zero, one, base, load, inc, store}; | 91 Node* to_insert[kArraySize] = {zero, one, base, load, inc, store}; |
93 int insertion_start = block_number == 0 ? 0 : 2; | 92 int insertion_start = block_number == 0 ? 0 : 2; |
94 NodeVector::iterator insertion_point = FindInsertionPoint(block); | 93 NodeVector::iterator insertion_point = FindInsertionPoint(block); |
95 block->InsertNodes(insertion_point, &to_insert[insertion_start], | 94 block->InsertNodes(insertion_point, &to_insert[insertion_start], |
96 &to_insert[kArraySize]); | 95 &to_insert[kArraySize]); |
97 // Tell the scheduler about the new nodes. | 96 // Tell the scheduler about the new nodes. |
98 for (int i = insertion_start; i < kArraySize; ++i) { | 97 for (int i = insertion_start; i < kArraySize; ++i) { |
99 schedule->SetBlockForNode(block, to_insert[i]); | 98 schedule->SetBlockForNode(block, to_insert[i]); |
100 } | 99 } |
101 } | 100 } |
102 return data; | 101 return data; |
103 } | 102 } |
104 | 103 |
105 } // namespace compiler | 104 } // namespace compiler |
106 } // namespace internal | 105 } // namespace internal |
107 } // namespace v8 | 106 } // namespace v8 |
OLD | NEW |