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

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

Issue 1690973002: [interpreter] Correctly thread through catch prediction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/interpreter/bytecode-generator.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 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_);
1640 exception_handlers_.push( 1642 exception_handlers_.push(
1641 {next_start, next_end, next_handler, context_register}); 1643 {next_start, next_end, next_handler, context_register, pred});
1642 current_exception_handler_++; 1644 current_exception_handler_++;
1643 } 1645 }
1644 } 1646 }
1645 1647
1646 Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count, 1648 Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count,
1647 Node** value_inputs, bool incomplete) { 1649 Node** value_inputs, bool incomplete) {
1648 DCHECK_EQ(op->ValueInputCount(), value_input_count); 1650 DCHECK_EQ(op->ValueInputCount(), value_input_count);
1649 1651
1650 bool has_context = OperatorProperties::HasContextInput(op); 1652 bool has_context = OperatorProperties::HasContextInput(op);
1651 int frame_state_count = OperatorProperties::GetFrameStateInputCount(op); 1653 int frame_state_count = OperatorProperties::GetFrameStateInputCount(op);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 environment()->UpdateControlDependency(result); 1691 environment()->UpdateControlDependency(result);
1690 } 1692 }
1691 // Update the current effect dependency for effect-producing nodes. 1693 // Update the current effect dependency for effect-producing nodes.
1692 if (result->op()->EffectOutputCount() > 0) { 1694 if (result->op()->EffectOutputCount() > 0) {
1693 environment()->UpdateEffectDependency(result); 1695 environment()->UpdateEffectDependency(result);
1694 } 1696 }
1695 // Add implicit exception continuation for throwing nodes. 1697 // Add implicit exception continuation for throwing nodes.
1696 if (!result->op()->HasProperty(Operator::kNoThrow) && inside_handler) { 1698 if (!result->op()->HasProperty(Operator::kNoThrow) && inside_handler) {
1697 int handler_offset = exception_handlers_.top().handler_offset_; 1699 int handler_offset = exception_handlers_.top().handler_offset_;
1698 int context_index = exception_handlers_.top().context_register_; 1700 int context_index = exception_handlers_.top().context_register_;
1701 CatchPrediction prediction = exception_handlers_.top().pred_;
1699 interpreter::Register context_register(context_index); 1702 interpreter::Register context_register(context_index);
1700 // TODO(mstarzinger): Thread through correct prediction! 1703 IfExceptionHint hint = prediction == CatchPrediction::CAUGHT
1701 IfExceptionHint hint = IfExceptionHint::kLocallyCaught; 1704 ? IfExceptionHint::kLocallyCaught
1705 : IfExceptionHint::kLocallyUncaught;
1702 Environment* success_env = environment()->CopyForConditional(); 1706 Environment* success_env = environment()->CopyForConditional();
1703 const Operator* op = common()->IfException(hint); 1707 const Operator* op = common()->IfException(hint);
1704 Node* effect = environment()->GetEffectDependency(); 1708 Node* effect = environment()->GetEffectDependency();
1705 Node* on_exception = graph()->NewNode(op, effect, result); 1709 Node* on_exception = graph()->NewNode(op, effect, result);
1706 Node* context = environment()->LookupRegister(context_register); 1710 Node* context = environment()->LookupRegister(context_register);
1707 environment()->UpdateControlDependency(on_exception); 1711 environment()->UpdateControlDependency(on_exception);
1708 environment()->UpdateEffectDependency(on_exception); 1712 environment()->UpdateEffectDependency(on_exception);
1709 environment()->BindAccumulator(on_exception); 1713 environment()->BindAccumulator(on_exception);
1710 environment()->SetContext(context); 1714 environment()->SetContext(context);
1711 MergeIntoSuccessorEnvironment(handler_offset); 1715 MergeIntoSuccessorEnvironment(handler_offset);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 // Phi does not exist yet, introduce one. 1798 // Phi does not exist yet, introduce one.
1795 value = NewPhi(inputs, value, control); 1799 value = NewPhi(inputs, value, control);
1796 value->ReplaceInput(inputs - 1, other); 1800 value->ReplaceInput(inputs - 1, other);
1797 } 1801 }
1798 return value; 1802 return value;
1799 } 1803 }
1800 1804
1801 } // namespace compiler 1805 } // namespace compiler
1802 } // namespace internal 1806 } // namespace internal
1803 } // namespace v8 1807 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698