OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
5 // met: | 5 // met: |
6 // | 6 // |
7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 uint32_t RelocInfo::wasm_memory_size_reference() { | 187 uint32_t RelocInfo::wasm_memory_size_reference() { |
188 DCHECK(IsWasmMemorySizeReference(rmode_)); | 188 DCHECK(IsWasmMemorySizeReference(rmode_)); |
189 return Memory::uint32_at(Assembler::target_pointer_address_at(pc_)); | 189 return Memory::uint32_at(Assembler::target_pointer_address_at(pc_)); |
190 } | 190 } |
191 | 191 |
192 Address RelocInfo::wasm_global_reference() { | 192 Address RelocInfo::wasm_global_reference() { |
193 DCHECK(IsWasmGlobalReference(rmode_)); | 193 DCHECK(IsWasmGlobalReference(rmode_)); |
194 return Memory::Address_at(Assembler::target_pointer_address_at(pc_)); | 194 return Memory::Address_at(Assembler::target_pointer_address_at(pc_)); |
195 } | 195 } |
196 | 196 |
197 void RelocInfo::update_wasm_memory_reference( | 197 void RelocInfo::unchecked_update_wasm_memory_reference( |
198 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, | 198 Address address, ICacheFlushMode flush_mode) { |
199 ICacheFlushMode icache_flush_mode) { | 199 Assembler::set_target_address_at(isolate_, pc_, host_, address, flush_mode); |
200 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_)); | |
201 if (IsWasmMemoryReference(rmode_) && old_base != new_base) { | |
202 Address updated_memory_reference; | |
203 DCHECK(old_base <= wasm_memory_reference() && | |
204 wasm_memory_reference() < old_base + old_size); | |
205 updated_memory_reference = new_base + (wasm_memory_reference() - old_base); | |
206 DCHECK(new_base <= updated_memory_reference && | |
207 updated_memory_reference < new_base + new_size); | |
208 Assembler::set_target_address_at( | |
209 isolate_, pc_, host_, updated_memory_reference, icache_flush_mode); | |
210 } else if (IsWasmMemorySizeReference(rmode_)) { | |
211 uint32_t updated_size_reference; | |
212 DCHECK(wasm_memory_size_reference() <= old_size); | |
213 updated_size_reference = | |
214 new_size + (wasm_memory_size_reference() - old_size); | |
215 DCHECK(updated_size_reference <= new_size); | |
216 Memory::uint32_at(Assembler::target_pointer_address_at(pc_)) = | |
217 updated_size_reference; | |
218 } else { | |
219 UNREACHABLE(); | |
220 } | |
221 } | 200 } |
222 | 201 |
223 void RelocInfo::update_wasm_global_reference( | 202 void RelocInfo::unchecked_update_wasm_memory_size(uint32_t size, |
224 Address old_base, Address new_base, ICacheFlushMode icache_flush_mode) { | 203 ICacheFlushMode flush_mode) { |
225 DCHECK(IsWasmGlobalReference(rmode_)); | 204 Memory::uint32_at(Assembler::target_pointer_address_at(pc_)) = size; |
226 Address updated_reference; | |
227 DCHECK(old_base <= wasm_global_reference()); | |
228 updated_reference = new_base + (wasm_global_reference() - old_base); | |
229 DCHECK(new_base <= updated_reference); | |
230 Assembler::set_target_address_at(isolate_, pc_, host_, updated_reference, | |
231 icache_flush_mode); | |
232 } | 205 } |
233 | 206 |
234 Register GetAllocatableRegisterThatIsNotOneOf(Register reg1, Register reg2, | 207 Register GetAllocatableRegisterThatIsNotOneOf(Register reg1, Register reg2, |
235 Register reg3, Register reg4) { | 208 Register reg3, Register reg4) { |
236 CPURegList regs(reg1, reg2, reg3, reg4); | 209 CPURegList regs(reg1, reg2, reg3, reg4); |
237 const RegisterConfiguration* config = | 210 const RegisterConfiguration* config = |
238 RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT); | 211 RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT); |
239 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { | 212 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { |
240 int code = config->GetAllocatableDoubleCode(i); | 213 int code = config->GetAllocatableDoubleCode(i); |
241 Register candidate = Register::from_code(code); | 214 Register candidate = Register::from_code(code); |
(...skipping 3013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3255 movk(scratch, (target_offset >> 32) & 0xFFFF, 32); | 3228 movk(scratch, (target_offset >> 32) & 0xFFFF, 32); |
3256 DCHECK((target_offset >> 48) == 0); | 3229 DCHECK((target_offset >> 48) == 0); |
3257 add(rd, rd, scratch); | 3230 add(rd, rd, scratch); |
3258 } | 3231 } |
3259 | 3232 |
3260 | 3233 |
3261 } // namespace internal | 3234 } // namespace internal |
3262 } // namespace v8 | 3235 } // namespace v8 |
3263 | 3236 |
3264 #endif // V8_TARGET_ARCH_ARM64 | 3237 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |