OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 Abort("Unimplemented: %s", "DoShiftI"); | 777 Abort("Unimplemented: %s", "DoShiftI"); |
778 } | 778 } |
779 | 779 |
780 | 780 |
781 void LCodeGen::DoSubI(LSubI* instr) { | 781 void LCodeGen::DoSubI(LSubI* instr) { |
782 Abort("Unimplemented: %s", "DoSubI"); | 782 Abort("Unimplemented: %s", "DoSubI"); |
783 } | 783 } |
784 | 784 |
785 | 785 |
786 void LCodeGen::DoConstantI(LConstantI* instr) { | 786 void LCodeGen::DoConstantI(LConstantI* instr) { |
787 Abort("Unimplemented: %s", "DoConstantI"); | 787 ASSERT(instr->result()->IsRegister()); |
| 788 __ movl(ToRegister(instr->result()), Immediate(instr->value())); |
788 } | 789 } |
789 | 790 |
790 | 791 |
791 void LCodeGen::DoConstantD(LConstantD* instr) { | 792 void LCodeGen::DoConstantD(LConstantD* instr) { |
792 Abort("Unimplemented: %s", "DoConstantI"); | 793 ASSERT(instr->result()->IsDoubleRegister()); |
| 794 XMMRegister res = ToDoubleRegister(instr->result()); |
| 795 double v = instr->value(); |
| 796 // Use xor to produce +0.0 in a fast and compact way, but avoid to |
| 797 // do so if the constant is -0.0. |
| 798 if (BitCast<uint64_t, double>(v) == 0) { |
| 799 __ xorpd(res, res); |
| 800 } else { |
| 801 Register tmp = ToRegister(instr->TempAt(0)); |
| 802 int32_t v_int32 = static_cast<int32_t>(v); |
| 803 if (static_cast<double>(v_int32) == v) { |
| 804 __ movl(tmp, Immediate(v_int32)); |
| 805 __ cvtlsi2sd(res, tmp); |
| 806 } else { |
| 807 uint64_t int_val = BitCast<uint64_t, double>(v); |
| 808 __ Set(tmp, int_val); |
| 809 __ movd(res, tmp); |
| 810 } |
| 811 } |
793 } | 812 } |
794 | 813 |
795 | 814 |
796 void LCodeGen::DoConstantT(LConstantT* instr) { | 815 void LCodeGen::DoConstantT(LConstantT* instr) { |
797 ASSERT(instr->result()->IsRegister()); | 816 ASSERT(instr->result()->IsRegister()); |
798 __ Move(ToRegister(instr->result()), instr->value()); | 817 __ Move(ToRegister(instr->result()), instr->value()); |
799 } | 818 } |
800 | 819 |
801 | 820 |
802 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) { | 821 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 void LCodeGen::DoIsSmi(LIsSmi* instr) { | 991 void LCodeGen::DoIsSmi(LIsSmi* instr) { |
973 Abort("Unimplemented: %s", "DoIsSmi"); | 992 Abort("Unimplemented: %s", "DoIsSmi"); |
974 } | 993 } |
975 | 994 |
976 | 995 |
977 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { | 996 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { |
978 Abort("Unimplemented: %s", "DoIsSmiAndBranch"); | 997 Abort("Unimplemented: %s", "DoIsSmiAndBranch"); |
979 } | 998 } |
980 | 999 |
981 | 1000 |
982 InstanceType LHasInstanceType::TestType() { | |
983 InstanceType from = hydrogen()->from(); | |
984 InstanceType to = hydrogen()->to(); | |
985 if (from == FIRST_TYPE) return to; | |
986 ASSERT(from == to || to == LAST_TYPE); | |
987 return from; | |
988 } | |
989 | |
990 | |
991 | |
992 Condition LHasInstanceType::BranchCondition() { | |
993 InstanceType from = hydrogen()->from(); | |
994 InstanceType to = hydrogen()->to(); | |
995 if (from == to) return equal; | |
996 if (to == LAST_TYPE) return above_equal; | |
997 if (from == FIRST_TYPE) return below_equal; | |
998 UNREACHABLE(); | |
999 return equal; | |
1000 } | |
1001 | |
1002 | |
1003 void LCodeGen::DoHasInstanceType(LHasInstanceType* instr) { | 1001 void LCodeGen::DoHasInstanceType(LHasInstanceType* instr) { |
1004 Abort("Unimplemented: %s", "DoHasInstanceType"); | 1002 Abort("Unimplemented: %s", "DoHasInstanceType"); |
1005 } | 1003 } |
1006 | 1004 |
1007 | 1005 |
1008 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) { | 1006 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) { |
1009 Abort("Unimplemented: %s", "DoHasInstanceTypeAndBranch"); | 1007 Abort("Unimplemented: %s", "DoHasInstanceTypeAndBranch"); |
1010 } | 1008 } |
1011 | 1009 |
1012 | 1010 |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 | 1464 |
1467 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 1465 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
1468 Abort("Unimplemented: %s", "DoOsrEntry"); | 1466 Abort("Unimplemented: %s", "DoOsrEntry"); |
1469 } | 1467 } |
1470 | 1468 |
1471 #undef __ | 1469 #undef __ |
1472 | 1470 |
1473 } } // namespace v8::internal | 1471 } } // namespace v8::internal |
1474 | 1472 |
1475 #endif // V8_TARGET_ARCH_X64 | 1473 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |