| 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 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2122 } else { | 2126 } else { |
| 2123 __ movl(dst, Immediate(value)); | 2127 __ movl(dst, Immediate(value)); |
| 2124 } | 2128 } |
| 2125 } | 2129 } |
| 2126 break; | 2130 break; |
| 2127 } | 2131 } |
| 2128 case Constant::kInt64: | 2132 case Constant::kInt64: |
| 2129 if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE) { | 2133 if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE) { |
| 2130 __ movq(dst, src.ToInt64(), src.rmode()); | 2134 __ movq(dst, src.ToInt64(), src.rmode()); |
| 2131 } else { | 2135 } else { |
| 2136 DCHECK(src.rmode() != RelocInfo::WASM_MEMORY_SIZE_REFERENCE); |
| 2132 __ Set(dst, src.ToInt64()); | 2137 __ Set(dst, src.ToInt64()); |
| 2133 } | 2138 } |
| 2134 break; | 2139 break; |
| 2135 case Constant::kFloat32: | 2140 case Constant::kFloat32: |
| 2136 __ Move(dst, | 2141 __ Move(dst, |
| 2137 isolate()->factory()->NewNumber(src.ToFloat32(), TENURED)); | 2142 isolate()->factory()->NewNumber(src.ToFloat32(), TENURED)); |
| 2138 break; | 2143 break; |
| 2139 case Constant::kFloat64: | 2144 case Constant::kFloat64: |
| 2140 __ Move(dst, | 2145 __ Move(dst, |
| 2141 isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); | 2146 isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2294 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2299 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
| 2295 __ Nop(padding_size); | 2300 __ Nop(padding_size); |
| 2296 } | 2301 } |
| 2297 } | 2302 } |
| 2298 | 2303 |
| 2299 #undef __ | 2304 #undef __ |
| 2300 | 2305 |
| 2301 } // namespace compiler | 2306 } // namespace compiler |
| 2302 } // namespace internal | 2307 } // namespace internal |
| 2303 } // namespace v8 | 2308 } // namespace v8 |
| OLD | NEW |