OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 #elif USE_EABI_HARDFLOAT | 207 #elif USE_EABI_HARDFLOAT |
208 bool eabi_hardfloat = true; | 208 bool eabi_hardfloat = true; |
209 #else | 209 #else |
210 bool eabi_hardfloat = false; | 210 bool eabi_hardfloat = false; |
211 #endif | 211 #endif |
212 printf(" USE_EABI_HARDFLOAT=%d\n", eabi_hardfloat); | 212 printf(" USE_EABI_HARDFLOAT=%d\n", eabi_hardfloat); |
213 } | 213 } |
214 | 214 |
215 | 215 |
216 // ----------------------------------------------------------------------------- | 216 // ----------------------------------------------------------------------------- |
217 // Implementation of DwVfpRegister | |
218 | |
219 const char* DwVfpRegister::AllocationIndexToString(int index) { | |
220 DCHECK(index >= 0 && index < NumAllocatableRegisters()); | |
221 DCHECK(kScratchDoubleReg.code() - kDoubleRegZero.code() == | |
222 kNumReservedRegisters - 1); | |
223 if (index >= kDoubleRegZero.code()) index += kNumReservedRegisters; | |
224 return VFPRegisters::Name(index, true); | |
225 } | |
226 | |
227 | |
228 // ----------------------------------------------------------------------------- | |
229 // Implementation of RelocInfo | 217 // Implementation of RelocInfo |
230 | 218 |
231 // static | 219 // static |
232 const int RelocInfo::kApplyMask = 0; | 220 const int RelocInfo::kApplyMask = 0; |
233 | 221 |
234 | 222 |
235 bool RelocInfo::IsCodedSpecially() { | 223 bool RelocInfo::IsCodedSpecially() { |
236 // The deserializer needs to know whether a pointer is specially coded. Being | 224 // The deserializer needs to know whether a pointer is specially coded. Being |
237 // specially coded on ARM means that it is a movw/movt instruction, or is an | 225 // specially coded on ARM means that it is a movw/movt instruction, or is an |
238 // embedded constant pool entry. These only occur if | 226 // embedded constant pool entry. These only occur if |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 } | 372 } |
385 } | 373 } |
386 | 374 |
387 | 375 |
388 // ----------------------------------------------------------------------------- | 376 // ----------------------------------------------------------------------------- |
389 // Specific instructions, constants, and masks. | 377 // Specific instructions, constants, and masks. |
390 | 378 |
391 // str(r, MemOperand(sp, 4, NegPreIndex), al) instruction (aka push(r)) | 379 // str(r, MemOperand(sp, 4, NegPreIndex), al) instruction (aka push(r)) |
392 // register r is not encoded. | 380 // register r is not encoded. |
393 const Instr kPushRegPattern = | 381 const Instr kPushRegPattern = |
394 al | B26 | 4 | NegPreIndex | kRegister_sp_Code * B16; | 382 al | B26 | 4 | NegPreIndex | Register::kCode_sp * B16; |
395 // ldr(r, MemOperand(sp, 4, PostIndex), al) instruction (aka pop(r)) | 383 // ldr(r, MemOperand(sp, 4, PostIndex), al) instruction (aka pop(r)) |
396 // register r is not encoded. | 384 // register r is not encoded. |
397 const Instr kPopRegPattern = | 385 const Instr kPopRegPattern = |
398 al | B26 | L | 4 | PostIndex | kRegister_sp_Code * B16; | 386 al | B26 | L | 4 | PostIndex | Register::kCode_sp * B16; |
399 // ldr rd, [pc, #offset] | 387 // ldr rd, [pc, #offset] |
400 const Instr kLdrPCImmedMask = 15 * B24 | 7 * B20 | 15 * B16; | 388 const Instr kLdrPCImmedMask = 15 * B24 | 7 * B20 | 15 * B16; |
401 const Instr kLdrPCImmedPattern = 5 * B24 | L | kRegister_pc_Code * B16; | 389 const Instr kLdrPCImmedPattern = 5 * B24 | L | Register::kCode_pc * B16; |
402 // ldr rd, [pp, #offset] | 390 // ldr rd, [pp, #offset] |
403 const Instr kLdrPpImmedMask = 15 * B24 | 7 * B20 | 15 * B16; | 391 const Instr kLdrPpImmedMask = 15 * B24 | 7 * B20 | 15 * B16; |
404 const Instr kLdrPpImmedPattern = 5 * B24 | L | kRegister_r8_Code * B16; | 392 const Instr kLdrPpImmedPattern = 5 * B24 | L | Register::kCode_r8 * B16; |
405 // ldr rd, [pp, rn] | 393 // ldr rd, [pp, rn] |
406 const Instr kLdrPpRegMask = 15 * B24 | 7 * B20 | 15 * B16; | 394 const Instr kLdrPpRegMask = 15 * B24 | 7 * B20 | 15 * B16; |
407 const Instr kLdrPpRegPattern = 7 * B24 | L | kRegister_r8_Code * B16; | 395 const Instr kLdrPpRegPattern = 7 * B24 | L | Register::kCode_r8 * B16; |
408 // vldr dd, [pc, #offset] | 396 // vldr dd, [pc, #offset] |
409 const Instr kVldrDPCMask = 15 * B24 | 3 * B20 | 15 * B16 | 15 * B8; | 397 const Instr kVldrDPCMask = 15 * B24 | 3 * B20 | 15 * B16 | 15 * B8; |
410 const Instr kVldrDPCPattern = 13 * B24 | L | kRegister_pc_Code * B16 | 11 * B8; | 398 const Instr kVldrDPCPattern = 13 * B24 | L | Register::kCode_pc * B16 | 11 * B8; |
411 // vldr dd, [pp, #offset] | 399 // vldr dd, [pp, #offset] |
412 const Instr kVldrDPpMask = 15 * B24 | 3 * B20 | 15 * B16 | 15 * B8; | 400 const Instr kVldrDPpMask = 15 * B24 | 3 * B20 | 15 * B16 | 15 * B8; |
413 const Instr kVldrDPpPattern = 13 * B24 | L | kRegister_r8_Code * B16 | 11 * B8; | 401 const Instr kVldrDPpPattern = 13 * B24 | L | Register::kCode_r8 * B16 | 11 * B8; |
414 // blxcc rm | 402 // blxcc rm |
415 const Instr kBlxRegMask = | 403 const Instr kBlxRegMask = |
416 15 * B24 | 15 * B20 | 15 * B16 | 15 * B12 | 15 * B8 | 15 * B4; | 404 15 * B24 | 15 * B20 | 15 * B16 | 15 * B12 | 15 * B8 | 15 * B4; |
417 const Instr kBlxRegPattern = | 405 const Instr kBlxRegPattern = |
418 B24 | B21 | 15 * B16 | 15 * B12 | 15 * B8 | BLX; | 406 B24 | B21 | 15 * B16 | 15 * B12 | 15 * B8 | BLX; |
419 const Instr kBlxIp = al | kBlxRegPattern | ip.code(); | 407 const Instr kBlxIp = al | kBlxRegPattern | ip.code(); |
420 const Instr kMovMvnMask = 0x6d * B21 | 0xf * B16; | 408 const Instr kMovMvnMask = 0x6d * B21 | 0xf * B16; |
421 const Instr kMovMvnPattern = 0xd * B21; | 409 const Instr kMovMvnPattern = 0xd * B21; |
422 const Instr kMovMvnFlip = B22; | 410 const Instr kMovMvnFlip = B22; |
423 const Instr kMovLeaveCCMask = 0xdff * B16; | 411 const Instr kMovLeaveCCMask = 0xdff * B16; |
424 const Instr kMovLeaveCCPattern = 0x1a0 * B16; | 412 const Instr kMovLeaveCCPattern = 0x1a0 * B16; |
425 const Instr kMovwPattern = 0x30 * B20; | 413 const Instr kMovwPattern = 0x30 * B20; |
426 const Instr kMovtPattern = 0x34 * B20; | 414 const Instr kMovtPattern = 0x34 * B20; |
427 const Instr kMovwLeaveCCFlip = 0x5 * B21; | 415 const Instr kMovwLeaveCCFlip = 0x5 * B21; |
428 const Instr kMovImmedMask = 0x7f * B21; | 416 const Instr kMovImmedMask = 0x7f * B21; |
429 const Instr kMovImmedPattern = 0x1d * B21; | 417 const Instr kMovImmedPattern = 0x1d * B21; |
430 const Instr kOrrImmedMask = 0x7f * B21; | 418 const Instr kOrrImmedMask = 0x7f * B21; |
431 const Instr kOrrImmedPattern = 0x1c * B21; | 419 const Instr kOrrImmedPattern = 0x1c * B21; |
432 const Instr kCmpCmnMask = 0xdd * B20 | 0xf * B12; | 420 const Instr kCmpCmnMask = 0xdd * B20 | 0xf * B12; |
433 const Instr kCmpCmnPattern = 0x15 * B20; | 421 const Instr kCmpCmnPattern = 0x15 * B20; |
434 const Instr kCmpCmnFlip = B21; | 422 const Instr kCmpCmnFlip = B21; |
435 const Instr kAddSubFlip = 0x6 * B21; | 423 const Instr kAddSubFlip = 0x6 * B21; |
436 const Instr kAndBicFlip = 0xe * B21; | 424 const Instr kAndBicFlip = 0xe * B21; |
437 | 425 |
438 // A mask for the Rd register for push, pop, ldr, str instructions. | 426 // A mask for the Rd register for push, pop, ldr, str instructions. |
439 const Instr kLdrRegFpOffsetPattern = | 427 const Instr kLdrRegFpOffsetPattern = |
440 al | B26 | L | Offset | kRegister_fp_Code * B16; | 428 al | B26 | L | Offset | Register::kCode_fp * B16; |
441 const Instr kStrRegFpOffsetPattern = | 429 const Instr kStrRegFpOffsetPattern = |
442 al | B26 | Offset | kRegister_fp_Code * B16; | 430 al | B26 | Offset | Register::kCode_fp * B16; |
443 const Instr kLdrRegFpNegOffsetPattern = | 431 const Instr kLdrRegFpNegOffsetPattern = |
444 al | B26 | L | NegOffset | kRegister_fp_Code * B16; | 432 al | B26 | L | NegOffset | Register::kCode_fp * B16; |
445 const Instr kStrRegFpNegOffsetPattern = | 433 const Instr kStrRegFpNegOffsetPattern = |
446 al | B26 | NegOffset | kRegister_fp_Code * B16; | 434 al | B26 | NegOffset | Register::kCode_fp * B16; |
447 const Instr kLdrStrInstrTypeMask = 0xffff0000; | 435 const Instr kLdrStrInstrTypeMask = 0xffff0000; |
448 | 436 |
449 | 437 |
450 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) | 438 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) |
451 : AssemblerBase(isolate, buffer, buffer_size), | 439 : AssemblerBase(isolate, buffer, buffer_size), |
452 recorded_ast_id_(TypeFeedbackId::None()), | 440 recorded_ast_id_(TypeFeedbackId::None()), |
453 pending_32_bit_constants_(&pending_32_bit_constants_buffer_[0]), | 441 pending_32_bit_constants_(&pending_32_bit_constants_buffer_[0]), |
454 pending_64_bit_constants_(&pending_64_bit_constants_buffer_[0]), | 442 pending_64_bit_constants_(&pending_64_bit_constants_buffer_[0]), |
455 constant_pool_builder_(kLdrMaxReachBits, kVldrMaxReachBits), | 443 constant_pool_builder_(kLdrMaxReachBits, kVldrMaxReachBits), |
456 positions_recorder_(this) { | 444 positions_recorder_(this) { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 DCHECK(IsAddRegisterImmediate(instr)); | 600 DCHECK(IsAddRegisterImmediate(instr)); |
613 DCHECK(offset >= 0); | 601 DCHECK(offset >= 0); |
614 DCHECK(is_uint12(offset)); | 602 DCHECK(is_uint12(offset)); |
615 // Set the offset. | 603 // Set the offset. |
616 return (instr & ~kOff12Mask) | offset; | 604 return (instr & ~kOff12Mask) | offset; |
617 } | 605 } |
618 | 606 |
619 | 607 |
620 Register Assembler::GetRd(Instr instr) { | 608 Register Assembler::GetRd(Instr instr) { |
621 Register reg; | 609 Register reg; |
622 reg.code_ = Instruction::RdValue(instr); | 610 reg.reg_code = Instruction::RdValue(instr); |
623 return reg; | 611 return reg; |
624 } | 612 } |
625 | 613 |
626 | 614 |
627 Register Assembler::GetRn(Instr instr) { | 615 Register Assembler::GetRn(Instr instr) { |
628 Register reg; | 616 Register reg; |
629 reg.code_ = Instruction::RnValue(instr); | 617 reg.reg_code = Instruction::RnValue(instr); |
630 return reg; | 618 return reg; |
631 } | 619 } |
632 | 620 |
633 | 621 |
634 Register Assembler::GetRm(Instr instr) { | 622 Register Assembler::GetRm(Instr instr) { |
635 Register reg; | 623 Register reg; |
636 reg.code_ = Instruction::RmValue(instr); | 624 reg.reg_code = Instruction::RmValue(instr); |
637 return reg; | 625 return reg; |
638 } | 626 } |
639 | 627 |
640 | 628 |
641 Instr Assembler::GetConsantPoolLoadPattern() { | 629 Instr Assembler::GetConsantPoolLoadPattern() { |
642 if (FLAG_enable_embedded_constant_pool) { | 630 if (FLAG_enable_embedded_constant_pool) { |
643 return kLdrPpImmedPattern; | 631 return kLdrPpImmedPattern; |
644 } else { | 632 } else { |
645 return kLdrPCImmedPattern; | 633 return kLdrPCImmedPattern; |
646 } | 634 } |
(...skipping 3378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4025 DCHECK(is_uint12(offset)); | 4013 DCHECK(is_uint12(offset)); |
4026 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset)); | 4014 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset)); |
4027 } | 4015 } |
4028 } | 4016 } |
4029 | 4017 |
4030 | 4018 |
4031 } // namespace internal | 4019 } // namespace internal |
4032 } // namespace v8 | 4020 } // namespace v8 |
4033 | 4021 |
4034 #endif // V8_TARGET_ARCH_ARM | 4022 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |