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

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

Issue 2056633002: [wasm] Separate compilation from instantiation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: feedback Created 4 years, 6 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/wasm/wasm-module.cc ('k') | test/cctest/wasm/wasm-run-utils.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 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 Address RelocInfo::wasm_global_reference() { 125 Address RelocInfo::wasm_global_reference() {
126 DCHECK(IsWasmGlobalReference(rmode_)); 126 DCHECK(IsWasmGlobalReference(rmode_));
127 return Memory::Address_at(pc_); 127 return Memory::Address_at(pc_);
128 } 128 }
129 129
130 uint32_t RelocInfo::wasm_memory_size_reference() { 130 uint32_t RelocInfo::wasm_memory_size_reference() {
131 DCHECK(IsWasmMemorySizeReference(rmode_)); 131 DCHECK(IsWasmMemorySizeReference(rmode_));
132 return Memory::uint32_at(pc_); 132 return Memory::uint32_at(pc_);
133 } 133 }
134 134
135 void RelocInfo::update_wasm_memory_reference( 135 void RelocInfo::unchecked_update_wasm_memory_reference(
136 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, 136 Address address, ICacheFlushMode flush_mode) {
137 ICacheFlushMode icache_flush_mode) { 137 Memory::Address_at(pc_) = address;
138 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_));
139 if (IsWasmMemoryReference(rmode_)) {
140 Address updated_reference;
141 DCHECK(old_base <= wasm_memory_reference() &&
142 wasm_memory_reference() < old_base + old_size);
143 updated_reference = new_base + (wasm_memory_reference() - old_base);
144 DCHECK(new_base <= updated_reference &&
145 updated_reference < new_base + new_size);
146 Memory::Address_at(pc_) = updated_reference;
147 } else if (IsWasmMemorySizeReference(rmode_)) {
148 uint32_t updated_size_reference;
149 DCHECK(wasm_memory_size_reference() <= old_size);
150 updated_size_reference =
151 new_size + (wasm_memory_size_reference() - old_size);
152 DCHECK(updated_size_reference <= new_size);
153 Memory::uint32_at(pc_) = updated_size_reference;
154 } else {
155 UNREACHABLE();
156 }
157 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
158 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t));
159 }
160 } 138 }
161 139
162 void RelocInfo::update_wasm_global_reference( 140 void RelocInfo::unchecked_update_wasm_memory_size(uint32_t size,
163 Address old_base, Address new_base, ICacheFlushMode icache_flush_mode) { 141 ICacheFlushMode flush_mode) {
164 DCHECK(IsWasmGlobalReference(rmode_)); 142 Memory::uint32_at(pc_) = size;
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 } 143 }
174 144
175 // ----------------------------------------------------------------------------- 145 // -----------------------------------------------------------------------------
176 // Implementation of Operand 146 // Implementation of Operand
177 147
178 Operand::Operand(Register base, int32_t disp) : rex_(0) { 148 Operand::Operand(Register base, int32_t disp) : rex_(0) {
179 len_ = 1; 149 len_ = 1;
180 if (base.is(rsp) || base.is(r12)) { 150 if (base.is(rsp) || base.is(r12)) {
181 // SIB byte is needed to encode (rsp + offset) or (r12 + offset). 151 // SIB byte is needed to encode (rsp + offset) or (r12 + offset).
182 set_sib(times_1, rsp, base); 152 set_sib(times_1, rsp, base);
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 } 580 }
611 } 581 }
612 582
613 583
614 void Assembler::immediate_arithmetic_op(byte subcode, 584 void Assembler::immediate_arithmetic_op(byte subcode,
615 Register dst, 585 Register dst,
616 Immediate src, 586 Immediate src,
617 int size) { 587 int size) {
618 EnsureSpace ensure_space(this); 588 EnsureSpace ensure_space(this);
619 emit_rex(dst, size); 589 emit_rex(dst, size);
620 if (is_int8(src.value_)) { 590 if (is_int8(src.value_) && RelocInfo::IsNone(src.rmode_)) {
621 emit(0x83); 591 emit(0x83);
622 emit_modrm(subcode, dst); 592 emit_modrm(subcode, dst);
623 if (!RelocInfo::IsNone(src.rmode_)) {
624 RecordRelocInfo(src.rmode_);
625 }
626 emit(src.value_); 593 emit(src.value_);
627 } else if (dst.is(rax)) { 594 } else if (dst.is(rax)) {
628 emit(0x05 | (subcode << 3)); 595 emit(0x05 | (subcode << 3));
629 emit(src); 596 emit(src);
630 } else { 597 } else {
631 emit(0x81); 598 emit(0x81);
632 emit_modrm(subcode, dst); 599 emit_modrm(subcode, dst);
633 emit(src); 600 emit(src);
634 } 601 }
635 } 602 }
(...skipping 3970 matching lines...) Expand 10 before | Expand all | Expand 10 after
4606 4573
4607 bool RelocInfo::IsInConstantPool() { 4574 bool RelocInfo::IsInConstantPool() {
4608 return false; 4575 return false;
4609 } 4576 }
4610 4577
4611 4578
4612 } // namespace internal 4579 } // namespace internal
4613 } // namespace v8 4580 } // namespace v8
4614 4581
4615 #endif // V8_TARGET_ARCH_X64 4582 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698