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

Unified Diff: src/compiler/x64/code-generator-x64.cc

Issue 1759383003: [compiler] Add relocatable pointer constants for wasm memory references. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix mips/mips64 compile Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler/x64/code-generator-x64.cc
diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc
index 510c0c6a0c78bf62e3cd7bffe3b62fc36870a89f..a877e883a5311a0af8289dbc9f2429b2c9bb7a0d 100644
--- a/src/compiler/x64/code-generator-x64.cc
+++ b/src/compiler/x64/code-generator-x64.cc
@@ -2021,41 +2021,49 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
if (destination->IsRegister() || destination->IsStackSlot()) {
Register dst = destination->IsRegister() ? g.ToRegister(destination)
: kScratchRegister;
- switch (src.type()) {
- case Constant::kInt32:
- // TODO(dcarney): don't need scratch in this case.
- __ Set(dst, src.ToInt32());
- break;
- case Constant::kInt64:
- __ Set(dst, src.ToInt64());
- break;
- case Constant::kFloat32:
- __ Move(dst,
- isolate()->factory()->NewNumber(src.ToFloat32(), TENURED));
- break;
- case Constant::kFloat64:
- __ Move(dst,
- isolate()->factory()->NewNumber(src.ToFloat64(), TENURED));
- break;
- case Constant::kExternalReference:
- __ Move(dst, src.ToExternalReference());
- break;
- case Constant::kHeapObject: {
- Handle<HeapObject> src_object = src.ToHeapObject();
- Heap::RootListIndex index;
- int offset;
- if (IsMaterializableFromFrame(src_object, &offset)) {
- __ movp(dst, Operand(rbp, offset));
- } else if (IsMaterializableFromRoot(src_object, &index)) {
- __ LoadRoot(dst, index);
- } else {
- __ Move(dst, src_object);
+ if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE) {
+ if (src.type() == Constant::kInt32) {
+ __ Set(dst, src.ToInt32(), src.rmode());
+ } else if (src.type() == Constant::kInt64) {
+ __ Set(dst, src.ToInt64(), src.rmode());
+ }
+ } else {
+ switch (src.type()) {
+ case Constant::kInt32:
+ // TODO(dcarney): don't need scratch in this case.
+ __ Set(dst, src.ToInt32());
+ break;
+ case Constant::kInt64:
+ __ Set(dst, src.ToInt64());
+ break;
+ case Constant::kFloat32:
+ __ Move(dst,
+ isolate()->factory()->NewNumber(src.ToFloat32(), TENURED));
+ break;
+ case Constant::kFloat64:
+ __ Move(dst,
+ isolate()->factory()->NewNumber(src.ToFloat64(), TENURED));
+ break;
+ case Constant::kExternalReference:
+ __ Move(dst, src.ToExternalReference());
+ break;
+ case Constant::kHeapObject: {
+ Handle<HeapObject> src_object = src.ToHeapObject();
+ Heap::RootListIndex index;
+ int offset;
+ if (IsMaterializableFromFrame(src_object, &offset)) {
+ __ movp(dst, Operand(rbp, offset));
+ } else if (IsMaterializableFromRoot(src_object, &index)) {
+ __ LoadRoot(dst, index);
+ } else {
+ __ Move(dst, src_object);
+ }
+ break;
}
- break;
+ case Constant::kRpoNumber:
+ UNREACHABLE(); // TODO(dcarney): load of labels on x64.
+ break;
}
- case Constant::kRpoNumber:
- UNREACHABLE(); // TODO(dcarney): load of labels on x64.
- break;
}
if (destination->IsStackSlot()) {
__ movq(g.ToOperand(destination), kScratchRegister);

Powered by Google App Engine
This is Rietveld 408576698