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

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

Issue 1676293002: [interpreter] Workaround for unused frame states. (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 | « no previous file | no next file » | 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 int accumulator_base_; 94 int accumulator_base_;
95 }; 95 };
96 96
97 // Helper for generating frame states for before and after a bytecode. 97 // Helper for generating frame states for before and after a bytecode.
98 class BytecodeGraphBuilder::FrameStateBeforeAndAfter { 98 class BytecodeGraphBuilder::FrameStateBeforeAndAfter {
99 public: 99 public:
100 explicit FrameStateBeforeAndAfter(BytecodeGraphBuilder* builder) 100 explicit FrameStateBeforeAndAfter(BytecodeGraphBuilder* builder)
101 : builder_(builder), 101 : builder_(builder),
102 id_after_(BailoutId::None()), 102 id_after_(BailoutId::None()),
103 added_to_node_(false), 103 added_to_node_(false),
104 frame_states_unused_(false),
104 output_poke_offset_(0), 105 output_poke_offset_(0),
105 output_poke_count_(0) { 106 output_poke_count_(0) {
106 BailoutId id_before(builder->bytecode_iterator().current_offset()); 107 BailoutId id_before(builder->bytecode_iterator().current_offset());
107 frame_state_before_ = builder_->environment()->Checkpoint( 108 frame_state_before_ = builder_->environment()->Checkpoint(
108 id_before, OutputFrameStateCombine::Ignore()); 109 id_before, OutputFrameStateCombine::Ignore());
109 id_after_ = BailoutId(id_before.ToInt() + 110 id_after_ = BailoutId(id_before.ToInt() +
110 builder->bytecode_iterator().current_bytecode_size()); 111 builder->bytecode_iterator().current_bytecode_size());
111 } 112 }
112 113
113 ~FrameStateBeforeAndAfter() { 114 ~FrameStateBeforeAndAfter() {
114 DCHECK(added_to_node_); 115 DCHECK(added_to_node_);
115 DCHECK(builder_->environment()->StateValuesAreUpToDate(output_poke_offset_, 116 DCHECK(frame_states_unused_ ||
117 builder_->environment()->StateValuesAreUpToDate(output_poke_offset_,
116 output_poke_count_)); 118 output_poke_count_));
117 } 119 }
118 120
119 private: 121 private:
120 friend class Environment; 122 friend class Environment;
121 123
122 void AddToNode(Node* node, OutputFrameStateCombine combine) { 124 void AddToNode(Node* node, OutputFrameStateCombine combine) {
123 DCHECK(!added_to_node_); 125 DCHECK(!added_to_node_);
124 int count = OperatorProperties::GetFrameStateInputCount(node->op()); 126 int count = OperatorProperties::GetFrameStateInputCount(node->op());
125 DCHECK_LE(count, 2); 127 DCHECK_LE(count, 2);
(...skipping 10 matching lines...) Expand all
136 // Add the frame state for before the operation. 138 // Add the frame state for before the operation.
137 DCHECK_EQ(IrOpcode::kDead, 139 DCHECK_EQ(IrOpcode::kDead,
138 NodeProperties::GetFrameStateInput(node, 1)->opcode()); 140 NodeProperties::GetFrameStateInput(node, 1)->opcode());
139 NodeProperties::ReplaceFrameStateInput(node, 1, frame_state_before_); 141 NodeProperties::ReplaceFrameStateInput(node, 1, frame_state_before_);
140 } 142 }
141 143
142 if (!combine.IsOutputIgnored()) { 144 if (!combine.IsOutputIgnored()) {
143 output_poke_offset_ = static_cast<int>(combine.GetOffsetToPokeAt()); 145 output_poke_offset_ = static_cast<int>(combine.GetOffsetToPokeAt());
144 output_poke_count_ = node->op()->ValueOutputCount(); 146 output_poke_count_ = node->op()->ValueOutputCount();
145 } 147 }
148 frame_states_unused_ = count == 0;
146 added_to_node_ = true; 149 added_to_node_ = true;
147 } 150 }
148 151
149 BytecodeGraphBuilder* builder_; 152 BytecodeGraphBuilder* builder_;
150 Node* frame_state_before_; 153 Node* frame_state_before_;
151 BailoutId id_after_; 154 BailoutId id_after_;
152 155
153 bool added_to_node_; 156 bool added_to_node_;
157 bool frame_states_unused_;
154 int output_poke_offset_; 158 int output_poke_offset_;
155 int output_poke_count_; 159 int output_poke_count_;
156 }; 160 };
157 161
158 162
159 // Issues: 163 // Issues:
160 // - Scopes - intimately tied to AST. Need to eval what is needed. 164 // - Scopes - intimately tied to AST. Need to eval what is needed.
161 // - Need to resolve closure parameter treatment. 165 // - Need to resolve closure parameter treatment.
162 BytecodeGraphBuilder::Environment::Environment(BytecodeGraphBuilder* builder, 166 BytecodeGraphBuilder::Environment::Environment(BytecodeGraphBuilder* builder,
163 int register_count, 167 int register_count,
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 // Phi does not exist yet, introduce one. 1836 // Phi does not exist yet, introduce one.
1833 value = NewPhi(inputs, value, control); 1837 value = NewPhi(inputs, value, control);
1834 value->ReplaceInput(inputs - 1, other); 1838 value->ReplaceInput(inputs - 1, other);
1835 } 1839 }
1836 return value; 1840 return value;
1837 } 1841 }
1838 1842
1839 } // namespace compiler 1843 } // namespace compiler
1840 } // namespace internal 1844 } // namespace internal
1841 } // namespace v8 1845 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698