| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 } | 390 } |
| 391 } | 391 } |
| 392 | 392 |
| 393 | 393 |
| 394 void Assembler::CodeTargetAlign() { | 394 void Assembler::CodeTargetAlign() { |
| 395 // Preferred alignment of jump targets on some ARM chips. | 395 // Preferred alignment of jump targets on some ARM chips. |
| 396 Align(8); | 396 Align(8); |
| 397 } | 397 } |
| 398 | 398 |
| 399 | 399 |
| 400 bool Assembler::IsNop(Instr instr, int type) { | |
| 401 // Check for mov rx, rx. | |
| 402 ASSERT(0 <= type && type <= 14); // mov pc, pc is not a nop. | |
| 403 return instr == (al | 13*B21 | type*B12 | type); | |
| 404 } | |
| 405 | |
| 406 | |
| 407 bool Assembler::IsBranch(Instr instr) { | 400 bool Assembler::IsBranch(Instr instr) { |
| 408 return (instr & (B27 | B25)) == (B27 | B25); | 401 return (instr & (B27 | B25)) == (B27 | B25); |
| 409 } | 402 } |
| 410 | 403 |
| 411 | 404 |
| 412 int Assembler::GetBranchOffset(Instr instr) { | 405 int Assembler::GetBranchOffset(Instr instr) { |
| 413 ASSERT(IsBranch(instr)); | 406 ASSERT(IsBranch(instr)); |
| 414 // Take the jump offset in the lower 24 bits, sign extend it and multiply it | 407 // Take the jump offset in the lower 24 bits, sign extend it and multiply it |
| 415 // with 4 to get the offset in bytes. | 408 // with 4 to get the offset in bytes. |
| 416 return ((instr & Imm24Mask) << 8) >> 6; | 409 return ((instr & Imm24Mask) << 8) >> 6; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 bool Assembler::IsStrRegFpNegOffset(Instr instr) { | 496 bool Assembler::IsStrRegFpNegOffset(Instr instr) { |
| 504 return ((instr & kLdrStrInstrTypeMask) == kStrRegFpNegOffsetPattern); | 497 return ((instr & kLdrStrInstrTypeMask) == kStrRegFpNegOffsetPattern); |
| 505 } | 498 } |
| 506 | 499 |
| 507 | 500 |
| 508 bool Assembler::IsLdrRegFpNegOffset(Instr instr) { | 501 bool Assembler::IsLdrRegFpNegOffset(Instr instr) { |
| 509 return ((instr & kLdrStrInstrTypeMask) == kLdrRegFpNegOffsetPattern); | 502 return ((instr & kLdrStrInstrTypeMask) == kLdrRegFpNegOffsetPattern); |
| 510 } | 503 } |
| 511 | 504 |
| 512 | 505 |
| 506 bool Assembler::IsLdrPcImmediateOffset(Instr instr) { |
| 507 // Check the instruction is indeed a |
| 508 // ldr<cond> <Rd>, [pc +/- offset_12]. |
| 509 return (instr & 0x0f7f0000) == 0x051f0000; |
| 510 } |
| 511 |
| 512 |
| 513 // Labels refer to positions in the (to be) generated code. | 513 // Labels refer to positions in the (to be) generated code. |
| 514 // There are bound, linked, and unused labels. | 514 // There are bound, linked, and unused labels. |
| 515 // | 515 // |
| 516 // Bound labels refer to known positions in the already | 516 // Bound labels refer to known positions in the already |
| 517 // generated code. pos() is the position the label refers to. | 517 // generated code. pos() is the position the label refers to. |
| 518 // | 518 // |
| 519 // Linked labels refer to unknown positions in the code | 519 // Linked labels refer to unknown positions in the code |
| 520 // to be generated; pos() is the position of the last | 520 // to be generated; pos() is the position of the last |
| 521 // instruction using the label. | 521 // instruction using the label. |
| 522 | 522 |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 SBit s, Condition cond) { | 1106 SBit s, Condition cond) { |
| 1107 addrmod1(cond | 12*B21 | s, src1, dst, src2); | 1107 addrmod1(cond | 12*B21 | s, src1, dst, src2); |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 | 1110 |
| 1111 void Assembler::mov(Register dst, const Operand& src, SBit s, Condition cond) { | 1111 void Assembler::mov(Register dst, const Operand& src, SBit s, Condition cond) { |
| 1112 if (dst.is(pc)) { | 1112 if (dst.is(pc)) { |
| 1113 positions_recorder()->WriteRecordedPositions(); | 1113 positions_recorder()->WriteRecordedPositions(); |
| 1114 } | 1114 } |
| 1115 // Don't allow nop instructions in the form mov rn, rn to be generated using | 1115 // Don't allow nop instructions in the form mov rn, rn to be generated using |
| 1116 // the mov instruction. They must be generated using nop(int) | 1116 // the mov instruction. They must be generated using nop(int/NopMarkerTypes) |
| 1117 // pseudo instructions. | 1117 // or MarkCode(int/NopMarkerTypes) pseudo instructions. |
| 1118 ASSERT(!(src.is_reg() && src.rm().is(dst) && s == LeaveCC && cond == al)); | 1118 ASSERT(!(src.is_reg() && src.rm().is(dst) && s == LeaveCC && cond == al)); |
| 1119 addrmod1(cond | 13*B21 | s, r0, dst, src); | 1119 addrmod1(cond | 13*B21 | s, r0, dst, src); |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 | 1122 |
| 1123 void Assembler::movw(Register reg, uint32_t immediate, Condition cond) { | 1123 void Assembler::movw(Register reg, uint32_t immediate, Condition cond) { |
| 1124 ASSERT(immediate < 0x10000); | 1124 ASSERT(immediate < 0x10000); |
| 1125 mov(reg, Operand(immediate), LeaveCC, cond); | 1125 mov(reg, Operand(immediate), LeaveCC, cond); |
| 1126 } | 1126 } |
| 1127 | 1127 |
| (...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2369 | 2369 |
| 2370 | 2370 |
| 2371 // Pseudo instructions. | 2371 // Pseudo instructions. |
| 2372 void Assembler::nop(int type) { | 2372 void Assembler::nop(int type) { |
| 2373 // This is mov rx, rx. | 2373 // This is mov rx, rx. |
| 2374 ASSERT(0 <= type && type <= 14); // mov pc, pc is not a nop. | 2374 ASSERT(0 <= type && type <= 14); // mov pc, pc is not a nop. |
| 2375 emit(al | 13*B21 | type*B12 | type); | 2375 emit(al | 13*B21 | type*B12 | type); |
| 2376 } | 2376 } |
| 2377 | 2377 |
| 2378 | 2378 |
| 2379 bool Assembler::IsNop(Instr instr, int type) { |
| 2380 // Check for mov rx, rx. |
| 2381 ASSERT(0 <= type && type <= 14); // mov pc, pc is not a nop. |
| 2382 return instr == (al | 13*B21 | type*B12 | type); |
| 2383 } |
| 2384 |
| 2385 |
| 2379 bool Assembler::ImmediateFitsAddrMode1Instruction(int32_t imm32) { | 2386 bool Assembler::ImmediateFitsAddrMode1Instruction(int32_t imm32) { |
| 2380 uint32_t dummy1; | 2387 uint32_t dummy1; |
| 2381 uint32_t dummy2; | 2388 uint32_t dummy2; |
| 2382 return fits_shifter(imm32, &dummy1, &dummy2, NULL); | 2389 return fits_shifter(imm32, &dummy1, &dummy2, NULL); |
| 2383 } | 2390 } |
| 2384 | 2391 |
| 2385 | 2392 |
| 2386 void Assembler::BlockConstPoolFor(int instructions) { | 2393 void Assembler::BlockConstPoolFor(int instructions) { |
| 2387 BlockConstPoolBefore(pc_offset() + instructions * kInstrSize); | 2394 BlockConstPoolBefore(pc_offset() + instructions * kInstrSize); |
| 2388 } | 2395 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2600 | 2607 |
| 2601 // Since a constant pool was just emitted, move the check offset forward by | 2608 // Since a constant pool was just emitted, move the check offset forward by |
| 2602 // the standard interval. | 2609 // the standard interval. |
| 2603 next_buffer_check_ = pc_offset() + kCheckConstInterval; | 2610 next_buffer_check_ = pc_offset() + kCheckConstInterval; |
| 2604 } | 2611 } |
| 2605 | 2612 |
| 2606 | 2613 |
| 2607 } } // namespace v8::internal | 2614 } } // namespace v8::internal |
| 2608 | 2615 |
| 2609 #endif // V8_TARGET_ARCH_ARM | 2616 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |