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

Side by Side Diff: src/ia32/assembler-ia32-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 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 Address RelocInfo::target_address() { 79 Address RelocInfo::target_address() {
80 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 80 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
81 return Assembler::target_address_at(pc_, host_); 81 return Assembler::target_address_at(pc_, host_);
82 } 82 }
83 83
84 Address RelocInfo::wasm_memory_reference() { 84 Address RelocInfo::wasm_memory_reference() {
85 DCHECK(IsWasmMemoryReference(rmode_)); 85 DCHECK(IsWasmMemoryReference(rmode_));
86 return Memory::Address_at(pc_); 86 return Memory::Address_at(pc_);
87 } 87 }
88 88
89 int32_t RelocInfo::wasm_memory_size_reference() {
90 DCHECK(IsWasmMemorySizeReference(rmode_));
91 return Memory::int32_at(pc_);
92 }
93
89 Address RelocInfo::target_address_address() { 94 Address RelocInfo::target_address_address() {
90 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) 95 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)
91 || rmode_ == EMBEDDED_OBJECT 96 || rmode_ == EMBEDDED_OBJECT
92 || rmode_ == EXTERNAL_REFERENCE); 97 || rmode_ == EXTERNAL_REFERENCE);
93 return reinterpret_cast<Address>(pc_); 98 return reinterpret_cast<Address>(pc_);
94 } 99 }
95 100
96 101
97 Address RelocInfo::constant_pool_entry_address() { 102 Address RelocInfo::constant_pool_entry_address() {
98 UNREACHABLE(); 103 UNREACHABLE();
(...skipping 14 matching lines...) Expand all
113 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 118 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
114 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL && 119 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL &&
115 IsCodeTarget(rmode_)) { 120 IsCodeTarget(rmode_)) {
116 Object* target_code = Code::GetCodeFromTargetAddress(target); 121 Object* target_code = Code::GetCodeFromTargetAddress(target);
117 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 122 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
118 host(), this, HeapObject::cast(target_code)); 123 host(), this, HeapObject::cast(target_code));
119 } 124 }
120 } 125 }
121 126
122 void RelocInfo::update_wasm_memory_reference( 127 void RelocInfo::update_wasm_memory_reference(
123 Address old_base, Address new_base, size_t old_size, size_t new_size, 128 Address old_base, Address new_base, int32_t old_size, int32_t new_size,
124 ICacheFlushMode icache_flush_mode) { 129 ICacheFlushMode icache_flush_mode) {
125 DCHECK(IsWasmMemoryReference(rmode_)); 130 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_));
126 DCHECK(old_base <= wasm_memory_reference() && 131 if (IsWasmMemoryReference(rmode_)) {
127 wasm_memory_reference() < old_base + old_size); 132 Address updated_reference;
128 Address updated_reference = new_base + (wasm_memory_reference() - old_base); 133 DCHECK(old_base <= wasm_memory_reference() &&
129 DCHECK(new_base <= updated_reference && 134 wasm_memory_reference() < old_base + old_size);
130 updated_reference < new_base + new_size); 135 updated_reference = new_base + (wasm_memory_reference() - old_base);
131 Memory::Address_at(pc_) = updated_reference; 136 DCHECK(new_base <= updated_reference &&
137 updated_reference < new_base + new_size);
138 Memory::Address_at(pc_) = updated_reference;
139 } else if (IsWasmMemorySizeReference(rmode_)) {
140 int32_t updated_size_reference;
141 DCHECK(wasm_memory_size_reference() <= old_size);
142 updated_size_reference =
143 new_size + (wasm_memory_size_reference() - old_size);
144 DCHECK(updated_size_reference <= new_size);
145 Memory::int32_at(pc_) = updated_size_reference;
146 } else {
147 UNREACHABLE();
148 }
132 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 149 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
133 Assembler::FlushICache(isolate_, pc_, sizeof(int32_t)); 150 Assembler::FlushICache(isolate_, pc_, sizeof(int32_t));
134 } 151 }
135 } 152 }
136 153
137 Object* RelocInfo::target_object() { 154 Object* RelocInfo::target_object() {
138 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 155 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
139 return Memory::Object_at(pc_); 156 return Memory::Object_at(pc_);
140 } 157 }
141 158
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 590
574 Operand::Operand(Immediate imm) { 591 Operand::Operand(Immediate imm) {
575 // [disp/r] 592 // [disp/r]
576 set_modrm(0, ebp); 593 set_modrm(0, ebp);
577 set_dispr(imm.x_, imm.rmode_); 594 set_dispr(imm.x_, imm.rmode_);
578 } 595 }
579 } // namespace internal 596 } // namespace internal
580 } // namespace v8 597 } // namespace v8
581 598
582 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ 599 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698