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/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
6 #include "src/compiler.h" | 6 #include "src/compiler.h" |
7 #include "src/compiler/all-nodes.h" | 7 #include "src/compiler/all-nodes.h" |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/common-operator-reducer.h" | 9 #include "src/compiler/common-operator-reducer.h" |
10 #include "src/compiler/dead-code-elimination.h" | 10 #include "src/compiler/dead-code-elimination.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 for (LoopTree::Loop* outer = loop->parent(); outer; | 77 for (LoopTree::Loop* outer = loop->parent(); outer; |
78 outer = outer->parent()) { | 78 outer = outer->parent()) { |
79 for (Node* node : loop_tree->HeaderNodes(outer)) { | 79 for (Node* node : loop_tree->HeaderNodes(outer)) { |
80 mapping->at(node->id()) = dead; | 80 mapping->at(node->id()) = dead; |
81 TRACE(" ---- #%d:%s -> dead (header)\n", node->id(), | 81 TRACE(" ---- #%d:%s -> dead (header)\n", node->id(), |
82 node->op()->mnemonic()); | 82 node->op()->mnemonic()); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 // Copy all nodes. | 86 // Copy all nodes. |
87 for (size_t i = 0; i < all.live.size(); i++) { | 87 for (size_t i = 0; i < all.reachable.size(); i++) { |
88 Node* orig = all.live[i]; | 88 Node* orig = all.reachable[i]; |
89 Node* copy = mapping->at(orig->id()); | 89 Node* copy = mapping->at(orig->id()); |
90 if (copy != sentinel) { | 90 if (copy != sentinel) { |
91 // Mapping already exists. | 91 // Mapping already exists. |
92 continue; | 92 continue; |
93 } | 93 } |
94 if (orig->InputCount() == 0 || orig->opcode() == IrOpcode::kParameter || | 94 if (orig->InputCount() == 0 || orig->opcode() == IrOpcode::kParameter || |
95 orig->opcode() == IrOpcode::kOsrValue) { | 95 orig->opcode() == IrOpcode::kOsrValue) { |
96 // No need to copy leaf nodes or parameters. | 96 // No need to copy leaf nodes or parameters. |
97 mapping->at(orig->id()) = orig; | 97 mapping->at(orig->id()) = orig; |
98 continue; | 98 continue; |
99 } | 99 } |
100 | 100 |
101 // Copy the node. | 101 // Copy the node. |
102 tmp_inputs.clear(); | 102 tmp_inputs.clear(); |
103 for (Node* input : orig->inputs()) { | 103 for (Node* input : orig->inputs()) { |
104 tmp_inputs.push_back(mapping->at(input->id())); | 104 tmp_inputs.push_back(mapping->at(input->id())); |
105 } | 105 } |
106 copy = graph->NewNode(orig->op(), orig->InputCount(), &tmp_inputs[0]); | 106 copy = graph->NewNode(orig->op(), orig->InputCount(), &tmp_inputs[0]); |
107 if (NodeProperties::IsTyped(orig)) { | 107 if (NodeProperties::IsTyped(orig)) { |
108 NodeProperties::SetType(copy, NodeProperties::GetType(orig)); | 108 NodeProperties::SetType(copy, NodeProperties::GetType(orig)); |
109 } | 109 } |
110 mapping->at(orig->id()) = copy; | 110 mapping->at(orig->id()) = copy; |
111 TRACE(" copy #%d:%s -> #%d\n", orig->id(), orig->op()->mnemonic(), | 111 TRACE(" copy #%d:%s -> #%d\n", orig->id(), orig->op()->mnemonic(), |
112 copy->id()); | 112 copy->id()); |
113 } | 113 } |
114 | 114 |
115 // Fix missing inputs. | 115 // Fix missing inputs. |
116 for (Node* orig : all.live) { | 116 for (Node* orig : all.reachable) { |
117 Node* copy = mapping->at(orig->id()); | 117 Node* copy = mapping->at(orig->id()); |
118 for (int j = 0; j < copy->InputCount(); j++) { | 118 for (int j = 0; j < copy->InputCount(); j++) { |
119 if (copy->InputAt(j) == sentinel) { | 119 if (copy->InputAt(j) == sentinel) { |
120 copy->ReplaceInput(j, mapping->at(orig->InputAt(j)->id())); | 120 copy->ReplaceInput(j, mapping->at(orig->InputAt(j)->id())); |
121 } | 121 } |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 // Construct the entry into this loop from previous copies. | 125 // Construct the entry into this loop from previous copies. |
126 | 126 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 | 334 |
335 void OsrHelper::SetupFrame(Frame* frame) { | 335 void OsrHelper::SetupFrame(Frame* frame) { |
336 // The optimized frame will subsume the unoptimized frame. Do so by reserving | 336 // The optimized frame will subsume the unoptimized frame. Do so by reserving |
337 // the first spill slots. | 337 // the first spill slots. |
338 frame->ReserveSpillSlots(UnoptimizedFrameSlots()); | 338 frame->ReserveSpillSlots(UnoptimizedFrameSlots()); |
339 } | 339 } |
340 | 340 |
341 } // namespace compiler | 341 } // namespace compiler |
342 } // namespace internal | 342 } // namespace internal |
343 } // namespace v8 | 343 } // namespace v8 |
OLD | NEW |