Chromium Code Reviews| 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/js-type-feedback.h" | 10 #include "src/compiler/js-type-feedback.h" |
| (...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1650 } | 1650 } |
| 1651 ast_context()->ProduceValue(literal); | 1651 ast_context()->ProduceValue(literal); |
| 1652 } | 1652 } |
| 1653 | 1653 |
| 1654 | 1654 |
| 1655 void AstGraphBuilder::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) { | 1655 void AstGraphBuilder::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) { |
| 1656 UNREACHABLE(); | 1656 UNREACHABLE(); |
| 1657 } | 1657 } |
| 1658 | 1658 |
| 1659 | 1659 |
| 1660 void AstGraphBuilder::VisitDoExpression(DoExpression* expr) { | |
| 1661 BlockBuilder block(this); | |
| 1662 ControlScopeForBreakable scope( | |
| 1663 this, reinterpret_cast<BreakableStatement*>(expr), &block); | |
| 1664 // Visit declarations and statements in a block scope. | |
| 1665 if (expr->scope()->NeedsContext()) { | |
| 1666 Node* context = BuildLocalBlockContext(expr->scope()); | |
| 1667 ContextScope scope(this, expr->scope(), context); | |
| 1668 VisitDeclarations(expr->scope()->declarations()); | |
| 1669 VisitStatements(expr->statements()); | |
| 1670 } else { | |
| 1671 VisitDeclarations(expr->scope()->declarations()); | |
| 1672 VisitStatements(expr->statements()); | |
| 1673 } | |
| 1674 if (expr->result()->is_assigned()) { | |
|
rossberg
2015/10/12 13:52:39
It's better to avoid this case distinction in back
caitp (gmail)
2015/10/12 18:22:59
Done.
It seems like it could potentially save a b
rossberg
2015/10/13 10:44:32
Such an optimsation comes for free with SSA form.
| |
| 1675 VisitVariableProxy(expr->result()); | |
| 1676 } else { | |
| 1677 ast_context()->ProduceValue(jsgraph()->UndefinedConstant()); | |
| 1678 } | |
| 1679 } | |
| 1680 | |
| 1681 | |
| 1660 void AstGraphBuilder::VisitConditional(Conditional* expr) { | 1682 void AstGraphBuilder::VisitConditional(Conditional* expr) { |
| 1661 IfBuilder compare_if(this); | 1683 IfBuilder compare_if(this); |
| 1662 VisitForTest(expr->condition()); | 1684 VisitForTest(expr->condition()); |
| 1663 Node* condition = environment()->Pop(); | 1685 Node* condition = environment()->Pop(); |
| 1664 compare_if.If(condition); | 1686 compare_if.If(condition); |
| 1665 compare_if.Then(); | 1687 compare_if.Then(); |
| 1666 Visit(expr->then_expression()); | 1688 Visit(expr->then_expression()); |
| 1667 compare_if.Else(); | 1689 compare_if.Else(); |
| 1668 Visit(expr->else_expression()); | 1690 Visit(expr->else_expression()); |
| 1669 compare_if.End(); | 1691 compare_if.End(); |
| (...skipping 2618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4288 // Phi does not exist yet, introduce one. | 4310 // Phi does not exist yet, introduce one. |
| 4289 value = NewPhi(inputs, value, control); | 4311 value = NewPhi(inputs, value, control); |
| 4290 value->ReplaceInput(inputs - 1, other); | 4312 value->ReplaceInput(inputs - 1, other); |
| 4291 } | 4313 } |
| 4292 return value; | 4314 return value; |
| 4293 } | 4315 } |
| 4294 | 4316 |
| 4295 } // namespace compiler | 4317 } // namespace compiler |
| 4296 } // namespace internal | 4318 } // namespace internal |
| 4297 } // namespace v8 | 4319 } // namespace v8 |
| OLD | NEW |