Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: src/arm/assembler-arm.cc

Issue 1380863004: Revert of Reland: Remove register index/code indirection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm/assembler-arm-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // -----------------------------------------------------------------------------
217 // Implementation of RelocInfo 229 // Implementation of RelocInfo
218 230
219 // static 231 // static
220 const int RelocInfo::kApplyMask = 0; 232 const int RelocInfo::kApplyMask = 0;
221 233
222 234
223 bool RelocInfo::IsCodedSpecially() { 235 bool RelocInfo::IsCodedSpecially() {
224 // The deserializer needs to know whether a pointer is specially coded.  Being 236 // The deserializer needs to know whether a pointer is specially coded.  Being
225 // specially coded on ARM means that it is a movw/movt instruction, or is an 237 // specially coded on ARM means that it is a movw/movt instruction, or is an
226 // embedded constant pool entry.  These only occur if 238 // embedded constant pool entry.  These only occur if
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 } 391 }
380 } 392 }
381 393
382 394
383 // ----------------------------------------------------------------------------- 395 // -----------------------------------------------------------------------------
384 // Specific instructions, constants, and masks. 396 // Specific instructions, constants, and masks.
385 397
386 // str(r, MemOperand(sp, 4, NegPreIndex), al) instruction (aka push(r)) 398 // str(r, MemOperand(sp, 4, NegPreIndex), al) instruction (aka push(r))
387 // register r is not encoded. 399 // register r is not encoded.
388 const Instr kPushRegPattern = 400 const Instr kPushRegPattern =
389 al | B26 | 4 | NegPreIndex | Register::kCode_sp * B16; 401 al | B26 | 4 | NegPreIndex | kRegister_sp_Code * B16;
390 // ldr(r, MemOperand(sp, 4, PostIndex), al) instruction (aka pop(r)) 402 // ldr(r, MemOperand(sp, 4, PostIndex), al) instruction (aka pop(r))
391 // register r is not encoded. 403 // register r is not encoded.
392 const Instr kPopRegPattern = 404 const Instr kPopRegPattern =
393 al | B26 | L | 4 | PostIndex | Register::kCode_sp * B16; 405 al | B26 | L | 4 | PostIndex | kRegister_sp_Code * B16;
394 // ldr rd, [pc, #offset] 406 // ldr rd, [pc, #offset]
395 const Instr kLdrPCImmedMask = 15 * B24 | 7 * B20 | 15 * B16; 407 const Instr kLdrPCImmedMask = 15 * B24 | 7 * B20 | 15 * B16;
396 const Instr kLdrPCImmedPattern = 5 * B24 | L | Register::kCode_pc * B16; 408 const Instr kLdrPCImmedPattern = 5 * B24 | L | kRegister_pc_Code * B16;
397 // ldr rd, [pp, #offset] 409 // ldr rd, [pp, #offset]
398 const Instr kLdrPpImmedMask = 15 * B24 | 7 * B20 | 15 * B16; 410 const Instr kLdrPpImmedMask = 15 * B24 | 7 * B20 | 15 * B16;
399 const Instr kLdrPpImmedPattern = 5 * B24 | L | Register::kCode_r8 * B16; 411 const Instr kLdrPpImmedPattern = 5 * B24 | L | kRegister_r8_Code * B16;
400 // ldr rd, [pp, rn] 412 // ldr rd, [pp, rn]
401 const Instr kLdrPpRegMask = 15 * B24 | 7 * B20 | 15 * B16; 413 const Instr kLdrPpRegMask = 15 * B24 | 7 * B20 | 15 * B16;
402 const Instr kLdrPpRegPattern = 7 * B24 | L | Register::kCode_r8 * B16; 414 const Instr kLdrPpRegPattern = 7 * B24 | L | kRegister_r8_Code * B16;
403 // vldr dd, [pc, #offset] 415 // vldr dd, [pc, #offset]
404 const Instr kVldrDPCMask = 15 * B24 | 3 * B20 | 15 * B16 | 15 * B8; 416 const Instr kVldrDPCMask = 15 * B24 | 3 * B20 | 15 * B16 | 15 * B8;
405 const Instr kVldrDPCPattern = 13 * B24 | L | Register::kCode_pc * B16 | 11 * B8; 417 const Instr kVldrDPCPattern = 13 * B24 | L | kRegister_pc_Code * B16 | 11 * B8;
406 // vldr dd, [pp, #offset] 418 // vldr dd, [pp, #offset]
407 const Instr kVldrDPpMask = 15 * B24 | 3 * B20 | 15 * B16 | 15 * B8; 419 const Instr kVldrDPpMask = 15 * B24 | 3 * B20 | 15 * B16 | 15 * B8;
408 const Instr kVldrDPpPattern = 13 * B24 | L | Register::kCode_r8 * B16 | 11 * B8; 420 const Instr kVldrDPpPattern = 13 * B24 | L | kRegister_r8_Code * B16 | 11 * B8;
409 // blxcc rm 421 // blxcc rm
410 const Instr kBlxRegMask = 422 const Instr kBlxRegMask =
411 15 * B24 | 15 * B20 | 15 * B16 | 15 * B12 | 15 * B8 | 15 * B4; 423 15 * B24 | 15 * B20 | 15 * B16 | 15 * B12 | 15 * B8 | 15 * B4;
412 const Instr kBlxRegPattern = 424 const Instr kBlxRegPattern =
413 B24 | B21 | 15 * B16 | 15 * B12 | 15 * B8 | BLX; 425 B24 | B21 | 15 * B16 | 15 * B12 | 15 * B8 | BLX;
414 const Instr kBlxIp = al | kBlxRegPattern | ip.code(); 426 const Instr kBlxIp = al | kBlxRegPattern | ip.code();
415 const Instr kMovMvnMask = 0x6d * B21 | 0xf * B16; 427 const Instr kMovMvnMask = 0x6d * B21 | 0xf * B16;
416 const Instr kMovMvnPattern = 0xd * B21; 428 const Instr kMovMvnPattern = 0xd * B21;
417 const Instr kMovMvnFlip = B22; 429 const Instr kMovMvnFlip = B22;
418 const Instr kMovLeaveCCMask = 0xdff * B16; 430 const Instr kMovLeaveCCMask = 0xdff * B16;
419 const Instr kMovLeaveCCPattern = 0x1a0 * B16; 431 const Instr kMovLeaveCCPattern = 0x1a0 * B16;
420 const Instr kMovwPattern = 0x30 * B20; 432 const Instr kMovwPattern = 0x30 * B20;
421 const Instr kMovtPattern = 0x34 * B20; 433 const Instr kMovtPattern = 0x34 * B20;
422 const Instr kMovwLeaveCCFlip = 0x5 * B21; 434 const Instr kMovwLeaveCCFlip = 0x5 * B21;
423 const Instr kMovImmedMask = 0x7f * B21; 435 const Instr kMovImmedMask = 0x7f * B21;
424 const Instr kMovImmedPattern = 0x1d * B21; 436 const Instr kMovImmedPattern = 0x1d * B21;
425 const Instr kOrrImmedMask = 0x7f * B21; 437 const Instr kOrrImmedMask = 0x7f * B21;
426 const Instr kOrrImmedPattern = 0x1c * B21; 438 const Instr kOrrImmedPattern = 0x1c * B21;
427 const Instr kCmpCmnMask = 0xdd * B20 | 0xf * B12; 439 const Instr kCmpCmnMask = 0xdd * B20 | 0xf * B12;
428 const Instr kCmpCmnPattern = 0x15 * B20; 440 const Instr kCmpCmnPattern = 0x15 * B20;
429 const Instr kCmpCmnFlip = B21; 441 const Instr kCmpCmnFlip = B21;
430 const Instr kAddSubFlip = 0x6 * B21; 442 const Instr kAddSubFlip = 0x6 * B21;
431 const Instr kAndBicFlip = 0xe * B21; 443 const Instr kAndBicFlip = 0xe * B21;
432 444
433 // A mask for the Rd register for push, pop, ldr, str instructions. 445 // A mask for the Rd register for push, pop, ldr, str instructions.
434 const Instr kLdrRegFpOffsetPattern = 446 const Instr kLdrRegFpOffsetPattern =
435 al | B26 | L | Offset | Register::kCode_fp * B16; 447 al | B26 | L | Offset | kRegister_fp_Code * B16;
436 const Instr kStrRegFpOffsetPattern = 448 const Instr kStrRegFpOffsetPattern =
437 al | B26 | Offset | Register::kCode_fp * B16; 449 al | B26 | Offset | kRegister_fp_Code * B16;
438 const Instr kLdrRegFpNegOffsetPattern = 450 const Instr kLdrRegFpNegOffsetPattern =
439 al | B26 | L | NegOffset | Register::kCode_fp * B16; 451 al | B26 | L | NegOffset | kRegister_fp_Code * B16;
440 const Instr kStrRegFpNegOffsetPattern = 452 const Instr kStrRegFpNegOffsetPattern =
441 al | B26 | NegOffset | Register::kCode_fp * B16; 453 al | B26 | NegOffset | kRegister_fp_Code * B16;
442 const Instr kLdrStrInstrTypeMask = 0xffff0000; 454 const Instr kLdrStrInstrTypeMask = 0xffff0000;
443 455
444 456
445 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) 457 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size)
446 : AssemblerBase(isolate, buffer, buffer_size), 458 : AssemblerBase(isolate, buffer, buffer_size),
447 recorded_ast_id_(TypeFeedbackId::None()), 459 recorded_ast_id_(TypeFeedbackId::None()),
448 pending_32_bit_constants_(&pending_32_bit_constants_buffer_[0]), 460 pending_32_bit_constants_(&pending_32_bit_constants_buffer_[0]),
449 pending_64_bit_constants_(&pending_64_bit_constants_buffer_[0]), 461 pending_64_bit_constants_(&pending_64_bit_constants_buffer_[0]),
450 constant_pool_builder_(kLdrMaxReachBits, kVldrMaxReachBits), 462 constant_pool_builder_(kLdrMaxReachBits, kVldrMaxReachBits),
451 positions_recorder_(this) { 463 positions_recorder_(this) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 DCHECK(IsAddRegisterImmediate(instr)); 619 DCHECK(IsAddRegisterImmediate(instr));
608 DCHECK(offset >= 0); 620 DCHECK(offset >= 0);
609 DCHECK(is_uint12(offset)); 621 DCHECK(is_uint12(offset));
610 // Set the offset. 622 // Set the offset.
611 return (instr & ~kOff12Mask) | offset; 623 return (instr & ~kOff12Mask) | offset;
612 } 624 }
613 625
614 626
615 Register Assembler::GetRd(Instr instr) { 627 Register Assembler::GetRd(Instr instr) {
616 Register reg; 628 Register reg;
617 reg.reg_code = Instruction::RdValue(instr); 629 reg.code_ = Instruction::RdValue(instr);
618 return reg; 630 return reg;
619 } 631 }
620 632
621 633
622 Register Assembler::GetRn(Instr instr) { 634 Register Assembler::GetRn(Instr instr) {
623 Register reg; 635 Register reg;
624 reg.reg_code = Instruction::RnValue(instr); 636 reg.code_ = Instruction::RnValue(instr);
625 return reg; 637 return reg;
626 } 638 }
627 639
628 640
629 Register Assembler::GetRm(Instr instr) { 641 Register Assembler::GetRm(Instr instr) {
630 Register reg; 642 Register reg;
631 reg.reg_code = Instruction::RmValue(instr); 643 reg.code_ = Instruction::RmValue(instr);
632 return reg; 644 return reg;
633 } 645 }
634 646
635 647
636 Instr Assembler::GetConsantPoolLoadPattern() { 648 Instr Assembler::GetConsantPoolLoadPattern() {
637 if (FLAG_enable_embedded_constant_pool) { 649 if (FLAG_enable_embedded_constant_pool) {
638 return kLdrPpImmedPattern; 650 return kLdrPpImmedPattern;
639 } else { 651 } else {
640 return kLdrPCImmedPattern; 652 return kLdrPCImmedPattern;
641 } 653 }
(...skipping 3378 matching lines...) Expand 10 before | Expand all | Expand 10 after
4020 DCHECK(is_uint12(offset)); 4032 DCHECK(is_uint12(offset));
4021 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset)); 4033 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset));
4022 } 4034 }
4023 } 4035 }
4024 4036
4025 4037
4026 } // namespace internal 4038 } // namespace internal
4027 } // namespace v8 4039 } // namespace v8
4028 4040
4029 #endif // V8_TARGET_ARCH_ARM 4041 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm/assembler-arm-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698