| 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/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" |
| 6 | 6 |
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
| 8 #include "src/compiler/ast-loop-assignment-analyzer.h" | 8 #include "src/compiler/ast-loop-assignment-analyzer.h" |
| 9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
| 10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 void AstGraphBuilder::ControlScope::PerformCommand(Command command, | 544 void AstGraphBuilder::ControlScope::PerformCommand(Command command, |
| 545 Statement* target, | 545 Statement* target, |
| 546 Node* value) { | 546 Node* value) { |
| 547 Environment* env = environment()->CopyAsUnreachable(); | 547 Environment* env = environment()->CopyAsUnreachable(); |
| 548 ControlScope* current = this; | 548 ControlScope* current = this; |
| 549 while (current != NULL) { | 549 while (current != NULL) { |
| 550 if (current->Execute(command, target, value)) break; | 550 if (current->Execute(command, target, value)) break; |
| 551 environment()->Drop(current->stack_delta()); | 551 environment()->Drop(current->stack_delta()); |
| 552 current = current->next_; | 552 current = current->next_; |
| 553 } | 553 } |
| 554 // TODO(mstarzinger): Unconditionally kill environment once throw is control. | 554 builder()->set_environment(env); |
| 555 if (command != CMD_THROW) builder()->set_environment(env); | |
| 556 DCHECK(current != NULL); // Always handled (unless stack is malformed). | 555 DCHECK(current != NULL); // Always handled (unless stack is malformed). |
| 557 } | 556 } |
| 558 | 557 |
| 559 | 558 |
| 560 void AstGraphBuilder::ControlScope::BreakTo(BreakableStatement* stmt) { | 559 void AstGraphBuilder::ControlScope::BreakTo(BreakableStatement* stmt) { |
| 561 PerformCommand(CMD_BREAK, stmt, nullptr); | 560 PerformCommand(CMD_BREAK, stmt, nullptr); |
| 562 } | 561 } |
| 563 | 562 |
| 564 | 563 |
| 565 void AstGraphBuilder::ControlScope::ContinueTo(BreakableStatement* stmt) { | 564 void AstGraphBuilder::ControlScope::ContinueTo(BreakableStatement* stmt) { |
| (...skipping 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2671 | 2670 |
| 2672 | 2671 |
| 2673 Node* AstGraphBuilder::BuildReturn(Node* return_value) { | 2672 Node* AstGraphBuilder::BuildReturn(Node* return_value) { |
| 2674 Node* control = NewNode(common()->Return(), return_value); | 2673 Node* control = NewNode(common()->Return(), return_value); |
| 2675 UpdateControlDependencyToLeaveFunction(control); | 2674 UpdateControlDependencyToLeaveFunction(control); |
| 2676 return control; | 2675 return control; |
| 2677 } | 2676 } |
| 2678 | 2677 |
| 2679 | 2678 |
| 2680 Node* AstGraphBuilder::BuildThrow(Node* exception_value) { | 2679 Node* AstGraphBuilder::BuildThrow(Node* exception_value) { |
| 2681 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); | 2680 NewNode(javascript()->CallRuntime(Runtime::kReThrow, 1), exception_value); |
| 2682 Node* control = NewNode(op, exception_value); | 2681 Node* control = NewNode(common()->Throw(), exception_value); |
| 2683 // TODO(mstarzinger): Thread through the correct bailout id to this point. | 2682 UpdateControlDependencyToLeaveFunction(control); |
| 2684 // PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | |
| 2685 PrepareFrameState(control, BailoutId::None()); | |
| 2686 return control; | 2683 return control; |
| 2687 } | 2684 } |
| 2688 | 2685 |
| 2689 | 2686 |
| 2690 Node* AstGraphBuilder::BuildBinaryOp(Node* left, Node* right, Token::Value op) { | 2687 Node* AstGraphBuilder::BuildBinaryOp(Node* left, Node* right, Token::Value op) { |
| 2691 const Operator* js_op; | 2688 const Operator* js_op; |
| 2692 switch (op) { | 2689 switch (op) { |
| 2693 case Token::BIT_OR: | 2690 case Token::BIT_OR: |
| 2694 js_op = javascript()->BitwiseOr(); | 2691 js_op = javascript()->BitwiseOr(); |
| 2695 break; | 2692 break; |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3009 Node* dead_node = graph()->NewNode(common()->Dead()); | 3006 Node* dead_node = graph()->NewNode(common()->Dead()); |
| 3010 dead_control_.set(dead_node); | 3007 dead_control_.set(dead_node); |
| 3011 return dead_node; | 3008 return dead_node; |
| 3012 } | 3009 } |
| 3013 return dead_control_.get(); | 3010 return dead_control_.get(); |
| 3014 } | 3011 } |
| 3015 | 3012 |
| 3016 } // namespace compiler | 3013 } // namespace compiler |
| 3017 } // namespace internal | 3014 } // namespace internal |
| 3018 } // namespace v8 | 3015 } // namespace v8 |
| OLD | NEW |