| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 211 |
| 212 | 212 |
| 213 RegList PopulateRegisterArray(Register* w, Register* x, Register* r, | 213 RegList PopulateRegisterArray(Register* w, Register* x, Register* r, |
| 214 int reg_size, int reg_count, RegList allowed) { | 214 int reg_size, int reg_count, RegList allowed) { |
| 215 RegList list = 0; | 215 RegList list = 0; |
| 216 int i = 0; | 216 int i = 0; |
| 217 for (unsigned n = 0; (n < kNumberOfRegisters) && (i < reg_count); n++) { | 217 for (unsigned n = 0; (n < kNumberOfRegisters) && (i < reg_count); n++) { |
| 218 if (((1UL << n) & allowed) != 0) { | 218 if (((1UL << n) & allowed) != 0) { |
| 219 // Only assign allowed registers. | 219 // Only assign allowed registers. |
| 220 if (r) { | 220 if (r) { |
| 221 r[i] = Register(n, reg_size); | 221 r[i] = Register::Create(n, reg_size); |
| 222 } | 222 } |
| 223 if (x) { | 223 if (x) { |
| 224 x[i] = Register(n, kXRegSize); | 224 x[i] = Register::Create(n, kXRegSize); |
| 225 } | 225 } |
| 226 if (w) { | 226 if (w) { |
| 227 w[i] = Register(n, kWRegSize); | 227 w[i] = Register::Create(n, kWRegSize); |
| 228 } | 228 } |
| 229 list |= (1UL << n); | 229 list |= (1UL << n); |
| 230 i++; | 230 i++; |
| 231 } | 231 } |
| 232 } | 232 } |
| 233 // Check that we got enough registers. | 233 // Check that we got enough registers. |
| 234 ASSERT(CountSetBits(list, kNumberOfRegisters) == reg_count); | 234 ASSERT(CountSetBits(list, kNumberOfRegisters) == reg_count); |
| 235 | 235 |
| 236 return list; | 236 return list; |
| 237 } | 237 } |
| 238 | 238 |
| 239 | 239 |
| 240 RegList PopulateFPRegisterArray(FPRegister* s, FPRegister* d, FPRegister* v, | 240 RegList PopulateFPRegisterArray(FPRegister* s, FPRegister* d, FPRegister* v, |
| 241 int reg_size, int reg_count, RegList allowed) { | 241 int reg_size, int reg_count, RegList allowed) { |
| 242 RegList list = 0; | 242 RegList list = 0; |
| 243 int i = 0; | 243 int i = 0; |
| 244 for (unsigned n = 0; (n < kNumberOfFPRegisters) && (i < reg_count); n++) { | 244 for (unsigned n = 0; (n < kNumberOfFPRegisters) && (i < reg_count); n++) { |
| 245 if (((1UL << n) & allowed) != 0) { | 245 if (((1UL << n) & allowed) != 0) { |
| 246 // Only assigned allowed registers. | 246 // Only assigned allowed registers. |
| 247 if (v) { | 247 if (v) { |
| 248 v[i] = FPRegister(n, reg_size); | 248 v[i] = FPRegister::Create(n, reg_size); |
| 249 } | 249 } |
| 250 if (d) { | 250 if (d) { |
| 251 d[i] = FPRegister(n, kDRegSize); | 251 d[i] = FPRegister::Create(n, kDRegSize); |
| 252 } | 252 } |
| 253 if (s) { | 253 if (s) { |
| 254 s[i] = FPRegister(n, kSRegSize); | 254 s[i] = FPRegister::Create(n, kSRegSize); |
| 255 } | 255 } |
| 256 list |= (1UL << n); | 256 list |= (1UL << n); |
| 257 i++; | 257 i++; |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 // Check that we got enough registers. | 260 // Check that we got enough registers. |
| 261 ASSERT(CountSetBits(list, kNumberOfFPRegisters) == reg_count); | 261 ASSERT(CountSetBits(list, kNumberOfFPRegisters) == reg_count); |
| 262 | 262 |
| 263 return list; | 263 return list; |
| 264 } | 264 } |
| 265 | 265 |
| 266 | 266 |
| 267 void Clobber(MacroAssembler* masm, RegList reg_list, uint64_t const value) { | 267 void Clobber(MacroAssembler* masm, RegList reg_list, uint64_t const value) { |
| 268 Register first = NoReg; | 268 Register first = NoReg; |
| 269 for (unsigned i = 0; i < kNumberOfRegisters; i++) { | 269 for (unsigned i = 0; i < kNumberOfRegisters; i++) { |
| 270 if (reg_list & (1UL << i)) { | 270 if (reg_list & (1UL << i)) { |
| 271 Register xn(i, kXRegSize); | 271 Register xn = Register::Create(i, kXRegSize); |
| 272 // We should never write into csp here. | 272 // We should never write into csp here. |
| 273 ASSERT(!xn.Is(csp)); | 273 ASSERT(!xn.Is(csp)); |
| 274 if (!xn.IsZero()) { | 274 if (!xn.IsZero()) { |
| 275 if (!first.IsValid()) { | 275 if (!first.IsValid()) { |
| 276 // This is the first register we've hit, so construct the literal. | 276 // This is the first register we've hit, so construct the literal. |
| 277 __ Mov(xn, value); | 277 __ Mov(xn, value); |
| 278 first = xn; | 278 first = xn; |
| 279 } else { | 279 } else { |
| 280 // We've already loaded the literal, so re-use the value already | 280 // We've already loaded the literal, so re-use the value already |
| 281 // loaded into the first register we hit. | 281 // loaded into the first register we hit. |
| 282 __ Mov(xn, first); | 282 __ Mov(xn, first); |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 | 288 |
| 289 | 289 |
| 290 void ClobberFP(MacroAssembler* masm, RegList reg_list, double const value) { | 290 void ClobberFP(MacroAssembler* masm, RegList reg_list, double const value) { |
| 291 FPRegister first = NoFPReg; | 291 FPRegister first = NoFPReg; |
| 292 for (unsigned i = 0; i < kNumberOfFPRegisters; i++) { | 292 for (unsigned i = 0; i < kNumberOfFPRegisters; i++) { |
| 293 if (reg_list & (1UL << i)) { | 293 if (reg_list & (1UL << i)) { |
| 294 FPRegister dn(i, kDRegSize); | 294 FPRegister dn = FPRegister::Create(i, kDRegSize); |
| 295 if (!first.IsValid()) { | 295 if (!first.IsValid()) { |
| 296 // This is the first register we've hit, so construct the literal. | 296 // This is the first register we've hit, so construct the literal. |
| 297 __ Fmov(dn, value); | 297 __ Fmov(dn, value); |
| 298 first = dn; | 298 first = dn; |
| 299 } else { | 299 } else { |
| 300 // We've already loaded the literal, so re-use the value already loaded | 300 // We've already loaded the literal, so re-use the value already loaded |
| 301 // into the first register we hit. | 301 // into the first register we hit. |
| 302 __ Fmov(dn, first); | 302 __ Fmov(dn, first); |
| 303 } | 303 } |
| 304 } | 304 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 // Finally, restore dump2_base and dump2. | 417 // Finally, restore dump2_base and dump2. |
| 418 __ Ldr(dump2_base, MemOperand(dump2, dump2_base.code() * kXRegSizeInBytes)); | 418 __ Ldr(dump2_base, MemOperand(dump2, dump2_base.code() * kXRegSizeInBytes)); |
| 419 __ Ldr(dump2, MemOperand(dump2, dump2.code() * kXRegSizeInBytes)); | 419 __ Ldr(dump2, MemOperand(dump2, dump2.code() * kXRegSizeInBytes)); |
| 420 | 420 |
| 421 // Restore the MacroAssembler's scratch registers. | 421 // Restore the MacroAssembler's scratch registers. |
| 422 __ SetScratchRegisters(old_tmp0, old_tmp1); | 422 __ SetScratchRegisters(old_tmp0, old_tmp1); |
| 423 __ SetFPScratchRegister(old_fptmp0); | 423 __ SetFPScratchRegister(old_fptmp0); |
| 424 | 424 |
| 425 completed_ = true; | 425 completed_ = true; |
| 426 } | 426 } |
| OLD | NEW |