OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_X64_MACRO_ASSEMBLER_X64_H_ | 5 #ifndef V8_X64_MACRO_ASSEMBLER_X64_H_ |
6 #define V8_X64_MACRO_ASSEMBLER_X64_H_ | 6 #define V8_X64_MACRO_ASSEMBLER_X64_H_ |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/frames.h" | 9 #include "src/frames.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 void PopReturnAddressTo(Register dst) { popq(dst); } | 875 void PopReturnAddressTo(Register dst) { popq(dst); } |
876 void Move(Register dst, ExternalReference ext) { | 876 void Move(Register dst, ExternalReference ext) { |
877 movp(dst, reinterpret_cast<void*>(ext.address()), | 877 movp(dst, reinterpret_cast<void*>(ext.address()), |
878 RelocInfo::EXTERNAL_REFERENCE); | 878 RelocInfo::EXTERNAL_REFERENCE); |
879 } | 879 } |
880 | 880 |
881 // Loads a pointer into a register with a relocation mode. | 881 // Loads a pointer into a register with a relocation mode. |
882 void Move(Register dst, void* ptr, RelocInfo::Mode rmode) { | 882 void Move(Register dst, void* ptr, RelocInfo::Mode rmode) { |
883 // This method must not be used with heap object references. The stored | 883 // This method must not be used with heap object references. The stored |
884 // address is not GC safe. Use the handle version instead. | 884 // address is not GC safe. Use the handle version instead. |
885 ASSERT(rmode > RelocInfo::LAST_GCED_ENUM); | 885 DCHECK(rmode > RelocInfo::LAST_GCED_ENUM); |
886 movp(dst, ptr, rmode); | 886 movp(dst, ptr, rmode); |
887 } | 887 } |
888 | 888 |
889 void Move(Register dst, Handle<Object> value, RelocInfo::Mode rmode) { | 889 void Move(Register dst, Handle<Object> value, RelocInfo::Mode rmode) { |
890 AllowDeferredHandleDereference using_raw_address; | 890 AllowDeferredHandleDereference using_raw_address; |
891 ASSERT(!RelocInfo::IsNone(rmode)); | 891 DCHECK(!RelocInfo::IsNone(rmode)); |
892 ASSERT(value->IsHeapObject()); | 892 DCHECK(value->IsHeapObject()); |
893 ASSERT(!isolate()->heap()->InNewSpace(*value)); | 893 DCHECK(!isolate()->heap()->InNewSpace(*value)); |
894 movp(dst, reinterpret_cast<void*>(value.location()), rmode); | 894 movp(dst, reinterpret_cast<void*>(value.location()), rmode); |
895 } | 895 } |
896 | 896 |
897 // Control Flow | 897 // Control Flow |
898 void Jump(Address destination, RelocInfo::Mode rmode); | 898 void Jump(Address destination, RelocInfo::Mode rmode); |
899 void Jump(ExternalReference ext); | 899 void Jump(ExternalReference ext); |
900 void Jump(const Operand& op); | 900 void Jump(const Operand& op); |
901 void Jump(Handle<Code> code_object, RelocInfo::Mode rmode); | 901 void Jump(Handle<Code> code_object, RelocInfo::Mode rmode); |
902 | 902 |
903 void Call(Address destination, RelocInfo::Mode rmode); | 903 void Call(Address destination, RelocInfo::Mode rmode); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 } | 1061 } |
1062 | 1062 |
1063 template<typename Field> | 1063 template<typename Field> |
1064 void DecodeFieldToSmi(Register reg) { | 1064 void DecodeFieldToSmi(Register reg) { |
1065 if (SmiValuesAre32Bits()) { | 1065 if (SmiValuesAre32Bits()) { |
1066 andp(reg, Immediate(Field::kMask)); | 1066 andp(reg, Immediate(Field::kMask)); |
1067 shlp(reg, Immediate(kSmiShift - Field::kShift)); | 1067 shlp(reg, Immediate(kSmiShift - Field::kShift)); |
1068 } else { | 1068 } else { |
1069 static const int shift = Field::kShift; | 1069 static const int shift = Field::kShift; |
1070 static const int mask = (Field::kMask >> Field::kShift) << kSmiTagSize; | 1070 static const int mask = (Field::kMask >> Field::kShift) << kSmiTagSize; |
1071 ASSERT(SmiValuesAre31Bits()); | 1071 DCHECK(SmiValuesAre31Bits()); |
1072 ASSERT(kSmiShift == kSmiTagSize); | 1072 DCHECK(kSmiShift == kSmiTagSize); |
1073 ASSERT((mask & 0x80000000u) == 0); | 1073 DCHECK((mask & 0x80000000u) == 0); |
1074 if (shift < kSmiShift) { | 1074 if (shift < kSmiShift) { |
1075 shlp(reg, Immediate(kSmiShift - shift)); | 1075 shlp(reg, Immediate(kSmiShift - shift)); |
1076 } else if (shift > kSmiShift) { | 1076 } else if (shift > kSmiShift) { |
1077 sarp(reg, Immediate(shift - kSmiShift)); | 1077 sarp(reg, Immediate(shift - kSmiShift)); |
1078 } | 1078 } |
1079 andp(reg, Immediate(mask)); | 1079 andp(reg, Immediate(mask)); |
1080 } | 1080 } |
1081 } | 1081 } |
1082 | 1082 |
1083 // Abort execution if argument is not a number, enabled via --debug-code. | 1083 // Abort execution if argument is not a number, enabled via --debug-code. |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 // --------------------------------------------------------------------------- | 1380 // --------------------------------------------------------------------------- |
1381 // Utilities | 1381 // Utilities |
1382 | 1382 |
1383 void Ret(); | 1383 void Ret(); |
1384 | 1384 |
1385 // Return and drop arguments from stack, where the number of arguments | 1385 // Return and drop arguments from stack, where the number of arguments |
1386 // may be bigger than 2^16 - 1. Requires a scratch register. | 1386 // may be bigger than 2^16 - 1. Requires a scratch register. |
1387 void Ret(int bytes_dropped, Register scratch); | 1387 void Ret(int bytes_dropped, Register scratch); |
1388 | 1388 |
1389 Handle<Object> CodeObject() { | 1389 Handle<Object> CodeObject() { |
1390 ASSERT(!code_object_.is_null()); | 1390 DCHECK(!code_object_.is_null()); |
1391 return code_object_; | 1391 return code_object_; |
1392 } | 1392 } |
1393 | 1393 |
1394 // Copy length bytes from source to destination. | 1394 // Copy length bytes from source to destination. |
1395 // Uses scratch register internally (if you have a low-eight register | 1395 // Uses scratch register internally (if you have a low-eight register |
1396 // free, do use it, otherwise kScratchRegister will be used). | 1396 // free, do use it, otherwise kScratchRegister will be used). |
1397 // The min_length is a minimum limit on the value that length will have. | 1397 // The min_length is a minimum limit on the value that length will have. |
1398 // The algorithm has some special cases that might be omitted if the string | 1398 // The algorithm has some special cases that might be omitted if the string |
1399 // is known to always be long. | 1399 // is known to always be long. |
1400 void CopyBytes(Register destination, | 1400 void CopyBytes(Register destination, |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 masm->popfq(); \ | 1657 masm->popfq(); \ |
1658 } \ | 1658 } \ |
1659 masm-> | 1659 masm-> |
1660 #else | 1660 #else |
1661 #define ACCESS_MASM(masm) masm-> | 1661 #define ACCESS_MASM(masm) masm-> |
1662 #endif | 1662 #endif |
1663 | 1663 |
1664 } } // namespace v8::internal | 1664 } } // namespace v8::internal |
1665 | 1665 |
1666 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1666 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |