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 are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 } | 373 } |
374 | 374 |
375 | 375 |
376 void Assembler::emit_disp(Label* L, Displacement::Type type) { | 376 void Assembler::emit_disp(Label* L, Displacement::Type type) { |
377 Displacement disp(L, type); | 377 Displacement disp(L, type); |
378 L->link_to(pc_offset()); | 378 L->link_to(pc_offset()); |
379 emit(static_cast<int>(disp.data())); | 379 emit(static_cast<int>(disp.data())); |
380 } | 380 } |
381 | 381 |
382 | 382 |
| 383 void Assembler::emit_near_disp(Label* L) { |
| 384 byte disp = 0x00; |
| 385 if (L->is_near_linked()) { |
| 386 int offset = L->near_link_pos() - pc_offset(); |
| 387 ASSERT(is_int8(offset)); |
| 388 disp = static_cast<byte>(offset & 0xFF); |
| 389 } |
| 390 L->link_to(pc_offset(), Label::kNear); |
| 391 *pc_++ = disp; |
| 392 } |
| 393 |
| 394 |
383 void Operand::set_modrm(int mod, Register rm) { | 395 void Operand::set_modrm(int mod, Register rm) { |
384 ASSERT((mod & -4) == 0); | 396 ASSERT((mod & -4) == 0); |
385 buf_[0] = mod << 6 | rm.code(); | 397 buf_[0] = mod << 6 | rm.code(); |
386 len_ = 1; | 398 len_ = 1; |
387 } | 399 } |
388 | 400 |
389 | 401 |
390 void Operand::set_sib(ScaleFactor scale, Register index, Register base) { | 402 void Operand::set_sib(ScaleFactor scale, Register index, Register base) { |
391 ASSERT(len_ == 1); | 403 ASSERT(len_ == 1); |
392 ASSERT((scale & -4) == 0); | 404 ASSERT((scale & -4) == 0); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 437 |
426 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 438 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
427 // [disp/r] | 439 // [disp/r] |
428 set_modrm(0, ebp); | 440 set_modrm(0, ebp); |
429 set_dispr(disp, rmode); | 441 set_dispr(disp, rmode); |
430 } | 442 } |
431 | 443 |
432 } } // namespace v8::internal | 444 } } // namespace v8::internal |
433 | 445 |
434 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 446 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |