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 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 } | 2555 } |
2556 } | 2556 } |
2557 } else if (destination->IsRegister()) { | 2557 } else if (destination->IsRegister()) { |
2558 Register dst = g.ToRegister(destination); | 2558 Register dst = g.ToRegister(destination); |
2559 __ Move(dst, g.ToImmediate(source)); | 2559 __ Move(dst, g.ToImmediate(source)); |
2560 } else if (destination->IsStackSlot()) { | 2560 } else if (destination->IsStackSlot()) { |
2561 Operand dst = g.ToOperand(destination); | 2561 Operand dst = g.ToOperand(destination); |
2562 __ Move(dst, g.ToImmediate(source)); | 2562 __ Move(dst, g.ToImmediate(source)); |
2563 } else if (src_constant.type() == Constant::kFloat32) { | 2563 } else if (src_constant.type() == Constant::kFloat32) { |
2564 // TODO(turbofan): Can we do better here? | 2564 // TODO(turbofan): Can we do better here? |
2565 uint32_t src = bit_cast<uint32_t>(src_constant.ToFloat32()); | 2565 uint32_t src = src_constant.ToFloat32AsInt(); |
2566 if (destination->IsFPRegister()) { | 2566 if (destination->IsFPRegister()) { |
2567 __ sub(esp, Immediate(kInt32Size)); | 2567 __ sub(esp, Immediate(kInt32Size)); |
2568 __ mov(MemOperand(esp, 0), Immediate(src)); | 2568 __ mov(MemOperand(esp, 0), Immediate(src)); |
2569 // always only push one value into the x87 stack. | 2569 // always only push one value into the x87 stack. |
2570 __ fstp(0); | 2570 __ fstp(0); |
2571 __ fld_s(MemOperand(esp, 0)); | 2571 __ fld_s(MemOperand(esp, 0)); |
2572 __ add(esp, Immediate(kInt32Size)); | 2572 __ add(esp, Immediate(kInt32Size)); |
2573 } else { | 2573 } else { |
2574 DCHECK(destination->IsFPStackSlot()); | 2574 DCHECK(destination->IsFPStackSlot()); |
2575 Operand dst = g.ToOperand(destination); | 2575 Operand dst = g.ToOperand(destination); |
2576 __ Move(dst, Immediate(src)); | 2576 __ Move(dst, Immediate(src)); |
2577 } | 2577 } |
2578 } else { | 2578 } else { |
2579 DCHECK_EQ(Constant::kFloat64, src_constant.type()); | 2579 DCHECK_EQ(Constant::kFloat64, src_constant.type()); |
2580 uint64_t src = bit_cast<uint64_t>(src_constant.ToFloat64()); | 2580 uint64_t src = src_constant.ToFloat64AsInt(); |
2581 uint32_t lower = static_cast<uint32_t>(src); | 2581 uint32_t lower = static_cast<uint32_t>(src); |
2582 uint32_t upper = static_cast<uint32_t>(src >> 32); | 2582 uint32_t upper = static_cast<uint32_t>(src >> 32); |
2583 if (destination->IsFPRegister()) { | 2583 if (destination->IsFPRegister()) { |
2584 __ sub(esp, Immediate(kDoubleSize)); | 2584 __ sub(esp, Immediate(kDoubleSize)); |
2585 __ mov(MemOperand(esp, 0), Immediate(lower)); | 2585 __ mov(MemOperand(esp, 0), Immediate(lower)); |
2586 __ mov(MemOperand(esp, kInt32Size), Immediate(upper)); | 2586 __ mov(MemOperand(esp, kInt32Size), Immediate(upper)); |
2587 // always only push one value into the x87 stack. | 2587 // always only push one value into the x87 stack. |
2588 __ fstp(0); | 2588 __ fstp(0); |
2589 __ fld_d(MemOperand(esp, 0)); | 2589 __ fld_d(MemOperand(esp, 0)); |
2590 __ add(esp, Immediate(kDoubleSize)); | 2590 __ add(esp, Immediate(kDoubleSize)); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2736 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2736 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2737 __ Nop(padding_size); | 2737 __ Nop(padding_size); |
2738 } | 2738 } |
2739 } | 2739 } |
2740 | 2740 |
2741 #undef __ | 2741 #undef __ |
2742 | 2742 |
2743 } // namespace compiler | 2743 } // namespace compiler |
2744 } // namespace internal | 2744 } // namespace internal |
2745 } // namespace v8 | 2745 } // namespace v8 |
OLD | NEW |