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 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1659 if (current_offset < current_end) break; // Still covered by range. | 1659 if (current_offset < current_end) break; // Still covered by range. |
1660 exception_handlers_.pop(); | 1660 exception_handlers_.pop(); |
1661 } | 1661 } |
1662 | 1662 |
1663 // Potentially enter exception handlers. | 1663 // Potentially enter exception handlers. |
1664 while (current_exception_handler_ < num_entries) { | 1664 while (current_exception_handler_ < num_entries) { |
1665 int next_start = table->GetRangeStart(current_exception_handler_); | 1665 int next_start = table->GetRangeStart(current_exception_handler_); |
1666 if (current_offset < next_start) break; // Not yet covered by range. | 1666 if (current_offset < next_start) break; // Not yet covered by range. |
1667 int next_end = table->GetRangeEnd(current_exception_handler_); | 1667 int next_end = table->GetRangeEnd(current_exception_handler_); |
1668 int next_handler = table->GetRangeHandler(current_exception_handler_); | 1668 int next_handler = table->GetRangeHandler(current_exception_handler_); |
1669 exception_handlers_.push({next_start, next_end, next_handler}); | 1669 int next_depth = table->GetRangeDepth(current_exception_handler_); |
Michael Starzinger
2016/02/03 14:34:01
disclosure: I understand that the naming of the Ha
| |
1670 exception_handlers_.push({next_start, next_end, next_handler, next_depth}); | |
1670 current_exception_handler_++; | 1671 current_exception_handler_++; |
1671 } | 1672 } |
1672 } | 1673 } |
1673 | 1674 |
1674 void BytecodeGraphBuilder::PrepareEntryFrameState(Node* node) { | 1675 void BytecodeGraphBuilder::PrepareEntryFrameState(Node* node) { |
1675 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); | 1676 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); |
1676 DCHECK_EQ(IrOpcode::kDead, | 1677 DCHECK_EQ(IrOpcode::kDead, |
1677 NodeProperties::GetFrameStateInput(node, 0)->opcode()); | 1678 NodeProperties::GetFrameStateInput(node, 0)->opcode()); |
1678 NodeProperties::ReplaceFrameStateInput( | 1679 NodeProperties::ReplaceFrameStateInput( |
1679 node, 0, environment()->Checkpoint(BailoutId(0), | 1680 node, 0, environment()->Checkpoint(BailoutId(0), |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1726 if (NodeProperties::IsControl(result)) { | 1727 if (NodeProperties::IsControl(result)) { |
1727 environment()->UpdateControlDependency(result); | 1728 environment()->UpdateControlDependency(result); |
1728 } | 1729 } |
1729 // Update the current effect dependency for effect-producing nodes. | 1730 // Update the current effect dependency for effect-producing nodes. |
1730 if (result->op()->EffectOutputCount() > 0) { | 1731 if (result->op()->EffectOutputCount() > 0) { |
1731 environment()->UpdateEffectDependency(result); | 1732 environment()->UpdateEffectDependency(result); |
1732 } | 1733 } |
1733 // Add implicit exception continuation for throwing nodes. | 1734 // Add implicit exception continuation for throwing nodes. |
1734 if (!result->op()->HasProperty(Operator::kNoThrow) && inside_handler) { | 1735 if (!result->op()->HasProperty(Operator::kNoThrow) && inside_handler) { |
1735 int handler_offset = exception_handlers_.top().handler_offset_; | 1736 int handler_offset = exception_handlers_.top().handler_offset_; |
1737 int context_index = exception_handlers_.top().context_register_; | |
1738 interpreter::Register context_register(context_index); | |
1736 // TODO(mstarzinger): Thread through correct prediction! | 1739 // TODO(mstarzinger): Thread through correct prediction! |
1737 IfExceptionHint hint = IfExceptionHint::kLocallyCaught; | 1740 IfExceptionHint hint = IfExceptionHint::kLocallyCaught; |
1738 Environment* success_env = environment()->CopyForConditional(); | 1741 Environment* success_env = environment()->CopyForConditional(); |
1739 const Operator* op = common()->IfException(hint); | 1742 const Operator* op = common()->IfException(hint); |
1740 Node* effect = environment()->GetEffectDependency(); | 1743 Node* effect = environment()->GetEffectDependency(); |
1741 Node* on_exception = graph()->NewNode(op, effect, result); | 1744 Node* on_exception = graph()->NewNode(op, effect, result); |
1745 Node* context = environment()->LookupRegister(context_register); | |
1742 environment()->UpdateControlDependency(on_exception); | 1746 environment()->UpdateControlDependency(on_exception); |
1743 environment()->UpdateEffectDependency(on_exception); | 1747 environment()->UpdateEffectDependency(on_exception); |
1744 environment()->BindAccumulator(on_exception); | 1748 environment()->BindAccumulator(on_exception); |
1749 environment()->SetContext(context); | |
1745 MergeIntoSuccessorEnvironment(handler_offset); | 1750 MergeIntoSuccessorEnvironment(handler_offset); |
1746 set_environment(success_env); | 1751 set_environment(success_env); |
1747 } | 1752 } |
1748 // Add implicit success continuation for throwing nodes. | 1753 // Add implicit success continuation for throwing nodes. |
1749 if (!result->op()->HasProperty(Operator::kNoThrow)) { | 1754 if (!result->op()->HasProperty(Operator::kNoThrow)) { |
1750 const Operator* if_success = common()->IfSuccess(); | 1755 const Operator* if_success = common()->IfSuccess(); |
1751 Node* on_success = graph()->NewNode(if_success, result); | 1756 Node* on_success = graph()->NewNode(if_success, result); |
1752 environment()->UpdateControlDependency(on_success); | 1757 environment()->UpdateControlDependency(on_success); |
1753 } | 1758 } |
1754 } | 1759 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1828 // Phi does not exist yet, introduce one. | 1833 // Phi does not exist yet, introduce one. |
1829 value = NewPhi(inputs, value, control); | 1834 value = NewPhi(inputs, value, control); |
1830 value->ReplaceInput(inputs - 1, other); | 1835 value->ReplaceInput(inputs - 1, other); |
1831 } | 1836 } |
1832 return value; | 1837 return value; |
1833 } | 1838 } |
1834 | 1839 |
1835 } // namespace compiler | 1840 } // namespace compiler |
1836 } // namespace internal | 1841 } // namespace internal |
1837 } // namespace v8 | 1842 } // namespace v8 |
OLD | NEW |