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 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 Operand OutputOperand() { return ToOperand(instr_->Output()); } | 39 Operand OutputOperand() { return ToOperand(instr_->Output()); } |
40 | 40 |
41 Immediate ToImmediate(InstructionOperand* operand) { | 41 Immediate ToImmediate(InstructionOperand* operand) { |
42 Constant constant = ToConstant(operand); | 42 Constant constant = ToConstant(operand); |
43 if (constant.type() == Constant::kFloat64) { | 43 if (constant.type() == Constant::kFloat64) { |
44 DCHECK_EQ(0, bit_cast<int64_t>(constant.ToFloat64())); | 44 DCHECK_EQ(0, bit_cast<int64_t>(constant.ToFloat64())); |
45 return Immediate(0); | 45 return Immediate(0); |
46 } | 46 } |
| 47 if (constant.rmode() == RelocInfo::WASM_MEMORY_REFERENCE || |
| 48 constant.rmode() == RelocInfo::WASM_MEMORY_SIZE_REFERENCE) { |
| 49 return Immediate(constant.ToInt32(), constant.rmode()); |
| 50 } |
47 return Immediate(constant.ToInt32()); | 51 return Immediate(constant.ToInt32()); |
48 } | 52 } |
49 | 53 |
50 Operand ToOperand(InstructionOperand* op, int extra = 0) { | 54 Operand ToOperand(InstructionOperand* op, int extra = 0) { |
51 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); | 55 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); |
52 return SlotToOperand(AllocatedOperand::cast(op)->index(), extra); | 56 return SlotToOperand(AllocatedOperand::cast(op)->index(), extra); |
53 } | 57 } |
54 | 58 |
55 Operand SlotToOperand(int slot_index, int extra = 0) { | 59 Operand SlotToOperand(int slot_index, int extra = 0) { |
56 FrameOffset offset = frame_access_state()->GetFrameOffset(slot_index); | 60 FrameOffset offset = frame_access_state()->GetFrameOffset(slot_index); |
(...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2143 } else { | 2147 } else { |
2144 __ movl(dst, Immediate(value)); | 2148 __ movl(dst, Immediate(value)); |
2145 } | 2149 } |
2146 } | 2150 } |
2147 break; | 2151 break; |
2148 } | 2152 } |
2149 case Constant::kInt64: | 2153 case Constant::kInt64: |
2150 if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE) { | 2154 if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE) { |
2151 __ movq(dst, src.ToInt64(), src.rmode()); | 2155 __ movq(dst, src.ToInt64(), src.rmode()); |
2152 } else { | 2156 } else { |
| 2157 DCHECK(src.rmode() != RelocInfo::WASM_MEMORY_SIZE_REFERENCE); |
2153 __ Set(dst, src.ToInt64()); | 2158 __ Set(dst, src.ToInt64()); |
2154 } | 2159 } |
2155 break; | 2160 break; |
2156 case Constant::kFloat32: | 2161 case Constant::kFloat32: |
2157 __ Move(dst, | 2162 __ Move(dst, |
2158 isolate()->factory()->NewNumber(src.ToFloat32(), TENURED)); | 2163 isolate()->factory()->NewNumber(src.ToFloat32(), TENURED)); |
2159 break; | 2164 break; |
2160 case Constant::kFloat64: | 2165 case Constant::kFloat64: |
2161 __ Move(dst, | 2166 __ Move(dst, |
2162 isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); | 2167 isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2317 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2313 __ Nop(padding_size); | 2318 __ Nop(padding_size); |
2314 } | 2319 } |
2315 } | 2320 } |
2316 | 2321 |
2317 #undef __ | 2322 #undef __ |
2318 | 2323 |
2319 } // namespace compiler | 2324 } // namespace compiler |
2320 } // namespace internal | 2325 } // namespace internal |
2321 } // namespace v8 | 2326 } // namespace v8 |
OLD | NEW |