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 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 exception_handlers_.pop(); | 1663 exception_handlers_.pop(); |
1664 } | 1664 } |
1665 | 1665 |
1666 // Potentially enter exception handlers. | 1666 // Potentially enter exception handlers. |
1667 while (current_exception_handler_ < num_entries) { | 1667 while (current_exception_handler_ < num_entries) { |
1668 int next_start = table->GetRangeStart(current_exception_handler_); | 1668 int next_start = table->GetRangeStart(current_exception_handler_); |
1669 if (current_offset < next_start) break; // Not yet covered by range. | 1669 if (current_offset < next_start) break; // Not yet covered by range. |
1670 int next_end = table->GetRangeEnd(current_exception_handler_); | 1670 int next_end = table->GetRangeEnd(current_exception_handler_); |
1671 int next_handler = table->GetRangeHandler(current_exception_handler_); | 1671 int next_handler = table->GetRangeHandler(current_exception_handler_); |
1672 int context_register = table->GetRangeData(current_exception_handler_); | 1672 int context_register = table->GetRangeData(current_exception_handler_); |
1673 CatchPrediction pred = | |
1674 table->GetRangePrediction(current_exception_handler_); | |
1675 exception_handlers_.push( | 1673 exception_handlers_.push( |
1676 {next_start, next_end, next_handler, context_register, pred}); | 1674 {next_start, next_end, next_handler, context_register}); |
1677 current_exception_handler_++; | 1675 current_exception_handler_++; |
1678 } | 1676 } |
1679 } | 1677 } |
1680 | 1678 |
1681 Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count, | 1679 Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count, |
1682 Node** value_inputs, bool incomplete) { | 1680 Node** value_inputs, bool incomplete) { |
1683 DCHECK_EQ(op->ValueInputCount(), value_input_count); | 1681 DCHECK_EQ(op->ValueInputCount(), value_input_count); |
1684 | 1682 |
1685 bool has_context = OperatorProperties::HasContextInput(op); | 1683 bool has_context = OperatorProperties::HasContextInput(op); |
1686 int frame_state_count = OperatorProperties::GetFrameStateInputCount(op); | 1684 int frame_state_count = OperatorProperties::GetFrameStateInputCount(op); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1724 environment()->UpdateControlDependency(result); | 1722 environment()->UpdateControlDependency(result); |
1725 } | 1723 } |
1726 // Update the current effect dependency for effect-producing nodes. | 1724 // Update the current effect dependency for effect-producing nodes. |
1727 if (result->op()->EffectOutputCount() > 0) { | 1725 if (result->op()->EffectOutputCount() > 0) { |
1728 environment()->UpdateEffectDependency(result); | 1726 environment()->UpdateEffectDependency(result); |
1729 } | 1727 } |
1730 // Add implicit exception continuation for throwing nodes. | 1728 // Add implicit exception continuation for throwing nodes. |
1731 if (!result->op()->HasProperty(Operator::kNoThrow) && inside_handler) { | 1729 if (!result->op()->HasProperty(Operator::kNoThrow) && inside_handler) { |
1732 int handler_offset = exception_handlers_.top().handler_offset_; | 1730 int handler_offset = exception_handlers_.top().handler_offset_; |
1733 int context_index = exception_handlers_.top().context_register_; | 1731 int context_index = exception_handlers_.top().context_register_; |
1734 CatchPrediction prediction = exception_handlers_.top().pred_; | |
1735 interpreter::Register context_register(context_index); | 1732 interpreter::Register context_register(context_index); |
1736 IfExceptionHint hint = ExceptionHintFromCatchPrediction(prediction); | |
1737 Environment* success_env = environment()->CopyForConditional(); | 1733 Environment* success_env = environment()->CopyForConditional(); |
1738 const Operator* op = common()->IfException(hint); | 1734 const Operator* op = common()->IfException(); |
1739 Node* effect = environment()->GetEffectDependency(); | 1735 Node* effect = environment()->GetEffectDependency(); |
1740 Node* on_exception = graph()->NewNode(op, effect, result); | 1736 Node* on_exception = graph()->NewNode(op, effect, result); |
1741 Node* context = environment()->LookupRegister(context_register); | 1737 Node* context = environment()->LookupRegister(context_register); |
1742 environment()->UpdateControlDependency(on_exception); | 1738 environment()->UpdateControlDependency(on_exception); |
1743 environment()->UpdateEffectDependency(on_exception); | 1739 environment()->UpdateEffectDependency(on_exception); |
1744 environment()->BindAccumulator(on_exception); | 1740 environment()->BindAccumulator(on_exception); |
1745 environment()->SetContext(context); | 1741 environment()->SetContext(context); |
1746 MergeIntoSuccessorEnvironment(handler_offset); | 1742 MergeIntoSuccessorEnvironment(handler_offset); |
1747 set_environment(success_env); | 1743 set_environment(success_env); |
1748 } | 1744 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 // Phi does not exist yet, introduce one. | 1825 // Phi does not exist yet, introduce one. |
1830 value = NewPhi(inputs, value, control); | 1826 value = NewPhi(inputs, value, control); |
1831 value->ReplaceInput(inputs - 1, other); | 1827 value->ReplaceInput(inputs - 1, other); |
1832 } | 1828 } |
1833 return value; | 1829 return value; |
1834 } | 1830 } |
1835 | 1831 |
1836 } // namespace compiler | 1832 } // namespace compiler |
1837 } // namespace internal | 1833 } // namespace internal |
1838 } // namespace v8 | 1834 } // namespace v8 |
OLD | NEW |