OLD | NEW |
1 | 1 |
2 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 2 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
3 // All Rights Reserved. | 3 // All Rights Reserved. |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // - Redistributions of source code must retain the above copyright notice, | 9 // - Redistributions of source code must retain the above copyright notice, |
10 // this list of conditions and the following disclaimer. | 10 // this list of conditions and the following disclaimer. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 Address RelocInfo::target_address() { | 100 Address RelocInfo::target_address() { |
101 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); | 101 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
102 return Assembler::target_address_at(pc_, host_); | 102 return Assembler::target_address_at(pc_, host_); |
103 } | 103 } |
104 | 104 |
105 Address RelocInfo::wasm_memory_reference() { | 105 Address RelocInfo::wasm_memory_reference() { |
106 DCHECK(IsWasmMemoryReference(rmode_)); | 106 DCHECK(IsWasmMemoryReference(rmode_)); |
107 return Assembler::target_address_at(pc_, host_); | 107 return Assembler::target_address_at(pc_, host_); |
108 } | 108 } |
109 | 109 |
| 110 int32_t RelocInfo::wasm_memory_size_reference() { |
| 111 DCHECK(IsWasmMemorySizeReference(rmode_)); |
| 112 return reinterpret_cast<int32_t>(Assembler::target_address_at(pc_, host_)); |
| 113 } |
| 114 |
110 Address RelocInfo::target_address_address() { | 115 Address RelocInfo::target_address_address() { |
111 DCHECK(IsCodeTarget(rmode_) || | 116 DCHECK(IsCodeTarget(rmode_) || |
112 IsRuntimeEntry(rmode_) || | 117 IsRuntimeEntry(rmode_) || |
113 rmode_ == EMBEDDED_OBJECT || | 118 rmode_ == EMBEDDED_OBJECT || |
114 rmode_ == EXTERNAL_REFERENCE); | 119 rmode_ == EXTERNAL_REFERENCE); |
115 // Read the address of the word containing the target_address in an | 120 // Read the address of the word containing the target_address in an |
116 // instruction stream. | 121 // instruction stream. |
117 // The only architecture-independent user of this function is the serializer. | 122 // The only architecture-independent user of this function is the serializer. |
118 // The serializer uses it to find out how many raw bytes of instruction to | 123 // The serializer uses it to find out how many raw bytes of instruction to |
119 // output before the next target. | 124 // output before the next target. |
(...skipping 30 matching lines...) Expand all Loading... |
150 icache_flush_mode); | 155 icache_flush_mode); |
151 if (write_barrier_mode == UPDATE_WRITE_BARRIER && | 156 if (write_barrier_mode == UPDATE_WRITE_BARRIER && |
152 host() != NULL && IsCodeTarget(rmode_)) { | 157 host() != NULL && IsCodeTarget(rmode_)) { |
153 Object* target_code = Code::GetCodeFromTargetAddress(target); | 158 Object* target_code = Code::GetCodeFromTargetAddress(target); |
154 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 159 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
155 host(), this, HeapObject::cast(target_code)); | 160 host(), this, HeapObject::cast(target_code)); |
156 } | 161 } |
157 } | 162 } |
158 | 163 |
159 void RelocInfo::update_wasm_memory_reference( | 164 void RelocInfo::update_wasm_memory_reference( |
160 Address old_base, Address new_base, size_t old_size, size_t new_size, | 165 Address old_base, Address new_base, int32_t old_size, int32_t new_size, |
161 ICacheFlushMode icache_flush_mode) { | 166 ICacheFlushMode icache_flush_mode) { |
162 DCHECK(IsWasmMemoryReference(rmode_)); | 167 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_)); |
163 DCHECK(old_base <= wasm_memory_reference() && | 168 if (IsWasmMemoryReference(rmode_)) { |
164 wasm_memory_reference() < old_base + old_size); | 169 Address updated_memory_reference; |
165 Address updated_reference = new_base + (wasm_memory_reference() - old_base); | 170 DCHECK(old_base <= wasm_memory_reference() && |
166 DCHECK(new_base <= updated_reference && | 171 wasm_memory_reference() < old_base + old_size); |
167 updated_reference < new_base + new_size); | 172 updated_memory_reference = new_base + (wasm_memory_reference() - old_base); |
168 Assembler::set_target_address_at(isolate_, pc_, host_, updated_reference, | 173 DCHECK(new_base <= updated_memory_reference && |
169 icache_flush_mode); | 174 updated_memory_reference < new_base + new_size); |
| 175 Assembler::set_target_address_at( |
| 176 isolate_, pc_, host_, updated_memory_reference, icache_flush_mode); |
| 177 } else if (IsWasmMemorySizeReference(rmode_)) { |
| 178 int32_t updated_size_reference; |
| 179 DCHECK(wasm_memory_size_reference() <= old_size); |
| 180 updated_size_reference = |
| 181 new_size + (wasm_memory_size_reference() - old_size); |
| 182 DCHECK(updated_size_reference <= new_size); |
| 183 Assembler::set_target_address_at( |
| 184 isolate_, pc_, host_, reinterpret_cast<Address>(updated_size_reference), |
| 185 icache_flush_mode); |
| 186 } else { |
| 187 UNREACHABLE(); |
| 188 } |
170 } | 189 } |
171 | 190 |
172 Address Assembler::target_address_from_return_address(Address pc) { | 191 Address Assembler::target_address_from_return_address(Address pc) { |
173 return pc - kCallTargetAddressOffset; | 192 return pc - kCallTargetAddressOffset; |
174 } | 193 } |
175 | 194 |
176 | 195 |
177 void Assembler::set_target_internal_reference_encoded_at(Address pc, | 196 void Assembler::set_target_internal_reference_encoded_at(Address pc, |
178 Address target) { | 197 Address target) { |
179 Instr instr1 = Assembler::instr_at(pc + 0 * Assembler::kInstrSize); | 198 Instr instr1 = Assembler::instr_at(pc + 0 * Assembler::kInstrSize); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 CheckBuffer(); | 514 CheckBuffer(); |
496 } | 515 } |
497 EmitHelper(x, is_compact_branch); | 516 EmitHelper(x, is_compact_branch); |
498 } | 517 } |
499 | 518 |
500 | 519 |
501 } // namespace internal | 520 } // namespace internal |
502 } // namespace v8 | 521 } // namespace v8 |
503 | 522 |
504 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 523 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
OLD | NEW |