| OLD | NEW |
| 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 #include "src/x64/assembler-x64.h" | 5 #include "src/x64/assembler-x64.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_X64 | 9 #if V8_TARGET_ARCH_X64 |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 115 } |
| 116 | 116 |
| 117 // ----------------------------------------------------------------------------- | 117 // ----------------------------------------------------------------------------- |
| 118 // Implementation of RelocInfo | 118 // Implementation of RelocInfo |
| 119 | 119 |
| 120 Address RelocInfo::wasm_memory_reference() { | 120 Address RelocInfo::wasm_memory_reference() { |
| 121 DCHECK(IsWasmMemoryReference(rmode_)); | 121 DCHECK(IsWasmMemoryReference(rmode_)); |
| 122 return Memory::Address_at(pc_); | 122 return Memory::Address_at(pc_); |
| 123 } | 123 } |
| 124 | 124 |
| 125 Address RelocInfo::wasm_global_reference() { |
| 126 DCHECK(IsWasmGlobalReference(rmode_)); |
| 127 return Memory::Address_at(pc_); |
| 128 } |
| 129 |
| 125 uint32_t RelocInfo::wasm_memory_size_reference() { | 130 uint32_t RelocInfo::wasm_memory_size_reference() { |
| 126 DCHECK(IsWasmMemorySizeReference(rmode_)); | 131 DCHECK(IsWasmMemorySizeReference(rmode_)); |
| 127 return Memory::uint32_at(pc_); | 132 return Memory::uint32_at(pc_); |
| 128 } | 133 } |
| 129 | 134 |
| 130 void RelocInfo::update_wasm_memory_reference( | 135 void RelocInfo::update_wasm_memory_reference( |
| 131 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, | 136 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, |
| 132 ICacheFlushMode icache_flush_mode) { | 137 ICacheFlushMode icache_flush_mode) { |
| 133 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_)); | 138 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_)); |
| 134 if (IsWasmMemoryReference(rmode_)) { | 139 if (IsWasmMemoryReference(rmode_)) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 147 DCHECK(updated_size_reference <= new_size); | 152 DCHECK(updated_size_reference <= new_size); |
| 148 Memory::uint32_at(pc_) = updated_size_reference; | 153 Memory::uint32_at(pc_) = updated_size_reference; |
| 149 } else { | 154 } else { |
| 150 UNREACHABLE(); | 155 UNREACHABLE(); |
| 151 } | 156 } |
| 152 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 157 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
| 153 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t)); | 158 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t)); |
| 154 } | 159 } |
| 155 } | 160 } |
| 156 | 161 |
| 162 void RelocInfo::update_wasm_global_reference( |
| 163 Address old_base, Address new_base, ICacheFlushMode icache_flush_mode) { |
| 164 DCHECK(IsWasmGlobalReference(rmode_)); |
| 165 Address updated_reference; |
| 166 DCHECK(old_base <= wasm_global_reference()); |
| 167 updated_reference = new_base + (wasm_global_reference() - old_base); |
| 168 DCHECK(new_base <= updated_reference); |
| 169 Memory::Address_at(pc_) = updated_reference; |
| 170 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
| 171 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t)); |
| 172 } |
| 173 } |
| 174 |
| 157 // ----------------------------------------------------------------------------- | 175 // ----------------------------------------------------------------------------- |
| 158 // Implementation of Operand | 176 // Implementation of Operand |
| 159 | 177 |
| 160 Operand::Operand(Register base, int32_t disp) : rex_(0) { | 178 Operand::Operand(Register base, int32_t disp) : rex_(0) { |
| 161 len_ = 1; | 179 len_ = 1; |
| 162 if (base.is(rsp) || base.is(r12)) { | 180 if (base.is(rsp) || base.is(r12)) { |
| 163 // SIB byte is needed to encode (rsp + offset) or (r12 + offset). | 181 // SIB byte is needed to encode (rsp + offset) or (r12 + offset). |
| 164 set_sib(times_1, rsp, base); | 182 set_sib(times_1, rsp, base); |
| 165 } | 183 } |
| 166 | 184 |
| (...skipping 4430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4597 | 4615 |
| 4598 bool RelocInfo::IsInConstantPool() { | 4616 bool RelocInfo::IsInConstantPool() { |
| 4599 return false; | 4617 return false; |
| 4600 } | 4618 } |
| 4601 | 4619 |
| 4602 | 4620 |
| 4603 } // namespace internal | 4621 } // namespace internal |
| 4604 } // namespace v8 | 4622 } // namespace v8 |
| 4605 | 4623 |
| 4606 #endif // V8_TARGET_ARCH_X64 | 4624 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |