| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/bytecode-graph-builder.h" | 5 #include "src/compiler/bytecode-graph-builder.h" |
| 6 | 6 |
| 7 #include "src/compiler/bytecode-branch-analysis.h" | 7 #include "src/compiler/bytecode-branch-analysis.h" |
| 8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
| 9 #include "src/compiler/operator-properties.h" | 9 #include "src/compiler/operator-properties.h" |
| 10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
| (...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1630 exception_handlers_.pop(); | 1630 exception_handlers_.pop(); |
| 1631 } | 1631 } |
| 1632 | 1632 |
| 1633 // Potentially enter exception handlers. | 1633 // Potentially enter exception handlers. |
| 1634 while (current_exception_handler_ < num_entries) { | 1634 while (current_exception_handler_ < num_entries) { |
| 1635 int next_start = table->GetRangeStart(current_exception_handler_); | 1635 int next_start = table->GetRangeStart(current_exception_handler_); |
| 1636 if (current_offset < next_start) break; // Not yet covered by range. | 1636 if (current_offset < next_start) break; // Not yet covered by range. |
| 1637 int next_end = table->GetRangeEnd(current_exception_handler_); | 1637 int next_end = table->GetRangeEnd(current_exception_handler_); |
| 1638 int next_handler = table->GetRangeHandler(current_exception_handler_); | 1638 int next_handler = table->GetRangeHandler(current_exception_handler_); |
| 1639 int context_register = table->GetRangeData(current_exception_handler_); | 1639 int context_register = table->GetRangeData(current_exception_handler_); |
| 1640 CatchPrediction pred = | |
| 1641 table->GetRangePrediction(current_exception_handler_); | |
| 1642 exception_handlers_.push( | 1640 exception_handlers_.push( |
| 1643 {next_start, next_end, next_handler, context_register, pred}); | 1641 {next_start, next_end, next_handler, context_register}); |
| 1644 current_exception_handler_++; | 1642 current_exception_handler_++; |
| 1645 } | 1643 } |
| 1646 } | 1644 } |
| 1647 | 1645 |
| 1648 Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count, | 1646 Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count, |
| 1649 Node** value_inputs, bool incomplete) { | 1647 Node** value_inputs, bool incomplete) { |
| 1650 DCHECK_EQ(op->ValueInputCount(), value_input_count); | 1648 DCHECK_EQ(op->ValueInputCount(), value_input_count); |
| 1651 | 1649 |
| 1652 bool has_context = OperatorProperties::HasContextInput(op); | 1650 bool has_context = OperatorProperties::HasContextInput(op); |
| 1653 int frame_state_count = OperatorProperties::GetFrameStateInputCount(op); | 1651 int frame_state_count = OperatorProperties::GetFrameStateInputCount(op); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1691 environment()->UpdateControlDependency(result); | 1689 environment()->UpdateControlDependency(result); |
| 1692 } | 1690 } |
| 1693 // Update the current effect dependency for effect-producing nodes. | 1691 // Update the current effect dependency for effect-producing nodes. |
| 1694 if (result->op()->EffectOutputCount() > 0) { | 1692 if (result->op()->EffectOutputCount() > 0) { |
| 1695 environment()->UpdateEffectDependency(result); | 1693 environment()->UpdateEffectDependency(result); |
| 1696 } | 1694 } |
| 1697 // Add implicit exception continuation for throwing nodes. | 1695 // Add implicit exception continuation for throwing nodes. |
| 1698 if (!result->op()->HasProperty(Operator::kNoThrow) && inside_handler) { | 1696 if (!result->op()->HasProperty(Operator::kNoThrow) && inside_handler) { |
| 1699 int handler_offset = exception_handlers_.top().handler_offset_; | 1697 int handler_offset = exception_handlers_.top().handler_offset_; |
| 1700 int context_index = exception_handlers_.top().context_register_; | 1698 int context_index = exception_handlers_.top().context_register_; |
| 1701 CatchPrediction prediction = exception_handlers_.top().pred_; | |
| 1702 interpreter::Register context_register(context_index); | 1699 interpreter::Register context_register(context_index); |
| 1703 IfExceptionHint hint = prediction == CatchPrediction::CAUGHT | 1700 // TODO(mstarzinger): Thread through correct prediction! |
| 1704 ? IfExceptionHint::kLocallyCaught | 1701 IfExceptionHint hint = IfExceptionHint::kLocallyCaught; |
| 1705 : IfExceptionHint::kLocallyUncaught; | |
| 1706 Environment* success_env = environment()->CopyForConditional(); | 1702 Environment* success_env = environment()->CopyForConditional(); |
| 1707 const Operator* op = common()->IfException(hint); | 1703 const Operator* op = common()->IfException(hint); |
| 1708 Node* effect = environment()->GetEffectDependency(); | 1704 Node* effect = environment()->GetEffectDependency(); |
| 1709 Node* on_exception = graph()->NewNode(op, effect, result); | 1705 Node* on_exception = graph()->NewNode(op, effect, result); |
| 1710 Node* context = environment()->LookupRegister(context_register); | 1706 Node* context = environment()->LookupRegister(context_register); |
| 1711 environment()->UpdateControlDependency(on_exception); | 1707 environment()->UpdateControlDependency(on_exception); |
| 1712 environment()->UpdateEffectDependency(on_exception); | 1708 environment()->UpdateEffectDependency(on_exception); |
| 1713 environment()->BindAccumulator(on_exception); | 1709 environment()->BindAccumulator(on_exception); |
| 1714 environment()->SetContext(context); | 1710 environment()->SetContext(context); |
| 1715 MergeIntoSuccessorEnvironment(handler_offset); | 1711 MergeIntoSuccessorEnvironment(handler_offset); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1798 // Phi does not exist yet, introduce one. | 1794 // Phi does not exist yet, introduce one. |
| 1799 value = NewPhi(inputs, value, control); | 1795 value = NewPhi(inputs, value, control); |
| 1800 value->ReplaceInput(inputs - 1, other); | 1796 value->ReplaceInput(inputs - 1, other); |
| 1801 } | 1797 } |
| 1802 return value; | 1798 return value; |
| 1803 } | 1799 } |
| 1804 | 1800 |
| 1805 } // namespace compiler | 1801 } // namespace compiler |
| 1806 } // namespace internal | 1802 } // namespace internal |
| 1807 } // namespace v8 | 1803 } // namespace v8 |
| OLD | NEW |