Chromium Code Reviews| 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 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1665 if (current_offset < current_end) break; // Still covered by range. | 1665 if (current_offset < current_end) break; // Still covered by range. |
| 1666 exception_handlers_.pop(); | 1666 exception_handlers_.pop(); |
| 1667 } | 1667 } |
| 1668 | 1668 |
| 1669 // Potentially enter exception handlers. | 1669 // Potentially enter exception handlers. |
| 1670 while (current_exception_handler_ < num_entries) { | 1670 while (current_exception_handler_ < num_entries) { |
| 1671 int next_start = table->GetRangeStart(current_exception_handler_); | 1671 int next_start = table->GetRangeStart(current_exception_handler_); |
| 1672 if (current_offset < next_start) break; // Not yet covered by range. | 1672 if (current_offset < next_start) break; // Not yet covered by range. |
| 1673 int next_end = table->GetRangeEnd(current_exception_handler_); | 1673 int next_end = table->GetRangeEnd(current_exception_handler_); |
| 1674 int next_handler = table->GetRangeHandler(current_exception_handler_); | 1674 int next_handler = table->GetRangeHandler(current_exception_handler_); |
| 1675 exception_handlers_.push({next_start, next_end, next_handler}); | 1675 int next_depth = table->GetRangeDepth(current_exception_handler_); |
|
rmcilroy
2016/02/04 12:22:49
nit - could we call the local context_register ins
Michael Starzinger
2016/02/04 12:40:32
Done.
| |
| 1676 exception_handlers_.push({next_start, next_end, next_handler, next_depth}); | |
| 1676 current_exception_handler_++; | 1677 current_exception_handler_++; |
| 1677 } | 1678 } |
| 1678 } | 1679 } |
| 1679 | 1680 |
| 1680 void BytecodeGraphBuilder::PrepareEntryFrameState(Node* node) { | 1681 void BytecodeGraphBuilder::PrepareEntryFrameState(Node* node) { |
| 1681 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); | 1682 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); |
| 1682 DCHECK_EQ(IrOpcode::kDead, | 1683 DCHECK_EQ(IrOpcode::kDead, |
| 1683 NodeProperties::GetFrameStateInput(node, 0)->opcode()); | 1684 NodeProperties::GetFrameStateInput(node, 0)->opcode()); |
| 1684 NodeProperties::ReplaceFrameStateInput( | 1685 NodeProperties::ReplaceFrameStateInput( |
| 1685 node, 0, environment()->Checkpoint(BailoutId(0), | 1686 node, 0, environment()->Checkpoint(BailoutId(0), |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1732 if (NodeProperties::IsControl(result)) { | 1733 if (NodeProperties::IsControl(result)) { |
| 1733 environment()->UpdateControlDependency(result); | 1734 environment()->UpdateControlDependency(result); |
| 1734 } | 1735 } |
| 1735 // Update the current effect dependency for effect-producing nodes. | 1736 // Update the current effect dependency for effect-producing nodes. |
| 1736 if (result->op()->EffectOutputCount() > 0) { | 1737 if (result->op()->EffectOutputCount() > 0) { |
| 1737 environment()->UpdateEffectDependency(result); | 1738 environment()->UpdateEffectDependency(result); |
| 1738 } | 1739 } |
| 1739 // Add implicit exception continuation for throwing nodes. | 1740 // Add implicit exception continuation for throwing nodes. |
| 1740 if (!result->op()->HasProperty(Operator::kNoThrow) && inside_handler) { | 1741 if (!result->op()->HasProperty(Operator::kNoThrow) && inside_handler) { |
| 1741 int handler_offset = exception_handlers_.top().handler_offset_; | 1742 int handler_offset = exception_handlers_.top().handler_offset_; |
| 1743 int context_index = exception_handlers_.top().context_register_; | |
| 1744 interpreter::Register context_register(context_index); | |
| 1742 // TODO(mstarzinger): Thread through correct prediction! | 1745 // TODO(mstarzinger): Thread through correct prediction! |
| 1743 IfExceptionHint hint = IfExceptionHint::kLocallyCaught; | 1746 IfExceptionHint hint = IfExceptionHint::kLocallyCaught; |
| 1744 Environment* success_env = environment()->CopyForConditional(); | 1747 Environment* success_env = environment()->CopyForConditional(); |
| 1745 const Operator* op = common()->IfException(hint); | 1748 const Operator* op = common()->IfException(hint); |
| 1746 Node* effect = environment()->GetEffectDependency(); | 1749 Node* effect = environment()->GetEffectDependency(); |
| 1747 Node* on_exception = graph()->NewNode(op, effect, result); | 1750 Node* on_exception = graph()->NewNode(op, effect, result); |
| 1751 Node* context = environment()->LookupRegister(context_register); | |
| 1748 environment()->UpdateControlDependency(on_exception); | 1752 environment()->UpdateControlDependency(on_exception); |
| 1749 environment()->UpdateEffectDependency(on_exception); | 1753 environment()->UpdateEffectDependency(on_exception); |
| 1750 environment()->BindAccumulator(on_exception); | 1754 environment()->BindAccumulator(on_exception); |
| 1755 environment()->SetContext(context); | |
| 1751 MergeIntoSuccessorEnvironment(handler_offset); | 1756 MergeIntoSuccessorEnvironment(handler_offset); |
| 1752 set_environment(success_env); | 1757 set_environment(success_env); |
| 1753 } | 1758 } |
| 1754 // Add implicit success continuation for throwing nodes. | 1759 // Add implicit success continuation for throwing nodes. |
| 1755 if (!result->op()->HasProperty(Operator::kNoThrow)) { | 1760 if (!result->op()->HasProperty(Operator::kNoThrow)) { |
| 1756 const Operator* if_success = common()->IfSuccess(); | 1761 const Operator* if_success = common()->IfSuccess(); |
| 1757 Node* on_success = graph()->NewNode(if_success, result); | 1762 Node* on_success = graph()->NewNode(if_success, result); |
| 1758 environment()->UpdateControlDependency(on_success); | 1763 environment()->UpdateControlDependency(on_success); |
| 1759 } | 1764 } |
| 1760 } | 1765 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1834 // Phi does not exist yet, introduce one. | 1839 // Phi does not exist yet, introduce one. |
| 1835 value = NewPhi(inputs, value, control); | 1840 value = NewPhi(inputs, value, control); |
| 1836 value->ReplaceInput(inputs - 1, other); | 1841 value->ReplaceInput(inputs - 1, other); |
| 1837 } | 1842 } |
| 1838 return value; | 1843 return value; |
| 1839 } | 1844 } |
| 1840 | 1845 |
| 1841 } // namespace compiler | 1846 } // namespace compiler |
| 1842 } // namespace internal | 1847 } // namespace internal |
| 1843 } // namespace v8 | 1848 } // namespace v8 |
| OLD | NEW |