OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/escape-analysis-reducer.h" | 5 #include "src/compiler/escape-analysis-reducer.h" |
6 | 6 |
7 #include "src/compiler/all-nodes.h" | 7 #include "src/compiler/all-nodes.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
10 #include "src/compiler/type-cache.h" | 10 #include "src/compiler/type-cache.h" |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 404 |
405 void EscapeAnalysisReducer::Finalize() { | 405 void EscapeAnalysisReducer::Finalize() { |
406 for (Node* node : arguments_elements_) { | 406 for (Node* node : arguments_elements_) { |
407 DCHECK(node->opcode() == IrOpcode::kNewUnmappedArgumentsElements); | 407 DCHECK(node->opcode() == IrOpcode::kNewUnmappedArgumentsElements); |
408 | 408 |
409 Node* arguments_frame = NodeProperties::GetValueInput(node, 0); | 409 Node* arguments_frame = NodeProperties::GetValueInput(node, 0); |
410 if (arguments_frame->opcode() != IrOpcode::kArgumentsFrame) continue; | 410 if (arguments_frame->opcode() != IrOpcode::kArgumentsFrame) continue; |
411 Node* arguments_length = NodeProperties::GetValueInput(node, 1); | 411 Node* arguments_length = NodeProperties::GetValueInput(node, 1); |
412 if (arguments_length->opcode() != IrOpcode::kArgumentsLength) continue; | 412 if (arguments_length->opcode() != IrOpcode::kArgumentsLength) continue; |
413 | 413 |
| 414 Node* arguments_length_state = nullptr; |
| 415 for (Edge edge : arguments_length->use_edges()) { |
| 416 Node* use = edge.from(); |
| 417 switch (use->opcode()) { |
| 418 case IrOpcode::kObjectState: |
| 419 case IrOpcode::kTypedObjectState: |
| 420 case IrOpcode::kStateValues: |
| 421 case IrOpcode::kTypedStateValues: |
| 422 if (!arguments_length_state) { |
| 423 arguments_length_state = jsgraph()->graph()->NewNode( |
| 424 jsgraph()->common()->ArgumentsLengthState( |
| 425 IsRestLengthOf(arguments_length->op()))); |
| 426 NodeProperties::SetType(arguments_length_state, |
| 427 Type::OtherInternal()); |
| 428 } |
| 429 edge.UpdateTo(arguments_length_state); |
| 430 break; |
| 431 default: |
| 432 break; |
| 433 } |
| 434 } |
| 435 |
414 bool escaping_use = false; | 436 bool escaping_use = false; |
415 ZoneVector<Node*> loads(zone()); | 437 ZoneVector<Node*> loads(zone()); |
416 for (Edge edge : node->use_edges()) { | 438 for (Edge edge : node->use_edges()) { |
417 Node* use = edge.from(); | 439 Node* use = edge.from(); |
418 if (!NodeProperties::IsValueEdge(edge)) continue; | 440 if (!NodeProperties::IsValueEdge(edge)) continue; |
419 if (use->use_edges().empty()) { | 441 if (use->use_edges().empty()) { |
420 // A node without uses is dead, so we don't have to care about it. | 442 // A node without uses is dead, so we don't have to care about it. |
421 continue; | 443 continue; |
422 } | 444 } |
423 switch (use->opcode()) { | 445 switch (use->opcode()) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 UNREACHABLE(); | 512 UNREACHABLE(); |
491 } | 513 } |
492 } | 514 } |
493 } | 515 } |
494 } | 516 } |
495 } | 517 } |
496 | 518 |
497 } // namespace compiler | 519 } // namespace compiler |
498 } // namespace internal | 520 } // namespace internal |
499 } // namespace v8 | 521 } // namespace v8 |
OLD | NEW |