| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 } | 600 } |
| 601 inline Object* ToObjectUnchecked() { | 601 inline Object* ToObjectUnchecked() { |
| 602 ASSERT(!IsFailure()); | 602 ASSERT(!IsFailure()); |
| 603 return reinterpret_cast<Object*>(this); | 603 return reinterpret_cast<Object*>(this); |
| 604 } | 604 } |
| 605 inline Object* ToObjectChecked() { | 605 inline Object* ToObjectChecked() { |
| 606 CHECK(!IsFailure()); | 606 CHECK(!IsFailure()); |
| 607 return reinterpret_cast<Object*>(this); | 607 return reinterpret_cast<Object*>(this); |
| 608 } | 608 } |
| 609 | 609 |
| 610 #ifdef OBJECT_PRINT |
| 611 // Prints this object with details. |
| 612 inline void Print() { |
| 613 Print(stdout); |
| 614 }; |
| 615 inline void PrintLn() { |
| 616 PrintLn(stdout); |
| 617 } |
| 618 void Print(FILE* out); |
| 619 void PrintLn(FILE* out); |
| 620 #endif |
| 610 #ifdef DEBUG | 621 #ifdef DEBUG |
| 611 // Prints this object with details. | |
| 612 void Print(); | |
| 613 void PrintLn(); | |
| 614 // Verifies the object. | 622 // Verifies the object. |
| 615 void Verify(); | 623 void Verify(); |
| 616 #endif | 624 #endif |
| 617 }; | 625 }; |
| 618 | 626 |
| 619 // Object is the abstract superclass for all classes in the | 627 // Object is the abstract superclass for all classes in the |
| 620 // object hierarchy. | 628 // object hierarchy. |
| 621 // Object does not use any virtual functions to avoid the | 629 // Object does not use any virtual functions to avoid the |
| 622 // allocation of the C++ vtable. | 630 // allocation of the C++ vtable. |
| 623 // Since Smi and Failure are subclasses of Object no | 631 // Since Smi and Failure are subclasses of Object no |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 // Returns true if this is a JSValue containing a string and the index is | 764 // Returns true if this is a JSValue containing a string and the index is |
| 757 // < the length of the string. Used to implement [] on strings. | 765 // < the length of the string. Used to implement [] on strings. |
| 758 inline bool IsStringObjectWithCharacterAt(uint32_t index); | 766 inline bool IsStringObjectWithCharacterAt(uint32_t index); |
| 759 | 767 |
| 760 #ifdef DEBUG | 768 #ifdef DEBUG |
| 761 // Verify a pointer is a valid object pointer. | 769 // Verify a pointer is a valid object pointer. |
| 762 static void VerifyPointer(Object* p); | 770 static void VerifyPointer(Object* p); |
| 763 #endif | 771 #endif |
| 764 | 772 |
| 765 // Prints this object without details. | 773 // Prints this object without details. |
| 766 void ShortPrint(); | 774 inline void ShortPrint() { |
| 775 ShortPrint(stdout); |
| 776 } |
| 777 void ShortPrint(FILE* out); |
| 767 | 778 |
| 768 // Prints this object without details to a message accumulator. | 779 // Prints this object without details to a message accumulator. |
| 769 void ShortPrint(StringStream* accumulator); | 780 void ShortPrint(StringStream* accumulator); |
| 770 | 781 |
| 771 // Casting: This cast is only needed to satisfy macros in objects-inl.h. | 782 // Casting: This cast is only needed to satisfy macros in objects-inl.h. |
| 772 static Object* cast(Object* value) { return value; } | 783 static Object* cast(Object* value) { return value; } |
| 773 | 784 |
| 774 // Layout description. | 785 // Layout description. |
| 775 static const int kHeaderSize = 0; // Object does not take up any space. | 786 static const int kHeaderSize = 0; // Object does not take up any space. |
| 776 | 787 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 795 | 806 |
| 796 static inline Smi* FromIntptr(intptr_t value); | 807 static inline Smi* FromIntptr(intptr_t value); |
| 797 | 808 |
| 798 // Returns whether value can be represented in a Smi. | 809 // Returns whether value can be represented in a Smi. |
| 799 static inline bool IsValid(intptr_t value); | 810 static inline bool IsValid(intptr_t value); |
| 800 | 811 |
| 801 // Casting. | 812 // Casting. |
| 802 static inline Smi* cast(Object* object); | 813 static inline Smi* cast(Object* object); |
| 803 | 814 |
| 804 // Dispatched behavior. | 815 // Dispatched behavior. |
| 805 void SmiPrint(); | 816 inline void SmiPrint() { |
| 817 SmiPrint(stdout); |
| 818 } |
| 819 void SmiPrint(FILE* out); |
| 806 void SmiPrint(StringStream* accumulator); | 820 void SmiPrint(StringStream* accumulator); |
| 807 #ifdef DEBUG | 821 #ifdef DEBUG |
| 808 void SmiVerify(); | 822 void SmiVerify(); |
| 809 #endif | 823 #endif |
| 810 | 824 |
| 811 static const int kMinValue = (-1 << (kSmiValueSize - 1)); | 825 static const int kMinValue = (-1 << (kSmiValueSize - 1)); |
| 812 static const int kMaxValue = -(kMinValue + 1); | 826 static const int kMaxValue = -(kMinValue + 1); |
| 813 | 827 |
| 814 private: | 828 private: |
| 815 DISALLOW_IMPLICIT_CONSTRUCTORS(Smi); | 829 DISALLOW_IMPLICIT_CONSTRUCTORS(Smi); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 | 878 |
| 865 static inline Failure* RetryAfterGC(AllocationSpace space); | 879 static inline Failure* RetryAfterGC(AllocationSpace space); |
| 866 static inline Failure* RetryAfterGC(); // NEW_SPACE | 880 static inline Failure* RetryAfterGC(); // NEW_SPACE |
| 867 static inline Failure* Exception(); | 881 static inline Failure* Exception(); |
| 868 static inline Failure* InternalError(); | 882 static inline Failure* InternalError(); |
| 869 static inline Failure* OutOfMemoryException(); | 883 static inline Failure* OutOfMemoryException(); |
| 870 // Casting. | 884 // Casting. |
| 871 static inline Failure* cast(MaybeObject* object); | 885 static inline Failure* cast(MaybeObject* object); |
| 872 | 886 |
| 873 // Dispatched behavior. | 887 // Dispatched behavior. |
| 874 void FailurePrint(); | 888 inline void FailurePrint() { |
| 889 FailurePrint(stdout); |
| 890 } |
| 891 void FailurePrint(FILE* out); |
| 875 void FailurePrint(StringStream* accumulator); | 892 void FailurePrint(StringStream* accumulator); |
| 876 #ifdef DEBUG | 893 #ifdef DEBUG |
| 877 void FailureVerify(); | 894 void FailureVerify(); |
| 878 #endif | 895 #endif |
| 879 | 896 |
| 880 private: | 897 private: |
| 881 inline intptr_t value() const; | 898 inline intptr_t value() const; |
| 882 static inline Failure* Construct(Type type, intptr_t value = 0); | 899 static inline Failure* Construct(Type type, intptr_t value = 0); |
| 883 | 900 |
| 884 DISALLOW_IMPLICIT_CONSTRUCTORS(Failure); | 901 DISALLOW_IMPLICIT_CONSTRUCTORS(Failure); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 | 1118 |
| 1102 // Return the write barrier mode for this. Callers of this function | 1119 // Return the write barrier mode for this. Callers of this function |
| 1103 // must be able to present a reference to an AssertNoAllocation | 1120 // must be able to present a reference to an AssertNoAllocation |
| 1104 // object as a sign that they are not going to use this function | 1121 // object as a sign that they are not going to use this function |
| 1105 // from code that allocates and thus invalidates the returned write | 1122 // from code that allocates and thus invalidates the returned write |
| 1106 // barrier mode. | 1123 // barrier mode. |
| 1107 inline WriteBarrierMode GetWriteBarrierMode(const AssertNoAllocation&); | 1124 inline WriteBarrierMode GetWriteBarrierMode(const AssertNoAllocation&); |
| 1108 | 1125 |
| 1109 // Dispatched behavior. | 1126 // Dispatched behavior. |
| 1110 void HeapObjectShortPrint(StringStream* accumulator); | 1127 void HeapObjectShortPrint(StringStream* accumulator); |
| 1128 #ifdef OBJECT_PRINT |
| 1129 inline void HeapObjectPrint() { |
| 1130 HeapObjectPrint(stdout); |
| 1131 } |
| 1132 void HeapObjectPrint(FILE* out); |
| 1133 #endif |
| 1111 #ifdef DEBUG | 1134 #ifdef DEBUG |
| 1112 void HeapObjectPrint(); | |
| 1113 void HeapObjectVerify(); | 1135 void HeapObjectVerify(); |
| 1114 inline void VerifyObjectField(int offset); | 1136 inline void VerifyObjectField(int offset); |
| 1115 inline void VerifySmiField(int offset); | 1137 inline void VerifySmiField(int offset); |
| 1138 #endif |
| 1116 | 1139 |
| 1117 void PrintHeader(const char* id); | 1140 #ifdef OBJECT_PRINT |
| 1141 void PrintHeader(FILE* out, const char* id); |
| 1142 #endif |
| 1118 | 1143 |
| 1144 #ifdef DEBUG |
| 1119 // Verify a pointer is a valid HeapObject pointer that points to object | 1145 // Verify a pointer is a valid HeapObject pointer that points to object |
| 1120 // areas in the heap. | 1146 // areas in the heap. |
| 1121 static void VerifyHeapPointer(Object* p); | 1147 static void VerifyHeapPointer(Object* p); |
| 1122 #endif | 1148 #endif |
| 1123 | 1149 |
| 1124 // Layout description. | 1150 // Layout description. |
| 1125 // First field in a heap object is map. | 1151 // First field in a heap object is map. |
| 1126 static const int kMapOffset = Object::kHeaderSize; | 1152 static const int kMapOffset = Object::kHeaderSize; |
| 1127 static const int kHeaderSize = kMapOffset + kPointerSize; | 1153 static const int kHeaderSize = kMapOffset + kPointerSize; |
| 1128 | 1154 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 public: | 1217 public: |
| 1192 // [value]: number value. | 1218 // [value]: number value. |
| 1193 inline double value(); | 1219 inline double value(); |
| 1194 inline void set_value(double value); | 1220 inline void set_value(double value); |
| 1195 | 1221 |
| 1196 // Casting. | 1222 // Casting. |
| 1197 static inline HeapNumber* cast(Object* obj); | 1223 static inline HeapNumber* cast(Object* obj); |
| 1198 | 1224 |
| 1199 // Dispatched behavior. | 1225 // Dispatched behavior. |
| 1200 Object* HeapNumberToBoolean(); | 1226 Object* HeapNumberToBoolean(); |
| 1201 void HeapNumberPrint(); | 1227 inline void HeapNumberPrint() { |
| 1228 HeapNumberPrint(stdout); |
| 1229 } |
| 1230 void HeapNumberPrint(FILE* out); |
| 1202 void HeapNumberPrint(StringStream* accumulator); | 1231 void HeapNumberPrint(StringStream* accumulator); |
| 1203 #ifdef DEBUG | 1232 #ifdef DEBUG |
| 1204 void HeapNumberVerify(); | 1233 void HeapNumberVerify(); |
| 1205 #endif | 1234 #endif |
| 1206 | 1235 |
| 1207 inline int get_exponent(); | 1236 inline int get_exponent(); |
| 1208 inline int get_sign(); | 1237 inline int get_sign(); |
| 1209 | 1238 |
| 1210 // Layout description. | 1239 // Layout description. |
| 1211 static const int kValueOffset = HeapObject::kHeaderSize; | 1240 static const int kValueOffset = HeapObject::kHeaderSize; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 InterceptorInfo* GetNamedInterceptor(); | 1399 InterceptorInfo* GetNamedInterceptor(); |
| 1371 InterceptorInfo* GetIndexedInterceptor(); | 1400 InterceptorInfo* GetIndexedInterceptor(); |
| 1372 | 1401 |
| 1373 inline PropertyAttributes GetPropertyAttribute(String* name); | 1402 inline PropertyAttributes GetPropertyAttribute(String* name); |
| 1374 PropertyAttributes GetPropertyAttributeWithReceiver(JSObject* receiver, | 1403 PropertyAttributes GetPropertyAttributeWithReceiver(JSObject* receiver, |
| 1375 String* name); | 1404 String* name); |
| 1376 PropertyAttributes GetLocalPropertyAttribute(String* name); | 1405 PropertyAttributes GetLocalPropertyAttribute(String* name); |
| 1377 | 1406 |
| 1378 MUST_USE_RESULT MaybeObject* DefineAccessor(String* name, | 1407 MUST_USE_RESULT MaybeObject* DefineAccessor(String* name, |
| 1379 bool is_getter, | 1408 bool is_getter, |
| 1380 JSFunction* fun, | 1409 Object* fun, |
| 1381 PropertyAttributes attributes); | 1410 PropertyAttributes attributes); |
| 1382 Object* LookupAccessor(String* name, bool is_getter); | 1411 Object* LookupAccessor(String* name, bool is_getter); |
| 1383 | 1412 |
| 1384 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); | 1413 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); |
| 1385 | 1414 |
| 1386 // Used from Object::GetProperty(). | 1415 // Used from Object::GetProperty(). |
| 1387 MaybeObject* GetPropertyWithFailedAccessCheck( | 1416 MaybeObject* GetPropertyWithFailedAccessCheck( |
| 1388 Object* receiver, | 1417 Object* receiver, |
| 1389 LookupResult* result, | 1418 LookupResult* result, |
| 1390 String* name, | 1419 String* name, |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1651 | 1680 |
| 1652 // Casting. | 1681 // Casting. |
| 1653 static inline JSObject* cast(Object* obj); | 1682 static inline JSObject* cast(Object* obj); |
| 1654 | 1683 |
| 1655 // Disalow further properties to be added to the object. | 1684 // Disalow further properties to be added to the object. |
| 1656 MUST_USE_RESULT MaybeObject* PreventExtensions(); | 1685 MUST_USE_RESULT MaybeObject* PreventExtensions(); |
| 1657 | 1686 |
| 1658 | 1687 |
| 1659 // Dispatched behavior. | 1688 // Dispatched behavior. |
| 1660 void JSObjectShortPrint(StringStream* accumulator); | 1689 void JSObjectShortPrint(StringStream* accumulator); |
| 1690 #ifdef OBJECT_PRINT |
| 1691 inline void JSObjectPrint() { |
| 1692 JSObjectPrint(stdout); |
| 1693 } |
| 1694 void JSObjectPrint(FILE* out); |
| 1695 #endif |
| 1661 #ifdef DEBUG | 1696 #ifdef DEBUG |
| 1662 void JSObjectPrint(); | |
| 1663 void JSObjectVerify(); | 1697 void JSObjectVerify(); |
| 1664 void PrintProperties(); | 1698 #endif |
| 1665 void PrintElements(); | 1699 #ifdef OBJECT_PRINT |
| 1700 inline void PrintProperties() { |
| 1701 PrintProperties(stdout); |
| 1702 } |
| 1703 void PrintProperties(FILE* out); |
| 1666 | 1704 |
| 1705 inline void PrintElements() { |
| 1706 PrintElements(stdout); |
| 1707 } |
| 1708 void PrintElements(FILE* out); |
| 1709 #endif |
| 1710 |
| 1711 #ifdef DEBUG |
| 1667 // Structure for collecting spill information about JSObjects. | 1712 // Structure for collecting spill information about JSObjects. |
| 1668 class SpillInformation { | 1713 class SpillInformation { |
| 1669 public: | 1714 public: |
| 1670 void Clear(); | 1715 void Clear(); |
| 1671 void Print(); | 1716 void Print(); |
| 1672 int number_of_objects_; | 1717 int number_of_objects_; |
| 1673 int number_of_objects_with_fast_properties_; | 1718 int number_of_objects_with_fast_properties_; |
| 1674 int number_of_objects_with_fast_elements_; | 1719 int number_of_objects_with_fast_elements_; |
| 1675 int number_of_fast_used_fields_; | 1720 int number_of_fast_used_fields_; |
| 1676 int number_of_fast_unused_fields_; | 1721 int number_of_fast_unused_fields_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1691 // the number of maps for objects used as dictionaries. | 1736 // the number of maps for objects used as dictionaries. |
| 1692 inline int MaxFastProperties(); | 1737 inline int MaxFastProperties(); |
| 1693 | 1738 |
| 1694 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). | 1739 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). |
| 1695 // Also maximal value of JSArray's length property. | 1740 // Also maximal value of JSArray's length property. |
| 1696 static const uint32_t kMaxElementCount = 0xffffffffu; | 1741 static const uint32_t kMaxElementCount = 0xffffffffu; |
| 1697 | 1742 |
| 1698 static const uint32_t kMaxGap = 1024; | 1743 static const uint32_t kMaxGap = 1024; |
| 1699 static const int kMaxFastElementsLength = 5000; | 1744 static const int kMaxFastElementsLength = 5000; |
| 1700 static const int kInitialMaxFastElementArray = 100000; | 1745 static const int kInitialMaxFastElementArray = 100000; |
| 1701 static const int kMaxFastProperties = 8; | 1746 static const int kMaxFastProperties = 12; |
| 1702 static const int kMaxInstanceSize = 255 * kPointerSize; | 1747 static const int kMaxInstanceSize = 255 * kPointerSize; |
| 1703 // When extending the backing storage for property values, we increase | 1748 // When extending the backing storage for property values, we increase |
| 1704 // its size by more than the 1 entry necessary, so sequentially adding fields | 1749 // its size by more than the 1 entry necessary, so sequentially adding fields |
| 1705 // to the same object requires fewer allocations and copies. | 1750 // to the same object requires fewer allocations and copies. |
| 1706 static const int kFieldsAdded = 3; | 1751 static const int kFieldsAdded = 3; |
| 1707 | 1752 |
| 1708 // Layout description. | 1753 // Layout description. |
| 1709 static const int kPropertiesOffset = HeapObject::kHeaderSize; | 1754 static const int kPropertiesOffset = HeapObject::kHeaderSize; |
| 1710 static const int kElementsOffset = kPropertiesOffset + kPointerSize; | 1755 static const int kElementsOffset = kPropertiesOffset + kPointerSize; |
| 1711 static const int kHeaderSize = kElementsOffset + kPointerSize; | 1756 static const int kHeaderSize = kElementsOffset + kPointerSize; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1842 static const int kHeaderSize = kLengthOffset + kPointerSize; | 1887 static const int kHeaderSize = kLengthOffset + kPointerSize; |
| 1843 | 1888 |
| 1844 // Maximal allowed size, in bytes, of a single FixedArray. | 1889 // Maximal allowed size, in bytes, of a single FixedArray. |
| 1845 // Prevents overflowing size computations, as well as extreme memory | 1890 // Prevents overflowing size computations, as well as extreme memory |
| 1846 // consumption. | 1891 // consumption. |
| 1847 static const int kMaxSize = 512 * MB; | 1892 static const int kMaxSize = 512 * MB; |
| 1848 // Maximally allowed length of a FixedArray. | 1893 // Maximally allowed length of a FixedArray. |
| 1849 static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize; | 1894 static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize; |
| 1850 | 1895 |
| 1851 // Dispatched behavior. | 1896 // Dispatched behavior. |
| 1897 #ifdef OBJECT_PRINT |
| 1898 inline void FixedArrayPrint() { |
| 1899 FixedArrayPrint(stdout); |
| 1900 } |
| 1901 void FixedArrayPrint(FILE* out); |
| 1902 #endif |
| 1852 #ifdef DEBUG | 1903 #ifdef DEBUG |
| 1853 void FixedArrayPrint(); | |
| 1854 void FixedArrayVerify(); | 1904 void FixedArrayVerify(); |
| 1855 // Checks if two FixedArrays have identical contents. | 1905 // Checks if two FixedArrays have identical contents. |
| 1856 bool IsEqualTo(FixedArray* other); | 1906 bool IsEqualTo(FixedArray* other); |
| 1857 #endif | 1907 #endif |
| 1858 | 1908 |
| 1859 // Swap two elements in a pair of arrays. If this array and the | 1909 // Swap two elements in a pair of arrays. If this array and the |
| 1860 // numbers array are the same object, the elements are only swapped | 1910 // numbers array are the same object, the elements are only swapped |
| 1861 // once. | 1911 // once. |
| 1862 void SwapPairs(FixedArray* numbers, int i, int j); | 1912 void SwapPairs(FixedArray* numbers, int i, int j); |
| 1863 | 1913 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2021 // Layout description. | 2071 // Layout description. |
| 2022 static const int kContentArrayOffset = FixedArray::kHeaderSize; | 2072 static const int kContentArrayOffset = FixedArray::kHeaderSize; |
| 2023 static const int kEnumerationIndexOffset = kContentArrayOffset + kPointerSize; | 2073 static const int kEnumerationIndexOffset = kContentArrayOffset + kPointerSize; |
| 2024 static const int kFirstOffset = kEnumerationIndexOffset + kPointerSize; | 2074 static const int kFirstOffset = kEnumerationIndexOffset + kPointerSize; |
| 2025 | 2075 |
| 2026 // Layout description for the bridge array. | 2076 // Layout description for the bridge array. |
| 2027 static const int kEnumCacheBridgeEnumOffset = FixedArray::kHeaderSize; | 2077 static const int kEnumCacheBridgeEnumOffset = FixedArray::kHeaderSize; |
| 2028 static const int kEnumCacheBridgeCacheOffset = | 2078 static const int kEnumCacheBridgeCacheOffset = |
| 2029 kEnumCacheBridgeEnumOffset + kPointerSize; | 2079 kEnumCacheBridgeEnumOffset + kPointerSize; |
| 2030 | 2080 |
| 2081 #ifdef OBJECT_PRINT |
| 2082 // Print all the descriptors. |
| 2083 inline void PrintDescriptors() { |
| 2084 PrintDescriptors(stdout); |
| 2085 } |
| 2086 void PrintDescriptors(FILE* out); |
| 2087 #endif |
| 2088 |
| 2031 #ifdef DEBUG | 2089 #ifdef DEBUG |
| 2032 // Print all the descriptors. | |
| 2033 void PrintDescriptors(); | |
| 2034 | |
| 2035 // Is the descriptor array sorted and without duplicates? | 2090 // Is the descriptor array sorted and without duplicates? |
| 2036 bool IsSortedNoDuplicates(); | 2091 bool IsSortedNoDuplicates(); |
| 2037 | 2092 |
| 2038 // Are two DescriptorArrays equal? | 2093 // Are two DescriptorArrays equal? |
| 2039 bool IsEqualTo(DescriptorArray* other); | 2094 bool IsEqualTo(DescriptorArray* other); |
| 2040 #endif | 2095 #endif |
| 2041 | 2096 |
| 2042 // The maximum number of descriptors we want in a descriptor array (should | 2097 // The maximum number of descriptors we want in a descriptor array (should |
| 2043 // fit in a page). | 2098 // fit in a page). |
| 2044 static const int kMaxNumberOfDescriptors = 1024 + 512; | 2099 static const int kMaxNumberOfDescriptors = 1024 + 512; |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2406 int NextEnumerationIndex() { | 2461 int NextEnumerationIndex() { |
| 2407 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); | 2462 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); |
| 2408 } | 2463 } |
| 2409 | 2464 |
| 2410 // Returns a new array for dictionary usage. Might return Failure. | 2465 // Returns a new array for dictionary usage. Might return Failure. |
| 2411 MUST_USE_RESULT static MaybeObject* Allocate(int at_least_space_for); | 2466 MUST_USE_RESULT static MaybeObject* Allocate(int at_least_space_for); |
| 2412 | 2467 |
| 2413 // Ensure enough space for n additional elements. | 2468 // Ensure enough space for n additional elements. |
| 2414 MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key); | 2469 MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key); |
| 2415 | 2470 |
| 2416 #ifdef DEBUG | 2471 #ifdef OBJECT_PRINT |
| 2417 void Print(); | 2472 inline void Print() { |
| 2473 Print(stdout); |
| 2474 } |
| 2475 void Print(FILE* out); |
| 2418 #endif | 2476 #endif |
| 2419 // Returns the key (slow). | 2477 // Returns the key (slow). |
| 2420 Object* SlowReverseLookup(Object* value); | 2478 Object* SlowReverseLookup(Object* value); |
| 2421 | 2479 |
| 2422 // Sets the entry to (key, value) pair. | 2480 // Sets the entry to (key, value) pair. |
| 2423 inline void SetEntry(int entry, | 2481 inline void SetEntry(int entry, |
| 2424 Object* key, | 2482 Object* key, |
| 2425 Object* value, | 2483 Object* value, |
| 2426 PropertyDetails details); | 2484 PropertyDetails details); |
| 2427 | 2485 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2629 // Returns a pointer to the ByteArray object for a given data start address. | 2687 // Returns a pointer to the ByteArray object for a given data start address. |
| 2630 static inline ByteArray* FromDataStartAddress(Address address); | 2688 static inline ByteArray* FromDataStartAddress(Address address); |
| 2631 | 2689 |
| 2632 // Casting. | 2690 // Casting. |
| 2633 static inline ByteArray* cast(Object* obj); | 2691 static inline ByteArray* cast(Object* obj); |
| 2634 | 2692 |
| 2635 // Dispatched behavior. | 2693 // Dispatched behavior. |
| 2636 inline int ByteArraySize() { | 2694 inline int ByteArraySize() { |
| 2637 return SizeFor(this->length()); | 2695 return SizeFor(this->length()); |
| 2638 } | 2696 } |
| 2697 #ifdef OBJECT_PRINT |
| 2698 inline void ByteArrayPrint() { |
| 2699 ByteArrayPrint(stdout); |
| 2700 } |
| 2701 void ByteArrayPrint(FILE* out); |
| 2702 #endif |
| 2639 #ifdef DEBUG | 2703 #ifdef DEBUG |
| 2640 void ByteArrayPrint(); | |
| 2641 void ByteArrayVerify(); | 2704 void ByteArrayVerify(); |
| 2642 #endif | 2705 #endif |
| 2643 | 2706 |
| 2644 // Layout description. | 2707 // Layout description. |
| 2645 // Length is smi tagged when it is stored. | 2708 // Length is smi tagged when it is stored. |
| 2646 static const int kLengthOffset = HeapObject::kHeaderSize; | 2709 static const int kLengthOffset = HeapObject::kHeaderSize; |
| 2647 static const int kHeaderSize = kLengthOffset + kPointerSize; | 2710 static const int kHeaderSize = kLengthOffset + kPointerSize; |
| 2648 | 2711 |
| 2649 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); | 2712 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); |
| 2650 | 2713 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2679 inline uint8_t get(int index); | 2742 inline uint8_t get(int index); |
| 2680 inline void set(int index, uint8_t value); | 2743 inline void set(int index, uint8_t value); |
| 2681 | 2744 |
| 2682 // This accessor applies the correct conversion from Smi, HeapNumber and | 2745 // This accessor applies the correct conversion from Smi, HeapNumber and |
| 2683 // undefined and clamps the converted value between 0 and 255. | 2746 // undefined and clamps the converted value between 0 and 255. |
| 2684 Object* SetValue(uint32_t index, Object* value); | 2747 Object* SetValue(uint32_t index, Object* value); |
| 2685 | 2748 |
| 2686 // Casting. | 2749 // Casting. |
| 2687 static inline PixelArray* cast(Object* obj); | 2750 static inline PixelArray* cast(Object* obj); |
| 2688 | 2751 |
| 2752 #ifdef OBJECT_PRINT |
| 2753 inline void PixelArrayPrint() { |
| 2754 PixelArrayPrint(stdout); |
| 2755 } |
| 2756 void PixelArrayPrint(FILE* out); |
| 2757 #endif |
| 2689 #ifdef DEBUG | 2758 #ifdef DEBUG |
| 2690 void PixelArrayPrint(); | |
| 2691 void PixelArrayVerify(); | 2759 void PixelArrayVerify(); |
| 2692 #endif // DEBUG | 2760 #endif // DEBUG |
| 2693 | 2761 |
| 2694 // Maximal acceptable length for a pixel array. | 2762 // Maximal acceptable length for a pixel array. |
| 2695 static const int kMaxLength = 0x3fffffff; | 2763 static const int kMaxLength = 0x3fffffff; |
| 2696 | 2764 |
| 2697 // PixelArray headers are not quadword aligned. | 2765 // PixelArray headers are not quadword aligned. |
| 2698 static const int kLengthOffset = HeapObject::kHeaderSize; | 2766 static const int kLengthOffset = HeapObject::kHeaderSize; |
| 2699 static const int kExternalPointerOffset = | 2767 static const int kExternalPointerOffset = |
| 2700 POINTER_SIZE_ALIGN(kLengthOffset + kIntSize); | 2768 POINTER_SIZE_ALIGN(kLengthOffset + kIntSize); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2751 inline int8_t get(int index); | 2819 inline int8_t get(int index); |
| 2752 inline void set(int index, int8_t value); | 2820 inline void set(int index, int8_t value); |
| 2753 | 2821 |
| 2754 // This accessor applies the correct conversion from Smi, HeapNumber | 2822 // This accessor applies the correct conversion from Smi, HeapNumber |
| 2755 // and undefined. | 2823 // and undefined. |
| 2756 MaybeObject* SetValue(uint32_t index, Object* value); | 2824 MaybeObject* SetValue(uint32_t index, Object* value); |
| 2757 | 2825 |
| 2758 // Casting. | 2826 // Casting. |
| 2759 static inline ExternalByteArray* cast(Object* obj); | 2827 static inline ExternalByteArray* cast(Object* obj); |
| 2760 | 2828 |
| 2829 #ifdef OBJECT_PRINT |
| 2830 inline void ExternalByteArrayPrint() { |
| 2831 ExternalByteArrayPrint(stdout); |
| 2832 } |
| 2833 void ExternalByteArrayPrint(FILE* out); |
| 2834 #endif |
| 2761 #ifdef DEBUG | 2835 #ifdef DEBUG |
| 2762 void ExternalByteArrayPrint(); | |
| 2763 void ExternalByteArrayVerify(); | 2836 void ExternalByteArrayVerify(); |
| 2764 #endif // DEBUG | 2837 #endif // DEBUG |
| 2765 | 2838 |
| 2766 private: | 2839 private: |
| 2767 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray); | 2840 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray); |
| 2768 }; | 2841 }; |
| 2769 | 2842 |
| 2770 | 2843 |
| 2771 class ExternalUnsignedByteArray: public ExternalArray { | 2844 class ExternalUnsignedByteArray: public ExternalArray { |
| 2772 public: | 2845 public: |
| 2773 // Setter and getter. | 2846 // Setter and getter. |
| 2774 inline uint8_t get(int index); | 2847 inline uint8_t get(int index); |
| 2775 inline void set(int index, uint8_t value); | 2848 inline void set(int index, uint8_t value); |
| 2776 | 2849 |
| 2777 // This accessor applies the correct conversion from Smi, HeapNumber | 2850 // This accessor applies the correct conversion from Smi, HeapNumber |
| 2778 // and undefined. | 2851 // and undefined. |
| 2779 MaybeObject* SetValue(uint32_t index, Object* value); | 2852 MaybeObject* SetValue(uint32_t index, Object* value); |
| 2780 | 2853 |
| 2781 // Casting. | 2854 // Casting. |
| 2782 static inline ExternalUnsignedByteArray* cast(Object* obj); | 2855 static inline ExternalUnsignedByteArray* cast(Object* obj); |
| 2783 | 2856 |
| 2857 #ifdef OBJECT_PRINT |
| 2858 inline void ExternalUnsignedByteArrayPrint() { |
| 2859 ExternalUnsignedByteArrayPrint(stdout); |
| 2860 } |
| 2861 void ExternalUnsignedByteArrayPrint(FILE* out); |
| 2862 #endif |
| 2784 #ifdef DEBUG | 2863 #ifdef DEBUG |
| 2785 void ExternalUnsignedByteArrayPrint(); | |
| 2786 void ExternalUnsignedByteArrayVerify(); | 2864 void ExternalUnsignedByteArrayVerify(); |
| 2787 #endif // DEBUG | 2865 #endif // DEBUG |
| 2788 | 2866 |
| 2789 private: | 2867 private: |
| 2790 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray); | 2868 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray); |
| 2791 }; | 2869 }; |
| 2792 | 2870 |
| 2793 | 2871 |
| 2794 class ExternalShortArray: public ExternalArray { | 2872 class ExternalShortArray: public ExternalArray { |
| 2795 public: | 2873 public: |
| 2796 // Setter and getter. | 2874 // Setter and getter. |
| 2797 inline int16_t get(int index); | 2875 inline int16_t get(int index); |
| 2798 inline void set(int index, int16_t value); | 2876 inline void set(int index, int16_t value); |
| 2799 | 2877 |
| 2800 // This accessor applies the correct conversion from Smi, HeapNumber | 2878 // This accessor applies the correct conversion from Smi, HeapNumber |
| 2801 // and undefined. | 2879 // and undefined. |
| 2802 MaybeObject* SetValue(uint32_t index, Object* value); | 2880 MaybeObject* SetValue(uint32_t index, Object* value); |
| 2803 | 2881 |
| 2804 // Casting. | 2882 // Casting. |
| 2805 static inline ExternalShortArray* cast(Object* obj); | 2883 static inline ExternalShortArray* cast(Object* obj); |
| 2806 | 2884 |
| 2885 #ifdef OBJECT_PRINT |
| 2886 inline void ExternalShortArrayPrint() { |
| 2887 ExternalShortArrayPrint(stdout); |
| 2888 } |
| 2889 void ExternalShortArrayPrint(FILE* out); |
| 2890 #endif |
| 2807 #ifdef DEBUG | 2891 #ifdef DEBUG |
| 2808 void ExternalShortArrayPrint(); | |
| 2809 void ExternalShortArrayVerify(); | 2892 void ExternalShortArrayVerify(); |
| 2810 #endif // DEBUG | 2893 #endif // DEBUG |
| 2811 | 2894 |
| 2812 private: | 2895 private: |
| 2813 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray); | 2896 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray); |
| 2814 }; | 2897 }; |
| 2815 | 2898 |
| 2816 | 2899 |
| 2817 class ExternalUnsignedShortArray: public ExternalArray { | 2900 class ExternalUnsignedShortArray: public ExternalArray { |
| 2818 public: | 2901 public: |
| 2819 // Setter and getter. | 2902 // Setter and getter. |
| 2820 inline uint16_t get(int index); | 2903 inline uint16_t get(int index); |
| 2821 inline void set(int index, uint16_t value); | 2904 inline void set(int index, uint16_t value); |
| 2822 | 2905 |
| 2823 // This accessor applies the correct conversion from Smi, HeapNumber | 2906 // This accessor applies the correct conversion from Smi, HeapNumber |
| 2824 // and undefined. | 2907 // and undefined. |
| 2825 MaybeObject* SetValue(uint32_t index, Object* value); | 2908 MaybeObject* SetValue(uint32_t index, Object* value); |
| 2826 | 2909 |
| 2827 // Casting. | 2910 // Casting. |
| 2828 static inline ExternalUnsignedShortArray* cast(Object* obj); | 2911 static inline ExternalUnsignedShortArray* cast(Object* obj); |
| 2829 | 2912 |
| 2913 #ifdef OBJECT_PRINT |
| 2914 inline void ExternalUnsignedShortArrayPrint() { |
| 2915 ExternalUnsignedShortArrayPrint(stdout); |
| 2916 } |
| 2917 void ExternalUnsignedShortArrayPrint(FILE* out); |
| 2918 #endif |
| 2830 #ifdef DEBUG | 2919 #ifdef DEBUG |
| 2831 void ExternalUnsignedShortArrayPrint(); | |
| 2832 void ExternalUnsignedShortArrayVerify(); | 2920 void ExternalUnsignedShortArrayVerify(); |
| 2833 #endif // DEBUG | 2921 #endif // DEBUG |
| 2834 | 2922 |
| 2835 private: | 2923 private: |
| 2836 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray); | 2924 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray); |
| 2837 }; | 2925 }; |
| 2838 | 2926 |
| 2839 | 2927 |
| 2840 class ExternalIntArray: public ExternalArray { | 2928 class ExternalIntArray: public ExternalArray { |
| 2841 public: | 2929 public: |
| 2842 // Setter and getter. | 2930 // Setter and getter. |
| 2843 inline int32_t get(int index); | 2931 inline int32_t get(int index); |
| 2844 inline void set(int index, int32_t value); | 2932 inline void set(int index, int32_t value); |
| 2845 | 2933 |
| 2846 // This accessor applies the correct conversion from Smi, HeapNumber | 2934 // This accessor applies the correct conversion from Smi, HeapNumber |
| 2847 // and undefined. | 2935 // and undefined. |
| 2848 MaybeObject* SetValue(uint32_t index, Object* value); | 2936 MaybeObject* SetValue(uint32_t index, Object* value); |
| 2849 | 2937 |
| 2850 // Casting. | 2938 // Casting. |
| 2851 static inline ExternalIntArray* cast(Object* obj); | 2939 static inline ExternalIntArray* cast(Object* obj); |
| 2852 | 2940 |
| 2941 #ifdef OBJECT_PRINT |
| 2942 inline void ExternalIntArrayPrint() { |
| 2943 ExternalIntArrayPrint(stdout); |
| 2944 } |
| 2945 void ExternalIntArrayPrint(FILE* out); |
| 2946 #endif |
| 2853 #ifdef DEBUG | 2947 #ifdef DEBUG |
| 2854 void ExternalIntArrayPrint(); | |
| 2855 void ExternalIntArrayVerify(); | 2948 void ExternalIntArrayVerify(); |
| 2856 #endif // DEBUG | 2949 #endif // DEBUG |
| 2857 | 2950 |
| 2858 private: | 2951 private: |
| 2859 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray); | 2952 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray); |
| 2860 }; | 2953 }; |
| 2861 | 2954 |
| 2862 | 2955 |
| 2863 class ExternalUnsignedIntArray: public ExternalArray { | 2956 class ExternalUnsignedIntArray: public ExternalArray { |
| 2864 public: | 2957 public: |
| 2865 // Setter and getter. | 2958 // Setter and getter. |
| 2866 inline uint32_t get(int index); | 2959 inline uint32_t get(int index); |
| 2867 inline void set(int index, uint32_t value); | 2960 inline void set(int index, uint32_t value); |
| 2868 | 2961 |
| 2869 // This accessor applies the correct conversion from Smi, HeapNumber | 2962 // This accessor applies the correct conversion from Smi, HeapNumber |
| 2870 // and undefined. | 2963 // and undefined. |
| 2871 MaybeObject* SetValue(uint32_t index, Object* value); | 2964 MaybeObject* SetValue(uint32_t index, Object* value); |
| 2872 | 2965 |
| 2873 // Casting. | 2966 // Casting. |
| 2874 static inline ExternalUnsignedIntArray* cast(Object* obj); | 2967 static inline ExternalUnsignedIntArray* cast(Object* obj); |
| 2875 | 2968 |
| 2969 #ifdef OBJECT_PRINT |
| 2970 inline void ExternalUnsignedIntArrayPrint() { |
| 2971 ExternalUnsignedIntArrayPrint(stdout); |
| 2972 } |
| 2973 void ExternalUnsignedIntArrayPrint(FILE* out); |
| 2974 #endif |
| 2876 #ifdef DEBUG | 2975 #ifdef DEBUG |
| 2877 void ExternalUnsignedIntArrayPrint(); | |
| 2878 void ExternalUnsignedIntArrayVerify(); | 2976 void ExternalUnsignedIntArrayVerify(); |
| 2879 #endif // DEBUG | 2977 #endif // DEBUG |
| 2880 | 2978 |
| 2881 private: | 2979 private: |
| 2882 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray); | 2980 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray); |
| 2883 }; | 2981 }; |
| 2884 | 2982 |
| 2885 | 2983 |
| 2886 class ExternalFloatArray: public ExternalArray { | 2984 class ExternalFloatArray: public ExternalArray { |
| 2887 public: | 2985 public: |
| 2888 // Setter and getter. | 2986 // Setter and getter. |
| 2889 inline float get(int index); | 2987 inline float get(int index); |
| 2890 inline void set(int index, float value); | 2988 inline void set(int index, float value); |
| 2891 | 2989 |
| 2892 // This accessor applies the correct conversion from Smi, HeapNumber | 2990 // This accessor applies the correct conversion from Smi, HeapNumber |
| 2893 // and undefined. | 2991 // and undefined. |
| 2894 MaybeObject* SetValue(uint32_t index, Object* value); | 2992 MaybeObject* SetValue(uint32_t index, Object* value); |
| 2895 | 2993 |
| 2896 // Casting. | 2994 // Casting. |
| 2897 static inline ExternalFloatArray* cast(Object* obj); | 2995 static inline ExternalFloatArray* cast(Object* obj); |
| 2898 | 2996 |
| 2997 #ifdef OBJECT_PRINT |
| 2998 inline void ExternalFloatArrayPrint() { |
| 2999 ExternalFloatArrayPrint(stdout); |
| 3000 } |
| 3001 void ExternalFloatArrayPrint(FILE* out); |
| 3002 #endif |
| 2899 #ifdef DEBUG | 3003 #ifdef DEBUG |
| 2900 void ExternalFloatArrayPrint(); | |
| 2901 void ExternalFloatArrayVerify(); | 3004 void ExternalFloatArrayVerify(); |
| 2902 #endif // DEBUG | 3005 #endif // DEBUG |
| 2903 | 3006 |
| 2904 private: | 3007 private: |
| 2905 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray); | 3008 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray); |
| 2906 }; | 3009 }; |
| 2907 | 3010 |
| 2908 | 3011 |
| 2909 // DeoptimizationInputData is a fixed array used to hold the deoptimization | 3012 // DeoptimizationInputData is a fixed array used to hold the deoptimization |
| 2910 // data for code generated by the Hydrogen/Lithium compiler. It also | 3013 // data for code generated by the Hydrogen/Lithium compiler. It also |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2970 return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize; | 3073 return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize; |
| 2971 } | 3074 } |
| 2972 | 3075 |
| 2973 // Allocates a DeoptimizationInputData. | 3076 // Allocates a DeoptimizationInputData. |
| 2974 MUST_USE_RESULT static MaybeObject* Allocate(int deopt_entry_count, | 3077 MUST_USE_RESULT static MaybeObject* Allocate(int deopt_entry_count, |
| 2975 PretenureFlag pretenure); | 3078 PretenureFlag pretenure); |
| 2976 | 3079 |
| 2977 // Casting. | 3080 // Casting. |
| 2978 static inline DeoptimizationInputData* cast(Object* obj); | 3081 static inline DeoptimizationInputData* cast(Object* obj); |
| 2979 | 3082 |
| 2980 #ifdef DEBUG | 3083 #ifdef OBJECT_PRINT |
| 2981 void DeoptimizationInputDataPrint(); | 3084 void DeoptimizationInputDataPrint(FILE* out); |
| 2982 #endif | 3085 #endif |
| 2983 | 3086 |
| 2984 private: | 3087 private: |
| 2985 static int IndexForEntry(int i) { | 3088 static int IndexForEntry(int i) { |
| 2986 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize); | 3089 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize); |
| 2987 } | 3090 } |
| 2988 | 3091 |
| 2989 static int LengthFor(int entry_count) { | 3092 static int LengthFor(int entry_count) { |
| 2990 return IndexForEntry(entry_count); | 3093 return IndexForEntry(entry_count); |
| 2991 } | 3094 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3009 return deopt_points * 2; | 3112 return deopt_points * 2; |
| 3010 } | 3113 } |
| 3011 | 3114 |
| 3012 // Allocates a DeoptimizationOutputData. | 3115 // Allocates a DeoptimizationOutputData. |
| 3013 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_deopt_points, | 3116 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_deopt_points, |
| 3014 PretenureFlag pretenure); | 3117 PretenureFlag pretenure); |
| 3015 | 3118 |
| 3016 // Casting. | 3119 // Casting. |
| 3017 static inline DeoptimizationOutputData* cast(Object* obj); | 3120 static inline DeoptimizationOutputData* cast(Object* obj); |
| 3018 | 3121 |
| 3019 #ifdef DEBUG | 3122 #ifdef OBJECT_PRINT |
| 3020 void DeoptimizationOutputDataPrint(); | 3123 void DeoptimizationOutputDataPrint(FILE* out); |
| 3021 #endif | 3124 #endif |
| 3022 }; | 3125 }; |
| 3023 | 3126 |
| 3024 | 3127 |
| 3025 // Code describes objects with on-the-fly generated machine code. | 3128 // Code describes objects with on-the-fly generated machine code. |
| 3026 class Code: public HeapObject { | 3129 class Code: public HeapObject { |
| 3027 public: | 3130 public: |
| 3028 // Opaque data type for encapsulating code flags like kind, inline | 3131 // Opaque data type for encapsulating code flags like kind, inline |
| 3029 // cache state, and arguments count. | 3132 // cache state, and arguments count. |
| 3030 // FLAGS_MIN_VALUE and FLAGS_MAX_VALUE are specified to ensure that | 3133 // FLAGS_MIN_VALUE and FLAGS_MAX_VALUE are specified to ensure that |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3059 | 3162 |
| 3060 enum { | 3163 enum { |
| 3061 NUMBER_OF_KINDS = LAST_IC_KIND + 1 | 3164 NUMBER_OF_KINDS = LAST_IC_KIND + 1 |
| 3062 }; | 3165 }; |
| 3063 | 3166 |
| 3064 #ifdef ENABLE_DISASSEMBLER | 3167 #ifdef ENABLE_DISASSEMBLER |
| 3065 // Printing | 3168 // Printing |
| 3066 static const char* Kind2String(Kind kind); | 3169 static const char* Kind2String(Kind kind); |
| 3067 static const char* ICState2String(InlineCacheState state); | 3170 static const char* ICState2String(InlineCacheState state); |
| 3068 static const char* PropertyType2String(PropertyType type); | 3171 static const char* PropertyType2String(PropertyType type); |
| 3069 void Disassemble(const char* name); | 3172 inline void Disassemble(const char* name) { |
| 3173 Disassemble(name, stdout); |
| 3174 } |
| 3175 void Disassemble(const char* name, FILE* out); |
| 3070 #endif // ENABLE_DISASSEMBLER | 3176 #endif // ENABLE_DISASSEMBLER |
| 3071 | 3177 |
| 3072 // [instruction_size]: Size of the native instructions | 3178 // [instruction_size]: Size of the native instructions |
| 3073 inline int instruction_size(); | 3179 inline int instruction_size(); |
| 3074 inline void set_instruction_size(int value); | 3180 inline void set_instruction_size(int value); |
| 3075 | 3181 |
| 3076 // [relocation_info]: Code relocation information | 3182 // [relocation_info]: Code relocation information |
| 3077 DECL_ACCESSORS(relocation_info, ByteArray) | 3183 DECL_ACCESSORS(relocation_info, ByteArray) |
| 3078 void InvalidateRelocation(); | 3184 void InvalidateRelocation(); |
| 3079 | 3185 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3252 | 3358 |
| 3253 // Casting. | 3359 // Casting. |
| 3254 static inline Code* cast(Object* obj); | 3360 static inline Code* cast(Object* obj); |
| 3255 | 3361 |
| 3256 // Dispatched behavior. | 3362 // Dispatched behavior. |
| 3257 int CodeSize() { return SizeFor(body_size()); } | 3363 int CodeSize() { return SizeFor(body_size()); } |
| 3258 inline void CodeIterateBody(ObjectVisitor* v); | 3364 inline void CodeIterateBody(ObjectVisitor* v); |
| 3259 | 3365 |
| 3260 template<typename StaticVisitor> | 3366 template<typename StaticVisitor> |
| 3261 inline void CodeIterateBody(Heap* heap); | 3367 inline void CodeIterateBody(Heap* heap); |
| 3368 #ifdef OBJECT_PRINT |
| 3369 inline void CodePrint() { |
| 3370 CodePrint(stdout); |
| 3371 } |
| 3372 void CodePrint(FILE* out); |
| 3373 #endif |
| 3262 #ifdef DEBUG | 3374 #ifdef DEBUG |
| 3263 void CodePrint(); | |
| 3264 void CodeVerify(); | 3375 void CodeVerify(); |
| 3265 #endif | 3376 #endif |
| 3266 | 3377 |
| 3267 // Max loop nesting marker used to postpose OSR. We don't take loop | 3378 // Max loop nesting marker used to postpose OSR. We don't take loop |
| 3268 // nesting that is deeper than 5 levels into account. | 3379 // nesting that is deeper than 5 levels into account. |
| 3269 static const int kMaxLoopNestingMarker = 6; | 3380 static const int kMaxLoopNestingMarker = 6; |
| 3270 | 3381 |
| 3271 // Layout description. | 3382 // Layout description. |
| 3272 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; | 3383 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; |
| 3273 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; | 3384 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3541 // This is undone in MarkCompactCollector::ClearNonLiveTransitions(). | 3652 // This is undone in MarkCompactCollector::ClearNonLiveTransitions(). |
| 3542 void CreateBackPointers(); | 3653 void CreateBackPointers(); |
| 3543 | 3654 |
| 3544 // Set all map transitions from this map to dead maps to null. | 3655 // Set all map transitions from this map to dead maps to null. |
| 3545 // Also, restore the original prototype on the targets of these | 3656 // Also, restore the original prototype on the targets of these |
| 3546 // transitions, so that we do not process this map again while | 3657 // transitions, so that we do not process this map again while |
| 3547 // following back pointers. | 3658 // following back pointers. |
| 3548 void ClearNonLiveTransitions(Heap* heap, Object* real_prototype); | 3659 void ClearNonLiveTransitions(Heap* heap, Object* real_prototype); |
| 3549 | 3660 |
| 3550 // Dispatched behavior. | 3661 // Dispatched behavior. |
| 3662 #ifdef OBJECT_PRINT |
| 3663 inline void MapPrint() { |
| 3664 MapPrint(stdout); |
| 3665 } |
| 3666 void MapPrint(FILE* out); |
| 3667 #endif |
| 3551 #ifdef DEBUG | 3668 #ifdef DEBUG |
| 3552 void MapPrint(); | |
| 3553 void MapVerify(); | 3669 void MapVerify(); |
| 3554 void SharedMapVerify(); | 3670 void SharedMapVerify(); |
| 3555 #endif | 3671 #endif |
| 3556 | 3672 |
| 3557 inline int visitor_id(); | 3673 inline int visitor_id(); |
| 3558 inline void set_visitor_id(int visitor_id); | 3674 inline void set_visitor_id(int visitor_id); |
| 3559 | 3675 |
| 3560 // Returns the heap this map belongs to. | 3676 // Returns the heap this map belongs to. |
| 3561 inline Heap* heap(); | 3677 inline Heap* heap(); |
| 3562 | 3678 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3701 // [eval_from_instructions_offset]: the instruction offset in the code for the | 3817 // [eval_from_instructions_offset]: the instruction offset in the code for the |
| 3702 // function from which eval was called where eval was called. | 3818 // function from which eval was called where eval was called. |
| 3703 DECL_ACCESSORS(eval_from_instructions_offset, Smi) | 3819 DECL_ACCESSORS(eval_from_instructions_offset, Smi) |
| 3704 | 3820 |
| 3705 static inline Script* cast(Object* obj); | 3821 static inline Script* cast(Object* obj); |
| 3706 | 3822 |
| 3707 // If script source is an external string, check that the underlying | 3823 // If script source is an external string, check that the underlying |
| 3708 // resource is accessible. Otherwise, always return true. | 3824 // resource is accessible. Otherwise, always return true. |
| 3709 inline bool HasValidSource(); | 3825 inline bool HasValidSource(); |
| 3710 | 3826 |
| 3827 #ifdef OBJECT_PRINT |
| 3828 inline void ScriptPrint() { |
| 3829 ScriptPrint(stdout); |
| 3830 } |
| 3831 void ScriptPrint(FILE* out); |
| 3832 #endif |
| 3711 #ifdef DEBUG | 3833 #ifdef DEBUG |
| 3712 void ScriptPrint(); | |
| 3713 void ScriptVerify(); | 3834 void ScriptVerify(); |
| 3714 #endif | 3835 #endif |
| 3715 | 3836 |
| 3716 static const int kSourceOffset = HeapObject::kHeaderSize; | 3837 static const int kSourceOffset = HeapObject::kHeaderSize; |
| 3717 static const int kNameOffset = kSourceOffset + kPointerSize; | 3838 static const int kNameOffset = kSourceOffset + kPointerSize; |
| 3718 static const int kLineOffsetOffset = kNameOffset + kPointerSize; | 3839 static const int kLineOffsetOffset = kNameOffset + kPointerSize; |
| 3719 static const int kColumnOffsetOffset = kLineOffsetOffset + kPointerSize; | 3840 static const int kColumnOffsetOffset = kLineOffsetOffset + kPointerSize; |
| 3720 static const int kDataOffset = kColumnOffsetOffset + kPointerSize; | 3841 static const int kDataOffset = kColumnOffsetOffset + kPointerSize; |
| 3721 static const int kContextOffset = kDataOffset + kPointerSize; | 3842 static const int kContextOffset = kDataOffset + kPointerSize; |
| 3722 static const int kWrapperOffset = kContextOffset + kPointerSize; | 3843 static const int kWrapperOffset = kContextOffset + kPointerSize; |
| 3723 static const int kTypeOffset = kWrapperOffset + kPointerSize; | 3844 static const int kTypeOffset = kWrapperOffset + kPointerSize; |
| 3724 static const int kCompilationTypeOffset = kTypeOffset + kPointerSize; | 3845 static const int kCompilationTypeOffset = kTypeOffset + kPointerSize; |
| 3725 static const int kLineEndsOffset = kCompilationTypeOffset + kPointerSize; | 3846 static const int kLineEndsOffset = kCompilationTypeOffset + kPointerSize; |
| 3726 static const int kIdOffset = kLineEndsOffset + kPointerSize; | 3847 static const int kIdOffset = kLineEndsOffset + kPointerSize; |
| 3727 static const int kEvalFromSharedOffset = kIdOffset + kPointerSize; | 3848 static const int kEvalFromSharedOffset = kIdOffset + kPointerSize; |
| 3728 static const int kEvalFrominstructionsOffsetOffset = | 3849 static const int kEvalFrominstructionsOffsetOffset = |
| 3729 kEvalFromSharedOffset + kPointerSize; | 3850 kEvalFromSharedOffset + kPointerSize; |
| 3730 static const int kSize = kEvalFrominstructionsOffsetOffset + kPointerSize; | 3851 static const int kSize = kEvalFrominstructionsOffsetOffset + kPointerSize; |
| 3731 | 3852 |
| 3732 private: | 3853 private: |
| 3733 DISALLOW_IMPLICIT_CONSTRUCTORS(Script); | 3854 DISALLOW_IMPLICIT_CONSTRUCTORS(Script); |
| 3734 }; | 3855 }; |
| 3735 | 3856 |
| 3736 | 3857 |
| 3737 enum MathFunctionId { | 3858 // List of builtin functions we want to identify to improve code |
| 3738 kNotSpecialMathFunction = 0, | 3859 // generation. |
| 3739 // These numbers must be kept in sync with the ones in math.js. | 3860 // |
| 3740 kMathFloor = 1, | 3861 // Each entry has a name of a global object property holding an object |
| 3741 kMathRound = 2, | 3862 // optionally followed by ".prototype", a name of a builtin function |
| 3742 kMathCeil = 3, | 3863 // on the object (the one the id is set for), and a label. |
| 3743 kMathAbs = 4, | 3864 // |
| 3744 kMathLog = 5, | 3865 // Installation of ids for the selected builtin functions is handled |
| 3745 kMathSin = 6, | 3866 // by the bootstrapper. |
| 3746 kMathCos = 7, | 3867 // |
| 3747 kMathTan = 8, | 3868 // NOTE: Order is important: math functions should be at the end of |
| 3748 kMathASin = 9, | 3869 // the list and MathFloor should be the first math function. |
| 3749 kMathACos = 0xa, | 3870 #define FUNCTIONS_WITH_ID_LIST(V) \ |
| 3750 kMathATan = 0xb, | 3871 V(Array.prototype, push, ArrayPush) \ |
| 3751 kMathExp = 0xc, | 3872 V(Array.prototype, pop, ArrayPop) \ |
| 3752 kMathSqrt = 0xd | 3873 V(String.prototype, charCodeAt, StringCharCodeAt) \ |
| 3874 V(String.prototype, charAt, StringCharAt) \ |
| 3875 V(String, fromCharCode, StringFromCharCode) \ |
| 3876 V(Math, floor, MathFloor) \ |
| 3877 V(Math, round, MathRound) \ |
| 3878 V(Math, ceil, MathCeil) \ |
| 3879 V(Math, abs, MathAbs) \ |
| 3880 V(Math, log, MathLog) \ |
| 3881 V(Math, sin, MathSin) \ |
| 3882 V(Math, cos, MathCos) \ |
| 3883 V(Math, tan, MathTan) \ |
| 3884 V(Math, asin, MathASin) \ |
| 3885 V(Math, acos, MathACos) \ |
| 3886 V(Math, atan, MathATan) \ |
| 3887 V(Math, exp, MathExp) \ |
| 3888 V(Math, sqrt, MathSqrt) \ |
| 3889 V(Math, pow, MathPow) |
| 3890 |
| 3891 |
| 3892 enum BuiltinFunctionId { |
| 3893 #define DECLARE_FUNCTION_ID(ignored1, ignore2, name) \ |
| 3894 k##name, |
| 3895 FUNCTIONS_WITH_ID_LIST(DECLARE_FUNCTION_ID) |
| 3896 #undef DECLARE_FUNCTION_ID |
| 3897 // Fake id for a special case of Math.pow. Note, it continues the |
| 3898 // list of math functions. |
| 3899 kMathPowHalf, |
| 3900 kFirstMathFunctionId = kMathFloor |
| 3753 }; | 3901 }; |
| 3754 | 3902 |
| 3755 | 3903 |
| 3756 // SharedFunctionInfo describes the JSFunction information that can be | 3904 // SharedFunctionInfo describes the JSFunction information that can be |
| 3757 // shared by multiple instances of the function. | 3905 // shared by multiple instances of the function. |
| 3758 class SharedFunctionInfo: public HeapObject { | 3906 class SharedFunctionInfo: public HeapObject { |
| 3759 public: | 3907 public: |
| 3760 // [name]: Function name. | 3908 // [name]: Function name. |
| 3761 DECL_ACCESSORS(name, Object) | 3909 DECL_ACCESSORS(name, Object) |
| 3762 | 3910 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3883 // May go back from true to false after GC. | 4031 // May go back from true to false after GC. |
| 3884 inline bool live_objects_may_exist(); | 4032 inline bool live_objects_may_exist(); |
| 3885 | 4033 |
| 3886 inline void set_live_objects_may_exist(bool value); | 4034 inline void set_live_objects_may_exist(bool value); |
| 3887 | 4035 |
| 3888 // [instance class name]: class name for instances. | 4036 // [instance class name]: class name for instances. |
| 3889 DECL_ACCESSORS(instance_class_name, Object) | 4037 DECL_ACCESSORS(instance_class_name, Object) |
| 3890 | 4038 |
| 3891 // [function data]: This field holds some additional data for function. | 4039 // [function data]: This field holds some additional data for function. |
| 3892 // Currently it either has FunctionTemplateInfo to make benefit the API | 4040 // Currently it either has FunctionTemplateInfo to make benefit the API |
| 3893 // or Smi identifying a custom call generator. | 4041 // or Smi identifying a builtin function. |
| 3894 // In the long run we don't want all functions to have this field but | 4042 // In the long run we don't want all functions to have this field but |
| 3895 // we can fix that when we have a better model for storing hidden data | 4043 // we can fix that when we have a better model for storing hidden data |
| 3896 // on objects. | 4044 // on objects. |
| 3897 DECL_ACCESSORS(function_data, Object) | 4045 DECL_ACCESSORS(function_data, Object) |
| 3898 | 4046 |
| 3899 inline bool IsApiFunction(); | 4047 inline bool IsApiFunction(); |
| 3900 inline FunctionTemplateInfo* get_api_func_data(); | 4048 inline FunctionTemplateInfo* get_api_func_data(); |
| 3901 inline bool HasCustomCallGenerator(); | 4049 inline bool HasBuiltinFunctionId(); |
| 3902 inline int custom_call_generator_id(); | 4050 inline bool IsBuiltinMathFunction(); |
| 4051 inline BuiltinFunctionId builtin_function_id(); |
| 3903 | 4052 |
| 3904 // [script info]: Script from which the function originates. | 4053 // [script info]: Script from which the function originates. |
| 3905 DECL_ACCESSORS(script, Object) | 4054 DECL_ACCESSORS(script, Object) |
| 3906 | 4055 |
| 3907 // [num_literals]: Number of literals used by this function. | 4056 // [num_literals]: Number of literals used by this function. |
| 3908 inline int num_literals(); | 4057 inline int num_literals(); |
| 3909 inline void set_num_literals(int value); | 4058 inline void set_num_literals(int value); |
| 3910 | 4059 |
| 3911 // [start_position_and_type]: Field used to store both the source code | 4060 // [start_position_and_type]: Field used to store both the source code |
| 3912 // position, whether or not the function is a function expression, | 4061 // position, whether or not the function is a function expression, |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4037 | 4186 |
| 4038 // Calculate the instance size. | 4187 // Calculate the instance size. |
| 4039 int CalculateInstanceSize(); | 4188 int CalculateInstanceSize(); |
| 4040 | 4189 |
| 4041 // Calculate the number of in-object properties. | 4190 // Calculate the number of in-object properties. |
| 4042 int CalculateInObjectProperties(); | 4191 int CalculateInObjectProperties(); |
| 4043 | 4192 |
| 4044 // Dispatched behavior. | 4193 // Dispatched behavior. |
| 4045 // Set max_length to -1 for unlimited length. | 4194 // Set max_length to -1 for unlimited length. |
| 4046 void SourceCodePrint(StringStream* accumulator, int max_length); | 4195 void SourceCodePrint(StringStream* accumulator, int max_length); |
| 4196 #ifdef OBJECT_PRINT |
| 4197 inline void SharedFunctionInfoPrint() { |
| 4198 SharedFunctionInfoPrint(stdout); |
| 4199 } |
| 4200 void SharedFunctionInfoPrint(FILE* out); |
| 4201 #endif |
| 4047 #ifdef DEBUG | 4202 #ifdef DEBUG |
| 4048 void SharedFunctionInfoPrint(); | |
| 4049 void SharedFunctionInfoVerify(); | 4203 void SharedFunctionInfoVerify(); |
| 4050 #endif | 4204 #endif |
| 4051 | 4205 |
| 4052 // Casting. | 4206 // Casting. |
| 4053 static inline SharedFunctionInfo* cast(Object* obj); | 4207 static inline SharedFunctionInfo* cast(Object* obj); |
| 4054 | 4208 |
| 4055 // Constants. | 4209 // Constants. |
| 4056 static const int kDontAdaptArgumentsSentinel = -1; | 4210 static const int kDontAdaptArgumentsSentinel = -1; |
| 4057 | 4211 |
| 4058 // Layout description. | 4212 // Layout description. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4143 #if __BYTE_ORDER == __LITTLE_ENDIAN | 4297 #if __BYTE_ORDER == __LITTLE_ENDIAN |
| 4144 static const int kConstructionCountOffset = kCompilerHintsOffset + 3; | 4298 static const int kConstructionCountOffset = kCompilerHintsOffset + 3; |
| 4145 #elif __BYTE_ORDER == __BIG_ENDIAN | 4299 #elif __BYTE_ORDER == __BIG_ENDIAN |
| 4146 static const int kConstructionCountOffset = kCompilerHintsOffset + 0; | 4300 static const int kConstructionCountOffset = kCompilerHintsOffset + 0; |
| 4147 #else | 4301 #else |
| 4148 #error Unknown byte ordering | 4302 #error Unknown byte ordering |
| 4149 #endif | 4303 #endif |
| 4150 | 4304 |
| 4151 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); | 4305 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); |
| 4152 | 4306 |
| 4153 // Get/set a special tag on the functions from math.js so we can inline | |
| 4154 // efficient versions of them in the code. | |
| 4155 inline MathFunctionId math_function_id(); | |
| 4156 inline void set_math_function_id(int id); | |
| 4157 static inline int max_math_id_number() { return kMathFunctionMask; } | |
| 4158 | |
| 4159 typedef FixedBodyDescriptor<kNameOffset, | 4307 typedef FixedBodyDescriptor<kNameOffset, |
| 4160 kThisPropertyAssignmentsOffset + kPointerSize, | 4308 kThisPropertyAssignmentsOffset + kPointerSize, |
| 4161 kSize> BodyDescriptor; | 4309 kSize> BodyDescriptor; |
| 4162 | 4310 |
| 4163 private: | 4311 private: |
| 4164 // Bit positions in start_position_and_type. | 4312 // Bit positions in start_position_and_type. |
| 4165 // The source code start position is in the 30 most significant bits of | 4313 // The source code start position is in the 30 most significant bits of |
| 4166 // the start_position_and_type field. | 4314 // the start_position_and_type field. |
| 4167 static const int kIsExpressionBit = 0; | 4315 static const int kIsExpressionBit = 0; |
| 4168 static const int kIsTopLevelBit = 1; | 4316 static const int kIsTopLevelBit = 1; |
| 4169 static const int kStartPositionShift = 2; | 4317 static const int kStartPositionShift = 2; |
| 4170 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 4318 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
| 4171 | 4319 |
| 4172 // Bit positions in compiler_hints. | 4320 // Bit positions in compiler_hints. |
| 4173 static const int kHasOnlySimpleThisPropertyAssignments = 0; | 4321 static const int kHasOnlySimpleThisPropertyAssignments = 0; |
| 4174 static const int kTryFullCodegen = 1; | 4322 static const int kTryFullCodegen = 1; |
| 4175 static const int kAllowLazyCompilation = 2; | 4323 static const int kAllowLazyCompilation = 2; |
| 4176 static const int kMathFunctionShift = 3; | 4324 static const int kLiveObjectsMayExist = 3; |
| 4177 static const int kMathFunctionMask = 0xf; | 4325 static const int kCodeAgeShift = 4; |
| 4178 static const int kLiveObjectsMayExist = 7; | |
| 4179 static const int kCodeAgeShift = 8; | |
| 4180 static const int kCodeAgeMask = 0x7; | 4326 static const int kCodeAgeMask = 0x7; |
| 4181 static const int kOptimizationDisabled = 11; | 4327 static const int kOptimizationDisabled = 7; |
| 4182 | 4328 |
| 4183 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); | 4329 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); |
| 4184 }; | 4330 }; |
| 4185 | 4331 |
| 4186 | 4332 |
| 4187 // JSFunction describes JavaScript functions. | 4333 // JSFunction describes JavaScript functions. |
| 4188 class JSFunction: public JSObject { | 4334 class JSFunction: public JSObject { |
| 4189 public: | 4335 public: |
| 4190 // [prototype_or_initial_map]: | 4336 // [prototype_or_initial_map]: |
| 4191 DECL_ACCESSORS(prototype_or_initial_map, Object) | 4337 DECL_ACCESSORS(prototype_or_initial_map, Object) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4278 Object* SetInstanceClassName(String* name); | 4424 Object* SetInstanceClassName(String* name); |
| 4279 | 4425 |
| 4280 // Returns if this function has been compiled to native code yet. | 4426 // Returns if this function has been compiled to native code yet. |
| 4281 inline bool is_compiled(); | 4427 inline bool is_compiled(); |
| 4282 | 4428 |
| 4283 // [next_function_link]: Field for linking functions. This list is treated as | 4429 // [next_function_link]: Field for linking functions. This list is treated as |
| 4284 // a weak list by the GC. | 4430 // a weak list by the GC. |
| 4285 DECL_ACCESSORS(next_function_link, Object) | 4431 DECL_ACCESSORS(next_function_link, Object) |
| 4286 | 4432 |
| 4287 // Prints the name of the function using PrintF. | 4433 // Prints the name of the function using PrintF. |
| 4288 void PrintName(); | 4434 inline void PrintName() { |
| 4435 PrintName(stdout); |
| 4436 } |
| 4437 void PrintName(FILE* out); |
| 4289 | 4438 |
| 4290 // Casting. | 4439 // Casting. |
| 4291 static inline JSFunction* cast(Object* obj); | 4440 static inline JSFunction* cast(Object* obj); |
| 4292 | 4441 |
| 4293 // Iterates the objects, including code objects indirectly referenced | 4442 // Iterates the objects, including code objects indirectly referenced |
| 4294 // through pointers to the first instruction in the code object. | 4443 // through pointers to the first instruction in the code object. |
| 4295 void JSFunctionIterateBody(int object_size, ObjectVisitor* v); | 4444 void JSFunctionIterateBody(int object_size, ObjectVisitor* v); |
| 4296 | 4445 |
| 4297 // Dispatched behavior. | 4446 // Dispatched behavior. |
| 4447 #ifdef OBJECT_PRINT |
| 4448 inline void JSFunctionPrint() { |
| 4449 JSFunctionPrint(stdout); |
| 4450 } |
| 4451 void JSFunctionPrint(FILE* out); |
| 4452 #endif |
| 4298 #ifdef DEBUG | 4453 #ifdef DEBUG |
| 4299 void JSFunctionPrint(); | |
| 4300 void JSFunctionVerify(); | 4454 void JSFunctionVerify(); |
| 4301 #endif | 4455 #endif |
| 4302 | 4456 |
| 4303 // Returns the number of allocated literals. | 4457 // Returns the number of allocated literals. |
| 4304 inline int NumberOfLiterals(); | 4458 inline int NumberOfLiterals(); |
| 4305 | 4459 |
| 4306 // Retrieve the global context from a function's literal array. | 4460 // Retrieve the global context from a function's literal array. |
| 4307 static Context* GlobalContextFromLiterals(FixedArray* literals); | 4461 static Context* GlobalContextFromLiterals(FixedArray* literals); |
| 4308 | 4462 |
| 4309 // Layout descriptors. The last property (from kNonWeakFieldsEndOffset to | 4463 // Layout descriptors. The last property (from kNonWeakFieldsEndOffset to |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4338 class JSGlobalProxy : public JSObject { | 4492 class JSGlobalProxy : public JSObject { |
| 4339 public: | 4493 public: |
| 4340 // [context]: the owner global context of this proxy object. | 4494 // [context]: the owner global context of this proxy object. |
| 4341 // It is null value if this object is not used by any context. | 4495 // It is null value if this object is not used by any context. |
| 4342 DECL_ACCESSORS(context, Object) | 4496 DECL_ACCESSORS(context, Object) |
| 4343 | 4497 |
| 4344 // Casting. | 4498 // Casting. |
| 4345 static inline JSGlobalProxy* cast(Object* obj); | 4499 static inline JSGlobalProxy* cast(Object* obj); |
| 4346 | 4500 |
| 4347 // Dispatched behavior. | 4501 // Dispatched behavior. |
| 4502 #ifdef OBJECT_PRINT |
| 4503 inline void JSGlobalProxyPrint() { |
| 4504 JSGlobalProxyPrint(stdout); |
| 4505 } |
| 4506 void JSGlobalProxyPrint(FILE* out); |
| 4507 #endif |
| 4348 #ifdef DEBUG | 4508 #ifdef DEBUG |
| 4349 void JSGlobalProxyPrint(); | |
| 4350 void JSGlobalProxyVerify(); | 4509 void JSGlobalProxyVerify(); |
| 4351 #endif | 4510 #endif |
| 4352 | 4511 |
| 4353 // Layout description. | 4512 // Layout description. |
| 4354 static const int kContextOffset = JSObject::kHeaderSize; | 4513 static const int kContextOffset = JSObject::kHeaderSize; |
| 4355 static const int kSize = kContextOffset + kPointerSize; | 4514 static const int kSize = kContextOffset + kPointerSize; |
| 4356 | 4515 |
| 4357 private: | 4516 private: |
| 4358 | 4517 |
| 4359 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); | 4518 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4409 | 4568 |
| 4410 | 4569 |
| 4411 // JavaScript global object. | 4570 // JavaScript global object. |
| 4412 class JSGlobalObject: public GlobalObject { | 4571 class JSGlobalObject: public GlobalObject { |
| 4413 public: | 4572 public: |
| 4414 | 4573 |
| 4415 // Casting. | 4574 // Casting. |
| 4416 static inline JSGlobalObject* cast(Object* obj); | 4575 static inline JSGlobalObject* cast(Object* obj); |
| 4417 | 4576 |
| 4418 // Dispatched behavior. | 4577 // Dispatched behavior. |
| 4578 #ifdef OBJECT_PRINT |
| 4579 inline void JSGlobalObjectPrint() { |
| 4580 JSGlobalObjectPrint(stdout); |
| 4581 } |
| 4582 void JSGlobalObjectPrint(FILE* out); |
| 4583 #endif |
| 4419 #ifdef DEBUG | 4584 #ifdef DEBUG |
| 4420 void JSGlobalObjectPrint(); | |
| 4421 void JSGlobalObjectVerify(); | 4585 void JSGlobalObjectVerify(); |
| 4422 #endif | 4586 #endif |
| 4423 | 4587 |
| 4424 // Layout description. | 4588 // Layout description. |
| 4425 static const int kSize = GlobalObject::kHeaderSize; | 4589 static const int kSize = GlobalObject::kHeaderSize; |
| 4426 | 4590 |
| 4427 private: | 4591 private: |
| 4428 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalObject); | 4592 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalObject); |
| 4429 }; | 4593 }; |
| 4430 | 4594 |
| 4431 | 4595 |
| 4432 // Builtins global object which holds the runtime routines written in | 4596 // Builtins global object which holds the runtime routines written in |
| 4433 // JavaScript. | 4597 // JavaScript. |
| 4434 class JSBuiltinsObject: public GlobalObject { | 4598 class JSBuiltinsObject: public GlobalObject { |
| 4435 public: | 4599 public: |
| 4436 // Accessors for the runtime routines written in JavaScript. | 4600 // Accessors for the runtime routines written in JavaScript. |
| 4437 inline Object* javascript_builtin(Builtins::JavaScript id); | 4601 inline Object* javascript_builtin(Builtins::JavaScript id); |
| 4438 inline void set_javascript_builtin(Builtins::JavaScript id, Object* value); | 4602 inline void set_javascript_builtin(Builtins::JavaScript id, Object* value); |
| 4439 | 4603 |
| 4440 // Accessors for code of the runtime routines written in JavaScript. | 4604 // Accessors for code of the runtime routines written in JavaScript. |
| 4441 inline Code* javascript_builtin_code(Builtins::JavaScript id); | 4605 inline Code* javascript_builtin_code(Builtins::JavaScript id); |
| 4442 inline void set_javascript_builtin_code(Builtins::JavaScript id, Code* value); | 4606 inline void set_javascript_builtin_code(Builtins::JavaScript id, Code* value); |
| 4443 | 4607 |
| 4444 // Casting. | 4608 // Casting. |
| 4445 static inline JSBuiltinsObject* cast(Object* obj); | 4609 static inline JSBuiltinsObject* cast(Object* obj); |
| 4446 | 4610 |
| 4447 // Dispatched behavior. | 4611 // Dispatched behavior. |
| 4612 #ifdef OBJECT_PRINT |
| 4613 inline void JSBuiltinsObjectPrint() { |
| 4614 JSBuiltinsObjectPrint(stdout); |
| 4615 } |
| 4616 void JSBuiltinsObjectPrint(FILE* out); |
| 4617 #endif |
| 4448 #ifdef DEBUG | 4618 #ifdef DEBUG |
| 4449 void JSBuiltinsObjectPrint(); | |
| 4450 void JSBuiltinsObjectVerify(); | 4619 void JSBuiltinsObjectVerify(); |
| 4451 #endif | 4620 #endif |
| 4452 | 4621 |
| 4453 // Layout description. The size of the builtins object includes | 4622 // Layout description. The size of the builtins object includes |
| 4454 // room for two pointers per runtime routine written in javascript | 4623 // room for two pointers per runtime routine written in javascript |
| 4455 // (function and code object). | 4624 // (function and code object). |
| 4456 static const int kJSBuiltinsCount = Builtins::id_count; | 4625 static const int kJSBuiltinsCount = Builtins::id_count; |
| 4457 static const int kJSBuiltinsOffset = GlobalObject::kHeaderSize; | 4626 static const int kJSBuiltinsOffset = GlobalObject::kHeaderSize; |
| 4458 static const int kJSBuiltinsCodeOffset = | 4627 static const int kJSBuiltinsCodeOffset = |
| 4459 GlobalObject::kHeaderSize + (kJSBuiltinsCount * kPointerSize); | 4628 GlobalObject::kHeaderSize + (kJSBuiltinsCount * kPointerSize); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 4476 // Representation for JS Wrapper objects, String, Number, Boolean, Date, etc. | 4645 // Representation for JS Wrapper objects, String, Number, Boolean, Date, etc. |
| 4477 class JSValue: public JSObject { | 4646 class JSValue: public JSObject { |
| 4478 public: | 4647 public: |
| 4479 // [value]: the object being wrapped. | 4648 // [value]: the object being wrapped. |
| 4480 DECL_ACCESSORS(value, Object) | 4649 DECL_ACCESSORS(value, Object) |
| 4481 | 4650 |
| 4482 // Casting. | 4651 // Casting. |
| 4483 static inline JSValue* cast(Object* obj); | 4652 static inline JSValue* cast(Object* obj); |
| 4484 | 4653 |
| 4485 // Dispatched behavior. | 4654 // Dispatched behavior. |
| 4655 #ifdef OBJECT_PRINT |
| 4656 inline void JSValuePrint() { |
| 4657 JSValuePrint(stdout); |
| 4658 } |
| 4659 void JSValuePrint(FILE* out); |
| 4660 #endif |
| 4486 #ifdef DEBUG | 4661 #ifdef DEBUG |
| 4487 void JSValuePrint(); | |
| 4488 void JSValueVerify(); | 4662 void JSValueVerify(); |
| 4489 #endif | 4663 #endif |
| 4490 | 4664 |
| 4491 // Layout description. | 4665 // Layout description. |
| 4492 static const int kValueOffset = JSObject::kHeaderSize; | 4666 static const int kValueOffset = JSObject::kHeaderSize; |
| 4493 static const int kSize = kValueOffset + kPointerSize; | 4667 static const int kSize = kValueOffset + kPointerSize; |
| 4494 | 4668 |
| 4495 private: | 4669 private: |
| 4496 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); | 4670 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); |
| 4497 }; | 4671 }; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4666 // code object is not in that cache. This index can be used to later call | 4840 // code object is not in that cache. This index can be used to later call |
| 4667 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and | 4841 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and |
| 4668 // RemoveByIndex. | 4842 // RemoveByIndex. |
| 4669 int GetIndex(Object* name, Code* code); | 4843 int GetIndex(Object* name, Code* code); |
| 4670 | 4844 |
| 4671 // Remove an object from the cache with the provided internal index. | 4845 // Remove an object from the cache with the provided internal index. |
| 4672 void RemoveByIndex(Object* name, Code* code, int index); | 4846 void RemoveByIndex(Object* name, Code* code, int index); |
| 4673 | 4847 |
| 4674 static inline CodeCache* cast(Object* obj); | 4848 static inline CodeCache* cast(Object* obj); |
| 4675 | 4849 |
| 4850 #ifdef OBJECT_PRINT |
| 4851 inline void CodeCachePrint() { |
| 4852 CodeCachePrint(stdout); |
| 4853 } |
| 4854 void CodeCachePrint(FILE* out); |
| 4855 #endif |
| 4676 #ifdef DEBUG | 4856 #ifdef DEBUG |
| 4677 void CodeCachePrint(); | |
| 4678 void CodeCacheVerify(); | 4857 void CodeCacheVerify(); |
| 4679 #endif | 4858 #endif |
| 4680 | 4859 |
| 4681 static const int kDefaultCacheOffset = HeapObject::kHeaderSize; | 4860 static const int kDefaultCacheOffset = HeapObject::kHeaderSize; |
| 4682 static const int kNormalTypeCacheOffset = | 4861 static const int kNormalTypeCacheOffset = |
| 4683 kDefaultCacheOffset + kPointerSize; | 4862 kDefaultCacheOffset + kPointerSize; |
| 4684 static const int kSize = kNormalTypeCacheOffset + kPointerSize; | 4863 static const int kSize = kNormalTypeCacheOffset + kPointerSize; |
| 4685 | 4864 |
| 4686 private: | 4865 private: |
| 4687 MUST_USE_RESULT MaybeObject* UpdateDefaultCache(String* name, Code* code); | 4866 MUST_USE_RESULT MaybeObject* UpdateDefaultCache(String* name, Code* code); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4968 // Casting. | 5147 // Casting. |
| 4969 static inline String* cast(Object* obj); | 5148 static inline String* cast(Object* obj); |
| 4970 | 5149 |
| 4971 void PrintOn(FILE* out); | 5150 void PrintOn(FILE* out); |
| 4972 | 5151 |
| 4973 // For use during stack traces. Performs rudimentary sanity check. | 5152 // For use during stack traces. Performs rudimentary sanity check. |
| 4974 bool LooksValid(); | 5153 bool LooksValid(); |
| 4975 | 5154 |
| 4976 // Dispatched behavior. | 5155 // Dispatched behavior. |
| 4977 void StringShortPrint(StringStream* accumulator); | 5156 void StringShortPrint(StringStream* accumulator); |
| 5157 #ifdef OBJECT_PRINT |
| 5158 inline void StringPrint() { |
| 5159 StringPrint(stdout); |
| 5160 } |
| 5161 void StringPrint(FILE* out); |
| 5162 #endif |
| 4978 #ifdef DEBUG | 5163 #ifdef DEBUG |
| 4979 void StringPrint(); | |
| 4980 void StringVerify(); | 5164 void StringVerify(); |
| 4981 #endif | 5165 #endif |
| 4982 inline bool IsFlat(); | 5166 inline bool IsFlat(); |
| 4983 | 5167 |
| 4984 // Layout description. | 5168 // Layout description. |
| 4985 static const int kLengthOffset = HeapObject::kHeaderSize; | 5169 static const int kLengthOffset = HeapObject::kHeaderSize; |
| 4986 static const int kHashFieldOffset = kLengthOffset + kPointerSize; | 5170 static const int kHashFieldOffset = kLengthOffset + kPointerSize; |
| 4987 static const int kSize = kHashFieldOffset + kPointerSize; | 5171 static const int kSize = kHashFieldOffset + kPointerSize; |
| 4988 | 5172 |
| 4989 // Maximum number of characters to consider when trying to convert a string | 5173 // Maximum number of characters to consider when trying to convert a string |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5534 class JSGlobalPropertyCell: public HeapObject { | 5718 class JSGlobalPropertyCell: public HeapObject { |
| 5535 public: | 5719 public: |
| 5536 // [value]: value of the global property. | 5720 // [value]: value of the global property. |
| 5537 DECL_ACCESSORS(value, Object) | 5721 DECL_ACCESSORS(value, Object) |
| 5538 | 5722 |
| 5539 // Casting. | 5723 // Casting. |
| 5540 static inline JSGlobalPropertyCell* cast(Object* obj); | 5724 static inline JSGlobalPropertyCell* cast(Object* obj); |
| 5541 | 5725 |
| 5542 #ifdef DEBUG | 5726 #ifdef DEBUG |
| 5543 void JSGlobalPropertyCellVerify(); | 5727 void JSGlobalPropertyCellVerify(); |
| 5544 void JSGlobalPropertyCellPrint(); | 5728 #endif |
| 5729 #ifdef OBJECT_PRINT |
| 5730 inline void JSGlobalPropertyCellPrint() { |
| 5731 JSGlobalPropertyCellPrint(stdout); |
| 5732 } |
| 5733 void JSGlobalPropertyCellPrint(FILE* out); |
| 5545 #endif | 5734 #endif |
| 5546 | 5735 |
| 5547 // Layout description. | 5736 // Layout description. |
| 5548 static const int kValueOffset = HeapObject::kHeaderSize; | 5737 static const int kValueOffset = HeapObject::kHeaderSize; |
| 5549 static const int kSize = kValueOffset + kPointerSize; | 5738 static const int kSize = kValueOffset + kPointerSize; |
| 5550 | 5739 |
| 5551 typedef FixedBodyDescriptor<kValueOffset, | 5740 typedef FixedBodyDescriptor<kValueOffset, |
| 5552 kValueOffset + kPointerSize, | 5741 kValueOffset + kPointerSize, |
| 5553 kSize> BodyDescriptor; | 5742 kSize> BodyDescriptor; |
| 5554 | 5743 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 5569 | 5758 |
| 5570 // Casting. | 5759 // Casting. |
| 5571 static inline Proxy* cast(Object* obj); | 5760 static inline Proxy* cast(Object* obj); |
| 5572 | 5761 |
| 5573 // Dispatched behavior. | 5762 // Dispatched behavior. |
| 5574 inline void ProxyIterateBody(ObjectVisitor* v); | 5763 inline void ProxyIterateBody(ObjectVisitor* v); |
| 5575 | 5764 |
| 5576 template<typename StaticVisitor> | 5765 template<typename StaticVisitor> |
| 5577 inline void ProxyIterateBody(); | 5766 inline void ProxyIterateBody(); |
| 5578 | 5767 |
| 5768 #ifdef OBJECT_PRINT |
| 5769 inline void ProxyPrint() { |
| 5770 ProxyPrint(stdout); |
| 5771 } |
| 5772 void ProxyPrint(FILE* out); |
| 5773 #endif |
| 5579 #ifdef DEBUG | 5774 #ifdef DEBUG |
| 5580 void ProxyPrint(); | |
| 5581 void ProxyVerify(); | 5775 void ProxyVerify(); |
| 5582 #endif | 5776 #endif |
| 5583 | 5777 |
| 5584 // Layout description. | 5778 // Layout description. |
| 5585 | 5779 |
| 5586 static const int kProxyOffset = HeapObject::kHeaderSize; | 5780 static const int kProxyOffset = HeapObject::kHeaderSize; |
| 5587 static const int kSize = kProxyOffset + kPointerSize; | 5781 static const int kSize = kProxyOffset + kPointerSize; |
| 5588 | 5782 |
| 5589 STATIC_CHECK(kProxyOffset == Internals::kProxyProxyOffset); | 5783 STATIC_CHECK(kProxyOffset == Internals::kProxyProxyOffset); |
| 5590 | 5784 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 5619 inline void SetContent(FixedArray* storage); | 5813 inline void SetContent(FixedArray* storage); |
| 5620 | 5814 |
| 5621 // Casting. | 5815 // Casting. |
| 5622 static inline JSArray* cast(Object* obj); | 5816 static inline JSArray* cast(Object* obj); |
| 5623 | 5817 |
| 5624 // Uses handles. Ensures that the fixed array backing the JSArray has at | 5818 // Uses handles. Ensures that the fixed array backing the JSArray has at |
| 5625 // least the stated size. | 5819 // least the stated size. |
| 5626 inline void EnsureSize(int minimum_size_of_backing_fixed_array); | 5820 inline void EnsureSize(int minimum_size_of_backing_fixed_array); |
| 5627 | 5821 |
| 5628 // Dispatched behavior. | 5822 // Dispatched behavior. |
| 5823 #ifdef OBJECT_PRINT |
| 5824 inline void JSArrayPrint() { |
| 5825 JSArrayPrint(stdout); |
| 5826 } |
| 5827 void JSArrayPrint(FILE* out); |
| 5828 #endif |
| 5629 #ifdef DEBUG | 5829 #ifdef DEBUG |
| 5630 void JSArrayPrint(); | |
| 5631 void JSArrayVerify(); | 5830 void JSArrayVerify(); |
| 5632 #endif | 5831 #endif |
| 5633 | 5832 |
| 5634 // Number of element slots to pre-allocate for an empty array. | 5833 // Number of element slots to pre-allocate for an empty array. |
| 5635 static const int kPreallocatedArrayElements = 4; | 5834 static const int kPreallocatedArrayElements = 4; |
| 5636 | 5835 |
| 5637 // Layout description. | 5836 // Layout description. |
| 5638 static const int kLengthOffset = JSObject::kHeaderSize; | 5837 static const int kLengthOffset = JSObject::kHeaderSize; |
| 5639 static const int kSize = kLengthOffset + kPointerSize; | 5838 static const int kSize = kLengthOffset + kPointerSize; |
| 5640 | 5839 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5691 inline void set_all_can_write(bool value); | 5890 inline void set_all_can_write(bool value); |
| 5692 | 5891 |
| 5693 inline bool prohibits_overwriting(); | 5892 inline bool prohibits_overwriting(); |
| 5694 inline void set_prohibits_overwriting(bool value); | 5893 inline void set_prohibits_overwriting(bool value); |
| 5695 | 5894 |
| 5696 inline PropertyAttributes property_attributes(); | 5895 inline PropertyAttributes property_attributes(); |
| 5697 inline void set_property_attributes(PropertyAttributes attributes); | 5896 inline void set_property_attributes(PropertyAttributes attributes); |
| 5698 | 5897 |
| 5699 static inline AccessorInfo* cast(Object* obj); | 5898 static inline AccessorInfo* cast(Object* obj); |
| 5700 | 5899 |
| 5900 #ifdef OBJECT_PRINT |
| 5901 inline void AccessorInfoPrint() { |
| 5902 AccessorInfoPrint(stdout); |
| 5903 } |
| 5904 void AccessorInfoPrint(FILE* out); |
| 5905 #endif |
| 5701 #ifdef DEBUG | 5906 #ifdef DEBUG |
| 5702 void AccessorInfoPrint(); | |
| 5703 void AccessorInfoVerify(); | 5907 void AccessorInfoVerify(); |
| 5704 #endif | 5908 #endif |
| 5705 | 5909 |
| 5706 static const int kGetterOffset = HeapObject::kHeaderSize; | 5910 static const int kGetterOffset = HeapObject::kHeaderSize; |
| 5707 static const int kSetterOffset = kGetterOffset + kPointerSize; | 5911 static const int kSetterOffset = kGetterOffset + kPointerSize; |
| 5708 static const int kDataOffset = kSetterOffset + kPointerSize; | 5912 static const int kDataOffset = kSetterOffset + kPointerSize; |
| 5709 static const int kNameOffset = kDataOffset + kPointerSize; | 5913 static const int kNameOffset = kDataOffset + kPointerSize; |
| 5710 static const int kFlagOffset = kNameOffset + kPointerSize; | 5914 static const int kFlagOffset = kNameOffset + kPointerSize; |
| 5711 static const int kSize = kFlagOffset + kPointerSize; | 5915 static const int kSize = kFlagOffset + kPointerSize; |
| 5712 | 5916 |
| 5713 private: | 5917 private: |
| 5714 // Bit positions in flag. | 5918 // Bit positions in flag. |
| 5715 static const int kAllCanReadBit = 0; | 5919 static const int kAllCanReadBit = 0; |
| 5716 static const int kAllCanWriteBit = 1; | 5920 static const int kAllCanWriteBit = 1; |
| 5717 static const int kProhibitsOverwritingBit = 2; | 5921 static const int kProhibitsOverwritingBit = 2; |
| 5718 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; | 5922 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; |
| 5719 | 5923 |
| 5720 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); | 5924 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); |
| 5721 }; | 5925 }; |
| 5722 | 5926 |
| 5723 | 5927 |
| 5724 class AccessCheckInfo: public Struct { | 5928 class AccessCheckInfo: public Struct { |
| 5725 public: | 5929 public: |
| 5726 DECL_ACCESSORS(named_callback, Object) | 5930 DECL_ACCESSORS(named_callback, Object) |
| 5727 DECL_ACCESSORS(indexed_callback, Object) | 5931 DECL_ACCESSORS(indexed_callback, Object) |
| 5728 DECL_ACCESSORS(data, Object) | 5932 DECL_ACCESSORS(data, Object) |
| 5729 | 5933 |
| 5730 static inline AccessCheckInfo* cast(Object* obj); | 5934 static inline AccessCheckInfo* cast(Object* obj); |
| 5731 | 5935 |
| 5936 #ifdef OBJECT_PRINT |
| 5937 inline void AccessCheckInfoPrint() { |
| 5938 AccessCheckInfoPrint(stdout); |
| 5939 } |
| 5940 void AccessCheckInfoPrint(FILE* out); |
| 5941 #endif |
| 5732 #ifdef DEBUG | 5942 #ifdef DEBUG |
| 5733 void AccessCheckInfoPrint(); | |
| 5734 void AccessCheckInfoVerify(); | 5943 void AccessCheckInfoVerify(); |
| 5735 #endif | 5944 #endif |
| 5736 | 5945 |
| 5737 static const int kNamedCallbackOffset = HeapObject::kHeaderSize; | 5946 static const int kNamedCallbackOffset = HeapObject::kHeaderSize; |
| 5738 static const int kIndexedCallbackOffset = kNamedCallbackOffset + kPointerSize; | 5947 static const int kIndexedCallbackOffset = kNamedCallbackOffset + kPointerSize; |
| 5739 static const int kDataOffset = kIndexedCallbackOffset + kPointerSize; | 5948 static const int kDataOffset = kIndexedCallbackOffset + kPointerSize; |
| 5740 static const int kSize = kDataOffset + kPointerSize; | 5949 static const int kSize = kDataOffset + kPointerSize; |
| 5741 | 5950 |
| 5742 private: | 5951 private: |
| 5743 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessCheckInfo); | 5952 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessCheckInfo); |
| 5744 }; | 5953 }; |
| 5745 | 5954 |
| 5746 | 5955 |
| 5747 class InterceptorInfo: public Struct { | 5956 class InterceptorInfo: public Struct { |
| 5748 public: | 5957 public: |
| 5749 DECL_ACCESSORS(getter, Object) | 5958 DECL_ACCESSORS(getter, Object) |
| 5750 DECL_ACCESSORS(setter, Object) | 5959 DECL_ACCESSORS(setter, Object) |
| 5751 DECL_ACCESSORS(query, Object) | 5960 DECL_ACCESSORS(query, Object) |
| 5752 DECL_ACCESSORS(deleter, Object) | 5961 DECL_ACCESSORS(deleter, Object) |
| 5753 DECL_ACCESSORS(enumerator, Object) | 5962 DECL_ACCESSORS(enumerator, Object) |
| 5754 DECL_ACCESSORS(data, Object) | 5963 DECL_ACCESSORS(data, Object) |
| 5755 | 5964 |
| 5756 static inline InterceptorInfo* cast(Object* obj); | 5965 static inline InterceptorInfo* cast(Object* obj); |
| 5757 | 5966 |
| 5967 #ifdef OBJECT_PRINT |
| 5968 inline void InterceptorInfoPrint() { |
| 5969 InterceptorInfoPrint(stdout); |
| 5970 } |
| 5971 void InterceptorInfoPrint(FILE* out); |
| 5972 #endif |
| 5758 #ifdef DEBUG | 5973 #ifdef DEBUG |
| 5759 void InterceptorInfoPrint(); | |
| 5760 void InterceptorInfoVerify(); | 5974 void InterceptorInfoVerify(); |
| 5761 #endif | 5975 #endif |
| 5762 | 5976 |
| 5763 static const int kGetterOffset = HeapObject::kHeaderSize; | 5977 static const int kGetterOffset = HeapObject::kHeaderSize; |
| 5764 static const int kSetterOffset = kGetterOffset + kPointerSize; | 5978 static const int kSetterOffset = kGetterOffset + kPointerSize; |
| 5765 static const int kQueryOffset = kSetterOffset + kPointerSize; | 5979 static const int kQueryOffset = kSetterOffset + kPointerSize; |
| 5766 static const int kDeleterOffset = kQueryOffset + kPointerSize; | 5980 static const int kDeleterOffset = kQueryOffset + kPointerSize; |
| 5767 static const int kEnumeratorOffset = kDeleterOffset + kPointerSize; | 5981 static const int kEnumeratorOffset = kDeleterOffset + kPointerSize; |
| 5768 static const int kDataOffset = kEnumeratorOffset + kPointerSize; | 5982 static const int kDataOffset = kEnumeratorOffset + kPointerSize; |
| 5769 static const int kSize = kDataOffset + kPointerSize; | 5983 static const int kSize = kDataOffset + kPointerSize; |
| 5770 | 5984 |
| 5771 private: | 5985 private: |
| 5772 DISALLOW_IMPLICIT_CONSTRUCTORS(InterceptorInfo); | 5986 DISALLOW_IMPLICIT_CONSTRUCTORS(InterceptorInfo); |
| 5773 }; | 5987 }; |
| 5774 | 5988 |
| 5775 | 5989 |
| 5776 class CallHandlerInfo: public Struct { | 5990 class CallHandlerInfo: public Struct { |
| 5777 public: | 5991 public: |
| 5778 DECL_ACCESSORS(callback, Object) | 5992 DECL_ACCESSORS(callback, Object) |
| 5779 DECL_ACCESSORS(data, Object) | 5993 DECL_ACCESSORS(data, Object) |
| 5780 | 5994 |
| 5781 static inline CallHandlerInfo* cast(Object* obj); | 5995 static inline CallHandlerInfo* cast(Object* obj); |
| 5782 | 5996 |
| 5997 #ifdef OBJECT_PRINT |
| 5998 inline void CallHandlerInfoPrint() { |
| 5999 CallHandlerInfoPrint(stdout); |
| 6000 } |
| 6001 void CallHandlerInfoPrint(FILE* out); |
| 6002 #endif |
| 5783 #ifdef DEBUG | 6003 #ifdef DEBUG |
| 5784 void CallHandlerInfoPrint(); | |
| 5785 void CallHandlerInfoVerify(); | 6004 void CallHandlerInfoVerify(); |
| 5786 #endif | 6005 #endif |
| 5787 | 6006 |
| 5788 static const int kCallbackOffset = HeapObject::kHeaderSize; | 6007 static const int kCallbackOffset = HeapObject::kHeaderSize; |
| 5789 static const int kDataOffset = kCallbackOffset + kPointerSize; | 6008 static const int kDataOffset = kCallbackOffset + kPointerSize; |
| 5790 static const int kSize = kDataOffset + kPointerSize; | 6009 static const int kSize = kDataOffset + kPointerSize; |
| 5791 | 6010 |
| 5792 private: | 6011 private: |
| 5793 DISALLOW_IMPLICIT_CONSTRUCTORS(CallHandlerInfo); | 6012 DISALLOW_IMPLICIT_CONSTRUCTORS(CallHandlerInfo); |
| 5794 }; | 6013 }; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5830 | 6049 |
| 5831 // Following properties use flag bits. | 6050 // Following properties use flag bits. |
| 5832 DECL_BOOLEAN_ACCESSORS(hidden_prototype) | 6051 DECL_BOOLEAN_ACCESSORS(hidden_prototype) |
| 5833 DECL_BOOLEAN_ACCESSORS(undetectable) | 6052 DECL_BOOLEAN_ACCESSORS(undetectable) |
| 5834 // If the bit is set, object instances created by this function | 6053 // If the bit is set, object instances created by this function |
| 5835 // requires access check. | 6054 // requires access check. |
| 5836 DECL_BOOLEAN_ACCESSORS(needs_access_check) | 6055 DECL_BOOLEAN_ACCESSORS(needs_access_check) |
| 5837 | 6056 |
| 5838 static inline FunctionTemplateInfo* cast(Object* obj); | 6057 static inline FunctionTemplateInfo* cast(Object* obj); |
| 5839 | 6058 |
| 6059 #ifdef OBJECT_PRINT |
| 6060 inline void FunctionTemplateInfoPrint() { |
| 6061 FunctionTemplateInfoPrint(stdout); |
| 6062 } |
| 6063 void FunctionTemplateInfoPrint(FILE* out); |
| 6064 #endif |
| 5840 #ifdef DEBUG | 6065 #ifdef DEBUG |
| 5841 void FunctionTemplateInfoPrint(); | |
| 5842 void FunctionTemplateInfoVerify(); | 6066 void FunctionTemplateInfoVerify(); |
| 5843 #endif | 6067 #endif |
| 5844 | 6068 |
| 5845 static const int kSerialNumberOffset = TemplateInfo::kHeaderSize; | 6069 static const int kSerialNumberOffset = TemplateInfo::kHeaderSize; |
| 5846 static const int kCallCodeOffset = kSerialNumberOffset + kPointerSize; | 6070 static const int kCallCodeOffset = kSerialNumberOffset + kPointerSize; |
| 5847 static const int kPropertyAccessorsOffset = kCallCodeOffset + kPointerSize; | 6071 static const int kPropertyAccessorsOffset = kCallCodeOffset + kPointerSize; |
| 5848 static const int kPrototypeTemplateOffset = | 6072 static const int kPrototypeTemplateOffset = |
| 5849 kPropertyAccessorsOffset + kPointerSize; | 6073 kPropertyAccessorsOffset + kPointerSize; |
| 5850 static const int kParentTemplateOffset = | 6074 static const int kParentTemplateOffset = |
| 5851 kPrototypeTemplateOffset + kPointerSize; | 6075 kPrototypeTemplateOffset + kPointerSize; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 5873 }; | 6097 }; |
| 5874 | 6098 |
| 5875 | 6099 |
| 5876 class ObjectTemplateInfo: public TemplateInfo { | 6100 class ObjectTemplateInfo: public TemplateInfo { |
| 5877 public: | 6101 public: |
| 5878 DECL_ACCESSORS(constructor, Object) | 6102 DECL_ACCESSORS(constructor, Object) |
| 5879 DECL_ACCESSORS(internal_field_count, Object) | 6103 DECL_ACCESSORS(internal_field_count, Object) |
| 5880 | 6104 |
| 5881 static inline ObjectTemplateInfo* cast(Object* obj); | 6105 static inline ObjectTemplateInfo* cast(Object* obj); |
| 5882 | 6106 |
| 6107 #ifdef OBJECT_PRINT |
| 6108 inline void ObjectTemplateInfoPrint() { |
| 6109 ObjectTemplateInfoPrint(stdout); |
| 6110 } |
| 6111 void ObjectTemplateInfoPrint(FILE* out); |
| 6112 #endif |
| 5883 #ifdef DEBUG | 6113 #ifdef DEBUG |
| 5884 void ObjectTemplateInfoPrint(); | |
| 5885 void ObjectTemplateInfoVerify(); | 6114 void ObjectTemplateInfoVerify(); |
| 5886 #endif | 6115 #endif |
| 5887 | 6116 |
| 5888 static const int kConstructorOffset = TemplateInfo::kHeaderSize; | 6117 static const int kConstructorOffset = TemplateInfo::kHeaderSize; |
| 5889 static const int kInternalFieldCountOffset = | 6118 static const int kInternalFieldCountOffset = |
| 5890 kConstructorOffset + kPointerSize; | 6119 kConstructorOffset + kPointerSize; |
| 5891 static const int kSize = kInternalFieldCountOffset + kPointerSize; | 6120 static const int kSize = kInternalFieldCountOffset + kPointerSize; |
| 5892 }; | 6121 }; |
| 5893 | 6122 |
| 5894 | 6123 |
| 5895 class SignatureInfo: public Struct { | 6124 class SignatureInfo: public Struct { |
| 5896 public: | 6125 public: |
| 5897 DECL_ACCESSORS(receiver, Object) | 6126 DECL_ACCESSORS(receiver, Object) |
| 5898 DECL_ACCESSORS(args, Object) | 6127 DECL_ACCESSORS(args, Object) |
| 5899 | 6128 |
| 5900 static inline SignatureInfo* cast(Object* obj); | 6129 static inline SignatureInfo* cast(Object* obj); |
| 5901 | 6130 |
| 6131 #ifdef OBJECT_PRINT |
| 6132 inline void SignatureInfoPrint() { |
| 6133 SignatureInfoPrint(stdout); |
| 6134 } |
| 6135 void SignatureInfoPrint(FILE* out); |
| 6136 #endif |
| 5902 #ifdef DEBUG | 6137 #ifdef DEBUG |
| 5903 void SignatureInfoPrint(); | |
| 5904 void SignatureInfoVerify(); | 6138 void SignatureInfoVerify(); |
| 5905 #endif | 6139 #endif |
| 5906 | 6140 |
| 5907 static const int kReceiverOffset = Struct::kHeaderSize; | 6141 static const int kReceiverOffset = Struct::kHeaderSize; |
| 5908 static const int kArgsOffset = kReceiverOffset + kPointerSize; | 6142 static const int kArgsOffset = kReceiverOffset + kPointerSize; |
| 5909 static const int kSize = kArgsOffset + kPointerSize; | 6143 static const int kSize = kArgsOffset + kPointerSize; |
| 5910 | 6144 |
| 5911 private: | 6145 private: |
| 5912 DISALLOW_IMPLICIT_CONSTRUCTORS(SignatureInfo); | 6146 DISALLOW_IMPLICIT_CONSTRUCTORS(SignatureInfo); |
| 5913 }; | 6147 }; |
| 5914 | 6148 |
| 5915 | 6149 |
| 5916 class TypeSwitchInfo: public Struct { | 6150 class TypeSwitchInfo: public Struct { |
| 5917 public: | 6151 public: |
| 5918 DECL_ACCESSORS(types, Object) | 6152 DECL_ACCESSORS(types, Object) |
| 5919 | 6153 |
| 5920 static inline TypeSwitchInfo* cast(Object* obj); | 6154 static inline TypeSwitchInfo* cast(Object* obj); |
| 5921 | 6155 |
| 6156 #ifdef OBJECT_PRINT |
| 6157 inline void TypeSwitchInfoPrint() { |
| 6158 TypeSwitchInfoPrint(stdout); |
| 6159 } |
| 6160 void TypeSwitchInfoPrint(FILE* out); |
| 6161 #endif |
| 5922 #ifdef DEBUG | 6162 #ifdef DEBUG |
| 5923 void TypeSwitchInfoPrint(); | |
| 5924 void TypeSwitchInfoVerify(); | 6163 void TypeSwitchInfoVerify(); |
| 5925 #endif | 6164 #endif |
| 5926 | 6165 |
| 5927 static const int kTypesOffset = Struct::kHeaderSize; | 6166 static const int kTypesOffset = Struct::kHeaderSize; |
| 5928 static const int kSize = kTypesOffset + kPointerSize; | 6167 static const int kSize = kTypesOffset + kPointerSize; |
| 5929 }; | 6168 }; |
| 5930 | 6169 |
| 5931 | 6170 |
| 5932 #ifdef ENABLE_DEBUGGER_SUPPORT | 6171 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 5933 // The DebugInfo class holds additional information for a function being | 6172 // The DebugInfo class holds additional information for a function being |
| (...skipping 25 matching lines...) Expand all Loading... |
| 5959 // Get the break point objects for a code position. | 6198 // Get the break point objects for a code position. |
| 5960 Object* GetBreakPointObjects(int code_position); | 6199 Object* GetBreakPointObjects(int code_position); |
| 5961 // Find the break point info holding this break point object. | 6200 // Find the break point info holding this break point object. |
| 5962 static Object* FindBreakPointInfo(Handle<DebugInfo> debug_info, | 6201 static Object* FindBreakPointInfo(Handle<DebugInfo> debug_info, |
| 5963 Handle<Object> break_point_object); | 6202 Handle<Object> break_point_object); |
| 5964 // Get the number of break points for this function. | 6203 // Get the number of break points for this function. |
| 5965 int GetBreakPointCount(); | 6204 int GetBreakPointCount(); |
| 5966 | 6205 |
| 5967 static inline DebugInfo* cast(Object* obj); | 6206 static inline DebugInfo* cast(Object* obj); |
| 5968 | 6207 |
| 6208 #ifdef OBJECT_PRINT |
| 6209 inline void DebugInfoPrint() { |
| 6210 DebugInfoPrint(stdout); |
| 6211 } |
| 6212 void DebugInfoPrint(FILE* out); |
| 6213 #endif |
| 5969 #ifdef DEBUG | 6214 #ifdef DEBUG |
| 5970 void DebugInfoPrint(); | |
| 5971 void DebugInfoVerify(); | 6215 void DebugInfoVerify(); |
| 5972 #endif | 6216 #endif |
| 5973 | 6217 |
| 5974 static const int kSharedFunctionInfoIndex = Struct::kHeaderSize; | 6218 static const int kSharedFunctionInfoIndex = Struct::kHeaderSize; |
| 5975 static const int kOriginalCodeIndex = kSharedFunctionInfoIndex + kPointerSize; | 6219 static const int kOriginalCodeIndex = kSharedFunctionInfoIndex + kPointerSize; |
| 5976 static const int kPatchedCodeIndex = kOriginalCodeIndex + kPointerSize; | 6220 static const int kPatchedCodeIndex = kOriginalCodeIndex + kPointerSize; |
| 5977 static const int kActiveBreakPointsCountIndex = | 6221 static const int kActiveBreakPointsCountIndex = |
| 5978 kPatchedCodeIndex + kPointerSize; | 6222 kPatchedCodeIndex + kPointerSize; |
| 5979 static const int kBreakPointsStateIndex = | 6223 static const int kBreakPointsStateIndex = |
| 5980 kActiveBreakPointsCountIndex + kPointerSize; | 6224 kActiveBreakPointsCountIndex + kPointerSize; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6012 static void SetBreakPoint(Handle<BreakPointInfo> info, | 6256 static void SetBreakPoint(Handle<BreakPointInfo> info, |
| 6013 Handle<Object> break_point_object); | 6257 Handle<Object> break_point_object); |
| 6014 // Check if break point info has this break point object. | 6258 // Check if break point info has this break point object. |
| 6015 static bool HasBreakPointObject(Handle<BreakPointInfo> info, | 6259 static bool HasBreakPointObject(Handle<BreakPointInfo> info, |
| 6016 Handle<Object> break_point_object); | 6260 Handle<Object> break_point_object); |
| 6017 // Get the number of break points for this code position. | 6261 // Get the number of break points for this code position. |
| 6018 int GetBreakPointCount(); | 6262 int GetBreakPointCount(); |
| 6019 | 6263 |
| 6020 static inline BreakPointInfo* cast(Object* obj); | 6264 static inline BreakPointInfo* cast(Object* obj); |
| 6021 | 6265 |
| 6266 #ifdef OBJECT_PRINT |
| 6267 inline void BreakPointInfoPrint() { |
| 6268 BreakPointInfoPrint(stdout); |
| 6269 } |
| 6270 void BreakPointInfoPrint(FILE* out); |
| 6271 #endif |
| 6022 #ifdef DEBUG | 6272 #ifdef DEBUG |
| 6023 void BreakPointInfoPrint(); | |
| 6024 void BreakPointInfoVerify(); | 6273 void BreakPointInfoVerify(); |
| 6025 #endif | 6274 #endif |
| 6026 | 6275 |
| 6027 static const int kCodePositionIndex = Struct::kHeaderSize; | 6276 static const int kCodePositionIndex = Struct::kHeaderSize; |
| 6028 static const int kSourcePositionIndex = kCodePositionIndex + kPointerSize; | 6277 static const int kSourcePositionIndex = kCodePositionIndex + kPointerSize; |
| 6029 static const int kStatementPositionIndex = | 6278 static const int kStatementPositionIndex = |
| 6030 kSourcePositionIndex + kPointerSize; | 6279 kSourcePositionIndex + kPointerSize; |
| 6031 static const int kBreakPointObjectsIndex = | 6280 static const int kBreakPointObjectsIndex = |
| 6032 kStatementPositionIndex + kPointerSize; | 6281 kStatementPositionIndex + kPointerSize; |
| 6033 static const int kSize = kBreakPointObjectsIndex + kPointerSize; | 6282 static const int kSize = kBreakPointObjectsIndex + kPointerSize; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6129 } else { | 6378 } else { |
| 6130 value &= ~(1 << bit_position); | 6379 value &= ~(1 << bit_position); |
| 6131 } | 6380 } |
| 6132 return value; | 6381 return value; |
| 6133 } | 6382 } |
| 6134 }; | 6383 }; |
| 6135 | 6384 |
| 6136 } } // namespace v8::internal | 6385 } } // namespace v8::internal |
| 6137 | 6386 |
| 6138 #endif // V8_OBJECTS_H_ | 6387 #endif // V8_OBJECTS_H_ |
| OLD | NEW |