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 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 try_control.BeginTry(); | 1467 try_control.BeginTry(); |
1468 { | 1468 { |
1469 ControlScopeForCatch scope(this, &try_control); | 1469 ControlScopeForCatch scope(this, &try_control); |
1470 STATIC_ASSERT(TryBlockConstant::kElementCount == 1); | 1470 STATIC_ASSERT(TryBlockConstant::kElementCount == 1); |
1471 environment()->Push(current_context()); | 1471 environment()->Push(current_context()); |
1472 Visit(stmt->try_block()); | 1472 Visit(stmt->try_block()); |
1473 environment()->Pop(); | 1473 environment()->Pop(); |
1474 } | 1474 } |
1475 try_control.EndTry(); | 1475 try_control.EndTry(); |
1476 | 1476 |
| 1477 // Clear message object as we enter the catch block. |
| 1478 ExternalReference message_object = |
| 1479 ExternalReference::address_of_pending_message_obj(isolate()); |
| 1480 Node* the_hole = jsgraph()->TheHoleConstant(); |
| 1481 BuildStoreExternal(message_object, kMachAnyTagged, the_hole); |
| 1482 |
1477 // Create a catch scope that binds the exception. | 1483 // Create a catch scope that binds the exception. |
1478 Node* exception = try_control.GetExceptionNode(); | 1484 Node* exception = try_control.GetExceptionNode(); |
1479 Unique<String> name = MakeUnique(stmt->variable()->name()); | 1485 Unique<String> name = MakeUnique(stmt->variable()->name()); |
1480 const Operator* op = javascript()->CreateCatchContext(name); | 1486 const Operator* op = javascript()->CreateCatchContext(name); |
1481 Node* context = NewNode(op, exception, GetFunctionClosure()); | 1487 Node* context = NewNode(op, exception, GetFunctionClosure()); |
1482 PrepareFrameState(context, BailoutId::None()); | 1488 PrepareFrameState(context, BailoutId::None()); |
1483 { | 1489 { |
1484 ContextScope scope(this, stmt->scope(), context); | 1490 ContextScope scope(this, stmt->scope(), context); |
1485 DCHECK(stmt->scope()->declarations()->is_empty()); | 1491 DCHECK(stmt->scope()->declarations()->is_empty()); |
1486 // Evaluate the catch-block. | 1492 // Evaluate the catch-block. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1532 Node* result = try_control.GetResultValueNode(); | 1538 Node* result = try_control.GetResultValueNode(); |
1533 Node* token = try_control.GetDispatchTokenNode(); | 1539 Node* token = try_control.GetDispatchTokenNode(); |
1534 | 1540 |
1535 // The result value, dispatch token and message is expected on the operand | 1541 // The result value, dispatch token and message is expected on the operand |
1536 // stack (this is in sync with FullCodeGenerator::EnterFinallyBlock). | 1542 // stack (this is in sync with FullCodeGenerator::EnterFinallyBlock). |
1537 Node* message = BuildLoadExternal(message_object, kMachAnyTagged); | 1543 Node* message = BuildLoadExternal(message_object, kMachAnyTagged); |
1538 environment()->Push(token); // TODO(mstarzinger): Cook token! | 1544 environment()->Push(token); // TODO(mstarzinger): Cook token! |
1539 environment()->Push(result); | 1545 environment()->Push(result); |
1540 environment()->Push(message); | 1546 environment()->Push(message); |
1541 | 1547 |
| 1548 // Clear message object as we enter the finally block. |
| 1549 Node* the_hole = jsgraph()->TheHoleConstant(); |
| 1550 BuildStoreExternal(message_object, kMachAnyTagged, the_hole); |
| 1551 |
1542 // Evaluate the finally-block. | 1552 // Evaluate the finally-block. |
1543 Visit(stmt->finally_block()); | 1553 Visit(stmt->finally_block()); |
1544 try_control.EndFinally(); | 1554 try_control.EndFinally(); |
1545 | 1555 |
1546 // The result value, dispatch token and message is restored from the operand | 1556 // The result value, dispatch token and message is restored from the operand |
1547 // stack (this is in sync with FullCodeGenerator::ExitFinallyBlock). | 1557 // stack (this is in sync with FullCodeGenerator::ExitFinallyBlock). |
1548 message = environment()->Pop(); | 1558 message = environment()->Pop(); |
1549 result = environment()->Pop(); | 1559 result = environment()->Pop(); |
1550 token = environment()->Pop(); // TODO(mstarzinger): Uncook token! | 1560 token = environment()->Pop(); // TODO(mstarzinger): Uncook token! |
1551 BuildStoreExternal(message_object, kMachAnyTagged, message); | 1561 BuildStoreExternal(message_object, kMachAnyTagged, message); |
(...skipping 2215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3767 // Phi does not exist yet, introduce one. | 3777 // Phi does not exist yet, introduce one. |
3768 value = NewPhi(inputs, value, control); | 3778 value = NewPhi(inputs, value, control); |
3769 value->ReplaceInput(inputs - 1, other); | 3779 value->ReplaceInput(inputs - 1, other); |
3770 } | 3780 } |
3771 return value; | 3781 return value; |
3772 } | 3782 } |
3773 | 3783 |
3774 } // namespace compiler | 3784 } // namespace compiler |
3775 } // namespace internal | 3785 } // namespace internal |
3776 } // namespace v8 | 3786 } // namespace v8 |
OLD | NEW |