| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 void PrepareForOsrEntry(); | 75 void PrepareForOsrEntry(); |
| 76 | 76 |
| 77 void PrepareForLoopExit(Node* loop); | 77 void PrepareForLoopExit(Node* loop); |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 Environment(const Environment* copy, LivenessAnalyzerBlock* liveness_block); | 80 Environment(const Environment* copy, LivenessAnalyzerBlock* liveness_block); |
| 81 void PrepareForLoop(); | 81 void PrepareForLoop(); |
| 82 | 82 |
| 83 bool StateValuesRequireUpdate(Node** state_values, int offset, int count); | 83 bool StateValuesRequireUpdate(Node** state_values, int offset, int count); |
| 84 void UpdateStateValues(Node** state_values, int offset, int count); | 84 void UpdateStateValues(Node** state_values, int offset, int count); |
| 85 void UpdateStateValuesWithCache(Node** state_values, int offset, int count); | |
| 86 | 85 |
| 87 int RegisterToValuesIndex(interpreter::Register the_register) const; | 86 int RegisterToValuesIndex(interpreter::Register the_register) const; |
| 88 | 87 |
| 89 bool IsLivenessBlockConsistent() const; | 88 bool IsLivenessBlockConsistent() const; |
| 90 | 89 |
| 91 Zone* zone() const { return builder_->local_zone(); } | 90 Zone* zone() const { return builder_->local_zone(); } |
| 92 Graph* graph() const { return builder_->graph(); } | 91 Graph* graph() const { return builder_->graph(); } |
| 93 CommonOperatorBuilder* common() const { return builder_->common(); } | 92 CommonOperatorBuilder* common() const { return builder_->common(); } |
| 94 BytecodeGraphBuilder* builder() const { return builder_; } | 93 BytecodeGraphBuilder* builder() const { return builder_; } |
| 95 LivenessAnalyzerBlock* liveness_block() const { return liveness_block_; } | 94 LivenessAnalyzerBlock* liveness_block() const { return liveness_block_; } |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 445 |
| 447 void BytecodeGraphBuilder::Environment::UpdateStateValues(Node** state_values, | 446 void BytecodeGraphBuilder::Environment::UpdateStateValues(Node** state_values, |
| 448 int offset, | 447 int offset, |
| 449 int count) { | 448 int count) { |
| 450 if (StateValuesRequireUpdate(state_values, offset, count)) { | 449 if (StateValuesRequireUpdate(state_values, offset, count)) { |
| 451 const Operator* op = common()->StateValues(count); | 450 const Operator* op = common()->StateValues(count); |
| 452 (*state_values) = graph()->NewNode(op, count, &values()->at(offset)); | 451 (*state_values) = graph()->NewNode(op, count, &values()->at(offset)); |
| 453 } | 452 } |
| 454 } | 453 } |
| 455 | 454 |
| 456 void BytecodeGraphBuilder::Environment::UpdateStateValuesWithCache( | |
| 457 Node** state_values, int offset, int count) { | |
| 458 Node** env_values = (count == 0) ? nullptr : &values()->at(offset); | |
| 459 *state_values = builder_->state_values_cache_.GetNodeForValues( | |
| 460 env_values, static_cast<size_t>(count)); | |
| 461 } | |
| 462 | |
| 463 Node* BytecodeGraphBuilder::Environment::Checkpoint( | 455 Node* BytecodeGraphBuilder::Environment::Checkpoint( |
| 464 BailoutId bailout_id, OutputFrameStateCombine combine, | 456 BailoutId bailout_id, OutputFrameStateCombine combine, |
| 465 bool owner_has_exception) { | 457 bool owner_has_exception) { |
| 466 UpdateStateValues(¶meters_state_values_, 0, parameter_count()); | 458 UpdateStateValues(¶meters_state_values_, 0, parameter_count()); |
| 467 UpdateStateValuesWithCache(®isters_state_values_, register_base(), | 459 UpdateStateValues(®isters_state_values_, register_base(), |
| 468 register_count()); | 460 register_count()); |
| 469 UpdateStateValues(&accumulator_state_values_, accumulator_base(), 1); | 461 UpdateStateValues(&accumulator_state_values_, accumulator_base(), 1); |
| 470 | 462 |
| 471 const Operator* op = common()->FrameState( | 463 const Operator* op = common()->FrameState( |
| 472 bailout_id, combine, builder()->frame_state_function_info()); | 464 bailout_id, combine, builder()->frame_state_function_info()); |
| 473 Node* result = graph()->NewNode( | 465 Node* result = graph()->NewNode( |
| 474 op, parameters_state_values_, registers_state_values_, | 466 op, parameters_state_values_, registers_state_values_, |
| 475 accumulator_state_values_, Context(), builder()->GetFunctionClosure(), | 467 accumulator_state_values_, Context(), builder()->GetFunctionClosure(), |
| 476 builder()->graph()->start()); | 468 builder()->graph()->start()); |
| 477 | 469 |
| 478 if (liveness_block() != nullptr) { | 470 if (liveness_block() != nullptr) { |
| (...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2209 it->source_position().ScriptOffset(), start_position_.InliningId())); | 2201 it->source_position().ScriptOffset(), start_position_.InliningId())); |
| 2210 it->Advance(); | 2202 it->Advance(); |
| 2211 } else { | 2203 } else { |
| 2212 DCHECK_GT(it->code_offset(), offset); | 2204 DCHECK_GT(it->code_offset(), offset); |
| 2213 } | 2205 } |
| 2214 } | 2206 } |
| 2215 | 2207 |
| 2216 } // namespace compiler | 2208 } // namespace compiler |
| 2217 } // namespace internal | 2209 } // namespace internal |
| 2218 } // namespace v8 | 2210 } // namespace v8 |
| OLD | NEW |