| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 4985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4996 // Move the instruction out of the loop. | 4996 // Move the instruction out of the loop. |
| 4997 current->RemoveEnvironment(); | 4997 current->RemoveEnvironment(); |
| 4998 if (it != NULL) { | 4998 if (it != NULL) { |
| 4999 it->RemoveCurrentFromGraph(); | 4999 it->RemoveCurrentFromGraph(); |
| 5000 } else { | 5000 } else { |
| 5001 current->RemoveFromGraph(); | 5001 current->RemoveFromGraph(); |
| 5002 } | 5002 } |
| 5003 GotoInstr* last = pre_header->last_instruction()->AsGoto(); | 5003 GotoInstr* last = pre_header->last_instruction()->AsGoto(); |
| 5004 // Using kind kEffect will not assign a fresh ssa temporary index. | 5004 // Using kind kEffect will not assign a fresh ssa temporary index. |
| 5005 flow_graph()->InsertBefore(last, current, last->env(), FlowGraph::kEffect); | 5005 flow_graph()->InsertBefore(last, current, last->env(), FlowGraph::kEffect); |
| 5006 current->deopt_id_ = last->GetDeoptId(); | 5006 current->CopyDeoptIdFrom(*last); |
| 5007 } | 5007 } |
| 5008 | 5008 |
| 5009 | 5009 |
| 5010 void LICM::TrySpecializeSmiPhi(PhiInstr* phi, | 5010 void LICM::TrySpecializeSmiPhi(PhiInstr* phi, |
| 5011 BlockEntryInstr* header, | 5011 BlockEntryInstr* header, |
| 5012 BlockEntryInstr* pre_header) { | 5012 BlockEntryInstr* pre_header) { |
| 5013 if (phi->Type()->ToCid() == kSmiCid) { | 5013 if (phi->Type()->ToCid() == kSmiCid) { |
| 5014 return; | 5014 return; |
| 5015 } | 5015 } |
| 5016 | 5016 |
| (...skipping 4237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9254 BranchInstr* new_branch = | 9254 BranchInstr* new_branch = |
| 9255 CloneBranch(isolate, branch, new_left, new_right); | 9255 CloneBranch(isolate, branch, new_left, new_right); |
| 9256 if (branch->env() == NULL) { | 9256 if (branch->env() == NULL) { |
| 9257 new_branch->InheritDeoptTarget(isolate, old_goto); | 9257 new_branch->InheritDeoptTarget(isolate, old_goto); |
| 9258 } else { | 9258 } else { |
| 9259 // Take the environment from the branch if it has one. | 9259 // Take the environment from the branch if it has one. |
| 9260 new_branch->InheritDeoptTarget(isolate, branch); | 9260 new_branch->InheritDeoptTarget(isolate, branch); |
| 9261 // InheritDeoptTarget gave the new branch's comparison the same | 9261 // InheritDeoptTarget gave the new branch's comparison the same |
| 9262 // deopt id that it gave the new branch. The id should be the | 9262 // deopt id that it gave the new branch. The id should be the |
| 9263 // deopt id of the original comparison. | 9263 // deopt id of the original comparison. |
| 9264 new_branch->comparison()->SetDeoptId(comparison->GetDeoptId()); | 9264 new_branch->comparison()->SetDeoptId(*comparison); |
| 9265 // The phi can be used in the branch's environment. Rename such | 9265 // The phi can be used in the branch's environment. Rename such |
| 9266 // uses. | 9266 // uses. |
| 9267 for (Environment::DeepIterator it(new_branch->env()); | 9267 for (Environment::DeepIterator it(new_branch->env()); |
| 9268 !it.Done(); | 9268 !it.Done(); |
| 9269 it.Advance()) { | 9269 it.Advance()) { |
| 9270 Value* use = it.CurrentValue(); | 9270 Value* use = it.CurrentValue(); |
| 9271 if (use->definition() == phi) { | 9271 if (use->definition() == phi) { |
| 9272 Definition* replacement = phi->InputAt(i)->definition(); | 9272 Definition* replacement = phi->InputAt(i)->definition(); |
| 9273 use->RemoveFromUseList(); | 9273 use->RemoveFromUseList(); |
| 9274 use->set_definition(replacement); | 9274 use->set_definition(replacement); |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10078 | 10078 |
| 10079 // Insert materializations at environment uses. | 10079 // Insert materializations at environment uses. |
| 10080 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { | 10080 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { |
| 10081 CreateMaterializationAt( | 10081 CreateMaterializationAt( |
| 10082 exits_collector_.exits()[i], alloc, *slots); | 10082 exits_collector_.exits()[i], alloc, *slots); |
| 10083 } | 10083 } |
| 10084 } | 10084 } |
| 10085 | 10085 |
| 10086 | 10086 |
| 10087 } // namespace dart | 10087 } // namespace dart |
| OLD | NEW |