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" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 namespace compiler { | 14 namespace compiler { |
15 | 15 |
| 16 // Helper for generating frame states for before and after a bytecode. |
| 17 class BytecodeGraphBuilder::FrameStateBeforeAndAfter { |
| 18 public: |
| 19 FrameStateBeforeAndAfter(BytecodeGraphBuilder* builder, |
| 20 const interpreter::BytecodeArrayIterator& iterator) |
| 21 : builder_(builder), id_after_(BailoutId::None()) { |
| 22 BailoutId id_before(iterator.current_offset()); |
| 23 frame_state_before_ = builder_->environment()->Checkpoint( |
| 24 id_before, AccumulatorUpdateMode::kOutputIgnored); |
| 25 id_after_ = BailoutId(id_before.ToInt() + iterator.current_bytecode_size()); |
| 26 } |
| 27 |
| 28 ~FrameStateBeforeAndAfter() { |
| 29 DCHECK(builder_->environment()->StateValuesAreUpToDate( |
| 30 accumulator_update_mode_)); |
| 31 } |
| 32 |
| 33 private: |
| 34 friend class Environment; |
| 35 |
| 36 void AddToNode(Node* node, AccumulatorUpdateMode update_mode) { |
| 37 int count = OperatorProperties::GetFrameStateInputCount(node->op()); |
| 38 DCHECK_LE(count, 2); |
| 39 if (count >= 1) { |
| 40 // Add the frame state for after the operation. |
| 41 DCHECK_EQ(IrOpcode::kDead, |
| 42 NodeProperties::GetFrameStateInput(node, 0)->opcode()); |
| 43 Node* frame_state_after = |
| 44 builder_->environment()->Checkpoint(id_after_, update_mode); |
| 45 NodeProperties::ReplaceFrameStateInput(node, 0, frame_state_after); |
| 46 } |
| 47 |
| 48 if (count >= 2) { |
| 49 // Add the frame state for before the operation. |
| 50 DCHECK_EQ(IrOpcode::kDead, |
| 51 NodeProperties::GetFrameStateInput(node, 1)->opcode()); |
| 52 NodeProperties::ReplaceFrameStateInput(node, 1, frame_state_before_); |
| 53 } |
| 54 accumulator_update_mode_ = update_mode; |
| 55 } |
| 56 |
| 57 BytecodeGraphBuilder* builder_; |
| 58 Node* frame_state_before_; |
| 59 BailoutId id_after_; |
| 60 AccumulatorUpdateMode accumulator_update_mode_; |
| 61 }; |
| 62 |
| 63 |
16 // Issues: | 64 // Issues: |
17 // - Need to deal with FrameState / FrameStateBeforeAndAfter / StateValue. | |
18 // - Scopes - intimately tied to AST. Need to eval what is needed. | 65 // - Scopes - intimately tied to AST. Need to eval what is needed. |
19 // - Need to resolve closure parameter treatment. | 66 // - Need to resolve closure parameter treatment. |
20 BytecodeGraphBuilder::Environment::Environment(BytecodeGraphBuilder* builder, | 67 BytecodeGraphBuilder::Environment::Environment(BytecodeGraphBuilder* builder, |
21 int register_count, | 68 int register_count, |
22 int parameter_count, | 69 int parameter_count, |
23 Node* control_dependency, | 70 Node* control_dependency, |
24 Node* context) | 71 Node* context) |
25 : builder_(builder), | 72 : builder_(builder), |
26 register_count_(register_count), | 73 register_count_(register_count), |
27 parameter_count_(parameter_count), | 74 parameter_count_(parameter_count), |
28 context_(context), | 75 context_(context), |
29 control_dependency_(control_dependency), | 76 control_dependency_(control_dependency), |
30 effect_dependency_(control_dependency), | 77 effect_dependency_(control_dependency), |
31 values_(builder->local_zone()) { | 78 values_(builder->local_zone()), |
| 79 parameters_state_values_(nullptr), |
| 80 registers_state_values_(nullptr), |
| 81 accumulator_state_values_(nullptr) { |
32 // The layout of values_ is: | 82 // The layout of values_ is: |
33 // | 83 // |
34 // [receiver] [parameters] [registers] | 84 // [receiver] [parameters] [registers] [accumulator] |
35 // | 85 // |
36 // parameter[0] is the receiver (this), parameters 1..N are the | 86 // parameter[0] is the receiver (this), parameters 1..N are the |
37 // parameters supplied to the method (arg0..argN-1). The accumulator | 87 // parameters supplied to the method (arg0..argN-1). The accumulator |
38 // is stored separately. | 88 // is stored separately. |
39 | 89 |
40 // Parameters including the receiver | 90 // Parameters including the receiver |
41 for (int i = 0; i < parameter_count; i++) { | 91 for (int i = 0; i < parameter_count; i++) { |
42 const char* debug_name = (i == 0) ? "%this" : nullptr; | 92 const char* debug_name = (i == 0) ? "%this" : nullptr; |
43 const Operator* op = common()->Parameter(i, debug_name); | 93 const Operator* op = common()->Parameter(i, debug_name); |
44 Node* parameter = builder->graph()->NewNode(op, graph()->start()); | 94 Node* parameter = builder->graph()->NewNode(op, graph()->start()); |
45 values()->push_back(parameter); | 95 values()->push_back(parameter); |
46 } | 96 } |
47 | 97 |
48 // Registers | 98 // Registers |
49 register_base_ = static_cast<int>(values()->size()); | 99 register_base_ = static_cast<int>(values()->size()); |
50 Node* undefined_constant = builder->jsgraph()->UndefinedConstant(); | 100 Node* undefined_constant = builder->jsgraph()->UndefinedConstant(); |
51 values()->insert(values()->end(), register_count, undefined_constant); | 101 values()->insert(values()->end(), register_count, undefined_constant); |
52 | 102 |
53 // Accumulator | 103 // Accumulator |
54 accumulator_ = undefined_constant; | 104 accumulator_base_ = static_cast<int>(values()->size()); |
| 105 values()->push_back(undefined_constant); |
55 } | 106 } |
56 | 107 |
57 | 108 |
58 BytecodeGraphBuilder::Environment::Environment( | 109 BytecodeGraphBuilder::Environment::Environment( |
59 const BytecodeGraphBuilder::Environment* other) | 110 const BytecodeGraphBuilder::Environment* other) |
60 : builder_(other->builder_), | 111 : builder_(other->builder_), |
61 register_count_(other->register_count_), | 112 register_count_(other->register_count_), |
62 parameter_count_(other->parameter_count_), | 113 parameter_count_(other->parameter_count_), |
63 accumulator_(other->accumulator_), | |
64 context_(other->context_), | 114 context_(other->context_), |
65 control_dependency_(other->control_dependency_), | 115 control_dependency_(other->control_dependency_), |
66 effect_dependency_(other->effect_dependency_), | 116 effect_dependency_(other->effect_dependency_), |
67 values_(other->zone()), | 117 values_(other->zone()), |
68 register_base_(other->register_base_) { | 118 parameters_state_values_(nullptr), |
| 119 registers_state_values_(nullptr), |
| 120 accumulator_state_values_(nullptr), |
| 121 register_base_(other->register_base_), |
| 122 accumulator_base_(other->accumulator_base_) { |
69 values_ = other->values_; | 123 values_ = other->values_; |
70 } | 124 } |
71 | 125 |
72 | 126 |
73 int BytecodeGraphBuilder::Environment::RegisterToValuesIndex( | 127 int BytecodeGraphBuilder::Environment::RegisterToValuesIndex( |
74 interpreter::Register the_register) const { | 128 interpreter::Register the_register) const { |
75 if (the_register.is_parameter()) { | 129 if (the_register.is_parameter()) { |
76 return the_register.ToParameterIndex(parameter_count()); | 130 return the_register.ToParameterIndex(parameter_count()); |
77 } else { | 131 } else { |
78 return the_register.index() + register_base(); | 132 return the_register.index() + register_base(); |
(...skipping 16 matching lines...) Expand all Loading... |
95 return builder()->GetFunctionClosure(); | 149 return builder()->GetFunctionClosure(); |
96 } else if (the_register.is_new_target()) { | 150 } else if (the_register.is_new_target()) { |
97 return builder()->GetNewTarget(); | 151 return builder()->GetNewTarget(); |
98 } else { | 152 } else { |
99 int values_index = RegisterToValuesIndex(the_register); | 153 int values_index = RegisterToValuesIndex(the_register); |
100 return values()->at(values_index); | 154 return values()->at(values_index); |
101 } | 155 } |
102 } | 156 } |
103 | 157 |
104 | 158 |
105 void BytecodeGraphBuilder::Environment::BindAccumulator(Node* node) { | 159 void BytecodeGraphBuilder::Environment::BindAccumulator( |
106 accumulator_ = node; | 160 Node* node, FrameStateBeforeAndAfter* states) { |
| 161 if (states) { |
| 162 states->AddToNode(node, AccumulatorUpdateMode::kOutputInAccumulator); |
| 163 } |
| 164 values()->at(accumulator_base_) = node; |
| 165 } |
| 166 |
| 167 void BytecodeGraphBuilder::Environment::RecordAfterState( |
| 168 Node* node, FrameStateBeforeAndAfter* states) { |
| 169 states->AddToNode(node, AccumulatorUpdateMode::kOutputIgnored); |
107 } | 170 } |
108 | 171 |
109 | 172 |
110 Node* BytecodeGraphBuilder::Environment::LookupAccumulator() const { | 173 Node* BytecodeGraphBuilder::Environment::LookupAccumulator() const { |
111 return accumulator_; | 174 return values()->at(accumulator_base_); |
112 } | 175 } |
113 | 176 |
114 | 177 |
115 bool BytecodeGraphBuilder::Environment::IsMarkedAsUnreachable() const { | 178 bool BytecodeGraphBuilder::Environment::IsMarkedAsUnreachable() const { |
116 return GetControlDependency()->opcode() == IrOpcode::kDead; | 179 return GetControlDependency()->opcode() == IrOpcode::kDead; |
117 } | 180 } |
118 | 181 |
119 | 182 |
120 void BytecodeGraphBuilder::Environment::MarkAsUnreachable() { | 183 void BytecodeGraphBuilder::Environment::MarkAsUnreachable() { |
121 UpdateControlDependency(builder()->jsgraph()->Dead()); | 184 UpdateControlDependency(builder()->jsgraph()->Dead()); |
(...skipping 27 matching lines...) Expand all Loading... |
149 UpdateControlDependency(control); | 212 UpdateControlDependency(control); |
150 | 213 |
151 // Create a merge of the effect dependencies of both environments and update | 214 // Create a merge of the effect dependencies of both environments and update |
152 // the current environment's effect dependency accordingly. | 215 // the current environment's effect dependency accordingly. |
153 Node* effect = builder()->MergeEffect(GetEffectDependency(), | 216 Node* effect = builder()->MergeEffect(GetEffectDependency(), |
154 other->GetEffectDependency(), control); | 217 other->GetEffectDependency(), control); |
155 UpdateEffectDependency(effect); | 218 UpdateEffectDependency(effect); |
156 | 219 |
157 // Introduce Phi nodes for values that have differing input at merge points, | 220 // Introduce Phi nodes for values that have differing input at merge points, |
158 // potentially extending an existing Phi node if possible. | 221 // potentially extending an existing Phi node if possible. |
159 accumulator_ = | |
160 builder()->MergeValue(accumulator_, other->accumulator_, control); | |
161 context_ = builder()->MergeValue(context_, other->context_, control); | 222 context_ = builder()->MergeValue(context_, other->context_, control); |
162 for (size_t i = 0; i < values_.size(); i++) { | 223 for (size_t i = 0; i < values_.size(); i++) { |
163 values_[i] = builder()->MergeValue(values_[i], other->values_[i], control); | 224 values_[i] = builder()->MergeValue(values_[i], other->values_[i], control); |
164 } | 225 } |
165 } | 226 } |
166 | 227 |
167 | 228 |
168 void BytecodeGraphBuilder::Environment::PrepareForLoop() { | 229 void BytecodeGraphBuilder::Environment::PrepareForLoop() { |
169 // Create a control node for the loop header. | 230 // Create a control node for the loop header. |
170 Node* control = builder()->NewLoop(); | 231 Node* control = builder()->NewLoop(); |
171 | 232 |
172 // Create a Phi for external effects. | 233 // Create a Phi for external effects. |
173 Node* effect = builder()->NewEffectPhi(1, GetEffectDependency(), control); | 234 Node* effect = builder()->NewEffectPhi(1, GetEffectDependency(), control); |
174 UpdateEffectDependency(effect); | 235 UpdateEffectDependency(effect); |
175 | 236 |
176 // Assume everything in the loop is updated. | 237 // Assume everything in the loop is updated. |
177 accumulator_ = builder()->NewPhi(1, accumulator_, control); | |
178 context_ = builder()->NewPhi(1, context_, control); | 238 context_ = builder()->NewPhi(1, context_, control); |
179 int size = static_cast<int>(values()->size()); | 239 int size = static_cast<int>(values()->size()); |
180 for (int i = 0; i < size; i++) { | 240 for (int i = 0; i < size; i++) { |
181 values()->at(i) = builder()->NewPhi(1, values()->at(i), control); | 241 values()->at(i) = builder()->NewPhi(1, values()->at(i), control); |
182 } | 242 } |
183 | 243 |
184 // Connect to the loop end. | 244 // Connect to the loop end. |
185 Node* terminate = builder()->graph()->NewNode( | 245 Node* terminate = builder()->graph()->NewNode( |
186 builder()->common()->Terminate(), effect, control); | 246 builder()->common()->Terminate(), effect, control); |
187 builder()->exit_controls_.push_back(terminate); | 247 builder()->exit_controls_.push_back(terminate); |
188 } | 248 } |
189 | 249 |
190 | 250 |
| 251 bool BytecodeGraphBuilder::Environment::StateValuesRequireUpdate( |
| 252 Node** state_values, int offset, int count) { |
| 253 Node** env_values = (count == 0) ? nullptr : &values()->at(offset); |
| 254 if (*state_values == nullptr) { |
| 255 return true; |
| 256 } else { |
| 257 DCHECK_EQ((*state_values)->InputCount(), count); |
| 258 DCHECK_LE(static_cast<size_t>(offset + count), values()->size()); |
| 259 for (int i = 0; i < count; i++) { |
| 260 if ((*state_values)->InputAt(i) != env_values[i]) { |
| 261 return true; |
| 262 } |
| 263 } |
| 264 } |
| 265 return false; |
| 266 } |
| 267 |
| 268 |
| 269 void BytecodeGraphBuilder::Environment::UpdateStateValues(Node** state_values, |
| 270 int offset, |
| 271 int count) { |
| 272 if (StateValuesRequireUpdate(state_values, offset, count)) { |
| 273 const Operator* op = common()->StateValues(count); |
| 274 (*state_values) = graph()->NewNode(op, count, &values()->at(offset)); |
| 275 } |
| 276 } |
| 277 |
| 278 |
| 279 Node* BytecodeGraphBuilder::Environment::Checkpoint( |
| 280 BailoutId bailout_id, AccumulatorUpdateMode update_mode) { |
| 281 if (!builder()->info()->is_deoptimization_enabled()) { |
| 282 return builder()->jsgraph()->EmptyFrameState(); |
| 283 } |
| 284 |
| 285 // TODO(rmcilroy): Consider using StateValuesCache for some state values. |
| 286 UpdateStateValues(¶meters_state_values_, 0, parameter_count()); |
| 287 UpdateStateValues(®isters_state_values_, register_base(), |
| 288 register_count()); |
| 289 UpdateStateValues(&accumulator_state_values_, accumulator_base(), 1); |
| 290 |
| 291 OutputFrameStateCombine combine = |
| 292 update_mode == AccumulatorUpdateMode::kOutputIgnored |
| 293 ? OutputFrameStateCombine::Ignore() |
| 294 : OutputFrameStateCombine::PokeAt(0); |
| 295 const Operator* op = common()->FrameState( |
| 296 bailout_id, combine, builder()->frame_state_function_info()); |
| 297 |
| 298 Node* result = graph()->NewNode( |
| 299 op, parameters_state_values_, registers_state_values_, |
| 300 accumulator_state_values_, Context(), builder()->GetFunctionClosure(), |
| 301 builder()->graph()->start()); |
| 302 |
| 303 return result; |
| 304 } |
| 305 |
| 306 |
| 307 bool BytecodeGraphBuilder::Environment::StateValuesAreUpToDate( |
| 308 AccumulatorUpdateMode update_mode) { |
| 309 return !StateValuesRequireUpdate(¶meters_state_values_, 0, |
| 310 parameter_count()) && |
| 311 !StateValuesRequireUpdate(®isters_state_values_, register_base(), |
| 312 register_count()) && |
| 313 (update_mode == AccumulatorUpdateMode::kOutputInAccumulator || |
| 314 !StateValuesRequireUpdate(&accumulator_state_values_, |
| 315 accumulator_base(), 1)); |
| 316 } |
| 317 |
| 318 |
191 BytecodeGraphBuilder::BytecodeGraphBuilder(Zone* local_zone, | 319 BytecodeGraphBuilder::BytecodeGraphBuilder(Zone* local_zone, |
192 CompilationInfo* compilation_info, | 320 CompilationInfo* compilation_info, |
193 JSGraph* jsgraph) | 321 JSGraph* jsgraph) |
194 : local_zone_(local_zone), | 322 : local_zone_(local_zone), |
195 info_(compilation_info), | 323 info_(compilation_info), |
196 jsgraph_(jsgraph), | 324 jsgraph_(jsgraph), |
| 325 bytecode_array_(handle(info()->shared_info()->bytecode_array())), |
| 326 frame_state_function_info_(common()->CreateFrameStateFunctionInfo( |
| 327 FrameStateType::kInterpretedFunction, |
| 328 bytecode_array()->parameter_count(), |
| 329 bytecode_array()->register_count(), info()->shared_info(), |
| 330 CALL_MAINTAINS_NATIVE_CONTEXT)), |
197 merge_environments_(local_zone), | 331 merge_environments_(local_zone), |
198 loop_header_environments_(local_zone), | 332 loop_header_environments_(local_zone), |
199 input_buffer_size_(0), | 333 input_buffer_size_(0), |
200 input_buffer_(nullptr), | 334 input_buffer_(nullptr), |
201 exit_controls_(local_zone) { | 335 exit_controls_(local_zone) {} |
202 bytecode_array_ = handle(info()->shared_info()->bytecode_array()); | |
203 } | |
204 | 336 |
205 | 337 |
206 Node* BytecodeGraphBuilder::GetNewTarget() { | 338 Node* BytecodeGraphBuilder::GetNewTarget() { |
207 if (!new_target_.is_set()) { | 339 if (!new_target_.is_set()) { |
208 int params = bytecode_array()->parameter_count(); | 340 int params = bytecode_array()->parameter_count(); |
209 int index = Linkage::GetJSCallNewTargetParamIndex(params); | 341 int index = Linkage::GetJSCallNewTargetParamIndex(params); |
210 const Operator* op = common()->Parameter(index, "%new.target"); | 342 const Operator* op = common()->Parameter(index, "%new.target"); |
211 Node* node = NewNode(op, graph()->start()); | 343 Node* node = NewNode(op, graph()->start()); |
212 new_target_.set(node); | 344 new_target_.set(node); |
213 } | 345 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 406 } |
275 | 407 |
276 | 408 |
277 VectorSlotPair BytecodeGraphBuilder::CreateVectorSlotPair(int slot_id) { | 409 VectorSlotPair BytecodeGraphBuilder::CreateVectorSlotPair(int slot_id) { |
278 Handle<TypeFeedbackVector> feedback_vector = info()->feedback_vector(); | 410 Handle<TypeFeedbackVector> feedback_vector = info()->feedback_vector(); |
279 FeedbackVectorSlot slot = feedback_vector->ToSlot(slot_id); | 411 FeedbackVectorSlot slot = feedback_vector->ToSlot(slot_id); |
280 return VectorSlotPair(feedback_vector, slot); | 412 return VectorSlotPair(feedback_vector, slot); |
281 } | 413 } |
282 | 414 |
283 | 415 |
284 // TODO(mythria): Replace this function with one which adds real frame state. | |
285 // Also add before and after frame states and checkpointing if required. | |
286 void BytecodeGraphBuilder::AddEmptyFrameStateInputs(Node* node) { | |
287 int frame_state_count = | |
288 OperatorProperties::GetFrameStateInputCount(node->op()); | |
289 for (int i = 0; i < frame_state_count; i++) { | |
290 NodeProperties::ReplaceFrameStateInput(node, i, | |
291 jsgraph()->EmptyFrameState()); | |
292 } | |
293 } | |
294 | |
295 | |
296 bool BytecodeGraphBuilder::CreateGraph(bool stack_check) { | 416 bool BytecodeGraphBuilder::CreateGraph(bool stack_check) { |
297 // Set up the basic structure of the graph. Outputs for {Start} are | 417 // Set up the basic structure of the graph. Outputs for {Start} are |
298 // the formal parameters (including the receiver) plus context and | 418 // the formal parameters (including the receiver) plus context and |
299 // closure. | 419 // closure. |
300 | 420 |
301 // Set up the basic structure of the graph. Outputs for {Start} are the formal | 421 // Set up the basic structure of the graph. Outputs for {Start} are the formal |
302 // parameters (including the receiver) plus new target, number of arguments, | 422 // parameters (including the receiver) plus new target, number of arguments, |
303 // context and closure. | 423 // context and closure. |
304 int actual_parameter_count = bytecode_array()->parameter_count() + 4; | 424 int actual_parameter_count = bytecode_array()->parameter_count() + 4; |
305 graph()->SetStart(graph()->NewNode(common()->Start(actual_parameter_count))); | 425 graph()->SetStart(graph()->NewNode(common()->Start(actual_parameter_count))); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 void BytecodeGraphBuilder::VisitMov( | 557 void BytecodeGraphBuilder::VisitMov( |
438 const interpreter::BytecodeArrayIterator& iterator) { | 558 const interpreter::BytecodeArrayIterator& iterator) { |
439 Node* value = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 559 Node* value = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
440 environment()->BindRegister(iterator.GetRegisterOperand(1), value); | 560 environment()->BindRegister(iterator.GetRegisterOperand(1), value); |
441 } | 561 } |
442 | 562 |
443 | 563 |
444 void BytecodeGraphBuilder::BuildLoadGlobal( | 564 void BytecodeGraphBuilder::BuildLoadGlobal( |
445 const interpreter::BytecodeArrayIterator& iterator, | 565 const interpreter::BytecodeArrayIterator& iterator, |
446 TypeofMode typeof_mode) { | 566 TypeofMode typeof_mode) { |
| 567 FrameStateBeforeAndAfter states(this, iterator); |
447 Handle<Name> name = | 568 Handle<Name> name = |
448 Handle<Name>::cast(iterator.GetConstantForIndexOperand(0)); | 569 Handle<Name>::cast(iterator.GetConstantForIndexOperand(0)); |
449 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1)); | 570 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1)); |
450 | 571 |
451 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); | 572 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); |
452 Node* node = NewNode(op, BuildLoadFeedbackVector()); | 573 Node* node = NewNode(op, BuildLoadFeedbackVector()); |
453 AddEmptyFrameStateInputs(node); | 574 environment()->BindAccumulator(node, &states); |
454 environment()->BindAccumulator(node); | |
455 } | 575 } |
456 | 576 |
457 | 577 |
458 void BytecodeGraphBuilder::VisitLdaGlobalSloppy( | 578 void BytecodeGraphBuilder::VisitLdaGlobalSloppy( |
459 const interpreter::BytecodeArrayIterator& iterator) { | 579 const interpreter::BytecodeArrayIterator& iterator) { |
460 DCHECK(is_sloppy(language_mode())); | 580 DCHECK(is_sloppy(language_mode())); |
461 BuildLoadGlobal(iterator, TypeofMode::NOT_INSIDE_TYPEOF); | 581 BuildLoadGlobal(iterator, TypeofMode::NOT_INSIDE_TYPEOF); |
462 } | 582 } |
463 | 583 |
464 | 584 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 626 |
507 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofStrictWide( | 627 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofStrictWide( |
508 const interpreter::BytecodeArrayIterator& iterator) { | 628 const interpreter::BytecodeArrayIterator& iterator) { |
509 DCHECK(is_strict(language_mode())); | 629 DCHECK(is_strict(language_mode())); |
510 BuildLoadGlobal(iterator, TypeofMode::INSIDE_TYPEOF); | 630 BuildLoadGlobal(iterator, TypeofMode::INSIDE_TYPEOF); |
511 } | 631 } |
512 | 632 |
513 | 633 |
514 void BytecodeGraphBuilder::BuildStoreGlobal( | 634 void BytecodeGraphBuilder::BuildStoreGlobal( |
515 const interpreter::BytecodeArrayIterator& iterator) { | 635 const interpreter::BytecodeArrayIterator& iterator) { |
| 636 FrameStateBeforeAndAfter states(this, iterator); |
516 Handle<Name> name = | 637 Handle<Name> name = |
517 Handle<Name>::cast(iterator.GetConstantForIndexOperand(0)); | 638 Handle<Name>::cast(iterator.GetConstantForIndexOperand(0)); |
518 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1)); | 639 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1)); |
519 Node* value = environment()->LookupAccumulator(); | 640 Node* value = environment()->LookupAccumulator(); |
520 | 641 |
521 const Operator* op = | 642 const Operator* op = |
522 javascript()->StoreGlobal(language_mode(), name, feedback); | 643 javascript()->StoreGlobal(language_mode(), name, feedback); |
523 Node* node = NewNode(op, value, BuildLoadFeedbackVector()); | 644 Node* node = NewNode(op, value, BuildLoadFeedbackVector()); |
524 AddEmptyFrameStateInputs(node); | 645 environment()->RecordAfterState(node, &states); |
525 } | 646 } |
526 | 647 |
527 | 648 |
528 void BytecodeGraphBuilder::VisitStaGlobalSloppy( | 649 void BytecodeGraphBuilder::VisitStaGlobalSloppy( |
529 const interpreter::BytecodeArrayIterator& iterator) { | 650 const interpreter::BytecodeArrayIterator& iterator) { |
530 DCHECK(is_sloppy(language_mode())); | 651 DCHECK(is_sloppy(language_mode())); |
531 BuildStoreGlobal(iterator); | 652 BuildStoreGlobal(iterator); |
532 } | 653 } |
533 | 654 |
534 | 655 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 | 691 |
571 void BytecodeGraphBuilder::VisitStaContextSlot( | 692 void BytecodeGraphBuilder::VisitStaContextSlot( |
572 const interpreter::BytecodeArrayIterator& iterator) { | 693 const interpreter::BytecodeArrayIterator& iterator) { |
573 // TODO(mythria): LoadContextSlots are unrolled by the required depth when | 694 // TODO(mythria): LoadContextSlots are unrolled by the required depth when |
574 // generating bytecode. Hence the value of depth is always 0. Update this | 695 // generating bytecode. Hence the value of depth is always 0. Update this |
575 // code, when the implementation changes. | 696 // code, when the implementation changes. |
576 const Operator* op = | 697 const Operator* op = |
577 javascript()->StoreContext(0, iterator.GetIndexOperand(1)); | 698 javascript()->StoreContext(0, iterator.GetIndexOperand(1)); |
578 Node* context = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 699 Node* context = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
579 Node* value = environment()->LookupAccumulator(); | 700 Node* value = environment()->LookupAccumulator(); |
580 Node* node = NewNode(op, context, value); | 701 NewNode(op, context, value); |
581 CHECK(node != nullptr); | |
582 environment()->BindAccumulator(value); | |
583 } | 702 } |
584 | 703 |
585 | 704 |
586 void BytecodeGraphBuilder::VisitLdaLookupSlot( | 705 void BytecodeGraphBuilder::VisitLdaLookupSlot( |
587 const interpreter::BytecodeArrayIterator& iterator) { | 706 const interpreter::BytecodeArrayIterator& iterator) { |
588 UNIMPLEMENTED(); | 707 UNIMPLEMENTED(); |
589 } | 708 } |
590 | 709 |
591 | 710 |
592 void BytecodeGraphBuilder::VisitLdaLookupSlotInsideTypeof( | 711 void BytecodeGraphBuilder::VisitLdaLookupSlotInsideTypeof( |
593 const interpreter::BytecodeArrayIterator& iterator) { | 712 const interpreter::BytecodeArrayIterator& iterator) { |
594 UNIMPLEMENTED(); | 713 UNIMPLEMENTED(); |
595 } | 714 } |
596 | 715 |
597 | 716 |
598 void BytecodeGraphBuilder::VisitStaLookupSlotSloppy( | 717 void BytecodeGraphBuilder::VisitStaLookupSlotSloppy( |
599 const interpreter::BytecodeArrayIterator& iterator) { | 718 const interpreter::BytecodeArrayIterator& iterator) { |
600 UNIMPLEMENTED(); | 719 UNIMPLEMENTED(); |
601 } | 720 } |
602 | 721 |
603 | 722 |
604 void BytecodeGraphBuilder::VisitStaLookupSlotStrict( | 723 void BytecodeGraphBuilder::VisitStaLookupSlotStrict( |
605 const interpreter::BytecodeArrayIterator& iterator) { | 724 const interpreter::BytecodeArrayIterator& iterator) { |
606 UNIMPLEMENTED(); | 725 UNIMPLEMENTED(); |
607 } | 726 } |
608 | 727 |
609 | 728 |
610 void BytecodeGraphBuilder::BuildNamedLoad( | 729 void BytecodeGraphBuilder::BuildNamedLoad( |
611 const interpreter::BytecodeArrayIterator& iterator) { | 730 const interpreter::BytecodeArrayIterator& iterator) { |
| 731 FrameStateBeforeAndAfter states(this, iterator); |
612 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 732 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
613 Handle<Name> name = | 733 Handle<Name> name = |
614 Handle<Name>::cast(iterator.GetConstantForIndexOperand(1)); | 734 Handle<Name>::cast(iterator.GetConstantForIndexOperand(1)); |
615 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(2)); | 735 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(2)); |
616 | 736 |
617 const Operator* op = javascript()->LoadNamed(language_mode(), name, feedback); | 737 const Operator* op = javascript()->LoadNamed(language_mode(), name, feedback); |
618 Node* node = NewNode(op, object, BuildLoadFeedbackVector()); | 738 Node* node = NewNode(op, object, BuildLoadFeedbackVector()); |
619 AddEmptyFrameStateInputs(node); | 739 environment()->BindAccumulator(node, &states); |
620 environment()->BindAccumulator(node); | |
621 } | 740 } |
622 | 741 |
623 | 742 |
624 void BytecodeGraphBuilder::VisitLoadICSloppy( | 743 void BytecodeGraphBuilder::VisitLoadICSloppy( |
625 const interpreter::BytecodeArrayIterator& iterator) { | 744 const interpreter::BytecodeArrayIterator& iterator) { |
626 DCHECK(is_sloppy(language_mode())); | 745 DCHECK(is_sloppy(language_mode())); |
627 BuildNamedLoad(iterator); | 746 BuildNamedLoad(iterator); |
628 } | 747 } |
629 | 748 |
630 | 749 |
(...skipping 13 matching lines...) Expand all Loading... |
644 | 763 |
645 void BytecodeGraphBuilder::VisitLoadICStrictWide( | 764 void BytecodeGraphBuilder::VisitLoadICStrictWide( |
646 const interpreter::BytecodeArrayIterator& iterator) { | 765 const interpreter::BytecodeArrayIterator& iterator) { |
647 DCHECK(is_strict(language_mode())); | 766 DCHECK(is_strict(language_mode())); |
648 BuildNamedLoad(iterator); | 767 BuildNamedLoad(iterator); |
649 } | 768 } |
650 | 769 |
651 | 770 |
652 void BytecodeGraphBuilder::BuildKeyedLoad( | 771 void BytecodeGraphBuilder::BuildKeyedLoad( |
653 const interpreter::BytecodeArrayIterator& iterator) { | 772 const interpreter::BytecodeArrayIterator& iterator) { |
| 773 FrameStateBeforeAndAfter states(this, iterator); |
654 Node* key = environment()->LookupAccumulator(); | 774 Node* key = environment()->LookupAccumulator(); |
655 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 775 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
656 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1)); | 776 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1)); |
657 | 777 |
658 const Operator* op = javascript()->LoadProperty(language_mode(), feedback); | 778 const Operator* op = javascript()->LoadProperty(language_mode(), feedback); |
659 Node* node = NewNode(op, object, key, BuildLoadFeedbackVector()); | 779 Node* node = NewNode(op, object, key, BuildLoadFeedbackVector()); |
660 AddEmptyFrameStateInputs(node); | 780 environment()->BindAccumulator(node, &states); |
661 environment()->BindAccumulator(node); | |
662 } | 781 } |
663 | 782 |
664 | 783 |
665 void BytecodeGraphBuilder::VisitKeyedLoadICSloppy( | 784 void BytecodeGraphBuilder::VisitKeyedLoadICSloppy( |
666 const interpreter::BytecodeArrayIterator& iterator) { | 785 const interpreter::BytecodeArrayIterator& iterator) { |
667 DCHECK(is_sloppy(language_mode())); | 786 DCHECK(is_sloppy(language_mode())); |
668 BuildKeyedLoad(iterator); | 787 BuildKeyedLoad(iterator); |
669 } | 788 } |
670 | 789 |
671 | 790 |
(...skipping 13 matching lines...) Expand all Loading... |
685 | 804 |
686 void BytecodeGraphBuilder::VisitKeyedLoadICStrictWide( | 805 void BytecodeGraphBuilder::VisitKeyedLoadICStrictWide( |
687 const interpreter::BytecodeArrayIterator& iterator) { | 806 const interpreter::BytecodeArrayIterator& iterator) { |
688 DCHECK(is_strict(language_mode())); | 807 DCHECK(is_strict(language_mode())); |
689 BuildKeyedLoad(iterator); | 808 BuildKeyedLoad(iterator); |
690 } | 809 } |
691 | 810 |
692 | 811 |
693 void BytecodeGraphBuilder::BuildNamedStore( | 812 void BytecodeGraphBuilder::BuildNamedStore( |
694 const interpreter::BytecodeArrayIterator& iterator) { | 813 const interpreter::BytecodeArrayIterator& iterator) { |
| 814 FrameStateBeforeAndAfter states(this, iterator); |
695 Node* value = environment()->LookupAccumulator(); | 815 Node* value = environment()->LookupAccumulator(); |
696 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 816 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
697 Handle<Name> name = | 817 Handle<Name> name = |
698 Handle<Name>::cast(iterator.GetConstantForIndexOperand(1)); | 818 Handle<Name>::cast(iterator.GetConstantForIndexOperand(1)); |
699 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(2)); | 819 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(2)); |
700 | 820 |
701 const Operator* op = | 821 const Operator* op = |
702 javascript()->StoreNamed(language_mode(), name, feedback); | 822 javascript()->StoreNamed(language_mode(), name, feedback); |
703 Node* node = NewNode(op, object, value, BuildLoadFeedbackVector()); | 823 Node* node = NewNode(op, object, value, BuildLoadFeedbackVector()); |
704 AddEmptyFrameStateInputs(node); | 824 environment()->RecordAfterState(node, &states); |
705 environment()->BindAccumulator(value); | |
706 } | 825 } |
707 | 826 |
708 | 827 |
709 void BytecodeGraphBuilder::VisitStoreICSloppy( | 828 void BytecodeGraphBuilder::VisitStoreICSloppy( |
710 const interpreter::BytecodeArrayIterator& iterator) { | 829 const interpreter::BytecodeArrayIterator& iterator) { |
711 DCHECK(is_sloppy(language_mode())); | 830 DCHECK(is_sloppy(language_mode())); |
712 BuildNamedStore(iterator); | 831 BuildNamedStore(iterator); |
713 } | 832 } |
714 | 833 |
715 | 834 |
(...skipping 13 matching lines...) Expand all Loading... |
729 | 848 |
730 void BytecodeGraphBuilder::VisitStoreICStrictWide( | 849 void BytecodeGraphBuilder::VisitStoreICStrictWide( |
731 const interpreter::BytecodeArrayIterator& iterator) { | 850 const interpreter::BytecodeArrayIterator& iterator) { |
732 DCHECK(is_strict(language_mode())); | 851 DCHECK(is_strict(language_mode())); |
733 BuildNamedStore(iterator); | 852 BuildNamedStore(iterator); |
734 } | 853 } |
735 | 854 |
736 | 855 |
737 void BytecodeGraphBuilder::BuildKeyedStore( | 856 void BytecodeGraphBuilder::BuildKeyedStore( |
738 const interpreter::BytecodeArrayIterator& iterator) { | 857 const interpreter::BytecodeArrayIterator& iterator) { |
| 858 FrameStateBeforeAndAfter states(this, iterator); |
739 Node* value = environment()->LookupAccumulator(); | 859 Node* value = environment()->LookupAccumulator(); |
740 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 860 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
741 Node* key = environment()->LookupRegister(iterator.GetRegisterOperand(1)); | 861 Node* key = environment()->LookupRegister(iterator.GetRegisterOperand(1)); |
742 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(2)); | 862 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(2)); |
743 | 863 |
744 const Operator* op = javascript()->StoreProperty(language_mode(), feedback); | 864 const Operator* op = javascript()->StoreProperty(language_mode(), feedback); |
745 Node* node = NewNode(op, object, key, value, BuildLoadFeedbackVector()); | 865 Node* node = NewNode(op, object, key, value, BuildLoadFeedbackVector()); |
746 AddEmptyFrameStateInputs(node); | 866 environment()->RecordAfterState(node, &states); |
747 environment()->BindAccumulator(value); | |
748 } | 867 } |
749 | 868 |
750 | 869 |
751 void BytecodeGraphBuilder::VisitKeyedStoreICSloppy( | 870 void BytecodeGraphBuilder::VisitKeyedStoreICSloppy( |
752 const interpreter::BytecodeArrayIterator& iterator) { | 871 const interpreter::BytecodeArrayIterator& iterator) { |
753 DCHECK(is_sloppy(language_mode())); | 872 DCHECK(is_sloppy(language_mode())); |
754 BuildKeyedStore(iterator); | 873 BuildKeyedStore(iterator); |
755 } | 874 } |
756 | 875 |
757 | 876 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 | 911 |
793 | 912 |
794 void BytecodeGraphBuilder::VisitCreateClosure( | 913 void BytecodeGraphBuilder::VisitCreateClosure( |
795 const interpreter::BytecodeArrayIterator& iterator) { | 914 const interpreter::BytecodeArrayIterator& iterator) { |
796 Handle<SharedFunctionInfo> shared_info = | 915 Handle<SharedFunctionInfo> shared_info = |
797 Handle<SharedFunctionInfo>::cast(iterator.GetConstantForIndexOperand(0)); | 916 Handle<SharedFunctionInfo>::cast(iterator.GetConstantForIndexOperand(0)); |
798 PretenureFlag tenured = | 917 PretenureFlag tenured = |
799 iterator.GetImmediateOperand(1) ? TENURED : NOT_TENURED; | 918 iterator.GetImmediateOperand(1) ? TENURED : NOT_TENURED; |
800 const Operator* op = javascript()->CreateClosure(shared_info, tenured); | 919 const Operator* op = javascript()->CreateClosure(shared_info, tenured); |
801 Node* closure = NewNode(op); | 920 Node* closure = NewNode(op); |
802 AddEmptyFrameStateInputs(closure); | |
803 environment()->BindAccumulator(closure); | 921 environment()->BindAccumulator(closure); |
804 } | 922 } |
805 | 923 |
806 | 924 |
807 void BytecodeGraphBuilder::VisitCreateClosureWide( | 925 void BytecodeGraphBuilder::VisitCreateClosureWide( |
808 const interpreter::BytecodeArrayIterator& iterator) { | 926 const interpreter::BytecodeArrayIterator& iterator) { |
809 VisitCreateClosure(iterator); | 927 VisitCreateClosure(iterator); |
810 } | 928 } |
811 | 929 |
812 | 930 |
813 void BytecodeGraphBuilder::VisitCreateMappedArguments( | 931 void BytecodeGraphBuilder::VisitCreateMappedArguments( |
814 const interpreter::BytecodeArrayIterator& iterator) { | 932 const interpreter::BytecodeArrayIterator& iterator) { |
815 UNIMPLEMENTED(); | 933 UNIMPLEMENTED(); |
816 } | 934 } |
817 | 935 |
818 | 936 |
819 void BytecodeGraphBuilder::VisitCreateUnmappedArguments( | 937 void BytecodeGraphBuilder::VisitCreateUnmappedArguments( |
820 const interpreter::BytecodeArrayIterator& iterator) { | 938 const interpreter::BytecodeArrayIterator& iterator) { |
821 UNIMPLEMENTED(); | 939 UNIMPLEMENTED(); |
822 } | 940 } |
823 | 941 |
824 | 942 |
825 void BytecodeGraphBuilder::BuildCreateLiteral(const Operator* op) { | 943 void BytecodeGraphBuilder::BuildCreateLiteral( |
| 944 const Operator* op, const interpreter::BytecodeArrayIterator& iterator) { |
| 945 FrameStateBeforeAndAfter states(this, iterator); |
826 Node* literal = NewNode(op, GetFunctionClosure()); | 946 Node* literal = NewNode(op, GetFunctionClosure()); |
827 AddEmptyFrameStateInputs(literal); | 947 environment()->BindAccumulator(literal, &states); |
828 environment()->BindAccumulator(literal); | |
829 } | 948 } |
830 | 949 |
831 | 950 |
832 void BytecodeGraphBuilder::BuildCreateRegExpLiteral( | 951 void BytecodeGraphBuilder::BuildCreateRegExpLiteral( |
833 const interpreter::BytecodeArrayIterator& iterator) { | 952 const interpreter::BytecodeArrayIterator& iterator) { |
834 Handle<String> constant_pattern = | 953 Handle<String> constant_pattern = |
835 Handle<String>::cast(iterator.GetConstantForIndexOperand(0)); | 954 Handle<String>::cast(iterator.GetConstantForIndexOperand(0)); |
836 int literal_index = iterator.GetIndexOperand(1); | 955 int literal_index = iterator.GetIndexOperand(1); |
837 int literal_flags = iterator.GetImmediateOperand(2); | 956 int literal_flags = iterator.GetImmediateOperand(2); |
838 const Operator* op = javascript()->CreateLiteralRegExp( | 957 const Operator* op = javascript()->CreateLiteralRegExp( |
839 constant_pattern, literal_flags, literal_index); | 958 constant_pattern, literal_flags, literal_index); |
840 BuildCreateLiteral(op); | 959 BuildCreateLiteral(op, iterator); |
841 } | 960 } |
842 | 961 |
843 | 962 |
844 void BytecodeGraphBuilder::VisitCreateRegExpLiteral( | 963 void BytecodeGraphBuilder::VisitCreateRegExpLiteral( |
845 const interpreter::BytecodeArrayIterator& iterator) { | 964 const interpreter::BytecodeArrayIterator& iterator) { |
846 BuildCreateRegExpLiteral(iterator); | 965 BuildCreateRegExpLiteral(iterator); |
847 } | 966 } |
848 | 967 |
849 | 968 |
850 void BytecodeGraphBuilder::VisitCreateRegExpLiteralWide( | 969 void BytecodeGraphBuilder::VisitCreateRegExpLiteralWide( |
851 const interpreter::BytecodeArrayIterator& iterator) { | 970 const interpreter::BytecodeArrayIterator& iterator) { |
852 BuildCreateRegExpLiteral(iterator); | 971 BuildCreateRegExpLiteral(iterator); |
853 } | 972 } |
854 | 973 |
855 | 974 |
856 void BytecodeGraphBuilder::BuildCreateArrayLiteral( | 975 void BytecodeGraphBuilder::BuildCreateArrayLiteral( |
857 const interpreter::BytecodeArrayIterator& iterator) { | 976 const interpreter::BytecodeArrayIterator& iterator) { |
858 Handle<FixedArray> constant_elements = | 977 Handle<FixedArray> constant_elements = |
859 Handle<FixedArray>::cast(iterator.GetConstantForIndexOperand(0)); | 978 Handle<FixedArray>::cast(iterator.GetConstantForIndexOperand(0)); |
860 int literal_index = iterator.GetIndexOperand(1); | 979 int literal_index = iterator.GetIndexOperand(1); |
861 int literal_flags = iterator.GetImmediateOperand(2); | 980 int literal_flags = iterator.GetImmediateOperand(2); |
862 const Operator* op = javascript()->CreateLiteralArray( | 981 const Operator* op = javascript()->CreateLiteralArray( |
863 constant_elements, literal_flags, literal_index); | 982 constant_elements, literal_flags, literal_index); |
864 BuildCreateLiteral(op); | 983 BuildCreateLiteral(op, iterator); |
865 } | 984 } |
866 | 985 |
867 | 986 |
868 void BytecodeGraphBuilder::VisitCreateArrayLiteral( | 987 void BytecodeGraphBuilder::VisitCreateArrayLiteral( |
869 const interpreter::BytecodeArrayIterator& iterator) { | 988 const interpreter::BytecodeArrayIterator& iterator) { |
870 BuildCreateArrayLiteral(iterator); | 989 BuildCreateArrayLiteral(iterator); |
871 } | 990 } |
872 | 991 |
873 | 992 |
874 void BytecodeGraphBuilder::VisitCreateArrayLiteralWide( | 993 void BytecodeGraphBuilder::VisitCreateArrayLiteralWide( |
875 const interpreter::BytecodeArrayIterator& iterator) { | 994 const interpreter::BytecodeArrayIterator& iterator) { |
876 BuildCreateArrayLiteral(iterator); | 995 BuildCreateArrayLiteral(iterator); |
877 } | 996 } |
878 | 997 |
879 | 998 |
880 void BytecodeGraphBuilder::BuildCreateObjectLiteral( | 999 void BytecodeGraphBuilder::BuildCreateObjectLiteral( |
881 const interpreter::BytecodeArrayIterator& iterator) { | 1000 const interpreter::BytecodeArrayIterator& iterator) { |
882 Handle<FixedArray> constant_properties = | 1001 Handle<FixedArray> constant_properties = |
883 Handle<FixedArray>::cast(iterator.GetConstantForIndexOperand(0)); | 1002 Handle<FixedArray>::cast(iterator.GetConstantForIndexOperand(0)); |
884 int literal_index = iterator.GetIndexOperand(1); | 1003 int literal_index = iterator.GetIndexOperand(1); |
885 int literal_flags = iterator.GetImmediateOperand(2); | 1004 int literal_flags = iterator.GetImmediateOperand(2); |
886 const Operator* op = javascript()->CreateLiteralObject( | 1005 const Operator* op = javascript()->CreateLiteralObject( |
887 constant_properties, literal_flags, literal_index); | 1006 constant_properties, literal_flags, literal_index); |
888 BuildCreateLiteral(op); | 1007 BuildCreateLiteral(op, iterator); |
889 } | 1008 } |
890 | 1009 |
891 | 1010 |
892 void BytecodeGraphBuilder::VisitCreateObjectLiteral( | 1011 void BytecodeGraphBuilder::VisitCreateObjectLiteral( |
893 const interpreter::BytecodeArrayIterator& iterator) { | 1012 const interpreter::BytecodeArrayIterator& iterator) { |
894 BuildCreateObjectLiteral(iterator); | 1013 BuildCreateObjectLiteral(iterator); |
895 } | 1014 } |
896 | 1015 |
897 | 1016 |
898 void BytecodeGraphBuilder::VisitCreateObjectLiteralWide( | 1017 void BytecodeGraphBuilder::VisitCreateObjectLiteralWide( |
(...skipping 14 matching lines...) Expand all Loading... |
913 all[i] = environment()->LookupRegister( | 1032 all[i] = environment()->LookupRegister( |
914 interpreter::Register(receiver_index + i - 1)); | 1033 interpreter::Register(receiver_index + i - 1)); |
915 } | 1034 } |
916 Node* value = MakeNode(call_op, static_cast<int>(arity), all, false); | 1035 Node* value = MakeNode(call_op, static_cast<int>(arity), all, false); |
917 return value; | 1036 return value; |
918 } | 1037 } |
919 | 1038 |
920 | 1039 |
921 void BytecodeGraphBuilder::BuildCall( | 1040 void BytecodeGraphBuilder::BuildCall( |
922 const interpreter::BytecodeArrayIterator& iterator) { | 1041 const interpreter::BytecodeArrayIterator& iterator) { |
| 1042 FrameStateBeforeAndAfter states(this, iterator); |
923 // TODO(rmcilroy): Set receiver_hint correctly based on whether the receiver | 1043 // TODO(rmcilroy): Set receiver_hint correctly based on whether the receiver |
924 // register has been loaded with null / undefined explicitly or we are sure it | 1044 // register has been loaded with null / undefined explicitly or we are sure it |
925 // is not null / undefined. | 1045 // is not null / undefined. |
926 ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny; | 1046 ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny; |
927 Node* callee = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 1047 Node* callee = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
928 interpreter::Register receiver = iterator.GetRegisterOperand(1); | 1048 interpreter::Register receiver = iterator.GetRegisterOperand(1); |
929 size_t arg_count = iterator.GetCountOperand(2); | 1049 size_t arg_count = iterator.GetCountOperand(2); |
930 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(3)); | 1050 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(3)); |
931 | 1051 |
932 const Operator* call = javascript()->CallFunction( | 1052 const Operator* call = javascript()->CallFunction( |
933 arg_count + 2, language_mode(), feedback, receiver_hint); | 1053 arg_count + 2, language_mode(), feedback, receiver_hint); |
934 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 2); | 1054 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 2); |
935 AddEmptyFrameStateInputs(value); | 1055 environment()->BindAccumulator(value, &states); |
936 environment()->BindAccumulator(value); | |
937 } | 1056 } |
938 | 1057 |
939 | 1058 |
940 void BytecodeGraphBuilder::VisitCall( | 1059 void BytecodeGraphBuilder::VisitCall( |
941 const interpreter::BytecodeArrayIterator& iterator) { | 1060 const interpreter::BytecodeArrayIterator& iterator) { |
942 BuildCall(iterator); | 1061 BuildCall(iterator); |
943 } | 1062 } |
944 | 1063 |
945 | 1064 |
946 void BytecodeGraphBuilder::VisitCallWide( | 1065 void BytecodeGraphBuilder::VisitCallWide( |
947 const interpreter::BytecodeArrayIterator& iterator) { | 1066 const interpreter::BytecodeArrayIterator& iterator) { |
948 BuildCall(iterator); | 1067 BuildCall(iterator); |
949 } | 1068 } |
950 | 1069 |
951 | 1070 |
952 void BytecodeGraphBuilder::VisitCallJSRuntime( | 1071 void BytecodeGraphBuilder::VisitCallJSRuntime( |
953 const interpreter::BytecodeArrayIterator& iterator) { | 1072 const interpreter::BytecodeArrayIterator& iterator) { |
| 1073 FrameStateBeforeAndAfter states(this, iterator); |
954 Node* callee = BuildLoadNativeContextField(iterator.GetIndexOperand(0)); | 1074 Node* callee = BuildLoadNativeContextField(iterator.GetIndexOperand(0)); |
955 interpreter::Register receiver = iterator.GetRegisterOperand(1); | 1075 interpreter::Register receiver = iterator.GetRegisterOperand(1); |
956 size_t arg_count = iterator.GetCountOperand(2); | 1076 size_t arg_count = iterator.GetCountOperand(2); |
957 | 1077 |
958 // Create node to perform the JS runtime call. | 1078 // Create node to perform the JS runtime call. |
959 const Operator* call = | 1079 const Operator* call = |
960 javascript()->CallFunction(arg_count + 2, language_mode()); | 1080 javascript()->CallFunction(arg_count + 2, language_mode()); |
961 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 2); | 1081 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 2); |
962 AddEmptyFrameStateInputs(value); | 1082 environment()->BindAccumulator(value, &states); |
963 environment()->BindAccumulator(value); | |
964 } | 1083 } |
965 | 1084 |
966 | 1085 |
967 Node* BytecodeGraphBuilder::ProcessCallRuntimeArguments( | 1086 Node* BytecodeGraphBuilder::ProcessCallRuntimeArguments( |
968 const Operator* call_runtime_op, interpreter::Register first_arg, | 1087 const Operator* call_runtime_op, interpreter::Register first_arg, |
969 size_t arity) { | 1088 size_t arity) { |
970 Node** all = info()->zone()->NewArray<Node*>(arity); | 1089 Node** all = info()->zone()->NewArray<Node*>(arity); |
971 int first_arg_index = first_arg.index(); | 1090 int first_arg_index = first_arg.index(); |
972 for (int i = 0; i < static_cast<int>(arity); ++i) { | 1091 for (int i = 0; i < static_cast<int>(arity); ++i) { |
973 all[i] = environment()->LookupRegister( | 1092 all[i] = environment()->LookupRegister( |
974 interpreter::Register(first_arg_index + i)); | 1093 interpreter::Register(first_arg_index + i)); |
975 } | 1094 } |
976 Node* value = MakeNode(call_runtime_op, static_cast<int>(arity), all, false); | 1095 Node* value = MakeNode(call_runtime_op, static_cast<int>(arity), all, false); |
977 return value; | 1096 return value; |
978 } | 1097 } |
979 | 1098 |
980 | 1099 |
981 void BytecodeGraphBuilder::VisitCallRuntime( | 1100 void BytecodeGraphBuilder::VisitCallRuntime( |
982 const interpreter::BytecodeArrayIterator& iterator) { | 1101 const interpreter::BytecodeArrayIterator& iterator) { |
| 1102 FrameStateBeforeAndAfter states(this, iterator); |
983 Runtime::FunctionId functionId = | 1103 Runtime::FunctionId functionId = |
984 static_cast<Runtime::FunctionId>(iterator.GetIndexOperand(0)); | 1104 static_cast<Runtime::FunctionId>(iterator.GetIndexOperand(0)); |
985 interpreter::Register first_arg = iterator.GetRegisterOperand(1); | 1105 interpreter::Register first_arg = iterator.GetRegisterOperand(1); |
986 size_t arg_count = iterator.GetCountOperand(2); | 1106 size_t arg_count = iterator.GetCountOperand(2); |
987 | 1107 |
988 // Create node to perform the runtime call. | 1108 // Create node to perform the runtime call. |
989 const Operator* call = javascript()->CallRuntime(functionId, arg_count); | 1109 const Operator* call = javascript()->CallRuntime(functionId, arg_count); |
990 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); | 1110 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); |
991 AddEmptyFrameStateInputs(value); | 1111 environment()->BindAccumulator(value, &states); |
992 environment()->BindAccumulator(value); | |
993 } | 1112 } |
994 | 1113 |
995 | 1114 |
996 Node* BytecodeGraphBuilder::ProcessCallNewArguments( | 1115 Node* BytecodeGraphBuilder::ProcessCallNewArguments( |
997 const Operator* call_new_op, interpreter::Register callee, | 1116 const Operator* call_new_op, interpreter::Register callee, |
998 interpreter::Register first_arg, size_t arity) { | 1117 interpreter::Register first_arg, size_t arity) { |
999 Node** all = info()->zone()->NewArray<Node*>(arity); | 1118 Node** all = info()->zone()->NewArray<Node*>(arity); |
1000 all[0] = environment()->LookupRegister(callee); | 1119 all[0] = environment()->LookupRegister(callee); |
1001 int first_arg_index = first_arg.index(); | 1120 int first_arg_index = first_arg.index(); |
1002 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) { | 1121 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) { |
1003 all[i] = environment()->LookupRegister( | 1122 all[i] = environment()->LookupRegister( |
1004 interpreter::Register(first_arg_index + i - 1)); | 1123 interpreter::Register(first_arg_index + i - 1)); |
1005 } | 1124 } |
1006 // Original constructor is the same as the callee. | 1125 // Original constructor is the same as the callee. |
1007 all[arity - 1] = environment()->LookupRegister(callee); | 1126 all[arity - 1] = environment()->LookupRegister(callee); |
1008 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); | 1127 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); |
1009 return value; | 1128 return value; |
1010 } | 1129 } |
1011 | 1130 |
1012 | 1131 |
1013 void BytecodeGraphBuilder::VisitNew( | 1132 void BytecodeGraphBuilder::VisitNew( |
1014 const interpreter::BytecodeArrayIterator& iterator) { | 1133 const interpreter::BytecodeArrayIterator& iterator) { |
| 1134 FrameStateBeforeAndAfter states(this, iterator); |
1015 interpreter::Register callee = iterator.GetRegisterOperand(0); | 1135 interpreter::Register callee = iterator.GetRegisterOperand(0); |
1016 interpreter::Register first_arg = iterator.GetRegisterOperand(1); | 1136 interpreter::Register first_arg = iterator.GetRegisterOperand(1); |
1017 size_t arg_count = iterator.GetCountOperand(2); | 1137 size_t arg_count = iterator.GetCountOperand(2); |
1018 | 1138 |
1019 // TODO(turbofan): Pass the feedback here. | 1139 // TODO(turbofan): Pass the feedback here. |
1020 const Operator* call = javascript()->CallConstruct( | 1140 const Operator* call = javascript()->CallConstruct( |
1021 static_cast<int>(arg_count) + 2, VectorSlotPair()); | 1141 static_cast<int>(arg_count) + 2, VectorSlotPair()); |
1022 Node* value = ProcessCallNewArguments(call, callee, first_arg, arg_count + 2); | 1142 Node* value = ProcessCallNewArguments(call, callee, first_arg, arg_count + 2); |
1023 AddEmptyFrameStateInputs(value); | 1143 environment()->BindAccumulator(value, &states); |
1024 environment()->BindAccumulator(value); | |
1025 } | 1144 } |
1026 | 1145 |
1027 | 1146 |
1028 void BytecodeGraphBuilder::VisitThrow( | 1147 void BytecodeGraphBuilder::VisitThrow( |
1029 const interpreter::BytecodeArrayIterator& iterator) { | 1148 const interpreter::BytecodeArrayIterator& iterator) { |
| 1149 FrameStateBeforeAndAfter states(this, iterator); |
1030 Node* value = environment()->LookupAccumulator(); | 1150 Node* value = environment()->LookupAccumulator(); |
1031 // TODO(mythria): Change to Runtime::kThrow when we have deoptimization | 1151 // TODO(mythria): Change to Runtime::kThrow when we have deoptimization |
1032 // information support in the interpreter. | 1152 // information support in the interpreter. |
1033 NewNode(javascript()->CallRuntime(Runtime::kReThrow, 1), value); | 1153 NewNode(javascript()->CallRuntime(Runtime::kReThrow, 1), value); |
1034 Node* control = NewNode(common()->Throw(), value); | 1154 Node* control = NewNode(common()->Throw(), value); |
| 1155 environment()->RecordAfterState(control, &states); |
1035 UpdateControlDependencyToLeaveFunction(control); | 1156 UpdateControlDependencyToLeaveFunction(control); |
1036 environment()->BindAccumulator(value); | |
1037 } | 1157 } |
1038 | 1158 |
1039 | 1159 |
1040 void BytecodeGraphBuilder::BuildBinaryOp( | 1160 void BytecodeGraphBuilder::BuildBinaryOp( |
1041 const Operator* js_op, const interpreter::BytecodeArrayIterator& iterator) { | 1161 const Operator* js_op, const interpreter::BytecodeArrayIterator& iterator) { |
| 1162 FrameStateBeforeAndAfter states(this, iterator); |
1042 Node* left = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 1163 Node* left = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
1043 Node* right = environment()->LookupAccumulator(); | 1164 Node* right = environment()->LookupAccumulator(); |
1044 Node* node = NewNode(js_op, left, right); | 1165 Node* node = NewNode(js_op, left, right); |
1045 | 1166 environment()->BindAccumulator(node, &states); |
1046 AddEmptyFrameStateInputs(node); | |
1047 environment()->BindAccumulator(node); | |
1048 } | 1167 } |
1049 | 1168 |
1050 | 1169 |
1051 void BytecodeGraphBuilder::VisitAdd( | 1170 void BytecodeGraphBuilder::VisitAdd( |
1052 const interpreter::BytecodeArrayIterator& iterator) { | 1171 const interpreter::BytecodeArrayIterator& iterator) { |
1053 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1172 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1054 BuildBinaryOp(javascript()->Add(language_mode(), hints), iterator); | 1173 BuildBinaryOp(javascript()->Add(language_mode(), hints), iterator); |
1055 } | 1174 } |
1056 | 1175 |
1057 | 1176 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 void BytecodeGraphBuilder::VisitShiftRightLogical( | 1240 void BytecodeGraphBuilder::VisitShiftRightLogical( |
1122 const interpreter::BytecodeArrayIterator& iterator) { | 1241 const interpreter::BytecodeArrayIterator& iterator) { |
1123 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1242 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1124 BuildBinaryOp(javascript()->ShiftRightLogical(language_mode(), hints), | 1243 BuildBinaryOp(javascript()->ShiftRightLogical(language_mode(), hints), |
1125 iterator); | 1244 iterator); |
1126 } | 1245 } |
1127 | 1246 |
1128 | 1247 |
1129 void BytecodeGraphBuilder::VisitInc( | 1248 void BytecodeGraphBuilder::VisitInc( |
1130 const interpreter::BytecodeArrayIterator& iterator) { | 1249 const interpreter::BytecodeArrayIterator& iterator) { |
| 1250 FrameStateBeforeAndAfter states(this, iterator); |
1131 const Operator* js_op = | 1251 const Operator* js_op = |
1132 javascript()->Add(language_mode(), BinaryOperationHints::Any()); | 1252 javascript()->Add(language_mode(), BinaryOperationHints::Any()); |
1133 Node* node = NewNode(js_op, environment()->LookupAccumulator(), | 1253 Node* node = NewNode(js_op, environment()->LookupAccumulator(), |
1134 jsgraph()->OneConstant()); | 1254 jsgraph()->OneConstant()); |
1135 | 1255 environment()->BindAccumulator(node, &states); |
1136 AddEmptyFrameStateInputs(node); | |
1137 environment()->BindAccumulator(node); | |
1138 } | 1256 } |
1139 | 1257 |
1140 | 1258 |
1141 void BytecodeGraphBuilder::VisitDec( | 1259 void BytecodeGraphBuilder::VisitDec( |
1142 const interpreter::BytecodeArrayIterator& iterator) { | 1260 const interpreter::BytecodeArrayIterator& iterator) { |
| 1261 FrameStateBeforeAndAfter states(this, iterator); |
1143 const Operator* js_op = | 1262 const Operator* js_op = |
1144 javascript()->Subtract(language_mode(), BinaryOperationHints::Any()); | 1263 javascript()->Subtract(language_mode(), BinaryOperationHints::Any()); |
1145 Node* node = NewNode(js_op, environment()->LookupAccumulator(), | 1264 Node* node = NewNode(js_op, environment()->LookupAccumulator(), |
1146 jsgraph()->OneConstant()); | 1265 jsgraph()->OneConstant()); |
1147 | 1266 environment()->BindAccumulator(node, &states); |
1148 AddEmptyFrameStateInputs(node); | |
1149 environment()->BindAccumulator(node); | |
1150 } | 1267 } |
1151 | 1268 |
1152 | 1269 |
1153 void BytecodeGraphBuilder::VisitLogicalNot( | 1270 void BytecodeGraphBuilder::VisitLogicalNot( |
1154 const interpreter::BytecodeArrayIterator& iterator) { | 1271 const interpreter::BytecodeArrayIterator& iterator) { |
1155 Node* value = NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), | 1272 Node* value = NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), |
1156 environment()->LookupAccumulator()); | 1273 environment()->LookupAccumulator()); |
1157 Node* node = NewNode(common()->Select(MachineRepresentation::kTagged), value, | 1274 Node* node = NewNode(common()->Select(MachineRepresentation::kTagged), value, |
1158 jsgraph()->FalseConstant(), jsgraph()->TrueConstant()); | 1275 jsgraph()->FalseConstant(), jsgraph()->TrueConstant()); |
1159 environment()->BindAccumulator(node); | 1276 environment()->BindAccumulator(node); |
1160 } | 1277 } |
1161 | 1278 |
1162 | 1279 |
1163 void BytecodeGraphBuilder::VisitTypeOf( | 1280 void BytecodeGraphBuilder::VisitTypeOf( |
1164 const interpreter::BytecodeArrayIterator& iterator) { | 1281 const interpreter::BytecodeArrayIterator& iterator) { |
1165 Node* node = | 1282 Node* node = |
1166 NewNode(javascript()->TypeOf(), environment()->LookupAccumulator()); | 1283 NewNode(javascript()->TypeOf(), environment()->LookupAccumulator()); |
1167 environment()->BindAccumulator(node); | 1284 environment()->BindAccumulator(node); |
1168 } | 1285 } |
1169 | 1286 |
1170 | 1287 |
1171 void BytecodeGraphBuilder::BuildDelete( | 1288 void BytecodeGraphBuilder::BuildDelete( |
1172 const interpreter::BytecodeArrayIterator& iterator) { | 1289 const interpreter::BytecodeArrayIterator& iterator) { |
| 1290 FrameStateBeforeAndAfter states(this, iterator); |
1173 Node* key = environment()->LookupAccumulator(); | 1291 Node* key = environment()->LookupAccumulator(); |
1174 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 1292 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
1175 | |
1176 Node* node = | 1293 Node* node = |
1177 NewNode(javascript()->DeleteProperty(language_mode()), object, key); | 1294 NewNode(javascript()->DeleteProperty(language_mode()), object, key); |
1178 AddEmptyFrameStateInputs(node); | 1295 environment()->BindAccumulator(node, &states); |
1179 environment()->BindAccumulator(node); | |
1180 } | 1296 } |
1181 | 1297 |
1182 | 1298 |
1183 void BytecodeGraphBuilder::VisitDeletePropertyStrict( | 1299 void BytecodeGraphBuilder::VisitDeletePropertyStrict( |
1184 const interpreter::BytecodeArrayIterator& iterator) { | 1300 const interpreter::BytecodeArrayIterator& iterator) { |
1185 DCHECK(is_strict(language_mode())); | 1301 DCHECK(is_strict(language_mode())); |
1186 BuildDelete(iterator); | 1302 BuildDelete(iterator); |
1187 } | 1303 } |
1188 | 1304 |
1189 | 1305 |
1190 void BytecodeGraphBuilder::VisitDeletePropertySloppy( | 1306 void BytecodeGraphBuilder::VisitDeletePropertySloppy( |
1191 const interpreter::BytecodeArrayIterator& iterator) { | 1307 const interpreter::BytecodeArrayIterator& iterator) { |
1192 DCHECK(is_sloppy(language_mode())); | 1308 DCHECK(is_sloppy(language_mode())); |
1193 BuildDelete(iterator); | 1309 BuildDelete(iterator); |
1194 } | 1310 } |
1195 | 1311 |
1196 | 1312 |
1197 void BytecodeGraphBuilder::BuildCompareOp( | 1313 void BytecodeGraphBuilder::BuildCompareOp( |
1198 const Operator* js_op, const interpreter::BytecodeArrayIterator& iterator) { | 1314 const Operator* js_op, const interpreter::BytecodeArrayIterator& iterator) { |
| 1315 FrameStateBeforeAndAfter states(this, iterator); |
1199 Node* left = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 1316 Node* left = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
1200 Node* right = environment()->LookupAccumulator(); | 1317 Node* right = environment()->LookupAccumulator(); |
1201 Node* node = NewNode(js_op, left, right); | 1318 Node* node = NewNode(js_op, left, right); |
1202 | 1319 environment()->BindAccumulator(node, &states); |
1203 AddEmptyFrameStateInputs(node); | |
1204 environment()->BindAccumulator(node); | |
1205 } | 1320 } |
1206 | 1321 |
1207 | 1322 |
1208 void BytecodeGraphBuilder::VisitTestEqual( | 1323 void BytecodeGraphBuilder::VisitTestEqual( |
1209 const interpreter::BytecodeArrayIterator& iterator) { | 1324 const interpreter::BytecodeArrayIterator& iterator) { |
1210 BuildCompareOp(javascript()->Equal(), iterator); | 1325 BuildCompareOp(javascript()->Equal(), iterator); |
1211 } | 1326 } |
1212 | 1327 |
1213 | 1328 |
1214 void BytecodeGraphBuilder::VisitTestNotEqual( | 1329 void BytecodeGraphBuilder::VisitTestNotEqual( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 | 1375 |
1261 | 1376 |
1262 void BytecodeGraphBuilder::VisitTestInstanceOf( | 1377 void BytecodeGraphBuilder::VisitTestInstanceOf( |
1263 const interpreter::BytecodeArrayIterator& iterator) { | 1378 const interpreter::BytecodeArrayIterator& iterator) { |
1264 BuildCompareOp(javascript()->InstanceOf(), iterator); | 1379 BuildCompareOp(javascript()->InstanceOf(), iterator); |
1265 } | 1380 } |
1266 | 1381 |
1267 | 1382 |
1268 void BytecodeGraphBuilder::BuildCastOperator( | 1383 void BytecodeGraphBuilder::BuildCastOperator( |
1269 const Operator* js_op, const interpreter::BytecodeArrayIterator& iterator) { | 1384 const Operator* js_op, const interpreter::BytecodeArrayIterator& iterator) { |
| 1385 FrameStateBeforeAndAfter states(this, iterator); |
1270 Node* node = NewNode(js_op, environment()->LookupAccumulator()); | 1386 Node* node = NewNode(js_op, environment()->LookupAccumulator()); |
1271 AddEmptyFrameStateInputs(node); | 1387 environment()->BindAccumulator(node, &states); |
1272 environment()->BindAccumulator(node); | |
1273 } | 1388 } |
1274 | 1389 |
1275 | 1390 |
1276 void BytecodeGraphBuilder::VisitToName( | 1391 void BytecodeGraphBuilder::VisitToName( |
1277 const interpreter::BytecodeArrayIterator& iterator) { | 1392 const interpreter::BytecodeArrayIterator& iterator) { |
1278 BuildCastOperator(javascript()->ToName(), iterator); | 1393 BuildCastOperator(javascript()->ToName(), iterator); |
1279 } | 1394 } |
1280 | 1395 |
1281 | 1396 |
1282 void BytecodeGraphBuilder::VisitToNumber( | 1397 void BytecodeGraphBuilder::VisitToNumber( |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1656 | 1771 |
1657 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { | 1772 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { |
1658 if (environment()->IsMarkedAsUnreachable()) return; | 1773 if (environment()->IsMarkedAsUnreachable()) return; |
1659 environment()->MarkAsUnreachable(); | 1774 environment()->MarkAsUnreachable(); |
1660 exit_controls_.push_back(exit); | 1775 exit_controls_.push_back(exit); |
1661 } | 1776 } |
1662 | 1777 |
1663 } // namespace compiler | 1778 } // namespace compiler |
1664 } // namespace internal | 1779 } // namespace internal |
1665 } // namespace v8 | 1780 } // namespace v8 |
OLD | NEW |