OLD | NEW |
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 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2071 __ movq(dst, tmp); | 2071 __ movq(dst, tmp); |
2072 } | 2072 } |
2073 } else if (source->IsConstant()) { | 2073 } else if (source->IsConstant()) { |
2074 ConstantOperand* constant_source = ConstantOperand::cast(source); | 2074 ConstantOperand* constant_source = ConstantOperand::cast(source); |
2075 Constant src = g.ToConstant(constant_source); | 2075 Constant src = g.ToConstant(constant_source); |
2076 if (destination->IsRegister() || destination->IsStackSlot()) { | 2076 if (destination->IsRegister() || destination->IsStackSlot()) { |
2077 Register dst = destination->IsRegister() ? g.ToRegister(destination) | 2077 Register dst = destination->IsRegister() ? g.ToRegister(destination) |
2078 : kScratchRegister; | 2078 : kScratchRegister; |
2079 switch (src.type()) { | 2079 switch (src.type()) { |
2080 case Constant::kInt32: { | 2080 case Constant::kInt32: { |
2081 // TODO(dcarney): don't need scratch in this case. | 2081 if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE) { |
2082 int32_t value = src.ToInt32(); | 2082 __ movq(dst, src.ToInt64(), src.rmode()); |
2083 if (value == 0) { | |
2084 __ xorl(dst, dst); | |
2085 } else { | 2083 } else { |
2086 __ movl(dst, Immediate(value)); | 2084 // TODO(dcarney): don't need scratch in this case. |
| 2085 int32_t value = src.ToInt32(); |
| 2086 if (value == 0) { |
| 2087 __ xorl(dst, dst); |
| 2088 } else { |
| 2089 __ movl(dst, Immediate(value)); |
| 2090 } |
2087 } | 2091 } |
2088 break; | 2092 break; |
2089 } | 2093 } |
2090 case Constant::kInt64: | 2094 case Constant::kInt64: |
2091 __ Set(dst, src.ToInt64()); | 2095 if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE) { |
| 2096 __ movq(dst, src.ToInt64(), src.rmode()); |
| 2097 } else { |
| 2098 __ Set(dst, src.ToInt64()); |
| 2099 } |
2092 break; | 2100 break; |
2093 case Constant::kFloat32: | 2101 case Constant::kFloat32: |
2094 __ Move(dst, | 2102 __ Move(dst, |
2095 isolate()->factory()->NewNumber(src.ToFloat32(), TENURED)); | 2103 isolate()->factory()->NewNumber(src.ToFloat32(), TENURED)); |
2096 break; | 2104 break; |
2097 case Constant::kFloat64: | 2105 case Constant::kFloat64: |
2098 __ Move(dst, | 2106 __ Move(dst, |
2099 isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); | 2107 isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); |
2100 break; | 2108 break; |
2101 case Constant::kExternalReference: | 2109 case Constant::kExternalReference: |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2252 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2260 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2253 __ Nop(padding_size); | 2261 __ Nop(padding_size); |
2254 } | 2262 } |
2255 } | 2263 } |
2256 | 2264 |
2257 #undef __ | 2265 #undef __ |
2258 | 2266 |
2259 } // namespace compiler | 2267 } // namespace compiler |
2260 } // namespace internal | 2268 } // namespace internal |
2261 } // namespace v8 | 2269 } // namespace v8 |
OLD | NEW |