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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 rmode_ = RelocInfo::NONE32; | 404 rmode_ = RelocInfo::NONE32; |
405 } | 405 } |
406 | 406 |
407 | 407 |
408 void Assembler::emit(uint32_t x) { | 408 void Assembler::emit(uint32_t x) { |
409 *reinterpret_cast<uint32_t*>(pc_) = x; | 409 *reinterpret_cast<uint32_t*>(pc_) = x; |
410 pc_ += sizeof(uint32_t); | 410 pc_ += sizeof(uint32_t); |
411 } | 411 } |
412 | 412 |
413 | 413 |
414 void Assembler::emit_q(uint64_t x) { | |
415 *reinterpret_cast<uint64_t*>(pc_) = x; | |
416 pc_ += sizeof(uint64_t); | |
417 } | |
418 | |
419 | |
420 void Assembler::emit(Handle<Object> handle) { | 414 void Assembler::emit(Handle<Object> handle) { |
421 AllowDeferredHandleDereference heap_object_check; | 415 AllowDeferredHandleDereference heap_object_check; |
422 // Verify all Objects referred by code are NOT in new space. | 416 // Verify all Objects referred by code are NOT in new space. |
423 Object* obj = *handle; | 417 Object* obj = *handle; |
424 DCHECK(!isolate()->heap()->InNewSpace(obj)); | 418 DCHECK(!isolate()->heap()->InNewSpace(obj)); |
425 if (obj->IsHeapObject()) { | 419 if (obj->IsHeapObject()) { |
426 emit(reinterpret_cast<intptr_t>(handle.location()), | 420 emit(reinterpret_cast<intptr_t>(handle.location()), |
427 RelocInfo::EMBEDDED_OBJECT); | 421 RelocInfo::EMBEDDED_OBJECT); |
428 } else { | 422 } else { |
429 // no relocation needed | 423 // no relocation needed |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 | 468 |
475 | 469 |
476 void Assembler::emit_w(const Immediate& x) { | 470 void Assembler::emit_w(const Immediate& x) { |
477 DCHECK(RelocInfo::IsNone(x.rmode_)); | 471 DCHECK(RelocInfo::IsNone(x.rmode_)); |
478 uint16_t value = static_cast<uint16_t>(x.x_); | 472 uint16_t value = static_cast<uint16_t>(x.x_); |
479 reinterpret_cast<uint16_t*>(pc_)[0] = value; | 473 reinterpret_cast<uint16_t*>(pc_)[0] = value; |
480 pc_ += sizeof(uint16_t); | 474 pc_ += sizeof(uint16_t); |
481 } | 475 } |
482 | 476 |
483 | 477 |
484 Address Assembler::target_address_at(Address pc, Address constant_pool) { | 478 Address Assembler::target_address_at(Address pc, |
| 479 ConstantPoolArray* constant_pool) { |
485 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc); | 480 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc); |
486 } | 481 } |
487 | 482 |
488 | 483 |
489 void Assembler::set_target_address_at(Address pc, Address constant_pool, | 484 void Assembler::set_target_address_at(Address pc, |
| 485 ConstantPoolArray* constant_pool, |
490 Address target, | 486 Address target, |
491 ICacheFlushMode icache_flush_mode) { | 487 ICacheFlushMode icache_flush_mode) { |
492 int32_t* p = reinterpret_cast<int32_t*>(pc); | 488 int32_t* p = reinterpret_cast<int32_t*>(pc); |
493 *p = target - (pc + sizeof(int32_t)); | 489 *p = target - (pc + sizeof(int32_t)); |
494 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 490 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
495 CpuFeatures::FlushICache(p, sizeof(int32_t)); | 491 CpuFeatures::FlushICache(p, sizeof(int32_t)); |
496 } | 492 } |
497 } | 493 } |
498 | 494 |
499 | 495 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 | 589 |
594 | 590 |
595 Operand::Operand(Immediate imm) { | 591 Operand::Operand(Immediate imm) { |
596 // [disp/r] | 592 // [disp/r] |
597 set_modrm(0, ebp); | 593 set_modrm(0, ebp); |
598 set_dispr(imm.x_, imm.rmode_); | 594 set_dispr(imm.x_, imm.rmode_); |
599 } | 595 } |
600 } } // namespace v8::internal | 596 } } // namespace v8::internal |
601 | 597 |
602 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 598 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |