Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" |
| 6 | 6 |
| 7 #include "src/ast/compile-time-value.h" | 7 #include "src/ast/compile-time-value.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.h" | 10 #include "src/compiler.h" |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 651 loop->Merge(osr_env); | 651 loop->Merge(osr_env); |
| 652 } | 652 } |
| 653 return loop; | 653 return loop; |
| 654 } | 654 } |
| 655 | 655 |
| 656 | 656 |
| 657 void AstGraphBuilder::Environment::UpdateStateValues(Node** state_values, | 657 void AstGraphBuilder::Environment::UpdateStateValues(Node** state_values, |
| 658 int offset, int count) { | 658 int offset, int count) { |
| 659 bool should_update = false; | 659 bool should_update = false; |
| 660 Node** env_values = (count == 0) ? nullptr : &values()->at(offset); | 660 Node** env_values = (count == 0) ? nullptr : &values()->at(offset); |
| 661 if (*state_values == nullptr || (*state_values)->InputCount() != count) { | 661 if (*state_values == nullptr) { |
| 662 should_update = true; | 662 should_update = true; |
| 663 } else { | 663 } else { |
| 664 DCHECK(static_cast<size_t>(offset + count) <= values()->size()); | 664 Node::Inputs inputs = (*state_values)->inputs(); |
| 665 for (int i = 0; i < count; i++) { | 665 if (inputs.count() != count) { |
| 666 if ((*state_values)->InputAt(i) != env_values[i]) { | 666 should_update = true; |
| 667 should_update = true; | 667 } else { |
| 668 break; | 668 DCHECK(static_cast<size_t>(offset + count) <= values()->size()); |
| 669 for (int i = 0; i < count; i++) { | |
| 670 if (inputs[i] != env_values[i]) { | |
| 671 should_update = true; | |
| 672 break; | |
| 673 } | |
|
Jarin
2017/01/10 10:53:38
This looks longer and harder to read. Do we have t
Leszek Swirski
2017/01/10 12:03:38
We don't, especially since this code is dying soon
| |
| 669 } | 674 } |
| 670 } | 675 } |
| 671 } | 676 } |
| 672 if (should_update) { | 677 if (should_update) { |
| 673 const Operator* op = common()->StateValues(count, SparseInputMask::Dense()); | 678 const Operator* op = common()->StateValues(count, SparseInputMask::Dense()); |
| 674 (*state_values) = graph()->NewNode(op, count, env_values); | 679 (*state_values) = graph()->NewNode(op, count, env_values); |
| 675 } | 680 } |
| 676 } | 681 } |
| 677 | 682 |
| 678 | 683 |
| (...skipping 2620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3299 float invocation_frequency, LoopAssignmentAnalysis* loop_assignment, | 3304 float invocation_frequency, LoopAssignmentAnalysis* loop_assignment, |
| 3300 SourcePositionTable* source_positions, int inlining_id) | 3305 SourcePositionTable* source_positions, int inlining_id) |
| 3301 : AstGraphBuilder(local_zone, info, jsgraph, invocation_frequency, | 3306 : AstGraphBuilder(local_zone, info, jsgraph, invocation_frequency, |
| 3302 loop_assignment), | 3307 loop_assignment), |
| 3303 source_positions_(source_positions), | 3308 source_positions_(source_positions), |
| 3304 start_position_(info->shared_info()->start_position(), inlining_id) {} | 3309 start_position_(info->shared_info()->start_position(), inlining_id) {} |
| 3305 | 3310 |
| 3306 } // namespace compiler | 3311 } // namespace compiler |
| 3307 } // namespace internal | 3312 } // namespace internal |
| 3308 } // namespace v8 | 3313 } // namespace v8 |
| OLD | NEW |