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/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler/bytecode-branch-analysis.h" | 10 #include "src/compiler/bytecode-branch-analysis.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 // Create OSR values for each environment value. | 431 // Create OSR values for each environment value. |
432 SetContext(graph()->NewNode( | 432 SetContext(graph()->NewNode( |
433 common()->OsrValue(Linkage::kOsrContextSpillSlotIndex), entry)); | 433 common()->OsrValue(Linkage::kOsrContextSpillSlotIndex), entry)); |
434 int size = static_cast<int>(values()->size()); | 434 int size = static_cast<int>(values()->size()); |
435 for (int i = 0; i < size; i++) { | 435 for (int i = 0; i < size; i++) { |
436 int idx = i; // Indexing scheme follows {StandardFrame}, adapt accordingly. | 436 int idx = i; // Indexing scheme follows {StandardFrame}, adapt accordingly. |
437 if (i >= register_base()) idx += InterpreterFrameConstants::kExtraSlotCount; | 437 if (i >= register_base()) idx += InterpreterFrameConstants::kExtraSlotCount; |
438 if (i >= accumulator_base()) idx = Linkage::kOsrAccumulatorRegisterIndex; | 438 if (i >= accumulator_base()) idx = Linkage::kOsrAccumulatorRegisterIndex; |
439 values()->at(i) = graph()->NewNode(common()->OsrValue(idx), entry); | 439 values()->at(i) = graph()->NewNode(common()->OsrValue(idx), entry); |
440 } | 440 } |
| 441 |
| 442 BailoutId loop_id(builder_->bytecode_iterator().current_offset()); |
| 443 Node* frame_state = |
| 444 Checkpoint(loop_id, OutputFrameStateCombine::Ignore(), false); |
| 445 Node* checkpoint = |
| 446 graph()->NewNode(common()->Checkpoint(), frame_state, entry, entry); |
| 447 UpdateEffectDependency(checkpoint); |
| 448 |
| 449 // Create the OSR guard nodes. |
| 450 const Operator* guard_op = common()->OsrGuard(OsrGuardType::kUninitialized); |
| 451 Node* effect = checkpoint; |
| 452 for (int i = 0; i < size; i++) { |
| 453 values()->at(i) = effect = |
| 454 graph()->NewNode(guard_op, values()->at(i), effect, entry); |
| 455 } |
| 456 Node* context = effect = graph()->NewNode(guard_op, Context(), effect, entry); |
| 457 SetContext(context); |
| 458 UpdateEffectDependency(effect); |
441 } | 459 } |
442 | 460 |
443 bool BytecodeGraphBuilder::Environment::StateValuesRequireUpdate( | 461 bool BytecodeGraphBuilder::Environment::StateValuesRequireUpdate( |
444 Node** state_values, int offset, int count) { | 462 Node** state_values, int offset, int count) { |
445 if (*state_values == nullptr) { | 463 if (*state_values == nullptr) { |
446 return true; | 464 return true; |
447 } | 465 } |
448 DCHECK_EQ((*state_values)->InputCount(), count); | 466 DCHECK_EQ((*state_values)->InputCount(), count); |
449 DCHECK_LE(static_cast<size_t>(offset + count), values()->size()); | 467 DCHECK_LE(static_cast<size_t>(offset + count), values()->size()); |
450 Node** env_values = (count == 0) ? nullptr : &values()->at(offset); | 468 Node** env_values = (count == 0) ? nullptr : &values()->at(offset); |
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2225 // Phi does not exist yet, introduce one. | 2243 // Phi does not exist yet, introduce one. |
2226 value = NewPhi(inputs, value, control); | 2244 value = NewPhi(inputs, value, control); |
2227 value->ReplaceInput(inputs - 1, other); | 2245 value->ReplaceInput(inputs - 1, other); |
2228 } | 2246 } |
2229 return value; | 2247 return value; |
2230 } | 2248 } |
2231 | 2249 |
2232 } // namespace compiler | 2250 } // namespace compiler |
2233 } // namespace internal | 2251 } // namespace internal |
2234 } // namespace v8 | 2252 } // namespace v8 |
OLD | NEW |