| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 | 347 |
| 348 | 348 |
| 349 void Assembler::CodeTargetAlign() { | 349 void Assembler::CodeTargetAlign() { |
| 350 // Preferred alignment of jump targets on some ARM chips. | 350 // Preferred alignment of jump targets on some ARM chips. |
| 351 Align(8); | 351 Align(8); |
| 352 } | 352 } |
| 353 | 353 |
| 354 | 354 |
| 355 Condition Assembler::GetCondition(Instr instr) { |
| 356 return Instruction::ConditionField(instr); |
| 357 } |
| 358 |
| 359 |
| 355 bool Assembler::IsBranch(Instr instr) { | 360 bool Assembler::IsBranch(Instr instr) { |
| 356 return (instr & (B27 | B25)) == (B27 | B25); | 361 return (instr & (B27 | B25)) == (B27 | B25); |
| 357 } | 362 } |
| 358 | 363 |
| 359 | 364 |
| 360 int Assembler::GetBranchOffset(Instr instr) { | 365 int Assembler::GetBranchOffset(Instr instr) { |
| 361 ASSERT(IsBranch(instr)); | 366 ASSERT(IsBranch(instr)); |
| 362 // Take the jump offset in the lower 24 bits, sign extend it and multiply it | 367 // Take the jump offset in the lower 24 bits, sign extend it and multiply it |
| 363 // with 4 to get the offset in bytes. | 368 // with 4 to get the offset in bytes. |
| 364 return ((instr & kImm24Mask) << 8) >> 6; | 369 return ((instr & kImm24Mask) << 8) >> 6; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 } | 426 } |
| 422 | 427 |
| 423 | 428 |
| 424 Register Assembler::GetRd(Instr instr) { | 429 Register Assembler::GetRd(Instr instr) { |
| 425 Register reg; | 430 Register reg; |
| 426 reg.code_ = Instruction::RdValue(instr); | 431 reg.code_ = Instruction::RdValue(instr); |
| 427 return reg; | 432 return reg; |
| 428 } | 433 } |
| 429 | 434 |
| 430 | 435 |
| 436 Register Assembler::GetRn(Instr instr) { |
| 437 Register reg; |
| 438 reg.code_ = Instruction::RnValue(instr); |
| 439 return reg; |
| 440 } |
| 441 |
| 442 |
| 443 Register Assembler::GetRm(Instr instr) { |
| 444 Register reg; |
| 445 reg.code_ = Instruction::RmValue(instr); |
| 446 return reg; |
| 447 } |
| 448 |
| 449 |
| 431 bool Assembler::IsPush(Instr instr) { | 450 bool Assembler::IsPush(Instr instr) { |
| 432 return ((instr & ~kRdMask) == kPushRegPattern); | 451 return ((instr & ~kRdMask) == kPushRegPattern); |
| 433 } | 452 } |
| 434 | 453 |
| 435 | 454 |
| 436 bool Assembler::IsPop(Instr instr) { | 455 bool Assembler::IsPop(Instr instr) { |
| 437 return ((instr & ~kRdMask) == kPopRegPattern); | 456 return ((instr & ~kRdMask) == kPopRegPattern); |
| 438 } | 457 } |
| 439 | 458 |
| 440 | 459 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 458 } | 477 } |
| 459 | 478 |
| 460 | 479 |
| 461 bool Assembler::IsLdrPcImmediateOffset(Instr instr) { | 480 bool Assembler::IsLdrPcImmediateOffset(Instr instr) { |
| 462 // Check the instruction is indeed a | 481 // Check the instruction is indeed a |
| 463 // ldr<cond> <Rd>, [pc +/- offset_12]. | 482 // ldr<cond> <Rd>, [pc +/- offset_12]. |
| 464 return (instr & (kLdrPCMask & ~kCondMask)) == 0x051f0000; | 483 return (instr & (kLdrPCMask & ~kCondMask)) == 0x051f0000; |
| 465 } | 484 } |
| 466 | 485 |
| 467 | 486 |
| 487 bool Assembler::IsTstImmediate(Instr instr) { |
| 488 return (instr & (B27 | B26 | I | kOpCodeMask | S | kRdMask)) == |
| 489 (I | TST | S); |
| 490 } |
| 491 |
| 492 |
| 493 bool Assembler::IsCmpRegister(Instr instr) { |
| 494 return (instr & (B27 | B26 | I | kOpCodeMask | S | kRdMask | B4)) == |
| 495 (CMP | S); |
| 496 } |
| 497 |
| 498 |
| 499 bool Assembler::IsCmpImmediate(Instr instr) { |
| 500 return (instr & (B27 | B26 | I | kOpCodeMask | S | kRdMask)) == |
| 501 (I | CMP | S); |
| 502 } |
| 503 |
| 504 |
| 505 Register Assembler::GetCmpImmediateRegister(Instr instr) { |
| 506 ASSERT(IsCmpImmediate(instr)); |
| 507 return GetRn(instr); |
| 508 } |
| 509 |
| 510 |
| 511 int Assembler::GetCmpImmediateRawImmediate(Instr instr) { |
| 512 ASSERT(IsCmpImmediate(instr)); |
| 513 return instr & kOff12Mask; |
| 514 } |
| 515 |
| 468 // Labels refer to positions in the (to be) generated code. | 516 // Labels refer to positions in the (to be) generated code. |
| 469 // There are bound, linked, and unused labels. | 517 // There are bound, linked, and unused labels. |
| 470 // | 518 // |
| 471 // Bound labels refer to known positions in the already | 519 // Bound labels refer to known positions in the already |
| 472 // generated code. pos() is the position the label refers to. | 520 // generated code. pos() is the position the label refers to. |
| 473 // | 521 // |
| 474 // Linked labels refer to unknown positions in the code | 522 // Linked labels refer to unknown positions in the code |
| 475 // to be generated; pos() is the position of the last | 523 // to be generated; pos() is the position of the last |
| 476 // instruction using the label. | 524 // instruction using the label. |
| 477 | 525 |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 void Assembler::teq(Register src1, const Operand& src2, Condition cond) { | 1093 void Assembler::teq(Register src1, const Operand& src2, Condition cond) { |
| 1046 addrmod1(cond | TEQ | S, src1, r0, src2); | 1094 addrmod1(cond | TEQ | S, src1, r0, src2); |
| 1047 } | 1095 } |
| 1048 | 1096 |
| 1049 | 1097 |
| 1050 void Assembler::cmp(Register src1, const Operand& src2, Condition cond) { | 1098 void Assembler::cmp(Register src1, const Operand& src2, Condition cond) { |
| 1051 addrmod1(cond | CMP | S, src1, r0, src2); | 1099 addrmod1(cond | CMP | S, src1, r0, src2); |
| 1052 } | 1100 } |
| 1053 | 1101 |
| 1054 | 1102 |
| 1103 void Assembler::cmp_raw_immediate( |
| 1104 Register src, int raw_immediate, Condition cond) { |
| 1105 ASSERT(is_uint12(raw_immediate)); |
| 1106 emit(cond | I | CMP | S | src.code() << 16 | raw_immediate); |
| 1107 } |
| 1108 |
| 1109 |
| 1055 void Assembler::cmn(Register src1, const Operand& src2, Condition cond) { | 1110 void Assembler::cmn(Register src1, const Operand& src2, Condition cond) { |
| 1056 addrmod1(cond | CMN | S, src1, r0, src2); | 1111 addrmod1(cond | CMN | S, src1, r0, src2); |
| 1057 } | 1112 } |
| 1058 | 1113 |
| 1059 | 1114 |
| 1060 void Assembler::orr(Register dst, Register src1, const Operand& src2, | 1115 void Assembler::orr(Register dst, Register src1, const Operand& src2, |
| 1061 SBit s, Condition cond) { | 1116 SBit s, Condition cond) { |
| 1062 addrmod1(cond | ORR | s, src1, dst, src2); | 1117 addrmod1(cond | ORR | s, src1, dst, src2); |
| 1063 } | 1118 } |
| 1064 | 1119 |
| (...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 | 2411 |
| 2357 // Pseudo instructions. | 2412 // Pseudo instructions. |
| 2358 void Assembler::nop(int type) { | 2413 void Assembler::nop(int type) { |
| 2359 // This is mov rx, rx. | 2414 // This is mov rx, rx. |
| 2360 ASSERT(0 <= type && type <= 14); // mov pc, pc is not a nop. | 2415 ASSERT(0 <= type && type <= 14); // mov pc, pc is not a nop. |
| 2361 emit(al | 13*B21 | type*B12 | type); | 2416 emit(al | 13*B21 | type*B12 | type); |
| 2362 } | 2417 } |
| 2363 | 2418 |
| 2364 | 2419 |
| 2365 bool Assembler::IsNop(Instr instr, int type) { | 2420 bool Assembler::IsNop(Instr instr, int type) { |
| 2366 // Check for mov rx, rx. | 2421 // Check for mov rx, rx where x = type. |
| 2367 ASSERT(0 <= type && type <= 14); // mov pc, pc is not a nop. | 2422 ASSERT(0 <= type && type <= 14); // mov pc, pc is not a nop. |
| 2368 return instr == (al | 13*B21 | type*B12 | type); | 2423 return instr == (al | 13*B21 | type*B12 | type); |
| 2369 } | 2424 } |
| 2370 | 2425 |
| 2371 | 2426 |
| 2372 bool Assembler::ImmediateFitsAddrMode1Instruction(int32_t imm32) { | 2427 bool Assembler::ImmediateFitsAddrMode1Instruction(int32_t imm32) { |
| 2373 uint32_t dummy1; | 2428 uint32_t dummy1; |
| 2374 uint32_t dummy2; | 2429 uint32_t dummy2; |
| 2375 return fits_shifter(imm32, &dummy1, &dummy2, NULL); | 2430 return fits_shifter(imm32, &dummy1, &dummy2, NULL); |
| 2376 } | 2431 } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2615 | 2670 |
| 2616 // Since a constant pool was just emitted, move the check offset forward by | 2671 // Since a constant pool was just emitted, move the check offset forward by |
| 2617 // the standard interval. | 2672 // the standard interval. |
| 2618 next_buffer_check_ = pc_offset() + kCheckConstInterval; | 2673 next_buffer_check_ = pc_offset() + kCheckConstInterval; |
| 2619 } | 2674 } |
| 2620 | 2675 |
| 2621 | 2676 |
| 2622 } } // namespace v8::internal | 2677 } } // namespace v8::internal |
| 2623 | 2678 |
| 2624 #endif // V8_TARGET_ARCH_ARM | 2679 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |