| 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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 } | 596 } |
| 597 | 597 |
| 598 void BytecodeGraphBuilder::PrepareEagerCheckpoint() { | 598 void BytecodeGraphBuilder::PrepareEagerCheckpoint() { |
| 599 if (environment()->GetEffectDependency()->opcode() != IrOpcode::kCheckpoint) { | 599 if (environment()->GetEffectDependency()->opcode() != IrOpcode::kCheckpoint) { |
| 600 // Create an explicit checkpoint node for before the operation. This only | 600 // Create an explicit checkpoint node for before the operation. This only |
| 601 // needs to happen if we aren't effect-dominated by a {Checkpoint} already. | 601 // needs to happen if we aren't effect-dominated by a {Checkpoint} already. |
| 602 Node* node = NewNode(common()->Checkpoint()); | 602 Node* node = NewNode(common()->Checkpoint()); |
| 603 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); | 603 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); |
| 604 DCHECK_EQ(IrOpcode::kDead, | 604 DCHECK_EQ(IrOpcode::kDead, |
| 605 NodeProperties::GetFrameStateInput(node)->opcode()); | 605 NodeProperties::GetFrameStateInput(node)->opcode()); |
| 606 BailoutId bailout_id_before(bytecode_iterator().current_offset()); | 606 BailoutId bailout_id(bytecode_iterator().current_offset()); |
| 607 Node* frame_state_before = environment()->Checkpoint( | 607 Node* frame_state_before = environment()->Checkpoint( |
| 608 bailout_id_before, OutputFrameStateCombine::Ignore(), false); | 608 bailout_id, OutputFrameStateCombine::Ignore(), false); |
| 609 NodeProperties::ReplaceFrameStateInput(node, frame_state_before); | 609 NodeProperties::ReplaceFrameStateInput(node, frame_state_before); |
| 610 } | 610 } |
| 611 } | 611 } |
| 612 | 612 |
| 613 void BytecodeGraphBuilder::PrepareFrameState(Node* node, | 613 void BytecodeGraphBuilder::PrepareFrameState(Node* node, |
| 614 OutputFrameStateCombine combine) { | 614 OutputFrameStateCombine combine) { |
| 615 if (OperatorProperties::HasFrameStateInput(node->op())) { | 615 if (OperatorProperties::HasFrameStateInput(node->op())) { |
| 616 // Add the frame state for after the operation. The node in question has | 616 // Add the frame state for after the operation. The node in question has |
| 617 // already been created and had a {Dead} frame state input up until now. | 617 // already been created and had a {Dead} frame state input up until now. |
| 618 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); | 618 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); |
| 619 DCHECK_EQ(IrOpcode::kDead, | 619 DCHECK_EQ(IrOpcode::kDead, |
| 620 NodeProperties::GetFrameStateInput(node)->opcode()); | 620 NodeProperties::GetFrameStateInput(node)->opcode()); |
| 621 BailoutId bailout_id_after(bytecode_iterator().current_offset() + | 621 BailoutId bailout_id(bytecode_iterator().current_offset()); |
| 622 bytecode_iterator().current_bytecode_size()); | |
| 623 bool has_exception = NodeProperties::IsExceptionalCall(node); | 622 bool has_exception = NodeProperties::IsExceptionalCall(node); |
| 624 Node* frame_state_after = | 623 Node* frame_state_after = |
| 625 environment()->Checkpoint(bailout_id_after, combine, has_exception); | 624 environment()->Checkpoint(bailout_id, combine, has_exception); |
| 626 NodeProperties::ReplaceFrameStateInput(node, frame_state_after); | 625 NodeProperties::ReplaceFrameStateInput(node, frame_state_after); |
| 627 } | 626 } |
| 628 } | 627 } |
| 629 | 628 |
| 630 void BytecodeGraphBuilder::ClearNonLiveSlotsInFrameStates() { | 629 void BytecodeGraphBuilder::ClearNonLiveSlotsInFrameStates() { |
| 631 if (!IsLivenessAnalysisEnabled()) { | 630 if (!IsLivenessAnalysisEnabled()) { |
| 632 return; | 631 return; |
| 633 } | 632 } |
| 634 NonLiveFrameStateSlotReplacer replacer( | 633 NonLiveFrameStateSlotReplacer replacer( |
| 635 &state_values_cache_, jsgraph()->OptimizedOutConstant(), | 634 &state_values_cache_, jsgraph()->OptimizedOutConstant(), |
| (...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2237 source_positions_->set_current_position(it->source_position()); | 2236 source_positions_->set_current_position(it->source_position()); |
| 2238 it->Advance(); | 2237 it->Advance(); |
| 2239 } else { | 2238 } else { |
| 2240 DCHECK_GT(it->code_offset(), offset); | 2239 DCHECK_GT(it->code_offset(), offset); |
| 2241 } | 2240 } |
| 2242 } | 2241 } |
| 2243 | 2242 |
| 2244 } // namespace compiler | 2243 } // namespace compiler |
| 2245 } // namespace internal | 2244 } // namespace internal |
| 2246 } // namespace v8 | 2245 } // namespace v8 |
| OLD | NEW |