OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 isolate()); | 1113 isolate()); |
1114 mov(Operand::StaticVariable(c_entry_fp_address), ebp); | 1114 mov(Operand::StaticVariable(c_entry_fp_address), ebp); |
1115 mov(Operand::StaticVariable(context_address), esi); | 1115 mov(Operand::StaticVariable(context_address), esi); |
1116 } | 1116 } |
1117 | 1117 |
1118 | 1118 |
1119 void MacroAssembler::EnterExitFrameEpilogue(int argc, bool save_doubles) { | 1119 void MacroAssembler::EnterExitFrameEpilogue(int argc, bool save_doubles) { |
1120 // Optionally save all XMM registers. | 1120 // Optionally save all XMM registers. |
1121 if (save_doubles) { | 1121 if (save_doubles) { |
1122 CpuFeatureScope scope(this, SSE2); | 1122 CpuFeatureScope scope(this, SSE2); |
1123 int space = XMMRegister::kNumRegisters * kDoubleSize + argc * kPointerSize; | 1123 int space = XMMRegister::kNumRegisters * kFloat32x4Size + |
| 1124 argc * kPointerSize; |
1124 sub(esp, Immediate(space)); | 1125 sub(esp, Immediate(space)); |
1125 const int offset = -2 * kPointerSize; | 1126 const int offset = -2 * kPointerSize; |
1126 for (int i = 0; i < XMMRegister::kNumRegisters; i++) { | 1127 for (int i = 0; i < XMMRegister::kNumRegisters; i++) { |
1127 XMMRegister reg = XMMRegister::from_code(i); | 1128 XMMRegister reg = XMMRegister::from_code(i); |
1128 movsd(Operand(ebp, offset - ((i + 1) * kDoubleSize)), reg); | 1129 movups(Operand(ebp, offset - ((i + 1) * kFloat32x4Size)), reg); |
1129 } | 1130 } |
1130 } else { | 1131 } else { |
1131 sub(esp, Immediate(argc * kPointerSize)); | 1132 sub(esp, Immediate(argc * kPointerSize)); |
1132 } | 1133 } |
1133 | 1134 |
1134 // Get the required frame alignment for the OS. | 1135 // Get the required frame alignment for the OS. |
1135 const int kFrameAlignment = OS::ActivationFrameAlignment(); | 1136 const int kFrameAlignment = OS::ActivationFrameAlignment(); |
1136 if (kFrameAlignment > 0) { | 1137 if (kFrameAlignment > 0) { |
1137 ASSERT(IsPowerOf2(kFrameAlignment)); | 1138 ASSERT(IsPowerOf2(kFrameAlignment)); |
1138 and_(esp, -kFrameAlignment); | 1139 and_(esp, -kFrameAlignment); |
(...skipping 23 matching lines...) Expand all Loading... |
1162 } | 1163 } |
1163 | 1164 |
1164 | 1165 |
1165 void MacroAssembler::LeaveExitFrame(bool save_doubles) { | 1166 void MacroAssembler::LeaveExitFrame(bool save_doubles) { |
1166 // Optionally restore all XMM registers. | 1167 // Optionally restore all XMM registers. |
1167 if (save_doubles) { | 1168 if (save_doubles) { |
1168 CpuFeatureScope scope(this, SSE2); | 1169 CpuFeatureScope scope(this, SSE2); |
1169 const int offset = -2 * kPointerSize; | 1170 const int offset = -2 * kPointerSize; |
1170 for (int i = 0; i < XMMRegister::kNumRegisters; i++) { | 1171 for (int i = 0; i < XMMRegister::kNumRegisters; i++) { |
1171 XMMRegister reg = XMMRegister::from_code(i); | 1172 XMMRegister reg = XMMRegister::from_code(i); |
1172 movsd(reg, Operand(ebp, offset - ((i + 1) * kDoubleSize))); | 1173 movups(reg, Operand(ebp, offset - ((i + 1) * kFloat32x4Size))); |
1173 } | 1174 } |
1174 } | 1175 } |
1175 | 1176 |
1176 // Get the return address from the stack and restore the frame pointer. | 1177 // Get the return address from the stack and restore the frame pointer. |
1177 mov(ecx, Operand(ebp, 1 * kPointerSize)); | 1178 mov(ecx, Operand(ebp, 1 * kPointerSize)); |
1178 mov(ebp, Operand(ebp, 0 * kPointerSize)); | 1179 mov(ebp, Operand(ebp, 0 * kPointerSize)); |
1179 | 1180 |
1180 // Pop the arguments and the receiver from the caller stack. | 1181 // Pop the arguments and the receiver from the caller stack. |
1181 lea(esp, Operand(esi, 1 * kPointerSize)); | 1182 lea(esp, Operand(esi, 1 * kPointerSize)); |
1182 | 1183 |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1828 // Allocate heap number in new space. | 1829 // Allocate heap number in new space. |
1829 Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required, | 1830 Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required, |
1830 TAG_OBJECT); | 1831 TAG_OBJECT); |
1831 | 1832 |
1832 // Set the map. | 1833 // Set the map. |
1833 mov(FieldOperand(result, HeapObject::kMapOffset), | 1834 mov(FieldOperand(result, HeapObject::kMapOffset), |
1834 Immediate(isolate()->factory()->heap_number_map())); | 1835 Immediate(isolate()->factory()->heap_number_map())); |
1835 } | 1836 } |
1836 | 1837 |
1837 | 1838 |
| 1839 void MacroAssembler::AllocateFloat32x4(Register result, |
| 1840 Register scratch, |
| 1841 Label* gc_required) { |
| 1842 // Allocate heap number in new space. |
| 1843 Allocate(Float32x4::kSize, result, scratch, no_reg, gc_required, TAG_OBJECT); |
| 1844 |
| 1845 // Set the map. |
| 1846 mov(FieldOperand(result, HeapObject::kMapOffset), |
| 1847 Immediate(isolate()->factory()->float32x4_map())); |
| 1848 } |
| 1849 |
| 1850 |
| 1851 void MacroAssembler::AllocateInt32x4(Register result, |
| 1852 Register scratch, |
| 1853 Label* gc_required) { |
| 1854 // Allocate heap number in new space. |
| 1855 Allocate(Int32x4::kSize, result, scratch, no_reg, gc_required, TAG_OBJECT); |
| 1856 |
| 1857 // Set the map. |
| 1858 mov(FieldOperand(result, HeapObject::kMapOffset), |
| 1859 Immediate(isolate()->factory()->int32x4_map())); |
| 1860 } |
| 1861 |
| 1862 |
1838 void MacroAssembler::AllocateTwoByteString(Register result, | 1863 void MacroAssembler::AllocateTwoByteString(Register result, |
1839 Register length, | 1864 Register length, |
1840 Register scratch1, | 1865 Register scratch1, |
1841 Register scratch2, | 1866 Register scratch2, |
1842 Register scratch3, | 1867 Register scratch3, |
1843 Label* gc_required) { | 1868 Label* gc_required) { |
1844 // Calculate the number of bytes needed for the characters in the string while | 1869 // Calculate the number of bytes needed for the characters in the string while |
1845 // observing object alignment. | 1870 // observing object alignment. |
1846 ASSERT((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0); | 1871 ASSERT((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0); |
1847 ASSERT(kShortSize == 2); | 1872 ASSERT(kShortSize == 2); |
(...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3690 mov(scratch1, FieldOperand(current, Map::kBitField2Offset)); | 3715 mov(scratch1, FieldOperand(current, Map::kBitField2Offset)); |
3691 and_(scratch1, Map::kElementsKindMask); | 3716 and_(scratch1, Map::kElementsKindMask); |
3692 shr(scratch1, Map::kElementsKindShift); | 3717 shr(scratch1, Map::kElementsKindShift); |
3693 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); | 3718 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); |
3694 j(equal, found); | 3719 j(equal, found); |
3695 mov(current, FieldOperand(current, Map::kPrototypeOffset)); | 3720 mov(current, FieldOperand(current, Map::kPrototypeOffset)); |
3696 cmp(current, Immediate(factory->null_value())); | 3721 cmp(current, Immediate(factory->null_value())); |
3697 j(not_equal, &loop_again); | 3722 j(not_equal, &loop_again); |
3698 } | 3723 } |
3699 | 3724 |
| 3725 |
| 3726 void MacroAssembler::absps(XMMRegister dst) { |
| 3727 static const struct V8_ALIGNED(16) { |
| 3728 uint32_t a; |
| 3729 uint32_t b; |
| 3730 uint32_t c; |
| 3731 uint32_t d; |
| 3732 } float_absolute_constant = |
| 3733 { 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF }; |
| 3734 andps(dst, |
| 3735 Operand(reinterpret_cast<int32_t>(&float_absolute_constant))); |
| 3736 } |
| 3737 |
| 3738 |
| 3739 void MacroAssembler::notps(XMMRegister dst) { |
| 3740 static const struct V8_ALIGNED(16) { |
| 3741 uint32_t a; |
| 3742 uint32_t b; |
| 3743 uint32_t c; |
| 3744 uint32_t d; |
| 3745 } float_not_constant = |
| 3746 { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; |
| 3747 xorps(dst, |
| 3748 Operand(Operand(reinterpret_cast<int32_t>(&float_not_constant)))); |
| 3749 } |
| 3750 |
| 3751 |
| 3752 void MacroAssembler::negateps(XMMRegister dst) { |
| 3753 static const struct V8_ALIGNED(16) { |
| 3754 uint32_t a; |
| 3755 uint32_t b; |
| 3756 uint32_t c; |
| 3757 uint32_t d; |
| 3758 } float_negate_constant = |
| 3759 { 0x80000000, 0x80000000, 0x80000000, 0x80000000 }; |
| 3760 xorps(dst, |
| 3761 Operand(Operand(reinterpret_cast<int32_t>(&float_negate_constant)))); |
| 3762 } |
| 3763 |
| 3764 |
| 3765 void MacroAssembler::pnegd(XMMRegister dst) { |
| 3766 static const struct V8_ALIGNED(16) { |
| 3767 uint32_t a; |
| 3768 uint32_t b; |
| 3769 uint32_t c; |
| 3770 uint32_t d; |
| 3771 } int32_one_constant = { 0x1, 0x1, 0x1, 0x1 }; |
| 3772 notps(dst); |
| 3773 paddd(dst, |
| 3774 Operand(Operand(reinterpret_cast<int32_t>(&int32_one_constant)))); |
| 3775 } |
| 3776 |
| 3777 |
3700 } } // namespace v8::internal | 3778 } } // namespace v8::internal |
3701 | 3779 |
3702 #endif // V8_TARGET_ARCH_IA32 | 3780 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |