| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source())); | 165 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source())); |
| 166 ASSERT(!in_cycle_); | 166 ASSERT(!in_cycle_); |
| 167 in_cycle_ = true; | 167 in_cycle_ = true; |
| 168 LOperand* source = moves_[index].source(); | 168 LOperand* source = moves_[index].source(); |
| 169 saved_destination_ = moves_[index].destination(); | 169 saved_destination_ = moves_[index].destination(); |
| 170 if (source->IsRegister()) { | 170 if (source->IsRegister()) { |
| 171 __ mov(kLithiumScratchReg, cgen_->ToRegister(source)); | 171 __ mov(kLithiumScratchReg, cgen_->ToRegister(source)); |
| 172 } else if (source->IsStackSlot()) { | 172 } else if (source->IsStackSlot()) { |
| 173 __ lw(kLithiumScratchReg, cgen_->ToMemOperand(source)); | 173 __ lw(kLithiumScratchReg, cgen_->ToMemOperand(source)); |
| 174 } else if (source->IsDoubleRegister()) { | 174 } else if (source->IsDoubleRegister()) { |
| 175 CpuFeatureScope scope(cgen_->masm(), FPU); | |
| 176 __ mov_d(kLithiumScratchDouble, cgen_->ToDoubleRegister(source)); | 175 __ mov_d(kLithiumScratchDouble, cgen_->ToDoubleRegister(source)); |
| 177 } else if (source->IsDoubleStackSlot()) { | 176 } else if (source->IsDoubleStackSlot()) { |
| 178 CpuFeatureScope scope(cgen_->masm(), FPU); | |
| 179 __ ldc1(kLithiumScratchDouble, cgen_->ToMemOperand(source)); | 177 __ ldc1(kLithiumScratchDouble, cgen_->ToMemOperand(source)); |
| 180 } else { | 178 } else { |
| 181 UNREACHABLE(); | 179 UNREACHABLE(); |
| 182 } | 180 } |
| 183 // This move will be done by restoring the saved value to the destination. | 181 // This move will be done by restoring the saved value to the destination. |
| 184 moves_[index].Eliminate(); | 182 moves_[index].Eliminate(); |
| 185 } | 183 } |
| 186 | 184 |
| 187 | 185 |
| 188 void LGapResolver::RestoreValue() { | 186 void LGapResolver::RestoreValue() { |
| 189 ASSERT(in_cycle_); | 187 ASSERT(in_cycle_); |
| 190 ASSERT(saved_destination_ != NULL); | 188 ASSERT(saved_destination_ != NULL); |
| 191 | 189 |
| 192 // Spilled value is in kLithiumScratchReg or kLithiumScratchDouble. | 190 // Spilled value is in kLithiumScratchReg or kLithiumScratchDouble. |
| 193 if (saved_destination_->IsRegister()) { | 191 if (saved_destination_->IsRegister()) { |
| 194 __ mov(cgen_->ToRegister(saved_destination_), kLithiumScratchReg); | 192 __ mov(cgen_->ToRegister(saved_destination_), kLithiumScratchReg); |
| 195 } else if (saved_destination_->IsStackSlot()) { | 193 } else if (saved_destination_->IsStackSlot()) { |
| 196 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(saved_destination_)); | 194 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(saved_destination_)); |
| 197 } else if (saved_destination_->IsDoubleRegister()) { | 195 } else if (saved_destination_->IsDoubleRegister()) { |
| 198 CpuFeatureScope scope(cgen_->masm(), FPU); | |
| 199 __ mov_d(cgen_->ToDoubleRegister(saved_destination_), | 196 __ mov_d(cgen_->ToDoubleRegister(saved_destination_), |
| 200 kLithiumScratchDouble); | 197 kLithiumScratchDouble); |
| 201 } else if (saved_destination_->IsDoubleStackSlot()) { | 198 } else if (saved_destination_->IsDoubleStackSlot()) { |
| 202 CpuFeatureScope scope(cgen_->masm(), FPU); | |
| 203 __ sdc1(kLithiumScratchDouble, | 199 __ sdc1(kLithiumScratchDouble, |
| 204 cgen_->ToMemOperand(saved_destination_)); | 200 cgen_->ToMemOperand(saved_destination_)); |
| 205 } else { | 201 } else { |
| 206 UNREACHABLE(); | 202 UNREACHABLE(); |
| 207 } | 203 } |
| 208 | 204 |
| 209 in_cycle_ = false; | 205 in_cycle_ = false; |
| 210 saved_destination_ = NULL; | 206 saved_destination_ = NULL; |
| 211 } | 207 } |
| 212 | 208 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 229 | 225 |
| 230 } else if (source->IsStackSlot()) { | 226 } else if (source->IsStackSlot()) { |
| 231 MemOperand source_operand = cgen_->ToMemOperand(source); | 227 MemOperand source_operand = cgen_->ToMemOperand(source); |
| 232 if (destination->IsRegister()) { | 228 if (destination->IsRegister()) { |
| 233 __ lw(cgen_->ToRegister(destination), source_operand); | 229 __ lw(cgen_->ToRegister(destination), source_operand); |
| 234 } else { | 230 } else { |
| 235 ASSERT(destination->IsStackSlot()); | 231 ASSERT(destination->IsStackSlot()); |
| 236 MemOperand destination_operand = cgen_->ToMemOperand(destination); | 232 MemOperand destination_operand = cgen_->ToMemOperand(destination); |
| 237 if (in_cycle_) { | 233 if (in_cycle_) { |
| 238 if (!destination_operand.OffsetIsInt16Encodable()) { | 234 if (!destination_operand.OffsetIsInt16Encodable()) { |
| 239 CpuFeatureScope scope(cgen_->masm(), FPU); | |
| 240 // 'at' is overwritten while saving the value to the destination. | 235 // 'at' is overwritten while saving the value to the destination. |
| 241 // Therefore we can't use 'at'. It is OK if the read from the source | 236 // Therefore we can't use 'at'. It is OK if the read from the source |
| 242 // destroys 'at', since that happens before the value is read. | 237 // destroys 'at', since that happens before the value is read. |
| 243 // This uses only a single reg of the double reg-pair. | 238 // This uses only a single reg of the double reg-pair. |
| 244 __ lwc1(kLithiumScratchDouble, source_operand); | 239 __ lwc1(kLithiumScratchDouble, source_operand); |
| 245 __ swc1(kLithiumScratchDouble, destination_operand); | 240 __ swc1(kLithiumScratchDouble, destination_operand); |
| 246 } else { | 241 } else { |
| 247 __ lw(at, source_operand); | 242 __ lw(at, source_operand); |
| 248 __ sw(at, destination_operand); | 243 __ sw(at, destination_operand); |
| 249 } | 244 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 269 __ li(kLithiumScratchReg, | 264 __ li(kLithiumScratchReg, |
| 270 Operand(cgen_->ToInteger32(constant_source))); | 265 Operand(cgen_->ToInteger32(constant_source))); |
| 271 } else { | 266 } else { |
| 272 __ LoadObject(kLithiumScratchReg, | 267 __ LoadObject(kLithiumScratchReg, |
| 273 cgen_->ToHandle(constant_source)); | 268 cgen_->ToHandle(constant_source)); |
| 274 } | 269 } |
| 275 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(destination)); | 270 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(destination)); |
| 276 } | 271 } |
| 277 | 272 |
| 278 } else if (source->IsDoubleRegister()) { | 273 } else if (source->IsDoubleRegister()) { |
| 279 CpuFeatureScope scope(cgen_->masm(), FPU); | |
| 280 DoubleRegister source_register = cgen_->ToDoubleRegister(source); | 274 DoubleRegister source_register = cgen_->ToDoubleRegister(source); |
| 281 if (destination->IsDoubleRegister()) { | 275 if (destination->IsDoubleRegister()) { |
| 282 __ mov_d(cgen_->ToDoubleRegister(destination), source_register); | 276 __ mov_d(cgen_->ToDoubleRegister(destination), source_register); |
| 283 } else { | 277 } else { |
| 284 ASSERT(destination->IsDoubleStackSlot()); | 278 ASSERT(destination->IsDoubleStackSlot()); |
| 285 MemOperand destination_operand = cgen_->ToMemOperand(destination); | 279 MemOperand destination_operand = cgen_->ToMemOperand(destination); |
| 286 __ sdc1(source_register, destination_operand); | 280 __ sdc1(source_register, destination_operand); |
| 287 } | 281 } |
| 288 | 282 |
| 289 } else if (source->IsDoubleStackSlot()) { | 283 } else if (source->IsDoubleStackSlot()) { |
| 290 CpuFeatureScope scope(cgen_->masm(), FPU); | |
| 291 MemOperand source_operand = cgen_->ToMemOperand(source); | 284 MemOperand source_operand = cgen_->ToMemOperand(source); |
| 292 if (destination->IsDoubleRegister()) { | 285 if (destination->IsDoubleRegister()) { |
| 293 __ ldc1(cgen_->ToDoubleRegister(destination), source_operand); | 286 __ ldc1(cgen_->ToDoubleRegister(destination), source_operand); |
| 294 } else { | 287 } else { |
| 295 ASSERT(destination->IsDoubleStackSlot()); | 288 ASSERT(destination->IsDoubleStackSlot()); |
| 296 MemOperand destination_operand = cgen_->ToMemOperand(destination); | 289 MemOperand destination_operand = cgen_->ToMemOperand(destination); |
| 297 if (in_cycle_) { | 290 if (in_cycle_) { |
| 298 // kLithiumScratchDouble was used to break the cycle, | 291 // kLithiumScratchDouble was used to break the cycle, |
| 299 // but kLithiumScratchReg is free. | 292 // but kLithiumScratchReg is free. |
| 300 MemOperand source_high_operand = | 293 MemOperand source_high_operand = |
| (...skipping 13 matching lines...) Expand all Loading... |
| 314 UNREACHABLE(); | 307 UNREACHABLE(); |
| 315 } | 308 } |
| 316 | 309 |
| 317 moves_[index].Eliminate(); | 310 moves_[index].Eliminate(); |
| 318 } | 311 } |
| 319 | 312 |
| 320 | 313 |
| 321 #undef __ | 314 #undef __ |
| 322 | 315 |
| 323 } } // namespace v8::internal | 316 } } // namespace v8::internal |
| OLD | NEW |