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

Side by Side Diff: src/x64/assembler-x64-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: 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/x64/assembler-x64.cc ('k') | test/cctest/compiler/test-run-wasm-machops.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_X64_ASSEMBLER_X64_INL_H_ 5 #ifndef V8_X64_ASSEMBLER_X64_INL_H_
6 #define V8_X64_ASSEMBLER_X64_INL_H_ 6 #define V8_X64_ASSEMBLER_X64_INL_H_
7 7
8 #include "src/x64/assembler-x64.h" 8 #include "src/x64/assembler-x64.h"
9 9
10 #include "src/base/cpu.h" 10 #include "src/base/cpu.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 Memory::Address_at(pc_) += delta; 321 Memory::Address_at(pc_) += delta;
322 } 322 }
323 } 323 }
324 324
325 325
326 Address RelocInfo::target_address() { 326 Address RelocInfo::target_address() {
327 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 327 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
328 return Assembler::target_address_at(pc_, host_); 328 return Assembler::target_address_at(pc_, host_);
329 } 329 }
330 330
331 Address RelocInfo::wasm_memory_reference() {
332 DCHECK(IsWasmMemoryReference(rmode_));
333 return Memory::Address_at(pc_);
334 }
335
336 Address RelocInfo::target_address_address() { 331 Address RelocInfo::target_address_address() {
337 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) 332 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)
338 || rmode_ == EMBEDDED_OBJECT 333 || rmode_ == EMBEDDED_OBJECT
339 || rmode_ == EXTERNAL_REFERENCE); 334 || rmode_ == EXTERNAL_REFERENCE);
340 return reinterpret_cast<Address>(pc_); 335 return reinterpret_cast<Address>(pc_);
341 } 336 }
342 337
343 338
344 Address RelocInfo::constant_pool_entry_address() { 339 Address RelocInfo::constant_pool_entry_address() {
345 UNREACHABLE(); 340 UNREACHABLE();
(...skipping 17 matching lines...) Expand all
363 Assembler::set_target_address_at(isolate_, pc_, host_, target, 358 Assembler::set_target_address_at(isolate_, pc_, host_, target,
364 icache_flush_mode); 359 icache_flush_mode);
365 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL && 360 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL &&
366 IsCodeTarget(rmode_)) { 361 IsCodeTarget(rmode_)) {
367 Object* target_code = Code::GetCodeFromTargetAddress(target); 362 Object* target_code = Code::GetCodeFromTargetAddress(target);
368 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 363 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
369 host(), this, HeapObject::cast(target_code)); 364 host(), this, HeapObject::cast(target_code));
370 } 365 }
371 } 366 }
372 367
373 void RelocInfo::update_wasm_memory_reference(
374 Address old_base, Address new_base, size_t old_size, size_t new_size,
375 ICacheFlushMode icache_flush_mode) {
376 DCHECK(IsWasmMemoryReference(rmode_));
377 DCHECK(old_base <= wasm_memory_reference() &&
378 wasm_memory_reference() < old_base + old_size);
379 Address updated_reference = new_base + (wasm_memory_reference() - old_base);
380 DCHECK(new_base <= updated_reference &&
381 updated_reference < new_base + new_size);
382 Memory::Address_at(pc_) = updated_reference;
383 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
384 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t));
385 }
386 }
387
388 Object* RelocInfo::target_object() { 368 Object* RelocInfo::target_object() {
389 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 369 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
390 return Memory::Object_at(pc_); 370 return Memory::Object_at(pc_);
391 } 371 }
392 372
393 373
394 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { 374 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
395 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 375 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
396 if (rmode_ == EMBEDDED_OBJECT) { 376 if (rmode_ == EMBEDDED_OBJECT) {
397 return Memory::Object_Handle_at(pc_); 377 return Memory::Object_Handle_at(pc_);
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 void Operand::set_disp64(int64_t disp) { 610 void Operand::set_disp64(int64_t disp) {
631 DCHECK_EQ(1, len_); 611 DCHECK_EQ(1, len_);
632 int64_t* p = reinterpret_cast<int64_t*>(&buf_[len_]); 612 int64_t* p = reinterpret_cast<int64_t*>(&buf_[len_]);
633 *p = disp; 613 *p = disp;
634 len_ += sizeof(disp); 614 len_ += sizeof(disp);
635 } 615 }
636 } // namespace internal 616 } // namespace internal
637 } // namespace v8 617 } // namespace v8
638 618
639 #endif // V8_X64_ASSEMBLER_X64_INL_H_ 619 #endif // V8_X64_ASSEMBLER_X64_INL_H_
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | test/cctest/compiler/test-run-wasm-machops.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698