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