| 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/compilation-info.h" | 7 #include "src/compilation-info.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 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 Operand OutputOperand() { return ToOperand(instr_->Output()); } | 36 Operand OutputOperand() { return ToOperand(instr_->Output()); } |
| 37 | 37 |
| 38 Immediate ToImmediate(InstructionOperand* operand) { | 38 Immediate ToImmediate(InstructionOperand* operand) { |
| 39 Constant constant = ToConstant(operand); | 39 Constant constant = ToConstant(operand); |
| 40 if (constant.type() == Constant::kFloat64) { | 40 if (constant.type() == Constant::kFloat64) { |
| 41 DCHECK_EQ(0, bit_cast<int64_t>(constant.ToFloat64())); | 41 DCHECK_EQ(0, bit_cast<int64_t>(constant.ToFloat64())); |
| 42 return Immediate(0); | 42 return Immediate(0); |
| 43 } | 43 } |
| 44 if (constant.rmode() == RelocInfo::WASM_MEMORY_REFERENCE || | 44 if (RelocInfo::IsWasmReference(constant.rmode())) { |
| 45 constant.rmode() == RelocInfo::WASM_MEMORY_SIZE_REFERENCE || | |
| 46 constant.rmode() == RelocInfo::WASM_GLOBAL_REFERENCE) { | |
| 47 return Immediate(constant.ToInt32(), constant.rmode()); | 45 return Immediate(constant.ToInt32(), constant.rmode()); |
| 48 } | 46 } |
| 49 return Immediate(constant.ToInt32()); | 47 return Immediate(constant.ToInt32()); |
| 50 } | 48 } |
| 51 | 49 |
| 52 Operand ToOperand(InstructionOperand* op, int extra = 0) { | 50 Operand ToOperand(InstructionOperand* op, int extra = 0) { |
| 53 DCHECK(op->IsStackSlot() || op->IsFPStackSlot()); | 51 DCHECK(op->IsStackSlot() || op->IsFPStackSlot()); |
| 54 return SlotToOperand(AllocatedOperand::cast(op)->index(), extra); | 52 return SlotToOperand(AllocatedOperand::cast(op)->index(), extra); |
| 55 } | 53 } |
| 56 | 54 |
| (...skipping 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2500 case Constant::kInt32: { | 2498 case Constant::kInt32: { |
| 2501 if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE || | 2499 if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE || |
| 2502 src.rmode() == RelocInfo::WASM_GLOBAL_REFERENCE) { | 2500 src.rmode() == RelocInfo::WASM_GLOBAL_REFERENCE) { |
| 2503 __ movq(dst, src.ToInt64(), src.rmode()); | 2501 __ movq(dst, src.ToInt64(), src.rmode()); |
| 2504 } else { | 2502 } else { |
| 2505 // TODO(dcarney): don't need scratch in this case. | 2503 // TODO(dcarney): don't need scratch in this case. |
| 2506 int32_t value = src.ToInt32(); | 2504 int32_t value = src.ToInt32(); |
| 2507 if (value == 0) { | 2505 if (value == 0) { |
| 2508 __ xorl(dst, dst); | 2506 __ xorl(dst, dst); |
| 2509 } else { | 2507 } else { |
| 2510 if (src.rmode() == RelocInfo::WASM_MEMORY_SIZE_REFERENCE) { | 2508 if (RelocInfo::IsWasmSizeReference(src.rmode())) { |
| 2511 __ movl(dst, Immediate(value, src.rmode())); | 2509 __ movl(dst, Immediate(value, src.rmode())); |
| 2512 } else { | 2510 } else { |
| 2513 __ movl(dst, Immediate(value)); | 2511 __ movl(dst, Immediate(value)); |
| 2514 } | 2512 } |
| 2515 } | 2513 } |
| 2516 } | 2514 } |
| 2517 break; | 2515 break; |
| 2518 } | 2516 } |
| 2519 case Constant::kInt64: | 2517 case Constant::kInt64: |
| 2520 if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE || | 2518 if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE || |
| 2521 src.rmode() == RelocInfo::WASM_GLOBAL_REFERENCE) { | 2519 src.rmode() == RelocInfo::WASM_GLOBAL_REFERENCE) { |
| 2522 __ movq(dst, src.ToInt64(), src.rmode()); | 2520 __ movq(dst, src.ToInt64(), src.rmode()); |
| 2523 } else { | 2521 } else { |
| 2524 DCHECK(src.rmode() != RelocInfo::WASM_MEMORY_SIZE_REFERENCE); | 2522 DCHECK(!RelocInfo::IsWasmReference(src.rmode())); |
| 2525 __ Set(dst, src.ToInt64()); | 2523 __ Set(dst, src.ToInt64()); |
| 2526 } | 2524 } |
| 2527 break; | 2525 break; |
| 2528 case Constant::kFloat32: | 2526 case Constant::kFloat32: |
| 2529 __ Move(dst, | 2527 __ Move(dst, |
| 2530 isolate()->factory()->NewNumber(src.ToFloat32(), TENURED)); | 2528 isolate()->factory()->NewNumber(src.ToFloat32(), TENURED)); |
| 2531 break; | 2529 break; |
| 2532 case Constant::kFloat64: | 2530 case Constant::kFloat64: |
| 2533 __ Move(dst, | 2531 __ Move(dst, |
| 2534 isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); | 2532 isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2720 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2718 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
| 2721 __ Nop(padding_size); | 2719 __ Nop(padding_size); |
| 2722 } | 2720 } |
| 2723 } | 2721 } |
| 2724 | 2722 |
| 2725 #undef __ | 2723 #undef __ |
| 2726 | 2724 |
| 2727 } // namespace compiler | 2725 } // namespace compiler |
| 2728 } // namespace internal | 2726 } // namespace internal |
| 2729 } // namespace v8 | 2727 } // namespace v8 |
| OLD | NEW |