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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 shift_imm_ = shift_imm & 31; | 230 shift_imm_ = shift_imm & 31; |
231 am_ = am; | 231 am_ = am; |
232 } | 232 } |
233 | 233 |
234 | 234 |
235 // ----------------------------------------------------------------------------- | 235 // ----------------------------------------------------------------------------- |
236 // Specific instructions, constants, and masks. | 236 // Specific instructions, constants, and masks. |
237 | 237 |
238 // add(sp, sp, 4) instruction (aka Pop()) | 238 // add(sp, sp, 4) instruction (aka Pop()) |
239 const Instr kPopInstruction = | 239 const Instr kPopInstruction = |
240 al | PostIndex | 4 | LeaveCC | I | kRegister_sp_Code * B16 | | 240 al | PostIndex | 4 | LeaveCC | I | sp.code() * B16 | sp.code() * B12; |
241 kRegister_sp_Code * B12; | |
242 // str(r, MemOperand(sp, 4, NegPreIndex), al) instruction (aka push(r)) | 241 // str(r, MemOperand(sp, 4, NegPreIndex), al) instruction (aka push(r)) |
243 // register r is not encoded. | 242 // register r is not encoded. |
244 const Instr kPushRegPattern = | 243 const Instr kPushRegPattern = |
245 al | B26 | 4 | NegPreIndex | kRegister_sp_Code * B16; | 244 al | B26 | 4 | NegPreIndex | sp.code() * B16; |
246 // ldr(r, MemOperand(sp, 4, PostIndex), al) instruction (aka pop(r)) | 245 // ldr(r, MemOperand(sp, 4, PostIndex), al) instruction (aka pop(r)) |
247 // register r is not encoded. | 246 // register r is not encoded. |
248 const Instr kPopRegPattern = | 247 const Instr kPopRegPattern = |
249 al | B26 | L | 4 | PostIndex | kRegister_sp_Code * B16; | 248 al | B26 | L | 4 | PostIndex | sp.code() * B16; |
250 // mov lr, pc | 249 // mov lr, pc |
251 const Instr kMovLrPc = al | MOV | kRegister_pc_Code | kRegister_lr_Code * B12; | 250 const Instr kMovLrPc = al | MOV | pc.code() | lr.code() * B12; |
252 // ldr rd, [pc, #offset] | 251 // ldr rd, [pc, #offset] |
253 const Instr kLdrPCMask = kCondMask | 15 * B24 | 7 * B20 | 15 * B16; | 252 const Instr kLdrPCMask = kCondMask | 15 * B24 | 7 * B20 | 15 * B16; |
254 const Instr kLdrPCPattern = al | 5 * B24 | L | kRegister_pc_Code * B16; | 253 const Instr kLdrPCPattern = al | 5 * B24 | L | pc.code() * B16; |
255 // blxcc rm | 254 // blxcc rm |
256 const Instr kBlxRegMask = | 255 const Instr kBlxRegMask = |
257 15 * B24 | 15 * B20 | 15 * B16 | 15 * B12 | 15 * B8 | 15 * B4; | 256 15 * B24 | 15 * B20 | 15 * B16 | 15 * B12 | 15 * B8 | 15 * B4; |
258 const Instr kBlxRegPattern = | 257 const Instr kBlxRegPattern = |
259 B24 | B21 | 15 * B16 | 15 * B12 | 15 * B8 | BLX; | 258 B24 | B21 | 15 * B16 | 15 * B12 | 15 * B8 | BLX; |
260 const Instr kBlxIp = al | kBlxRegPattern | ip.code(); | 259 const Instr kBlxIp = al | kBlxRegPattern | ip.code(); |
261 const Instr kMovMvnMask = 0x6d * B21 | 0xf * B16; | 260 const Instr kMovMvnMask = 0x6d * B21 | 0xf * B16; |
262 const Instr kMovMvnPattern = 0xd * B21; | 261 const Instr kMovMvnPattern = 0xd * B21; |
263 const Instr kMovMvnFlip = B22; | 262 const Instr kMovMvnFlip = B22; |
264 const Instr kMovLeaveCCMask = 0xdff * B16; | 263 const Instr kMovLeaveCCMask = 0xdff * B16; |
265 const Instr kMovLeaveCCPattern = 0x1a0 * B16; | 264 const Instr kMovLeaveCCPattern = 0x1a0 * B16; |
266 const Instr kMovwMask = 0xff * B20; | 265 const Instr kMovwMask = 0xff * B20; |
267 const Instr kMovwPattern = 0x30 * B20; | 266 const Instr kMovwPattern = 0x30 * B20; |
268 const Instr kMovwLeaveCCFlip = 0x5 * B21; | 267 const Instr kMovwLeaveCCFlip = 0x5 * B21; |
269 const Instr kCmpCmnMask = 0xdd * B20 | 0xf * B12; | 268 const Instr kCmpCmnMask = 0xdd * B20 | 0xf * B12; |
270 const Instr kCmpCmnPattern = 0x15 * B20; | 269 const Instr kCmpCmnPattern = 0x15 * B20; |
271 const Instr kCmpCmnFlip = B21; | 270 const Instr kCmpCmnFlip = B21; |
272 const Instr kAddSubFlip = 0x6 * B21; | 271 const Instr kAddSubFlip = 0x6 * B21; |
273 const Instr kAndBicFlip = 0xe * B21; | 272 const Instr kAndBicFlip = 0xe * B21; |
274 | 273 |
275 // A mask for the Rd register for push, pop, ldr, str instructions. | 274 // A mask for the Rd register for push, pop, ldr, str instructions. |
276 const Instr kLdrRegFpOffsetPattern = | 275 const Instr kLdrRegFpOffsetPattern = |
277 al | B26 | L | Offset | kRegister_fp_Code * B16; | 276 al | B26 | L | Offset | fp.code() * B16; |
278 const Instr kStrRegFpOffsetPattern = | 277 const Instr kStrRegFpOffsetPattern = |
279 al | B26 | Offset | kRegister_fp_Code * B16; | 278 al | B26 | Offset | fp.code() * B16; |
280 const Instr kLdrRegFpNegOffsetPattern = | 279 const Instr kLdrRegFpNegOffsetPattern = |
281 al | B26 | L | NegOffset | kRegister_fp_Code * B16; | 280 al | B26 | L | NegOffset | fp.code() * B16; |
282 const Instr kStrRegFpNegOffsetPattern = | 281 const Instr kStrRegFpNegOffsetPattern = |
283 al | B26 | NegOffset | kRegister_fp_Code * B16; | 282 al | B26 | NegOffset | fp.code() * B16; |
284 const Instr kLdrStrInstrTypeMask = 0xffff0000; | 283 const Instr kLdrStrInstrTypeMask = 0xffff0000; |
285 const Instr kLdrStrInstrArgumentMask = 0x0000ffff; | 284 const Instr kLdrStrInstrArgumentMask = 0x0000ffff; |
286 const Instr kLdrStrOffsetMask = 0x00000fff; | 285 const Instr kLdrStrOffsetMask = 0x00000fff; |
287 | 286 |
288 | 287 |
289 // Spare buffer. | 288 // Spare buffer. |
290 static const int kMinimalBufferSize = 4*KB; | 289 static const int kMinimalBufferSize = 4*KB; |
291 | 290 |
292 | 291 |
293 Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) | 292 Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) |
(...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2657 | 2656 |
2658 // Since a constant pool was just emitted, move the check offset forward by | 2657 // Since a constant pool was just emitted, move the check offset forward by |
2659 // the standard interval. | 2658 // the standard interval. |
2660 next_buffer_check_ = pc_offset() + kCheckPoolInterval; | 2659 next_buffer_check_ = pc_offset() + kCheckPoolInterval; |
2661 } | 2660 } |
2662 | 2661 |
2663 | 2662 |
2664 } } // namespace v8::internal | 2663 } } // namespace v8::internal |
2665 | 2664 |
2666 #endif // V8_TARGET_ARCH_ARM | 2665 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |