Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: src/compiler/bytecode-graph-builder.cc

Issue 1665833002: [interpreter] Switch context during stack unwinding. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/frames.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 if (current_offset < current_end) break; // Still covered by range. 1656 if (current_offset < current_end) break; // Still covered by range.
1657 exception_handlers_.pop(); 1657 exception_handlers_.pop();
1658 } 1658 }
1659 1659
1660 // Potentially enter exception handlers. 1660 // Potentially enter exception handlers.
1661 while (current_exception_handler_ < num_entries) { 1661 while (current_exception_handler_ < num_entries) {
1662 int next_start = table->GetRangeStart(current_exception_handler_); 1662 int next_start = table->GetRangeStart(current_exception_handler_);
1663 if (current_offset < next_start) break; // Not yet covered by range. 1663 if (current_offset < next_start) break; // Not yet covered by range.
1664 int next_end = table->GetRangeEnd(current_exception_handler_); 1664 int next_end = table->GetRangeEnd(current_exception_handler_);
1665 int next_handler = table->GetRangeHandler(current_exception_handler_); 1665 int next_handler = table->GetRangeHandler(current_exception_handler_);
1666 exception_handlers_.push({next_start, next_end, next_handler}); 1666 // TODO(mstarzinger): We are hijacking the "depth" field in the exception
1667 // handler table to hold the context register. We should rename the field.
1668 int context_register = table->GetRangeDepth(current_exception_handler_);
1669 exception_handlers_.push(
1670 {next_start, next_end, next_handler, context_register});
1667 current_exception_handler_++; 1671 current_exception_handler_++;
1668 } 1672 }
1669 } 1673 }
1670 1674
1671 Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count, 1675 Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count,
1672 Node** value_inputs, bool incomplete) { 1676 Node** value_inputs, bool incomplete) {
1673 DCHECK_EQ(op->ValueInputCount(), value_input_count); 1677 DCHECK_EQ(op->ValueInputCount(), value_input_count);
1674 1678
1675 bool has_context = OperatorProperties::HasContextInput(op); 1679 bool has_context = OperatorProperties::HasContextInput(op);
1676 int frame_state_count = OperatorProperties::GetFrameStateInputCount(op); 1680 int frame_state_count = OperatorProperties::GetFrameStateInputCount(op);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 if (NodeProperties::IsControl(result)) { 1717 if (NodeProperties::IsControl(result)) {
1714 environment()->UpdateControlDependency(result); 1718 environment()->UpdateControlDependency(result);
1715 } 1719 }
1716 // Update the current effect dependency for effect-producing nodes. 1720 // Update the current effect dependency for effect-producing nodes.
1717 if (result->op()->EffectOutputCount() > 0) { 1721 if (result->op()->EffectOutputCount() > 0) {
1718 environment()->UpdateEffectDependency(result); 1722 environment()->UpdateEffectDependency(result);
1719 } 1723 }
1720 // Add implicit exception continuation for throwing nodes. 1724 // Add implicit exception continuation for throwing nodes.
1721 if (!result->op()->HasProperty(Operator::kNoThrow) && inside_handler) { 1725 if (!result->op()->HasProperty(Operator::kNoThrow) && inside_handler) {
1722 int handler_offset = exception_handlers_.top().handler_offset_; 1726 int handler_offset = exception_handlers_.top().handler_offset_;
1727 int context_index = exception_handlers_.top().context_register_;
1728 interpreter::Register context_register(context_index);
1723 // TODO(mstarzinger): Thread through correct prediction! 1729 // TODO(mstarzinger): Thread through correct prediction!
1724 IfExceptionHint hint = IfExceptionHint::kLocallyCaught; 1730 IfExceptionHint hint = IfExceptionHint::kLocallyCaught;
1725 Environment* success_env = environment()->CopyForConditional(); 1731 Environment* success_env = environment()->CopyForConditional();
1726 const Operator* op = common()->IfException(hint); 1732 const Operator* op = common()->IfException(hint);
1727 Node* effect = environment()->GetEffectDependency(); 1733 Node* effect = environment()->GetEffectDependency();
1728 Node* on_exception = graph()->NewNode(op, effect, result); 1734 Node* on_exception = graph()->NewNode(op, effect, result);
1735 Node* context = environment()->LookupRegister(context_register);
1729 environment()->UpdateControlDependency(on_exception); 1736 environment()->UpdateControlDependency(on_exception);
1730 environment()->UpdateEffectDependency(on_exception); 1737 environment()->UpdateEffectDependency(on_exception);
1731 environment()->BindAccumulator(on_exception); 1738 environment()->BindAccumulator(on_exception);
1739 environment()->SetContext(context);
1732 MergeIntoSuccessorEnvironment(handler_offset); 1740 MergeIntoSuccessorEnvironment(handler_offset);
1733 set_environment(success_env); 1741 set_environment(success_env);
1734 } 1742 }
1735 // Add implicit success continuation for throwing nodes. 1743 // Add implicit success continuation for throwing nodes.
1736 if (!result->op()->HasProperty(Operator::kNoThrow)) { 1744 if (!result->op()->HasProperty(Operator::kNoThrow)) {
1737 const Operator* if_success = common()->IfSuccess(); 1745 const Operator* if_success = common()->IfSuccess();
1738 Node* on_success = graph()->NewNode(if_success, result); 1746 Node* on_success = graph()->NewNode(if_success, result);
1739 environment()->UpdateControlDependency(on_success); 1747 environment()->UpdateControlDependency(on_success);
1740 } 1748 }
1741 } 1749 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 // Phi does not exist yet, introduce one. 1823 // Phi does not exist yet, introduce one.
1816 value = NewPhi(inputs, value, control); 1824 value = NewPhi(inputs, value, control);
1817 value->ReplaceInput(inputs - 1, other); 1825 value->ReplaceInput(inputs - 1, other);
1818 } 1826 }
1819 return value; 1827 return value;
1820 } 1828 }
1821 1829
1822 } // namespace compiler 1830 } // namespace compiler
1823 } // namespace internal 1831 } // namespace internal
1824 } // namespace v8 1832 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/frames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698