| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "v8.h" | 5 #include "v8.h" |
| 6 #include "lithium-allocator-inl.h" | 6 #include "lithium-allocator-inl.h" |
| 7 | 7 |
| 8 #include "hydrogen.h" | 8 #include "hydrogen.h" |
| 9 #include "string-stream.h" | 9 #include "string-stream.h" |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 LOperand* operand, | 39 LOperand* operand, |
| 40 LOperand* hint) | 40 LOperand* hint) |
| 41 : operand_(operand), | 41 : operand_(operand), |
| 42 hint_(hint), | 42 hint_(hint), |
| 43 pos_(pos), | 43 pos_(pos), |
| 44 next_(NULL), | 44 next_(NULL), |
| 45 requires_reg_(false), | 45 requires_reg_(false), |
| 46 register_beneficial_(true) { | 46 register_beneficial_(true) { |
| 47 if (operand_ != NULL && operand_->IsUnallocated()) { | 47 if (operand_ != NULL && operand_->IsUnallocated()) { |
| 48 LUnallocated* unalloc = LUnallocated::cast(operand_); | 48 LUnallocated* unalloc = LUnallocated::cast(operand_); |
| 49 requires_reg_ = unalloc->HasRegisterPolicy(); | 49 requires_reg_ = unalloc->HasRegisterPolicy() || |
| 50 unalloc->HasDoubleRegisterPolicy(); |
| 50 register_beneficial_ = !unalloc->HasAnyPolicy(); | 51 register_beneficial_ = !unalloc->HasAnyPolicy(); |
| 51 } | 52 } |
| 52 ASSERT(pos_.IsValid()); | 53 ASSERT(pos_.IsValid()); |
| 53 } | 54 } |
| 54 | 55 |
| 55 | 56 |
| 56 bool UsePosition::HasHint() const { | 57 bool UsePosition::HasHint() const { |
| 57 return hint_ != NULL && !hint_->IsUnallocated(); | 58 return hint_ != NULL && !hint_->IsUnallocated(); |
| 58 } | 59 } |
| 59 | 60 |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 if (temp->IsRegister()) continue; | 999 if (temp->IsRegister()) continue; |
| 999 if (temp->IsUnallocated()) { | 1000 if (temp->IsUnallocated()) { |
| 1000 LUnallocated* temp_unalloc = LUnallocated::cast(temp); | 1001 LUnallocated* temp_unalloc = LUnallocated::cast(temp); |
| 1001 if (temp_unalloc->HasFixedPolicy()) { | 1002 if (temp_unalloc->HasFixedPolicy()) { |
| 1002 continue; | 1003 continue; |
| 1003 } | 1004 } |
| 1004 } | 1005 } |
| 1005 } | 1006 } |
| 1006 Use(block_start_position, curr_position.InstructionEnd(), temp, NULL); | 1007 Use(block_start_position, curr_position.InstructionEnd(), temp, NULL); |
| 1007 Define(curr_position, temp, NULL); | 1008 Define(curr_position, temp, NULL); |
| 1009 |
| 1010 if (temp->IsUnallocated()) { |
| 1011 LUnallocated* temp_unalloc = LUnallocated::cast(temp); |
| 1012 if (temp_unalloc->HasDoubleRegisterPolicy()) { |
| 1013 double_artificial_registers_.Add( |
| 1014 temp_unalloc->virtual_register() - first_artificial_register_, |
| 1015 zone()); |
| 1016 } |
| 1017 } |
| 1008 } | 1018 } |
| 1009 } | 1019 } |
| 1010 } | 1020 } |
| 1011 | 1021 |
| 1012 index = index - 1; | 1022 index = index - 1; |
| 1013 } | 1023 } |
| 1014 } | 1024 } |
| 1015 | 1025 |
| 1016 | 1026 |
| 1017 void LAllocator::ResolvePhis(HBasicBlock* block) { | 1027 void LAllocator::ResolvePhis(HBasicBlock* block) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 if (!AllocationOk()) return false; | 1098 if (!AllocationOk()) return false; |
| 1089 PopulatePointerMaps(); | 1099 PopulatePointerMaps(); |
| 1090 ConnectRanges(); | 1100 ConnectRanges(); |
| 1091 ResolveControlFlow(); | 1101 ResolveControlFlow(); |
| 1092 return true; | 1102 return true; |
| 1093 } | 1103 } |
| 1094 | 1104 |
| 1095 | 1105 |
| 1096 void LAllocator::MeetRegisterConstraints() { | 1106 void LAllocator::MeetRegisterConstraints() { |
| 1097 LAllocatorPhase phase("L_Register constraints", this); | 1107 LAllocatorPhase phase("L_Register constraints", this); |
| 1098 first_artificial_register_ = next_virtual_register_; | |
| 1099 const ZoneList<HBasicBlock*>* blocks = graph_->blocks(); | 1108 const ZoneList<HBasicBlock*>* blocks = graph_->blocks(); |
| 1100 for (int i = 0; i < blocks->length(); ++i) { | 1109 for (int i = 0; i < blocks->length(); ++i) { |
| 1101 HBasicBlock* block = blocks->at(i); | 1110 HBasicBlock* block = blocks->at(i); |
| 1102 MeetRegisterConstraints(block); | 1111 MeetRegisterConstraints(block); |
| 1103 if (!AllocationOk()) return; | 1112 if (!AllocationOk()) return; |
| 1104 } | 1113 } |
| 1105 } | 1114 } |
| 1106 | 1115 |
| 1107 | 1116 |
| 1108 void LAllocator::ResolvePhis() { | 1117 void LAllocator::ResolvePhis() { |
| (...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2189 isolate()->GetHTracer()->TraceLiveRanges(name(), allocator_); | 2198 isolate()->GetHTracer()->TraceLiveRanges(name(), allocator_); |
| 2190 } | 2199 } |
| 2191 | 2200 |
| 2192 #ifdef DEBUG | 2201 #ifdef DEBUG |
| 2193 if (allocator_ != NULL) allocator_->Verify(); | 2202 if (allocator_ != NULL) allocator_->Verify(); |
| 2194 #endif | 2203 #endif |
| 2195 } | 2204 } |
| 2196 | 2205 |
| 2197 | 2206 |
| 2198 } } // namespace v8::internal | 2207 } } // namespace v8::internal |
| OLD | NEW |