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/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 #include "src/compiler/typer.h" | 8 #include "src/compiler/typer.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 Node* JSGraph::ExternalConstant(ExternalReference reference) { | 177 Node* JSGraph::ExternalConstant(ExternalReference reference) { |
178 Node** loc = cache_.FindExternalConstant(reference); | 178 Node** loc = cache_.FindExternalConstant(reference); |
179 if (*loc == NULL) { | 179 if (*loc == NULL) { |
180 *loc = graph()->NewNode(common()->ExternalConstant(reference)); | 180 *loc = graph()->NewNode(common()->ExternalConstant(reference)); |
181 } | 181 } |
182 return *loc; | 182 return *loc; |
183 } | 183 } |
184 | 184 |
185 | 185 |
186 Node* JSGraph::EmptyFrameState() { | 186 Node* JSGraph::EmptyFrameState() { |
187 if (cached_nodes_[kEmptyFrameState] == nullptr) { | 187 Node* empty_frame_state = cached_nodes_[kEmptyFrameState]; |
188 Node* values = graph()->NewNode(common()->StateValues(0)); | 188 if (!empty_frame_state || empty_frame_state->IsDead()) { |
189 Node* state_node = graph()->NewNode( | 189 Node* state_values = graph()->NewNode(common()->StateValues(0)); |
| 190 empty_frame_state = graph()->NewNode( |
190 common()->FrameState(JS_FRAME, BailoutId::None(), | 191 common()->FrameState(JS_FRAME, BailoutId::None(), |
191 OutputFrameStateCombine::Ignore()), | 192 OutputFrameStateCombine::Ignore()), |
192 values, values, values, NoContextConstant(), UndefinedConstant()); | 193 state_values, state_values, state_values, NoContextConstant(), |
193 cached_nodes_[kEmptyFrameState] = state_node; | 194 UndefinedConstant()); |
| 195 cached_nodes_[kEmptyFrameState] = empty_frame_state; |
194 } | 196 } |
195 return cached_nodes_[kEmptyFrameState]; | 197 return empty_frame_state; |
196 } | 198 } |
197 | 199 |
198 | 200 |
199 Node* JSGraph::DeadControl() { | 201 Node* JSGraph::DeadControl() { |
200 return CACHED(kDeadControl, graph()->NewNode(common()->Dead())); | 202 return CACHED(kDeadControl, graph()->NewNode(common()->Dead())); |
201 } | 203 } |
202 | 204 |
203 | 205 |
204 void JSGraph::GetCachedNodes(NodeVector* nodes) { | 206 void JSGraph::GetCachedNodes(NodeVector* nodes) { |
205 cache_.GetCachedNodes(nodes); | 207 cache_.GetCachedNodes(nodes); |
206 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { | 208 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { |
207 if (cached_nodes_[i]) nodes->push_back(cached_nodes_[i]); | 209 if (Node* node = cached_nodes_[i]) { |
| 210 if (!node->IsDead()) nodes->push_back(node); |
| 211 } |
208 } | 212 } |
209 } | 213 } |
210 | 214 |
211 } // namespace compiler | 215 } // namespace compiler |
212 } // namespace internal | 216 } // namespace internal |
213 } // namespace v8 | 217 } // namespace v8 |
OLD | NEW |