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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
793 // instruction, not even into the zero register. | 793 // instruction, not even into the zero register. |
794 ASSERT(!AreAliased(dst0, dst1, dst2, dst3)); | 794 ASSERT(!AreAliased(dst0, dst1, dst2, dst3)); |
795 ASSERT(AreSameSizeAndType(dst0, dst1, dst2, dst3)); | 795 ASSERT(AreSameSizeAndType(dst0, dst1, dst2, dst3)); |
796 ASSERT(dst0.IsValid()); | 796 ASSERT(dst0.IsValid()); |
797 | 797 |
798 int count = 1 + dst1.IsValid() + dst2.IsValid() + dst3.IsValid(); | 798 int count = 1 + dst1.IsValid() + dst2.IsValid() + dst3.IsValid(); |
799 int size = dst0.SizeInBytes(); | 799 int size = dst0.SizeInBytes(); |
800 | 800 |
801 PrepareForPop(count, size); | 801 PrepareForPop(count, size); |
802 PopHelper(count, size, dst0, dst1, dst2, dst3); | 802 PopHelper(count, size, dst0, dst1, dst2, dst3); |
803 | |
804 if (!csp.Is(StackPointer()) && emit_debug_code()) { | |
805 // It is safe to leave csp where it is when unwinding the JavaScript stack, | |
806 // but if we keep it matching StackPointer, the simulator can detect memory | |
807 // accesses in the now-free part of the stack. | |
808 Mov(csp, StackPointer()); | |
jbramley
2014/05/01 15:17:10
It would be better to leave this here (or replace
rmcilroy
2014/05/01 18:29:11
I see what you mean, but actually, looking at it a
| |
809 } | |
810 } | 803 } |
811 | 804 |
812 | 805 |
813 void MacroAssembler::PushPopQueue::PushQueued() { | 806 void MacroAssembler::PushPopQueue::PushQueued() { |
814 if (queued_.empty()) return; | 807 if (queued_.empty()) return; |
815 | 808 |
816 masm_->PrepareForPush(size_); | 809 masm_->PrepareForPush(size_); |
817 | 810 |
818 int count = queued_.size(); | 811 int count = queued_.size(); |
819 int index = 0; | 812 int index = 0; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
888 // order to maintain the 16-byte alignment for csp. | 881 // order to maintain the 16-byte alignment for csp. |
889 while (!registers.IsEmpty()) { | 882 while (!registers.IsEmpty()) { |
890 int count_before = registers.Count(); | 883 int count_before = registers.Count(); |
891 const CPURegister& dst0 = registers.PopLowestIndex(); | 884 const CPURegister& dst0 = registers.PopLowestIndex(); |
892 const CPURegister& dst1 = registers.PopLowestIndex(); | 885 const CPURegister& dst1 = registers.PopLowestIndex(); |
893 const CPURegister& dst2 = registers.PopLowestIndex(); | 886 const CPURegister& dst2 = registers.PopLowestIndex(); |
894 const CPURegister& dst3 = registers.PopLowestIndex(); | 887 const CPURegister& dst3 = registers.PopLowestIndex(); |
895 int count = count_before - registers.Count(); | 888 int count = count_before - registers.Count(); |
896 PopHelper(count, size, dst0, dst1, dst2, dst3); | 889 PopHelper(count, size, dst0, dst1, dst2, dst3); |
897 } | 890 } |
898 | |
899 if (!csp.Is(StackPointer()) && emit_debug_code()) { | |
900 // It is safe to leave csp where it is when unwinding the JavaScript stack, | |
901 // but if we keep it matching StackPointer, the simulator can detect memory | |
902 // accesses in the now-free part of the stack. | |
903 Mov(csp, StackPointer()); | |
904 } | |
905 } | 891 } |
906 | 892 |
907 | 893 |
908 void MacroAssembler::PushMultipleTimes(CPURegister src, int count) { | 894 void MacroAssembler::PushMultipleTimes(CPURegister src, int count) { |
909 int size = src.SizeInBytes(); | 895 int size = src.SizeInBytes(); |
910 | 896 |
911 PrepareForPush(count, size); | 897 PrepareForPush(count, size); |
912 | 898 |
913 if (FLAG_optimize_for_size && count > 8) { | 899 if (FLAG_optimize_for_size && count > 8) { |
914 UseScratchRegisterScope temps(this); | 900 UseScratchRegisterScope temps(this); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1097 if (csp.Is(StackPointer())) { | 1083 if (csp.Is(StackPointer())) { |
1098 // If the current stack pointer is csp, then it must be aligned to 16 bytes | 1084 // If the current stack pointer is csp, then it must be aligned to 16 bytes |
1099 // on entry and the total size of the specified registers must also be a | 1085 // on entry and the total size of the specified registers must also be a |
1100 // multiple of 16 bytes. | 1086 // multiple of 16 bytes. |
1101 if (total_size.IsImmediate()) { | 1087 if (total_size.IsImmediate()) { |
1102 ASSERT((total_size.immediate() % 16) == 0); | 1088 ASSERT((total_size.immediate() % 16) == 0); |
1103 } | 1089 } |
1104 | 1090 |
1105 // Don't check access size for non-immediate sizes. It's difficult to do | 1091 // Don't check access size for non-immediate sizes. It's difficult to do |
1106 // well, and it will be caught by hardware (or the simulator) anyway. | 1092 // well, and it will be caught by hardware (or the simulator) anyway. |
1093 } else if (emit_debug_code()) { | |
1094 // It is safe to leave csp where it is when unwinding the JavaScript stack, | |
1095 // but if we keep it matching StackPointer, the simulator can detect memory | |
1096 // accesses in the now-free part of the stack. | |
1097 SyncSystemStackPointer(); | |
1107 } | 1098 } |
1108 } | 1099 } |
1109 | 1100 |
1110 | 1101 |
1111 void MacroAssembler::Poke(const CPURegister& src, const Operand& offset) { | 1102 void MacroAssembler::Poke(const CPURegister& src, const Operand& offset) { |
1112 if (offset.IsImmediate()) { | 1103 if (offset.IsImmediate()) { |
1113 ASSERT(offset.immediate() >= 0); | 1104 ASSERT(offset.immediate() >= 0); |
1114 } else if (emit_debug_code()) { | 1105 } else if (emit_debug_code()) { |
1115 Cmp(xzr, offset); | 1106 Cmp(xzr, offset); |
1116 Check(le, kStackAccessBelowStackPointer); | 1107 Check(le, kStackAccessBelowStackPointer); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1193 | 1184 |
1194 ldp(d8, d9, tos); | 1185 ldp(d8, d9, tos); |
1195 ldp(d10, d11, tos); | 1186 ldp(d10, d11, tos); |
1196 ldp(d12, d13, tos); | 1187 ldp(d12, d13, tos); |
1197 ldp(d14, d15, tos); | 1188 ldp(d14, d15, tos); |
1198 } | 1189 } |
1199 | 1190 |
1200 | 1191 |
1201 void MacroAssembler::AssertStackConsistency() { | 1192 void MacroAssembler::AssertStackConsistency() { |
1202 if (emit_debug_code()) { | 1193 if (emit_debug_code()) { |
1203 if (csp.Is(StackPointer())) { | 1194 // Always check the alignment of csp since it could have been bumped even if |
1204 // We can't check the alignment of csp without using a scratch register | 1195 // it is not the stack pointer. We can't check the alignment of csp without |
1205 // (or clobbering the flags), but the processor (or simulator) will abort | 1196 // using a scratch register (or clobbering the flags), but the processor |
1206 // if it is not properly aligned during a load. | 1197 // (or simulator) will abort if it is not properly aligned during a load. |
1207 ldr(xzr, MemOperand(csp, 0)); | 1198 ldr(xzr, MemOperand(csp, 0)); |
1208 } else if (FLAG_enable_slow_asserts) { | 1199 if (FLAG_enable_slow_asserts && !csp.Is(StackPointer())) { |
1209 Label ok; | 1200 Label ok; |
1210 // Check that csp <= StackPointer(), preserving all registers and NZCV. | 1201 // Check that csp <= StackPointer(), preserving all registers and NZCV. |
1211 sub(StackPointer(), csp, StackPointer()); | 1202 sub(StackPointer(), csp, StackPointer()); |
1212 cbz(StackPointer(), &ok); // Ok if csp == StackPointer(). | 1203 cbz(StackPointer(), &ok); // Ok if csp == StackPointer(). |
1213 tbnz(StackPointer(), kXSignBit, &ok); // Ok if csp < StackPointer(). | 1204 tbnz(StackPointer(), kXSignBit, &ok); // Ok if csp < StackPointer(). |
1214 | 1205 |
1215 Abort(kTheCurrentStackPointerIsBelowCsp); | 1206 Abort(kTheCurrentStackPointerIsBelowCsp); |
1216 | 1207 |
1217 bind(&ok); | 1208 bind(&ok); |
1218 // Restore StackPointer(). | 1209 // Restore StackPointer(). |
(...skipping 3996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5215 } | 5206 } |
5216 } | 5207 } |
5217 | 5208 |
5218 | 5209 |
5219 #undef __ | 5210 #undef __ |
5220 | 5211 |
5221 | 5212 |
5222 } } // namespace v8::internal | 5213 } } // namespace v8::internal |
5223 | 5214 |
5224 #endif // V8_TARGET_ARCH_ARM64 | 5215 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |