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

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

Issue 2051043002: Implement Wasm GrowMemory opcode as a wasm runtime call (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test failures 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
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 return Memory::uint32_at(pc_); 127 return Memory::uint32_at(pc_);
128 } 128 }
129 129
130 void RelocInfo::update_wasm_memory_reference( 130 void RelocInfo::update_wasm_memory_reference(
131 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, 131 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size,
132 ICacheFlushMode icache_flush_mode) { 132 ICacheFlushMode icache_flush_mode) {
133 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_)); 133 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_));
134 if (IsWasmMemoryReference(rmode_)) { 134 if (IsWasmMemoryReference(rmode_)) {
135 Address updated_reference; 135 Address updated_reference;
136 DCHECK(old_base <= wasm_memory_reference() && 136 DCHECK(old_base <= wasm_memory_reference() &&
137 wasm_memory_reference() < old_base + old_size); 137 wasm_memory_reference() <= old_base + old_size);
138 updated_reference = new_base + (wasm_memory_reference() - old_base); 138 updated_reference = new_base + (wasm_memory_reference() - old_base);
139 DCHECK(new_base <= updated_reference && 139 DCHECK(new_base <= updated_reference &&
140 updated_reference < new_base + new_size); 140 updated_reference < new_base + new_size);
141 Memory::Address_at(pc_) = updated_reference; 141 Memory::Address_at(pc_) = updated_reference;
142 } else if (IsWasmMemorySizeReference(rmode_)) { 142 } else if (IsWasmMemorySizeReference(rmode_)) {
143 uint32_t updated_size_reference; 143 uint32_t updated_size_reference;
144 DCHECK(wasm_memory_size_reference() <= old_size); 144 DCHECK(wasm_memory_size_reference() <= old_size);
145 updated_size_reference = 145 updated_size_reference =
146 new_size + (wasm_memory_size_reference() - old_size); 146 new_size + (wasm_memory_size_reference() - old_size);
147 DCHECK(updated_size_reference <= new_size); 147 DCHECK(updated_size_reference <= new_size);
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 } 592 }
593 } 593 }
594 594
595 595
596 void Assembler::immediate_arithmetic_op(byte subcode, 596 void Assembler::immediate_arithmetic_op(byte subcode,
597 Register dst, 597 Register dst,
598 Immediate src, 598 Immediate src,
599 int size) { 599 int size) {
600 EnsureSpace ensure_space(this); 600 EnsureSpace ensure_space(this);
601 emit_rex(dst, size); 601 emit_rex(dst, size);
602 if (is_int8(src.value_)) { 602 if (is_int8(src.value_) && RelocInfo::IsNone(src.rmode_)) {
603 emit(0x83); 603 emit(0x83);
604 emit_modrm(subcode, dst); 604 emit_modrm(subcode, dst);
605 if (!RelocInfo::IsNone(src.rmode_)) {
606 RecordRelocInfo(src.rmode_);
607 }
608 emit(src.value_); 605 emit(src.value_);
609 } else if (dst.is(rax)) { 606 } else if (dst.is(rax)) {
610 emit(0x05 | (subcode << 3)); 607 emit(0x05 | (subcode << 3));
611 emit(src); 608 emit(src);
612 } else { 609 } else {
613 emit(0x81); 610 emit(0x81);
614 emit_modrm(subcode, dst); 611 emit_modrm(subcode, dst);
615 emit(src); 612 emit(src);
616 } 613 }
617 } 614 }
(...skipping 3979 matching lines...) Expand 10 before | Expand all | Expand 10 after
4597 4594
4598 bool RelocInfo::IsInConstantPool() { 4595 bool RelocInfo::IsInConstantPool() {
4599 return false; 4596 return false;
4600 } 4597 }
4601 4598
4602 4599
4603 } // namespace internal 4600 } // namespace internal
4604 } // namespace v8 4601 } // namespace v8
4605 4602
4606 #endif // V8_TARGET_ARCH_X64 4603 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698