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

Side by Side 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: Removing additional check Created 4 years, 9 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler/code-generator-impl.h" 8 #include "src/compiler/code-generator-impl.h"
9 #include "src/compiler/gap-resolver.h" 9 #include "src/compiler/gap-resolver.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 2057 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 Operand dst = g.ToOperand(destination); 2068 Operand dst = g.ToOperand(destination);
2069 __ movq(tmp, src); 2069 __ movq(tmp, src);
2070 __ movq(dst, tmp); 2070 __ movq(dst, tmp);
2071 } 2071 }
2072 } else if (source->IsConstant()) { 2072 } else if (source->IsConstant()) {
2073 ConstantOperand* constant_source = ConstantOperand::cast(source); 2073 ConstantOperand* constant_source = ConstantOperand::cast(source);
2074 Constant src = g.ToConstant(constant_source); 2074 Constant src = g.ToConstant(constant_source);
2075 if (destination->IsRegister() || destination->IsStackSlot()) { 2075 if (destination->IsRegister() || destination->IsStackSlot()) {
2076 Register dst = destination->IsRegister() ? g.ToRegister(destination) 2076 Register dst = destination->IsRegister() ? g.ToRegister(destination)
2077 : kScratchRegister; 2077 : kScratchRegister;
2078 switch (src.type()) { 2078 if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE) {
2079 case Constant::kInt32: 2079 __ movq(dst, src.ToInt64(), src.rmode());
2080 // TODO(dcarney): don't need scratch in this case. 2080 } else {
2081 __ Set(dst, src.ToInt32()); 2081 switch (src.type()) {
2082 break; 2082 case Constant::kInt32:
2083 case Constant::kInt64: 2083 // TODO(dcarney): don't need scratch in this case.
2084 __ Set(dst, src.ToInt64()); 2084 __ Set(dst, src.ToInt32());
2085 break; 2085 break;
2086 case Constant::kFloat32: 2086 case Constant::kInt64:
2087 __ Move(dst, 2087 __ Set(dst, src.ToInt64());
2088 isolate()->factory()->NewNumber(src.ToFloat32(), TENURED)); 2088 break;
2089 break; 2089 case Constant::kFloat32:
2090 case Constant::kFloat64: 2090 __ Move(dst,
2091 __ Move(dst, 2091 isolate()->factory()->NewNumber(src.ToFloat32(), TENURED));
2092 isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); 2092 break;
2093 break; 2093 case Constant::kFloat64:
2094 case Constant::kExternalReference: 2094 __ Move(dst,
2095 __ Move(dst, src.ToExternalReference()); 2095 isolate()->factory()->NewNumber(src.ToFloat64(), TENURED));
2096 break; 2096 break;
2097 case Constant::kHeapObject: { 2097 case Constant::kExternalReference:
2098 Handle<HeapObject> src_object = src.ToHeapObject(); 2098 __ Move(dst, src.ToExternalReference());
2099 Heap::RootListIndex index; 2099 break;
2100 int slot; 2100 case Constant::kHeapObject: {
2101 if (IsMaterializableFromFrame(src_object, &slot)) { 2101 Handle<HeapObject> src_object = src.ToHeapObject();
2102 __ movp(dst, g.SlotToOperand(slot)); 2102 Heap::RootListIndex index;
2103 } else if (IsMaterializableFromRoot(src_object, &index)) { 2103 int slot;
2104 __ LoadRoot(dst, index); 2104 if (IsMaterializableFromFrame(src_object, &slot)) {
2105 } else { 2105 __ movp(dst, g.SlotToOperand(slot));
2106 __ Move(dst, src_object); 2106 } else if (IsMaterializableFromRoot(src_object, &index)) {
2107 __ LoadRoot(dst, index);
2108 } else {
2109 __ Move(dst, src_object);
2110 }
2111 break;
2107 } 2112 }
2108 break; 2113 case Constant::kRpoNumber:
2114 UNREACHABLE(); // TODO(dcarney): load of labels on x64.
2115 break;
2109 } 2116 }
2110 case Constant::kRpoNumber:
2111 UNREACHABLE(); // TODO(dcarney): load of labels on x64.
2112 break;
2113 } 2117 }
2114 if (destination->IsStackSlot()) { 2118 if (destination->IsStackSlot()) {
2115 __ movq(g.ToOperand(destination), kScratchRegister); 2119 __ movq(g.ToOperand(destination), kScratchRegister);
2116 } 2120 }
2117 } else if (src.type() == Constant::kFloat32) { 2121 } else if (src.type() == Constant::kFloat32) {
2118 // TODO(turbofan): Can we do better here? 2122 // TODO(turbofan): Can we do better here?
2119 uint32_t src_const = bit_cast<uint32_t>(src.ToFloat32()); 2123 uint32_t src_const = bit_cast<uint32_t>(src.ToFloat32());
2120 if (destination->IsDoubleRegister()) { 2124 if (destination->IsDoubleRegister()) {
2121 __ Move(g.ToDoubleRegister(destination), src_const); 2125 __ Move(g.ToDoubleRegister(destination), src_const);
2122 } else { 2126 } else {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2245 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 2249 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
2246 __ Nop(padding_size); 2250 __ Nop(padding_size);
2247 } 2251 }
2248 } 2252 }
2249 2253
2250 #undef __ 2254 #undef __
2251 2255
2252 } // namespace compiler 2256 } // namespace compiler
2253 } // namespace internal 2257 } // namespace internal
2254 } // namespace v8 2258 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698