Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: src/arm64/assembler-arm64.cc

Issue 1921203002: Add new relocation type WASM_MEMORY_SIZE_REFERENCE, use relocatable pointers to update wasm memory … (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ben's review Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm/assembler-arm-inl.h ('k') | src/arm64/assembler-arm64-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // generate those for relocatable pointers. 185 // generate those for relocatable pointers.
186 return false; 186 return false;
187 } 187 }
188 188
189 189
190 bool RelocInfo::IsInConstantPool() { 190 bool RelocInfo::IsInConstantPool() {
191 Instruction* instr = reinterpret_cast<Instruction*>(pc_); 191 Instruction* instr = reinterpret_cast<Instruction*>(pc_);
192 return instr->IsLdrLiteralX(); 192 return instr->IsLdrLiteralX();
193 } 193 }
194 194
195 Address RelocInfo::wasm_memory_reference() {
196 DCHECK(IsWasmMemoryReference(rmode_));
197 return Memory::Address_at(Assembler::target_pointer_address_at(pc_));
198 }
199
200 uint32_t RelocInfo::wasm_memory_size_reference() {
201 DCHECK(IsWasmMemorySizeReference(rmode_));
202 return Memory::uint32_at(Assembler::target_pointer_address_at(pc_));
203 }
204
205 void RelocInfo::update_wasm_memory_reference(
206 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size,
207 ICacheFlushMode icache_flush_mode) {
208 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_));
209 if (IsWasmMemoryReference(rmode_) && old_base != new_base) {
210 Address updated_memory_reference;
211 DCHECK(old_base <= wasm_memory_reference() &&
212 wasm_memory_reference() < old_base + old_size);
213 updated_memory_reference = new_base + (wasm_memory_reference() - old_base);
214 DCHECK(new_base <= updated_memory_reference &&
215 updated_memory_reference < new_base + new_size);
216 Assembler::set_target_address_at(
217 isolate_, pc_, host_, updated_memory_reference, icache_flush_mode);
218 } else if (IsWasmMemorySizeReference(rmode_)) {
219 uint32_t updated_size_reference;
220 DCHECK(wasm_memory_size_reference() <= old_size);
221 updated_size_reference =
222 new_size + (wasm_memory_size_reference() - old_size);
223 DCHECK(updated_size_reference <= new_size);
224 Memory::uint32_at(Assembler::target_pointer_address_at(pc_)) =
225 updated_size_reference;
226 } else {
227 UNREACHABLE();
228 }
229 }
195 230
196 Register GetAllocatableRegisterThatIsNotOneOf(Register reg1, Register reg2, 231 Register GetAllocatableRegisterThatIsNotOneOf(Register reg1, Register reg2,
197 Register reg3, Register reg4) { 232 Register reg3, Register reg4) {
198 CPURegList regs(reg1, reg2, reg3, reg4); 233 CPURegList regs(reg1, reg2, reg3, reg4);
199 const RegisterConfiguration* config = 234 const RegisterConfiguration* config =
200 RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT); 235 RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT);
201 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { 236 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) {
202 int code = config->GetAllocatableDoubleCode(i); 237 int code = config->GetAllocatableDoubleCode(i);
203 Register candidate = Register::from_code(code); 238 Register candidate = Register::from_code(code);
204 if (regs.IncludesAliasOf(candidate)) continue; 239 if (regs.IncludesAliasOf(candidate)) continue;
(...skipping 2936 matching lines...) Expand 10 before | Expand all | Expand 10 after
3141 movk(scratch, (target_offset >> 32) & 0xFFFF, 32); 3176 movk(scratch, (target_offset >> 32) & 0xFFFF, 32);
3142 DCHECK((target_offset >> 48) == 0); 3177 DCHECK((target_offset >> 48) == 0);
3143 add(rd, rd, scratch); 3178 add(rd, rd, scratch);
3144 } 3179 }
3145 3180
3146 3181
3147 } // namespace internal 3182 } // namespace internal
3148 } // namespace v8 3183 } // namespace v8
3149 3184
3150 #endif // V8_TARGET_ARCH_ARM64 3185 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/assembler-arm-inl.h ('k') | src/arm64/assembler-arm64-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698