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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 9 #include "src/compiler/ast-loop-assignment-analyzer.h" |
10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" |
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 try_control.BeginTry(); | 1442 try_control.BeginTry(); |
1443 { | 1443 { |
1444 ControlScopeForCatch scope(this, &try_control); | 1444 ControlScopeForCatch scope(this, &try_control); |
1445 STATIC_ASSERT(TryBlockConstant::kElementCount == 1); | 1445 STATIC_ASSERT(TryBlockConstant::kElementCount == 1); |
1446 environment()->Push(current_context()); | 1446 environment()->Push(current_context()); |
1447 Visit(stmt->try_block()); | 1447 Visit(stmt->try_block()); |
1448 environment()->Pop(); | 1448 environment()->Pop(); |
1449 } | 1449 } |
1450 try_control.EndTry(); | 1450 try_control.EndTry(); |
1451 | 1451 |
1452 // Insert lazy bailout point. | |
1453 // TODO(mstarzinger): We are only using a 'call' to get a lazy bailout | |
1454 // point. Ideally, we whould not re-enter optimized code when deoptimized | |
1455 // lazily. Tracked by issue v8:4195. | |
1456 NewNode(common()->LazyBailout(), | |
1457 jsgraph()->ZeroConstant(), // dummy target. | |
1458 environment()->Checkpoint(stmt->HandlerId())); // frame state. | |
1459 | |
1460 // Clear message object as we enter the catch block. | 1452 // Clear message object as we enter the catch block. |
1461 Node* the_hole = jsgraph()->TheHoleConstant(); | 1453 Node* the_hole = jsgraph()->TheHoleConstant(); |
1462 NewNode(javascript()->StoreMessage(), the_hole); | 1454 NewNode(javascript()->StoreMessage(), the_hole); |
1463 | 1455 |
1464 // Create a catch scope that binds the exception. | 1456 // Create a catch scope that binds the exception. |
1465 Node* exception = try_control.GetExceptionNode(); | 1457 Node* exception = try_control.GetExceptionNode(); |
1466 Handle<String> name = stmt->variable()->name(); | 1458 Handle<String> name = stmt->variable()->name(); |
1467 const Operator* op = javascript()->CreateCatchContext(name); | 1459 const Operator* op = javascript()->CreateCatchContext(name); |
1468 Node* context = NewNode(op, exception, GetFunctionClosureForContext()); | 1460 Node* context = NewNode(op, exception, GetFunctionClosureForContext()); |
1469 | 1461 |
(...skipping 24 matching lines...) Expand all Loading... |
1494 try_control.BeginTry(); | 1486 try_control.BeginTry(); |
1495 { | 1487 { |
1496 ControlScopeForFinally scope(this, commands, &try_control); | 1488 ControlScopeForFinally scope(this, commands, &try_control); |
1497 STATIC_ASSERT(TryBlockConstant::kElementCount == 1); | 1489 STATIC_ASSERT(TryBlockConstant::kElementCount == 1); |
1498 environment()->Push(current_context()); | 1490 environment()->Push(current_context()); |
1499 Visit(stmt->try_block()); | 1491 Visit(stmt->try_block()); |
1500 environment()->Pop(); | 1492 environment()->Pop(); |
1501 } | 1493 } |
1502 try_control.EndTry(commands->GetFallThroughToken(), fallthrough_result); | 1494 try_control.EndTry(commands->GetFallThroughToken(), fallthrough_result); |
1503 | 1495 |
1504 // Insert lazy bailout point. | |
1505 // TODO(mstarzinger): We are only using a 'call' to get a lazy bailout | |
1506 // point. Ideally, we whould not re-enter optimized code when deoptimized | |
1507 // lazily. Tracked by issue v8:4195. | |
1508 NewNode(common()->LazyBailout(), | |
1509 jsgraph()->ZeroConstant(), // dummy target. | |
1510 environment()->Checkpoint(stmt->HandlerId())); // frame state. | |
1511 | |
1512 // The result value semantics depend on how the block was entered: | 1496 // The result value semantics depend on how the block was entered: |
1513 // - ReturnStatement: It represents the return value being returned. | 1497 // - ReturnStatement: It represents the return value being returned. |
1514 // - ThrowStatement: It represents the exception being thrown. | 1498 // - ThrowStatement: It represents the exception being thrown. |
1515 // - BreakStatement/ContinueStatement: Filled with the hole. | 1499 // - BreakStatement/ContinueStatement: Filled with the hole. |
1516 // - Falling through into finally-block: Filled with the hole. | 1500 // - Falling through into finally-block: Filled with the hole. |
1517 Node* result = try_control.GetResultValueNode(); | 1501 Node* result = try_control.GetResultValueNode(); |
1518 Node* token = try_control.GetDispatchTokenNode(); | 1502 Node* token = try_control.GetDispatchTokenNode(); |
1519 | 1503 |
1520 // The result value, dispatch token and message is expected on the operand | 1504 // The result value, dispatch token and message is expected on the operand |
1521 // stack (this is in sync with FullCodeGenerator::EnterFinallyBlock). | 1505 // stack (this is in sync with FullCodeGenerator::EnterFinallyBlock). |
(...skipping 2843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4365 // Phi does not exist yet, introduce one. | 4349 // Phi does not exist yet, introduce one. |
4366 value = NewPhi(inputs, value, control); | 4350 value = NewPhi(inputs, value, control); |
4367 value->ReplaceInput(inputs - 1, other); | 4351 value->ReplaceInput(inputs - 1, other); |
4368 } | 4352 } |
4369 return value; | 4353 return value; |
4370 } | 4354 } |
4371 | 4355 |
4372 } // namespace compiler | 4356 } // namespace compiler |
4373 } // namespace internal | 4357 } // namespace internal |
4374 } // namespace v8 | 4358 } // namespace v8 |
OLD | NEW |