| 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/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 Node* condition = environment()->Pop(); | 802 Node* condition = environment()->Pop(); |
| 803 for_loop.BreakWhen(condition); | 803 for_loop.BreakWhen(condition); |
| 804 VisitForEffect(stmt->assign_each()); | 804 VisitForEffect(stmt->assign_each()); |
| 805 VisitIterationBody(stmt, &for_loop, 0); | 805 VisitIterationBody(stmt, &for_loop, 0); |
| 806 for_loop.EndBody(); | 806 for_loop.EndBody(); |
| 807 for_loop.EndLoop(); | 807 for_loop.EndLoop(); |
| 808 } | 808 } |
| 809 | 809 |
| 810 | 810 |
| 811 void AstGraphBuilder::VisitTryCatchStatement(TryCatchStatement* stmt) { | 811 void AstGraphBuilder::VisitTryCatchStatement(TryCatchStatement* stmt) { |
| 812 UNREACHABLE(); | 812 // TODO(turbofan): Implement try-catch here. |
| 813 SetStackOverflow(); |
| 813 } | 814 } |
| 814 | 815 |
| 815 | 816 |
| 816 void AstGraphBuilder::VisitTryFinallyStatement(TryFinallyStatement* stmt) { | 817 void AstGraphBuilder::VisitTryFinallyStatement(TryFinallyStatement* stmt) { |
| 817 UNREACHABLE(); | 818 // TODO(turbofan): Implement try-catch here. |
| 819 SetStackOverflow(); |
| 818 } | 820 } |
| 819 | 821 |
| 820 | 822 |
| 821 void AstGraphBuilder::VisitDebuggerStatement(DebuggerStatement* stmt) { | 823 void AstGraphBuilder::VisitDebuggerStatement(DebuggerStatement* stmt) { |
| 822 // TODO(turbofan): Do we really need a separate reloc-info for this? | 824 // TODO(turbofan): Do we really need a separate reloc-info for this? |
| 823 Node* node = NewNode(javascript()->CallRuntime(Runtime::kDebugBreak, 0)); | 825 Node* node = NewNode(javascript()->CallRuntime(Runtime::kDebugBreak, 0)); |
| 824 PrepareFrameState(node, stmt->DebugBreakId()); | 826 PrepareFrameState(node, stmt->DebugBreakId()); |
| 825 } | 827 } |
| 826 | 828 |
| 827 | 829 |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 ast_context()->GetStateCombine()); | 1300 ast_context()->GetStateCombine()); |
| 1299 break; | 1301 break; |
| 1300 } | 1302 } |
| 1301 } | 1303 } |
| 1302 | 1304 |
| 1303 ast_context()->ProduceValue(value); | 1305 ast_context()->ProduceValue(value); |
| 1304 } | 1306 } |
| 1305 | 1307 |
| 1306 | 1308 |
| 1307 void AstGraphBuilder::VisitYield(Yield* expr) { | 1309 void AstGraphBuilder::VisitYield(Yield* expr) { |
| 1308 VisitForValue(expr->generator_object()); | 1310 // TODO(turbofan): Implement yield here. |
| 1309 VisitForValue(expr->expression()); | 1311 SetStackOverflow(); |
| 1310 environment()->Pop(); | |
| 1311 environment()->Pop(); | |
| 1312 // TODO(turbofan): VisitYield | |
| 1313 ast_context()->ProduceValue(jsgraph()->UndefinedConstant()); | 1312 ast_context()->ProduceValue(jsgraph()->UndefinedConstant()); |
| 1314 } | 1313 } |
| 1315 | 1314 |
| 1316 | 1315 |
| 1317 void AstGraphBuilder::VisitThrow(Throw* expr) { | 1316 void AstGraphBuilder::VisitThrow(Throw* expr) { |
| 1318 VisitForValue(expr->exception()); | 1317 VisitForValue(expr->exception()); |
| 1319 Node* exception = environment()->Pop(); | 1318 Node* exception = environment()->Pop(); |
| 1320 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); | 1319 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); |
| 1321 Node* value = NewNode(op, exception); | 1320 Node* value = NewNode(op, exception); |
| 1322 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | 1321 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 PrepareFrameState(callee_value, property->LoadId(), | 1394 PrepareFrameState(callee_value, property->LoadId(), |
| 1396 OutputFrameStateCombine::Push()); | 1395 OutputFrameStateCombine::Push()); |
| 1397 receiver_value = environment()->Pop(); | 1396 receiver_value = environment()->Pop(); |
| 1398 // Note that a PROPERTY_CALL requires the receiver to be wrapped into an | 1397 // Note that a PROPERTY_CALL requires the receiver to be wrapped into an |
| 1399 // object for sloppy callees. This could also be modeled explicitly here, | 1398 // object for sloppy callees. This could also be modeled explicitly here, |
| 1400 // thereby obsoleting the need for a flag to the call operator. | 1399 // thereby obsoleting the need for a flag to the call operator. |
| 1401 flags = CALL_AS_METHOD; | 1400 flags = CALL_AS_METHOD; |
| 1402 break; | 1401 break; |
| 1403 } | 1402 } |
| 1404 case Call::SUPER_CALL: { | 1403 case Call::SUPER_CALL: { |
| 1405 // todo(dslomov): implement super calls in turbofan. | 1404 // TODO(dslomov): Implement super calls. |
| 1406 UNIMPLEMENTED(); | 1405 UNIMPLEMENTED(); |
| 1407 break; | 1406 break; |
| 1408 } | 1407 } |
| 1409 case Call::POSSIBLY_EVAL_CALL: | 1408 case Call::POSSIBLY_EVAL_CALL: |
| 1410 possibly_eval = true; | 1409 possibly_eval = true; |
| 1411 // Fall through. | 1410 // Fall through. |
| 1412 case Call::OTHER_CALL: | 1411 case Call::OTHER_CALL: |
| 1413 VisitForValue(callee); | 1412 VisitForValue(callee); |
| 1414 callee_value = environment()->Pop(); | 1413 callee_value = environment()->Pop(); |
| 1415 receiver_value = jsgraph()->UndefinedConstant(); | 1414 receiver_value = jsgraph()->UndefinedConstant(); |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1719 } | 1718 } |
| 1720 | 1719 |
| 1721 | 1720 |
| 1722 void AstGraphBuilder::VisitThisFunction(ThisFunction* expr) { | 1721 void AstGraphBuilder::VisitThisFunction(ThisFunction* expr) { |
| 1723 Node* value = GetFunctionClosure(); | 1722 Node* value = GetFunctionClosure(); |
| 1724 ast_context()->ProduceValue(value); | 1723 ast_context()->ProduceValue(value); |
| 1725 } | 1724 } |
| 1726 | 1725 |
| 1727 | 1726 |
| 1728 void AstGraphBuilder::VisitSuperReference(SuperReference* expr) { | 1727 void AstGraphBuilder::VisitSuperReference(SuperReference* expr) { |
| 1729 UNREACHABLE(); | 1728 // TODO(turbofan): Implement super here. |
| 1729 SetStackOverflow(); |
| 1730 ast_context()->ProduceValue(jsgraph()->UndefinedConstant()); |
| 1730 } | 1731 } |
| 1731 | 1732 |
| 1732 | 1733 |
| 1733 void AstGraphBuilder::VisitCaseClause(CaseClause* expr) { UNREACHABLE(); } | 1734 void AstGraphBuilder::VisitCaseClause(CaseClause* expr) { UNREACHABLE(); } |
| 1734 | 1735 |
| 1735 | 1736 |
| 1736 void AstGraphBuilder::VisitDeclarations(ZoneList<Declaration*>* declarations) { | 1737 void AstGraphBuilder::VisitDeclarations(ZoneList<Declaration*>* declarations) { |
| 1737 DCHECK(globals()->empty()); | 1738 DCHECK(globals()->empty()); |
| 1738 AstVisitor::VisitDeclarations(declarations); | 1739 AstVisitor::VisitDeclarations(declarations); |
| 1739 if (globals()->empty()) return; | 1740 if (globals()->empty()) return; |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2357 | 2358 |
| 2358 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( | 2359 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( |
| 2359 IterationStatement* stmt) { | 2360 IterationStatement* stmt) { |
| 2360 if (loop_assignment_analysis_ == NULL) return NULL; | 2361 if (loop_assignment_analysis_ == NULL) return NULL; |
| 2361 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); | 2362 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); |
| 2362 } | 2363 } |
| 2363 | 2364 |
| 2364 } // namespace compiler | 2365 } // namespace compiler |
| 2365 } // namespace internal | 2366 } // namespace internal |
| 2366 } // namespace v8 | 2367 } // namespace v8 |
| OLD | NEW |