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

Side by Side Diff: src/mips64/assembler-mips64-inl.h

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: Add compiler test 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
OLDNEW
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
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 static_cast<int32_t>(
113 reinterpret_cast<intptr_t>((Assembler::target_address_at(pc_, host_))));
114 }
115
110 Address RelocInfo::target_address_address() { 116 Address RelocInfo::target_address_address() {
111 DCHECK(IsCodeTarget(rmode_) || 117 DCHECK(IsCodeTarget(rmode_) ||
112 IsRuntimeEntry(rmode_) || 118 IsRuntimeEntry(rmode_) ||
113 rmode_ == EMBEDDED_OBJECT || 119 rmode_ == EMBEDDED_OBJECT ||
114 rmode_ == EXTERNAL_REFERENCE); 120 rmode_ == EXTERNAL_REFERENCE);
115 // Read the address of the word containing the target_address in an 121 // Read the address of the word containing the target_address in an
116 // instruction stream. 122 // instruction stream.
117 // The only architecture-independent user of this function is the serializer. 123 // 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 124 // The serializer uses it to find out how many raw bytes of instruction to
119 // output before the next target. 125 // output before the next target.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 icache_flush_mode); 158 icache_flush_mode);
153 if (write_barrier_mode == UPDATE_WRITE_BARRIER && 159 if (write_barrier_mode == UPDATE_WRITE_BARRIER &&
154 host() != NULL && IsCodeTarget(rmode_)) { 160 host() != NULL && IsCodeTarget(rmode_)) {
155 Object* target_code = Code::GetCodeFromTargetAddress(target); 161 Object* target_code = Code::GetCodeFromTargetAddress(target);
156 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 162 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
157 host(), this, HeapObject::cast(target_code)); 163 host(), this, HeapObject::cast(target_code));
158 } 164 }
159 } 165 }
160 166
161 void RelocInfo::update_wasm_memory_reference( 167 void RelocInfo::update_wasm_memory_reference(
162 Address old_base, Address new_base, size_t old_size, size_t new_size, 168 Address old_base, Address new_base, int32_t old_size, int32_t new_size,
163 ICacheFlushMode icache_flush_mode) { 169 ICacheFlushMode icache_flush_mode) {
164 DCHECK(IsWasmMemoryReference(rmode_)); 170 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_));
165 DCHECK(old_base <= wasm_memory_reference() && 171 if (IsWasmMemoryReference(rmode_)) {
166 wasm_memory_reference() < old_base + old_size); 172 Address updated_memory_reference;
167 Address updated_reference = new_base + (wasm_memory_reference() - old_base); 173 DCHECK(old_base <= wasm_memory_reference() &&
168 DCHECK(new_base <= updated_reference && 174 wasm_memory_reference() < old_base + old_size);
169 updated_reference < new_base + new_size); 175 updated_memory_reference = new_base + (wasm_memory_reference() - old_base);
170 Assembler::set_target_address_at(isolate_, pc_, host_, updated_reference, 176 DCHECK(new_base <= updated_memory_reference &&
171 icache_flush_mode); 177 updated_memory_reference < new_base + new_size);
178 Assembler::set_target_address_at(
179 isolate_, pc_, host_, updated_memory_reference, icache_flush_mode);
180 } else if (IsWasmMemorySizeReference(rmode_)) {
181 int32_t updated_size_reference;
182 DCHECK(wasm_memory_size_reference() <= old_size);
183 updated_size_reference =
184 new_size + (wasm_memory_size_reference() - old_size);
185 DCHECK(updated_size_reference <= new_size);
186 Assembler::set_target_address_at(
187 isolate_, pc_, host_, reinterpret_cast<Address>(updated_size_reference),
188 icache_flush_mode);
189 } else {
190 UNREACHABLE();
191 }
172 } 192 }
173 193
174 Address Assembler::target_address_from_return_address(Address pc) { 194 Address Assembler::target_address_from_return_address(Address pc) {
175 return pc - kCallTargetAddressOffset; 195 return pc - kCallTargetAddressOffset;
176 } 196 }
177 197
178 198
179 void Assembler::set_target_internal_reference_encoded_at(Address pc, 199 void Assembler::set_target_internal_reference_encoded_at(Address pc,
180 Address target) { 200 Address target) {
181 // Encoded internal references are j/jal instructions. 201 // Encoded internal references are j/jal instructions.
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 void Assembler::emit(uint64_t data) { 503 void Assembler::emit(uint64_t data) {
484 CheckForEmitInForbiddenSlot(); 504 CheckForEmitInForbiddenSlot();
485 EmitHelper(data); 505 EmitHelper(data);
486 } 506 }
487 507
488 508
489 } // namespace internal 509 } // namespace internal
490 } // namespace v8 510 } // namespace v8
491 511
492 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ 512 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698