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

Side by Side Diff: src/compiler/x64/code-generator-x64.cc

Issue 1846083005: Revert of [compiler] Add relocatable pointer constants for wasm memory references. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/compiler/wasm-compiler.cc ('k') | src/compiler/x64/instruction-selector-x64.cc » ('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 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 if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE) { 2078 switch (src.type()) {
2079 __ movq(dst, src.ToInt64(), src.rmode()); 2079 case Constant::kInt32:
2080 } else { 2080 // TODO(dcarney): don't need scratch in this case.
2081 switch (src.type()) { 2081 __ Set(dst, src.ToInt32());
2082 case Constant::kInt32: 2082 break;
2083 // TODO(dcarney): don't need scratch in this case. 2083 case Constant::kInt64:
2084 __ Set(dst, src.ToInt32()); 2084 __ Set(dst, src.ToInt64());
2085 break; 2085 break;
2086 case Constant::kInt64: 2086 case Constant::kFloat32:
2087 __ Set(dst, src.ToInt64()); 2087 __ Move(dst,
2088 break; 2088 isolate()->factory()->NewNumber(src.ToFloat32(), TENURED));
2089 case Constant::kFloat32: 2089 break;
2090 __ Move(dst, 2090 case Constant::kFloat64:
2091 isolate()->factory()->NewNumber(src.ToFloat32(), TENURED)); 2091 __ Move(dst,
2092 break; 2092 isolate()->factory()->NewNumber(src.ToFloat64(), TENURED));
2093 case Constant::kFloat64: 2093 break;
2094 __ Move(dst, 2094 case Constant::kExternalReference:
2095 isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); 2095 __ Move(dst, src.ToExternalReference());
2096 break; 2096 break;
2097 case Constant::kExternalReference: 2097 case Constant::kHeapObject: {
2098 __ Move(dst, src.ToExternalReference()); 2098 Handle<HeapObject> src_object = src.ToHeapObject();
2099 break; 2099 Heap::RootListIndex index;
2100 case Constant::kHeapObject: { 2100 int slot;
2101 Handle<HeapObject> src_object = src.ToHeapObject(); 2101 if (IsMaterializableFromFrame(src_object, &slot)) {
2102 Heap::RootListIndex index; 2102 __ movp(dst, g.SlotToOperand(slot));
2103 int slot; 2103 } else if (IsMaterializableFromRoot(src_object, &index)) {
2104 if (IsMaterializableFromFrame(src_object, &slot)) { 2104 __ LoadRoot(dst, index);
2105 __ movp(dst, g.SlotToOperand(slot)); 2105 } else {
2106 } else if (IsMaterializableFromRoot(src_object, &index)) { 2106 __ Move(dst, src_object);
2107 __ LoadRoot(dst, index);
2108 } else {
2109 __ Move(dst, src_object);
2110 }
2111 break;
2112 } 2107 }
2113 case Constant::kRpoNumber: 2108 break;
2114 UNREACHABLE(); // TODO(dcarney): load of labels on x64.
2115 break;
2116 } 2109 }
2110 case Constant::kRpoNumber:
2111 UNREACHABLE(); // TODO(dcarney): load of labels on x64.
2112 break;
2117 } 2113 }
2118 if (destination->IsStackSlot()) { 2114 if (destination->IsStackSlot()) {
2119 __ movq(g.ToOperand(destination), kScratchRegister); 2115 __ movq(g.ToOperand(destination), kScratchRegister);
2120 } 2116 }
2121 } else if (src.type() == Constant::kFloat32) { 2117 } else if (src.type() == Constant::kFloat32) {
2122 // TODO(turbofan): Can we do better here? 2118 // TODO(turbofan): Can we do better here?
2123 uint32_t src_const = bit_cast<uint32_t>(src.ToFloat32()); 2119 uint32_t src_const = bit_cast<uint32_t>(src.ToFloat32());
2124 if (destination->IsDoubleRegister()) { 2120 if (destination->IsDoubleRegister()) {
2125 __ Move(g.ToDoubleRegister(destination), src_const); 2121 __ Move(g.ToDoubleRegister(destination), src_const);
2126 } else { 2122 } else {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2249 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 2245 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
2250 __ Nop(padding_size); 2246 __ Nop(padding_size);
2251 } 2247 }
2252 } 2248 }
2253 2249
2254 #undef __ 2250 #undef __
2255 2251
2256 } // namespace compiler 2252 } // namespace compiler
2257 } // namespace internal 2253 } // namespace internal
2258 } // namespace v8 2254 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698