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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 *p += delta; // Relocate entry. | 74 *p += delta; // Relocate entry. |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 | 78 |
79 Address RelocInfo::target_address() { | 79 Address RelocInfo::target_address() { |
80 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); | 80 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
81 return Assembler::target_address_at(pc_, host_); | 81 return Assembler::target_address_at(pc_, host_); |
82 } | 82 } |
83 | 83 |
| 84 Address RelocInfo::wasm_memory_reference() { |
| 85 DCHECK(IsWasmMemoryReference(rmode_)); |
| 86 return Memory::Address_at(pc_); |
| 87 } |
84 | 88 |
85 Address RelocInfo::target_address_address() { | 89 Address RelocInfo::target_address_address() { |
86 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) | 90 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) |
87 || rmode_ == EMBEDDED_OBJECT | 91 || rmode_ == EMBEDDED_OBJECT |
88 || rmode_ == EXTERNAL_REFERENCE); | 92 || rmode_ == EXTERNAL_REFERENCE); |
89 return reinterpret_cast<Address>(pc_); | 93 return reinterpret_cast<Address>(pc_); |
90 } | 94 } |
91 | 95 |
92 | 96 |
93 Address RelocInfo::constant_pool_entry_address() { | 97 Address RelocInfo::constant_pool_entry_address() { |
(...skipping 14 matching lines...) Expand all Loading... |
108 icache_flush_mode); | 112 icache_flush_mode); |
109 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); | 113 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
110 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL && | 114 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL && |
111 IsCodeTarget(rmode_)) { | 115 IsCodeTarget(rmode_)) { |
112 Object* target_code = Code::GetCodeFromTargetAddress(target); | 116 Object* target_code = Code::GetCodeFromTargetAddress(target); |
113 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 117 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
114 host(), this, HeapObject::cast(target_code)); | 118 host(), this, HeapObject::cast(target_code)); |
115 } | 119 } |
116 } | 120 } |
117 | 121 |
| 122 void RelocInfo::update_wasm_memory_reference( |
| 123 Address old_base, Address new_base, size_t old_size, size_t new_size, |
| 124 ICacheFlushMode icache_flush_mode) { |
| 125 DCHECK(IsWasmMemoryReference(rmode_)); |
| 126 DCHECK(old_size <= new_size); |
| 127 DCHECK(old_base <= wasm_memory_reference() && |
| 128 wasm_memory_reference() <= old_base + old_size); |
| 129 Address updated_reference = wasm_memory_reference() + (new_base - old_base); |
| 130 DCHECK(new_base <= updated_reference && |
| 131 updated_reference <= new_base + new_size); |
| 132 Memory::Address_at(pc_) = updated_reference; |
| 133 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
| 134 Assembler::FlushICache(isolate_, pc_, sizeof(int32_t)); |
| 135 } |
| 136 } |
118 | 137 |
119 Object* RelocInfo::target_object() { | 138 Object* RelocInfo::target_object() { |
120 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 139 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
121 return Memory::Object_at(pc_); | 140 return Memory::Object_at(pc_); |
122 } | 141 } |
123 | 142 |
124 | 143 |
125 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { | 144 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { |
126 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 145 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
127 return Memory::Object_Handle_at(pc_); | 146 return Memory::Object_Handle_at(pc_); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 } | 333 } |
315 } | 334 } |
316 | 335 |
317 | 336 |
318 | 337 |
319 Immediate::Immediate(int x) { | 338 Immediate::Immediate(int x) { |
320 x_ = x; | 339 x_ = x; |
321 rmode_ = RelocInfo::NONE32; | 340 rmode_ = RelocInfo::NONE32; |
322 } | 341 } |
323 | 342 |
| 343 Immediate::Immediate(Address x, RelocInfo::Mode rmode) { |
| 344 x_ = reinterpret_cast<int32_t>(x); |
| 345 rmode_ = rmode; |
| 346 } |
324 | 347 |
325 Immediate::Immediate(const ExternalReference& ext) { | 348 Immediate::Immediate(const ExternalReference& ext) { |
326 x_ = reinterpret_cast<int32_t>(ext.address()); | 349 x_ = reinterpret_cast<int32_t>(ext.address()); |
327 rmode_ = RelocInfo::EXTERNAL_REFERENCE; | 350 rmode_ = RelocInfo::EXTERNAL_REFERENCE; |
328 } | 351 } |
329 | 352 |
330 | 353 |
331 Immediate::Immediate(Label* internal_offset) { | 354 Immediate::Immediate(Label* internal_offset) { |
332 x_ = reinterpret_cast<int32_t>(internal_offset); | 355 x_ = reinterpret_cast<int32_t>(internal_offset); |
333 rmode_ = RelocInfo::INTERNAL_REFERENCE; | 356 rmode_ = RelocInfo::INTERNAL_REFERENCE; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 569 |
547 Operand::Operand(Immediate imm) { | 570 Operand::Operand(Immediate imm) { |
548 // [disp/r] | 571 // [disp/r] |
549 set_modrm(0, ebp); | 572 set_modrm(0, ebp); |
550 set_dispr(imm.x_, imm.rmode_); | 573 set_dispr(imm.x_, imm.rmode_); |
551 } | 574 } |
552 } // namespace internal | 575 } // namespace internal |
553 } // namespace v8 | 576 } // namespace v8 |
554 | 577 |
555 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 578 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |