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/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 } | 898 } |
899 } | 899 } |
900 } else if (destination->IsRegister()) { | 900 } else if (destination->IsRegister()) { |
901 Register dst = g.ToRegister(destination); | 901 Register dst = g.ToRegister(destination); |
902 __ mov(dst, g.ToImmediate(source)); | 902 __ mov(dst, g.ToImmediate(source)); |
903 } else if (destination->IsStackSlot()) { | 903 } else if (destination->IsStackSlot()) { |
904 Operand dst = g.ToOperand(destination); | 904 Operand dst = g.ToOperand(destination); |
905 __ mov(dst, g.ToImmediate(source)); | 905 __ mov(dst, g.ToImmediate(source)); |
906 } else if (src_constant.type() == Constant::kFloat32) { | 906 } else if (src_constant.type() == Constant::kFloat32) { |
907 // TODO(turbofan): Can we do better here? | 907 // TODO(turbofan): Can we do better here? |
908 Immediate src(bit_cast<int32_t>(src_constant.ToFloat32())); | 908 uint32_t src = bit_cast<uint32_t>(src_constant.ToFloat32()); |
909 if (destination->IsDoubleRegister()) { | 909 if (destination->IsDoubleRegister()) { |
910 XMMRegister dst = g.ToDoubleRegister(destination); | 910 XMMRegister dst = g.ToDoubleRegister(destination); |
911 __ push(Immediate(src)); | 911 __ Move(dst, src); |
912 __ movss(dst, Operand(esp, 0)); | |
913 __ add(esp, Immediate(kDoubleSize / 2)); | |
914 } else { | 912 } else { |
915 DCHECK(destination->IsDoubleStackSlot()); | 913 DCHECK(destination->IsDoubleStackSlot()); |
916 Operand dst = g.ToOperand(destination); | 914 Operand dst = g.ToOperand(destination); |
917 __ mov(dst, src); | 915 __ mov(dst, Immediate(src)); |
918 } | 916 } |
919 } else { | 917 } else { |
920 DCHECK_EQ(Constant::kFloat64, src_constant.type()); | 918 DCHECK_EQ(Constant::kFloat64, src_constant.type()); |
921 double v = src_constant.ToFloat64(); | 919 uint64_t src = bit_cast<uint64_t>(src_constant.ToFloat64()); |
922 uint64_t int_val = bit_cast<uint64_t, double>(v); | 920 uint32_t lower = static_cast<uint32_t>(src); |
923 int32_t lower = static_cast<int32_t>(int_val); | 921 uint32_t upper = static_cast<uint32_t>(src >> 32); |
924 int32_t upper = static_cast<int32_t>(int_val >> kBitsPerInt); | |
925 if (destination->IsDoubleRegister()) { | 922 if (destination->IsDoubleRegister()) { |
926 XMMRegister dst = g.ToDoubleRegister(destination); | 923 XMMRegister dst = g.ToDoubleRegister(destination); |
927 __ Move(dst, v); | 924 __ Move(dst, src); |
928 } else { | 925 } else { |
929 DCHECK(destination->IsDoubleStackSlot()); | 926 DCHECK(destination->IsDoubleStackSlot()); |
930 Operand dst0 = g.ToOperand(destination); | 927 Operand dst0 = g.ToOperand(destination); |
931 Operand dst1 = g.HighOperand(destination); | 928 Operand dst1 = g.HighOperand(destination); |
932 __ mov(dst0, Immediate(lower)); | 929 __ mov(dst0, Immediate(lower)); |
933 __ mov(dst1, Immediate(upper)); | 930 __ mov(dst1, Immediate(upper)); |
934 } | 931 } |
935 } | 932 } |
936 } else if (source->IsDoubleRegister()) { | 933 } else if (source->IsDoubleRegister()) { |
937 XMMRegister src = g.ToDoubleRegister(source); | 934 XMMRegister src = g.ToDoubleRegister(source); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 } | 1029 } |
1033 } | 1030 } |
1034 MarkLazyDeoptSite(); | 1031 MarkLazyDeoptSite(); |
1035 } | 1032 } |
1036 | 1033 |
1037 #undef __ | 1034 #undef __ |
1038 | 1035 |
1039 } // namespace compiler | 1036 } // namespace compiler |
1040 } // namespace internal | 1037 } // namespace internal |
1041 } // namespace v8 | 1038 } // namespace v8 |
OLD | NEW |