| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 // Returns true if this is a JSValue containing a string and the index is | 763 // Returns true if this is a JSValue containing a string and the index is |
| 756 // < the length of the string. Used to implement [] on strings. | 764 // < the length of the string. Used to implement [] on strings. |
| 757 inline bool IsStringObjectWithCharacterAt(uint32_t index); | 765 inline bool IsStringObjectWithCharacterAt(uint32_t index); |
| 758 | 766 |
| 759 #ifdef DEBUG | 767 #ifdef DEBUG |
| 760 // Verify a pointer is a valid object pointer. | 768 // Verify a pointer is a valid object pointer. |
| 761 static void VerifyPointer(Object* p); | 769 static void VerifyPointer(Object* p); |
| 762 #endif | 770 #endif |
| 763 | 771 |
| 764 // Prints this object without details. | 772 // Prints this object without details. |
| 765 void ShortPrint(); | 773 inline void ShortPrint() { |
| 774 ShortPrint(stdout); |
| 775 } |
| 776 void ShortPrint(FILE* out); |
| 766 | 777 |
| 767 // Prints this object without details to a message accumulator. | 778 // Prints this object without details to a message accumulator. |
| 768 void ShortPrint(StringStream* accumulator); | 779 void ShortPrint(StringStream* accumulator); |
| 769 | 780 |
| 770 // Casting: This cast is only needed to satisfy macros in objects-inl.h. | 781 // Casting: This cast is only needed to satisfy macros in objects-inl.h. |
| 771 static Object* cast(Object* value) { return value; } | 782 static Object* cast(Object* value) { return value; } |
| 772 | 783 |
| 773 // Layout description. | 784 // Layout description. |
| 774 static const int kHeaderSize = 0; // Object does not take up any space. | 785 static const int kHeaderSize = 0; // Object does not take up any space. |
| 775 | 786 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 794 | 805 |
| 795 static inline Smi* FromIntptr(intptr_t value); | 806 static inline Smi* FromIntptr(intptr_t value); |
| 796 | 807 |
| 797 // Returns whether value can be represented in a Smi. | 808 // Returns whether value can be represented in a Smi. |
| 798 static inline bool IsValid(intptr_t value); | 809 static inline bool IsValid(intptr_t value); |
| 799 | 810 |
| 800 // Casting. | 811 // Casting. |
| 801 static inline Smi* cast(Object* object); | 812 static inline Smi* cast(Object* object); |
| 802 | 813 |
| 803 // Dispatched behavior. | 814 // Dispatched behavior. |
| 804 void SmiPrint(); | 815 inline void SmiPrint() { |
| 816 SmiPrint(stdout); |
| 817 } |
| 818 void SmiPrint(FILE* out); |
| 805 void SmiPrint(StringStream* accumulator); | 819 void SmiPrint(StringStream* accumulator); |
| 806 #ifdef DEBUG | 820 #ifdef DEBUG |
| 807 void SmiVerify(); | 821 void SmiVerify(); |
| 808 #endif | 822 #endif |
| 809 | 823 |
| 810 static const int kMinValue = (-1 << (kSmiValueSize - 1)); | 824 static const int kMinValue = (-1 << (kSmiValueSize - 1)); |
| 811 static const int kMaxValue = -(kMinValue + 1); | 825 static const int kMaxValue = -(kMinValue + 1); |
| 812 | 826 |
| 813 private: | 827 private: |
| 814 DISALLOW_IMPLICIT_CONSTRUCTORS(Smi); | 828 DISALLOW_IMPLICIT_CONSTRUCTORS(Smi); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 | 877 |
| 864 static inline Failure* RetryAfterGC(AllocationSpace space); | 878 static inline Failure* RetryAfterGC(AllocationSpace space); |
| 865 static inline Failure* RetryAfterGC(); // NEW_SPACE | 879 static inline Failure* RetryAfterGC(); // NEW_SPACE |
| 866 static inline Failure* Exception(); | 880 static inline Failure* Exception(); |
| 867 static inline Failure* InternalError(); | 881 static inline Failure* InternalError(); |
| 868 static inline Failure* OutOfMemoryException(); | 882 static inline Failure* OutOfMemoryException(); |
| 869 // Casting. | 883 // Casting. |
| 870 static inline Failure* cast(MaybeObject* object); | 884 static inline Failure* cast(MaybeObject* object); |
| 871 | 885 |
| 872 // Dispatched behavior. | 886 // Dispatched behavior. |
| 873 void FailurePrint(); | 887 inline void FailurePrint() { |
| 888 FailurePrint(stdout); |
| 889 } |
| 890 void FailurePrint(FILE* out); |
| 874 void FailurePrint(StringStream* accumulator); | 891 void FailurePrint(StringStream* accumulator); |
| 875 #ifdef DEBUG | 892 #ifdef DEBUG |
| 876 void FailureVerify(); | 893 void FailureVerify(); |
| 877 #endif | 894 #endif |
| 878 | 895 |
| 879 private: | 896 private: |
| 880 inline intptr_t value() const; | 897 inline intptr_t value() const; |
| 881 static inline Failure* Construct(Type type, intptr_t value = 0); | 898 static inline Failure* Construct(Type type, intptr_t value = 0); |
| 882 | 899 |
| 883 DISALLOW_IMPLICIT_CONSTRUCTORS(Failure); | 900 DISALLOW_IMPLICIT_CONSTRUCTORS(Failure); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 | 1050 |
| 1034 // Return the write barrier mode for this. Callers of this function | 1051 // Return the write barrier mode for this. Callers of this function |
| 1035 // must be able to present a reference to an AssertNoAllocation | 1052 // must be able to present a reference to an AssertNoAllocation |
| 1036 // object as a sign that they are not going to use this function | 1053 // object as a sign that they are not going to use this function |
| 1037 // from code that allocates and thus invalidates the returned write | 1054 // from code that allocates and thus invalidates the returned write |
| 1038 // barrier mode. | 1055 // barrier mode. |
| 1039 inline WriteBarrierMode GetWriteBarrierMode(const AssertNoAllocation&); | 1056 inline WriteBarrierMode GetWriteBarrierMode(const AssertNoAllocation&); |
| 1040 | 1057 |
| 1041 // Dispatched behavior. | 1058 // Dispatched behavior. |
| 1042 void HeapObjectShortPrint(StringStream* accumulator); | 1059 void HeapObjectShortPrint(StringStream* accumulator); |
| 1060 #ifdef OBJECT_PRINT |
| 1061 inline void HeapObjectPrint() { |
| 1062 HeapObjectPrint(stdout); |
| 1063 } |
| 1064 void HeapObjectPrint(FILE* out); |
| 1065 #endif |
| 1043 #ifdef DEBUG | 1066 #ifdef DEBUG |
| 1044 void HeapObjectPrint(); | |
| 1045 void HeapObjectVerify(); | 1067 void HeapObjectVerify(); |
| 1046 inline void VerifyObjectField(int offset); | 1068 inline void VerifyObjectField(int offset); |
| 1047 inline void VerifySmiField(int offset); | 1069 inline void VerifySmiField(int offset); |
| 1070 #endif |
| 1048 | 1071 |
| 1049 void PrintHeader(const char* id); | 1072 #ifdef OBJECT_PRINT |
| 1073 void PrintHeader(FILE* out, const char* id); |
| 1074 #endif |
| 1050 | 1075 |
| 1076 #ifdef DEBUG |
| 1051 // Verify a pointer is a valid HeapObject pointer that points to object | 1077 // Verify a pointer is a valid HeapObject pointer that points to object |
| 1052 // areas in the heap. | 1078 // areas in the heap. |
| 1053 static void VerifyHeapPointer(Object* p); | 1079 static void VerifyHeapPointer(Object* p); |
| 1054 #endif | 1080 #endif |
| 1055 | 1081 |
| 1056 // Layout description. | 1082 // Layout description. |
| 1057 // First field in a heap object is map. | 1083 // First field in a heap object is map. |
| 1058 static const int kMapOffset = Object::kHeaderSize; | 1084 static const int kMapOffset = Object::kHeaderSize; |
| 1059 static const int kHeaderSize = kMapOffset + kPointerSize; | 1085 static const int kHeaderSize = kMapOffset + kPointerSize; |
| 1060 | 1086 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 public: | 1149 public: |
| 1124 // [value]: number value. | 1150 // [value]: number value. |
| 1125 inline double value(); | 1151 inline double value(); |
| 1126 inline void set_value(double value); | 1152 inline void set_value(double value); |
| 1127 | 1153 |
| 1128 // Casting. | 1154 // Casting. |
| 1129 static inline HeapNumber* cast(Object* obj); | 1155 static inline HeapNumber* cast(Object* obj); |
| 1130 | 1156 |
| 1131 // Dispatched behavior. | 1157 // Dispatched behavior. |
| 1132 Object* HeapNumberToBoolean(); | 1158 Object* HeapNumberToBoolean(); |
| 1133 void HeapNumberPrint(); | 1159 inline void HeapNumberPrint() { |
| 1160 HeapNumberPrint(stdout); |
| 1161 } |
| 1162 void HeapNumberPrint(FILE* out); |
| 1134 void HeapNumberPrint(StringStream* accumulator); | 1163 void HeapNumberPrint(StringStream* accumulator); |
| 1135 #ifdef DEBUG | 1164 #ifdef DEBUG |
| 1136 void HeapNumberVerify(); | 1165 void HeapNumberVerify(); |
| 1137 #endif | 1166 #endif |
| 1138 | 1167 |
| 1139 inline int get_exponent(); | 1168 inline int get_exponent(); |
| 1140 inline int get_sign(); | 1169 inline int get_sign(); |
| 1141 | 1170 |
| 1142 // Layout description. | 1171 // Layout description. |
| 1143 static const int kValueOffset = HeapObject::kHeaderSize; | 1172 static const int kValueOffset = HeapObject::kHeaderSize; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 InterceptorInfo* GetNamedInterceptor(); | 1331 InterceptorInfo* GetNamedInterceptor(); |
| 1303 InterceptorInfo* GetIndexedInterceptor(); | 1332 InterceptorInfo* GetIndexedInterceptor(); |
| 1304 | 1333 |
| 1305 inline PropertyAttributes GetPropertyAttribute(String* name); | 1334 inline PropertyAttributes GetPropertyAttribute(String* name); |
| 1306 PropertyAttributes GetPropertyAttributeWithReceiver(JSObject* receiver, | 1335 PropertyAttributes GetPropertyAttributeWithReceiver(JSObject* receiver, |
| 1307 String* name); | 1336 String* name); |
| 1308 PropertyAttributes GetLocalPropertyAttribute(String* name); | 1337 PropertyAttributes GetLocalPropertyAttribute(String* name); |
| 1309 | 1338 |
| 1310 MUST_USE_RESULT MaybeObject* DefineAccessor(String* name, | 1339 MUST_USE_RESULT MaybeObject* DefineAccessor(String* name, |
| 1311 bool is_getter, | 1340 bool is_getter, |
| 1312 JSFunction* fun, | 1341 Object* fun, |
| 1313 PropertyAttributes attributes); | 1342 PropertyAttributes attributes); |
| 1314 Object* LookupAccessor(String* name, bool is_getter); | 1343 Object* LookupAccessor(String* name, bool is_getter); |
| 1315 | 1344 |
| 1316 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); | 1345 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); |
| 1317 | 1346 |
| 1318 // Used from Object::GetProperty(). | 1347 // Used from Object::GetProperty(). |
| 1319 MaybeObject* GetPropertyWithFailedAccessCheck( | 1348 MaybeObject* GetPropertyWithFailedAccessCheck( |
| 1320 Object* receiver, | 1349 Object* receiver, |
| 1321 LookupResult* result, | 1350 LookupResult* result, |
| 1322 String* name, | 1351 String* name, |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 | 1612 |
| 1584 // Casting. | 1613 // Casting. |
| 1585 static inline JSObject* cast(Object* obj); | 1614 static inline JSObject* cast(Object* obj); |
| 1586 | 1615 |
| 1587 // Disalow further properties to be added to the object. | 1616 // Disalow further properties to be added to the object. |
| 1588 MUST_USE_RESULT MaybeObject* PreventExtensions(); | 1617 MUST_USE_RESULT MaybeObject* PreventExtensions(); |
| 1589 | 1618 |
| 1590 | 1619 |
| 1591 // Dispatched behavior. | 1620 // Dispatched behavior. |
| 1592 void JSObjectShortPrint(StringStream* accumulator); | 1621 void JSObjectShortPrint(StringStream* accumulator); |
| 1622 #ifdef OBJECT_PRINT |
| 1623 inline void JSObjectPrint() { |
| 1624 JSObjectPrint(stdout); |
| 1625 } |
| 1626 void JSObjectPrint(FILE* out); |
| 1627 #endif |
| 1593 #ifdef DEBUG | 1628 #ifdef DEBUG |
| 1594 void JSObjectPrint(); | |
| 1595 void JSObjectVerify(); | 1629 void JSObjectVerify(); |
| 1596 void PrintProperties(); | 1630 #endif |
| 1597 void PrintElements(); | 1631 #ifdef OBJECT_PRINT |
| 1632 inline void PrintProperties() { |
| 1633 PrintProperties(stdout); |
| 1634 } |
| 1635 void PrintProperties(FILE* out); |
| 1598 | 1636 |
| 1637 inline void PrintElements() { |
| 1638 PrintElements(stdout); |
| 1639 } |
| 1640 void PrintElements(FILE* out); |
| 1641 #endif |
| 1642 |
| 1643 #ifdef DEBUG |
| 1599 // Structure for collecting spill information about JSObjects. | 1644 // Structure for collecting spill information about JSObjects. |
| 1600 class SpillInformation { | 1645 class SpillInformation { |
| 1601 public: | 1646 public: |
| 1602 void Clear(); | 1647 void Clear(); |
| 1603 void Print(); | 1648 void Print(); |
| 1604 int number_of_objects_; | 1649 int number_of_objects_; |
| 1605 int number_of_objects_with_fast_properties_; | 1650 int number_of_objects_with_fast_properties_; |
| 1606 int number_of_objects_with_fast_elements_; | 1651 int number_of_objects_with_fast_elements_; |
| 1607 int number_of_fast_used_fields_; | 1652 int number_of_fast_used_fields_; |
| 1608 int number_of_fast_unused_fields_; | 1653 int number_of_fast_unused_fields_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1623 // the number of maps for objects used as dictionaries. | 1668 // the number of maps for objects used as dictionaries. |
| 1624 inline int MaxFastProperties(); | 1669 inline int MaxFastProperties(); |
| 1625 | 1670 |
| 1626 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). | 1671 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). |
| 1627 // Also maximal value of JSArray's length property. | 1672 // Also maximal value of JSArray's length property. |
| 1628 static const uint32_t kMaxElementCount = 0xffffffffu; | 1673 static const uint32_t kMaxElementCount = 0xffffffffu; |
| 1629 | 1674 |
| 1630 static const uint32_t kMaxGap = 1024; | 1675 static const uint32_t kMaxGap = 1024; |
| 1631 static const int kMaxFastElementsLength = 5000; | 1676 static const int kMaxFastElementsLength = 5000; |
| 1632 static const int kInitialMaxFastElementArray = 100000; | 1677 static const int kInitialMaxFastElementArray = 100000; |
| 1633 static const int kMaxFastProperties = 8; | 1678 static const int kMaxFastProperties = 12; |
| 1634 static const int kMaxInstanceSize = 255 * kPointerSize; | 1679 static const int kMaxInstanceSize = 255 * kPointerSize; |
| 1635 // When extending the backing storage for property values, we increase | 1680 // When extending the backing storage for property values, we increase |
| 1636 // its size by more than the 1 entry necessary, so sequentially adding fields | 1681 // its size by more than the 1 entry necessary, so sequentially adding fields |
| 1637 // to the same object requires fewer allocations and copies. | 1682 // to the same object requires fewer allocations and copies. |
| 1638 static const int kFieldsAdded = 3; | 1683 static const int kFieldsAdded = 3; |
| 1639 | 1684 |
| 1640 // Layout description. | 1685 // Layout description. |
| 1641 static const int kPropertiesOffset = HeapObject::kHeaderSize; | 1686 static const int kPropertiesOffset = HeapObject::kHeaderSize; |
| 1642 static const int kElementsOffset = kPropertiesOffset + kPointerSize; | 1687 static const int kElementsOffset = kPropertiesOffset + kPointerSize; |
| 1643 static const int kHeaderSize = kElementsOffset + kPointerSize; | 1688 static const int kHeaderSize = kElementsOffset + kPointerSize; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1769 static const int kHeaderSize = kLengthOffset + kPointerSize; | 1814 static const int kHeaderSize = kLengthOffset + kPointerSize; |
| 1770 | 1815 |
| 1771 // Maximal allowed size, in bytes, of a single FixedArray. | 1816 // Maximal allowed size, in bytes, of a single FixedArray. |
| 1772 // Prevents overflowing size computations, as well as extreme memory | 1817 // Prevents overflowing size computations, as well as extreme memory |
| 1773 // consumption. | 1818 // consumption. |
| 1774 static const int kMaxSize = 512 * MB; | 1819 static const int kMaxSize = 512 * MB; |
| 1775 // Maximally allowed length of a FixedArray. | 1820 // Maximally allowed length of a FixedArray. |
| 1776 static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize; | 1821 static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize; |
| 1777 | 1822 |
| 1778 // Dispatched behavior. | 1823 // Dispatched behavior. |
| 1824 #ifdef OBJECT_PRINT |
| 1825 inline void FixedArrayPrint() { |
| 1826 FixedArrayPrint(stdout); |
| 1827 } |
| 1828 void FixedArrayPrint(FILE* out); |
| 1829 #endif |
| 1779 #ifdef DEBUG | 1830 #ifdef DEBUG |
| 1780 void FixedArrayPrint(); | |
| 1781 void FixedArrayVerify(); | 1831 void FixedArrayVerify(); |
| 1782 // Checks if two FixedArrays have identical contents. | 1832 // Checks if two FixedArrays have identical contents. |
| 1783 bool IsEqualTo(FixedArray* other); | 1833 bool IsEqualTo(FixedArray* other); |
| 1784 #endif | 1834 #endif |
| 1785 | 1835 |
| 1786 // Swap two elements in a pair of arrays. If this array and the | 1836 // Swap two elements in a pair of arrays. If this array and the |
| 1787 // numbers array are the same object, the elements are only swapped | 1837 // numbers array are the same object, the elements are only swapped |
| 1788 // once. | 1838 // once. |
| 1789 void SwapPairs(FixedArray* numbers, int i, int j); | 1839 void SwapPairs(FixedArray* numbers, int i, int j); |
| 1790 | 1840 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1946 // Layout description. | 1996 // Layout description. |
| 1947 static const int kContentArrayOffset = FixedArray::kHeaderSize; | 1997 static const int kContentArrayOffset = FixedArray::kHeaderSize; |
| 1948 static const int kEnumerationIndexOffset = kContentArrayOffset + kPointerSize; | 1998 static const int kEnumerationIndexOffset = kContentArrayOffset + kPointerSize; |
| 1949 static const int kFirstOffset = kEnumerationIndexOffset + kPointerSize; | 1999 static const int kFirstOffset = kEnumerationIndexOffset + kPointerSize; |
| 1950 | 2000 |
| 1951 // Layout description for the bridge array. | 2001 // Layout description for the bridge array. |
| 1952 static const int kEnumCacheBridgeEnumOffset = FixedArray::kHeaderSize; | 2002 static const int kEnumCacheBridgeEnumOffset = FixedArray::kHeaderSize; |
| 1953 static const int kEnumCacheBridgeCacheOffset = | 2003 static const int kEnumCacheBridgeCacheOffset = |
| 1954 kEnumCacheBridgeEnumOffset + kPointerSize; | 2004 kEnumCacheBridgeEnumOffset + kPointerSize; |
| 1955 | 2005 |
| 2006 #ifdef OBJECT_PRINT |
| 2007 // Print all the descriptors. |
| 2008 inline void PrintDescriptors() { |
| 2009 PrintDescriptors(stdout); |
| 2010 } |
| 2011 void PrintDescriptors(FILE* out); |
| 2012 #endif |
| 2013 |
| 1956 #ifdef DEBUG | 2014 #ifdef DEBUG |
| 1957 // Print all the descriptors. | |
| 1958 void PrintDescriptors(); | |
| 1959 | |
| 1960 // Is the descriptor array sorted and without duplicates? | 2015 // Is the descriptor array sorted and without duplicates? |
| 1961 bool IsSortedNoDuplicates(); | 2016 bool IsSortedNoDuplicates(); |
| 1962 | 2017 |
| 1963 // Are two DescriptorArrays equal? | 2018 // Are two DescriptorArrays equal? |
| 1964 bool IsEqualTo(DescriptorArray* other); | 2019 bool IsEqualTo(DescriptorArray* other); |
| 1965 #endif | 2020 #endif |
| 1966 | 2021 |
| 1967 // The maximum number of descriptors we want in a descriptor array (should | 2022 // The maximum number of descriptors we want in a descriptor array (should |
| 1968 // fit in a page). | 2023 // fit in a page). |
| 1969 static const int kMaxNumberOfDescriptors = 1024 + 512; | 2024 static const int kMaxNumberOfDescriptors = 1024 + 512; |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2330 int NextEnumerationIndex() { | 2385 int NextEnumerationIndex() { |
| 2331 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); | 2386 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); |
| 2332 } | 2387 } |
| 2333 | 2388 |
| 2334 // Returns a new array for dictionary usage. Might return Failure. | 2389 // Returns a new array for dictionary usage. Might return Failure. |
| 2335 MUST_USE_RESULT static MaybeObject* Allocate(int at_least_space_for); | 2390 MUST_USE_RESULT static MaybeObject* Allocate(int at_least_space_for); |
| 2336 | 2391 |
| 2337 // Ensure enough space for n additional elements. | 2392 // Ensure enough space for n additional elements. |
| 2338 MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key); | 2393 MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key); |
| 2339 | 2394 |
| 2340 #ifdef DEBUG | 2395 #ifdef OBJECT_PRINT |
| 2341 void Print(); | 2396 inline void Print() { |
| 2397 Print(stdout); |
| 2398 } |
| 2399 void Print(FILE* out); |
| 2342 #endif | 2400 #endif |
| 2343 // Returns the key (slow). | 2401 // Returns the key (slow). |
| 2344 Object* SlowReverseLookup(Object* value); | 2402 Object* SlowReverseLookup(Object* value); |
| 2345 | 2403 |
| 2346 // Sets the entry to (key, value) pair. | 2404 // Sets the entry to (key, value) pair. |
| 2347 inline void SetEntry(int entry, | 2405 inline void SetEntry(int entry, |
| 2348 Object* key, | 2406 Object* key, |
| 2349 Object* value, | 2407 Object* value, |
| 2350 PropertyDetails details); | 2408 PropertyDetails details); |
| 2351 | 2409 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2553 // Returns a pointer to the ByteArray object for a given data start address. | 2611 // Returns a pointer to the ByteArray object for a given data start address. |
| 2554 static inline ByteArray* FromDataStartAddress(Address address); | 2612 static inline ByteArray* FromDataStartAddress(Address address); |
| 2555 | 2613 |
| 2556 // Casting. | 2614 // Casting. |
| 2557 static inline ByteArray* cast(Object* obj); | 2615 static inline ByteArray* cast(Object* obj); |
| 2558 | 2616 |
| 2559 // Dispatched behavior. | 2617 // Dispatched behavior. |
| 2560 inline int ByteArraySize() { | 2618 inline int ByteArraySize() { |
| 2561 return SizeFor(this->length()); | 2619 return SizeFor(this->length()); |
| 2562 } | 2620 } |
| 2621 #ifdef OBJECT_PRINT |
| 2622 inline void ByteArrayPrint() { |
| 2623 ByteArrayPrint(stdout); |
| 2624 } |
| 2625 void ByteArrayPrint(FILE* out); |
| 2626 #endif |
| 2563 #ifdef DEBUG | 2627 #ifdef DEBUG |
| 2564 void ByteArrayPrint(); | |
| 2565 void ByteArrayVerify(); | 2628 void ByteArrayVerify(); |
| 2566 #endif | 2629 #endif |
| 2567 | 2630 |
| 2568 // Layout description. | 2631 // Layout description. |
| 2569 // Length is smi tagged when it is stored. | 2632 // Length is smi tagged when it is stored. |
| 2570 static const int kLengthOffset = HeapObject::kHeaderSize; | 2633 static const int kLengthOffset = HeapObject::kHeaderSize; |
| 2571 static const int kHeaderSize = kLengthOffset + kPointerSize; | 2634 static const int kHeaderSize = kLengthOffset + kPointerSize; |
| 2572 | 2635 |
| 2573 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); | 2636 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); |
| 2574 | 2637 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2603 inline uint8_t get(int index); | 2666 inline uint8_t get(int index); |
| 2604 inline void set(int index, uint8_t value); | 2667 inline void set(int index, uint8_t value); |
| 2605 | 2668 |
| 2606 // This accessor applies the correct conversion from Smi, HeapNumber and | 2669 // This accessor applies the correct conversion from Smi, HeapNumber and |
| 2607 // undefined and clamps the converted value between 0 and 255. | 2670 // undefined and clamps the converted value between 0 and 255. |
| 2608 Object* SetValue(uint32_t index, Object* value); | 2671 Object* SetValue(uint32_t index, Object* value); |
| 2609 | 2672 |
| 2610 // Casting. | 2673 // Casting. |
| 2611 static inline PixelArray* cast(Object* obj); | 2674 static inline PixelArray* cast(Object* obj); |
| 2612 | 2675 |
| 2676 #ifdef OBJECT_PRINT |
| 2677 inline void PixelArrayPrint() { |
| 2678 PixelArrayPrint(stdout); |
| 2679 } |
| 2680 void PixelArrayPrint(FILE* out); |
| 2681 #endif |
| 2613 #ifdef DEBUG | 2682 #ifdef DEBUG |
| 2614 void PixelArrayPrint(); | |
| 2615 void PixelArrayVerify(); | 2683 void PixelArrayVerify(); |
| 2616 #endif // DEBUG | 2684 #endif // DEBUG |
| 2617 | 2685 |
| 2618 // Maximal acceptable length for a pixel array. | 2686 // Maximal acceptable length for a pixel array. |
| 2619 static const int kMaxLength = 0x3fffffff; | 2687 static const int kMaxLength = 0x3fffffff; |
| 2620 | 2688 |
| 2621 // PixelArray headers are not quadword aligned. | 2689 // PixelArray headers are not quadword aligned. |
| 2622 static const int kLengthOffset = HeapObject::kHeaderSize; | 2690 static const int kLengthOffset = HeapObject::kHeaderSize; |
| 2623 static const int kExternalPointerOffset = | 2691 static const int kExternalPointerOffset = |
| 2624 POINTER_SIZE_ALIGN(kLengthOffset + kIntSize); | 2692 POINTER_SIZE_ALIGN(kLengthOffset + kIntSize); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2675 inline int8_t get(int index); | 2743 inline int8_t get(int index); |
| 2676 inline void set(int index, int8_t value); | 2744 inline void set(int index, int8_t value); |
| 2677 | 2745 |
| 2678 // This accessor applies the correct conversion from Smi, HeapNumber | 2746 // This accessor applies the correct conversion from Smi, HeapNumber |
| 2679 // and undefined. | 2747 // and undefined. |
| 2680 MaybeObject* SetValue(uint32_t index, Object* value); | 2748 MaybeObject* SetValue(uint32_t index, Object* value); |
| 2681 | 2749 |
| 2682 // Casting. | 2750 // Casting. |
| 2683 static inline ExternalByteArray* cast(Object* obj); | 2751 static inline ExternalByteArray* cast(Object* obj); |
| 2684 | 2752 |
| 2753 #ifdef OBJECT_PRINT |
| 2754 inline void ExternalByteArrayPrint() { |
| 2755 ExternalByteArrayPrint(stdout); |
| 2756 } |
| 2757 void ExternalByteArrayPrint(FILE* out); |
| 2758 #endif |
| 2685 #ifdef DEBUG | 2759 #ifdef DEBUG |
| 2686 void ExternalByteArrayPrint(); | |
| 2687 void ExternalByteArrayVerify(); | 2760 void ExternalByteArrayVerify(); |
| 2688 #endif // DEBUG | 2761 #endif // DEBUG |
| 2689 | 2762 |
| 2690 private: | 2763 private: |
| 2691 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray); | 2764 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray); |
| 2692 }; | 2765 }; |
| 2693 | 2766 |
| 2694 | 2767 |
| 2695 class ExternalUnsignedByteArray: public ExternalArray { | 2768 class ExternalUnsignedByteArray: public ExternalArray { |
| 2696 public: | 2769 public: |
| 2697 // Setter and getter. | 2770 // Setter and getter. |
| 2698 inline uint8_t get(int index); | 2771 inline uint8_t get(int index); |
| 2699 inline void set(int index, uint8_t value); | 2772 inline void set(int index, uint8_t value); |
| 2700 | 2773 |
| 2701 // This accessor applies the correct conversion from Smi, HeapNumber | 2774 // This accessor applies the correct conversion from Smi, HeapNumber |
| 2702 // and undefined. | 2775 // and undefined. |
| 2703 MaybeObject* SetValue(uint32_t index, Object* value); | 2776 MaybeObject* SetValue(uint32_t index, Object* value); |
| 2704 | 2777 |
| 2705 // Casting. | 2778 // Casting. |
| 2706 static inline ExternalUnsignedByteArray* cast(Object* obj); | 2779 static inline ExternalUnsignedByteArray* cast(Object* obj); |
| 2707 | 2780 |
| 2781 #ifdef OBJECT_PRINT |
| 2782 inline void ExternalUnsignedByteArrayPrint() { |
| 2783 ExternalUnsignedByteArrayPrint(stdout); |
| 2784 } |
| 2785 void ExternalUnsignedByteArrayPrint(FILE* out); |
| 2786 #endif |
| 2708 #ifdef DEBUG | 2787 #ifdef DEBUG |
| 2709 void ExternalUnsignedByteArrayPrint(); | |
| 2710 void ExternalUnsignedByteArrayVerify(); | 2788 void ExternalUnsignedByteArrayVerify(); |
| 2711 #endif // DEBUG | 2789 #endif // DEBUG |
| 2712 | 2790 |
| 2713 private: | 2791 private: |
| 2714 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray); | 2792 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray); |
| 2715 }; | 2793 }; |
| 2716 | 2794 |
| 2717 | 2795 |
| 2718 class ExternalShortArray: public ExternalArray { | 2796 class ExternalShortArray: public ExternalArray { |
| 2719 public: | 2797 public: |
| 2720 // Setter and getter. | 2798 // Setter and getter. |
| 2721 inline int16_t get(int index); | 2799 inline int16_t get(int index); |
| 2722 inline void set(int index, int16_t value); | 2800 inline void set(int index, int16_t value); |
| 2723 | 2801 |
| 2724 // This accessor applies the correct conversion from Smi, HeapNumber | 2802 // This accessor applies the correct conversion from Smi, HeapNumber |
| 2725 // and undefined. | 2803 // and undefined. |
| 2726 MaybeObject* SetValue(uint32_t index, Object* value); | 2804 MaybeObject* SetValue(uint32_t index, Object* value); |
| 2727 | 2805 |
| 2728 // Casting. | 2806 // Casting. |
| 2729 static inline ExternalShortArray* cast(Object* obj); | 2807 static inline ExternalShortArray* cast(Object* obj); |
| 2730 | 2808 |
| 2809 #ifdef OBJECT_PRINT |
| 2810 inline void ExternalShortArrayPrint() { |
| 2811 ExternalShortArrayPrint(stdout); |
| 2812 } |
| 2813 void ExternalShortArrayPrint(FILE* out); |
| 2814 #endif |
| 2731 #ifdef DEBUG | 2815 #ifdef DEBUG |
| 2732 void ExternalShortArrayPrint(); | |
| 2733 void ExternalShortArrayVerify(); | 2816 void ExternalShortArrayVerify(); |
| 2734 #endif // DEBUG | 2817 #endif // DEBUG |
| 2735 | 2818 |
| 2736 private: | 2819 private: |
| 2737 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray); | 2820 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray); |
| 2738 }; | 2821 }; |
| 2739 | 2822 |
| 2740 | 2823 |
| 2741 class ExternalUnsignedShortArray: public ExternalArray { | 2824 class ExternalUnsignedShortArray: public ExternalArray { |
| 2742 public: | 2825 public: |
| 2743 // Setter and getter. | 2826 // Setter and getter. |
| 2744 inline uint16_t get(int index); | 2827 inline uint16_t get(int index); |
| 2745 inline void set(int index, uint16_t value); | 2828 inline void set(int index, uint16_t value); |
| 2746 | 2829 |
| 2747 // This accessor applies the correct conversion from Smi, HeapNumber | 2830 // This accessor applies the correct conversion from Smi, HeapNumber |
| 2748 // and undefined. | 2831 // and undefined. |
| 2749 MaybeObject* SetValue(uint32_t index, Object* value); | 2832 MaybeObject* SetValue(uint32_t index, Object* value); |
| 2750 | 2833 |
| 2751 // Casting. | 2834 // Casting. |
| 2752 static inline ExternalUnsignedShortArray* cast(Object* obj); | 2835 static inline ExternalUnsignedShortArray* cast(Object* obj); |
| 2753 | 2836 |
| 2837 #ifdef OBJECT_PRINT |
| 2838 inline void ExternalUnsignedShortArrayPrint() { |
| 2839 ExternalUnsignedShortArrayPrint(stdout); |
| 2840 } |
| 2841 void ExternalUnsignedShortArrayPrint(FILE* out); |
| 2842 #endif |
| 2754 #ifdef DEBUG | 2843 #ifdef DEBUG |
| 2755 void ExternalUnsignedShortArrayPrint(); | |
| 2756 void ExternalUnsignedShortArrayVerify(); | 2844 void ExternalUnsignedShortArrayVerify(); |
| 2757 #endif // DEBUG | 2845 #endif // DEBUG |
| 2758 | 2846 |
| 2759 private: | 2847 private: |
| 2760 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray); | 2848 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray); |
| 2761 }; | 2849 }; |
| 2762 | 2850 |
| 2763 | 2851 |
| 2764 class ExternalIntArray: public ExternalArray { | 2852 class ExternalIntArray: public ExternalArray { |
| 2765 public: | 2853 public: |
| 2766 // Setter and getter. | 2854 // Setter and getter. |
| 2767 inline int32_t get(int index); | 2855 inline int32_t get(int index); |
| 2768 inline void set(int index, int32_t value); | 2856 inline void set(int index, int32_t value); |
| 2769 | 2857 |
| 2770 // This accessor applies the correct conversion from Smi, HeapNumber | 2858 // This accessor applies the correct conversion from Smi, HeapNumber |
| 2771 // and undefined. | 2859 // and undefined. |
| 2772 MaybeObject* SetValue(uint32_t index, Object* value); | 2860 MaybeObject* SetValue(uint32_t index, Object* value); |
| 2773 | 2861 |
| 2774 // Casting. | 2862 // Casting. |
| 2775 static inline ExternalIntArray* cast(Object* obj); | 2863 static inline ExternalIntArray* cast(Object* obj); |
| 2776 | 2864 |
| 2865 #ifdef OBJECT_PRINT |
| 2866 inline void ExternalIntArrayPrint() { |
| 2867 ExternalIntArrayPrint(stdout); |
| 2868 } |
| 2869 void ExternalIntArrayPrint(FILE* out); |
| 2870 #endif |
| 2777 #ifdef DEBUG | 2871 #ifdef DEBUG |
| 2778 void ExternalIntArrayPrint(); | |
| 2779 void ExternalIntArrayVerify(); | 2872 void ExternalIntArrayVerify(); |
| 2780 #endif // DEBUG | 2873 #endif // DEBUG |
| 2781 | 2874 |
| 2782 private: | 2875 private: |
| 2783 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray); | 2876 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray); |
| 2784 }; | 2877 }; |
| 2785 | 2878 |
| 2786 | 2879 |
| 2787 class ExternalUnsignedIntArray: public ExternalArray { | 2880 class ExternalUnsignedIntArray: public ExternalArray { |
| 2788 public: | 2881 public: |
| 2789 // Setter and getter. | 2882 // Setter and getter. |
| 2790 inline uint32_t get(int index); | 2883 inline uint32_t get(int index); |
| 2791 inline void set(int index, uint32_t value); | 2884 inline void set(int index, uint32_t value); |
| 2792 | 2885 |
| 2793 // This accessor applies the correct conversion from Smi, HeapNumber | 2886 // This accessor applies the correct conversion from Smi, HeapNumber |
| 2794 // and undefined. | 2887 // and undefined. |
| 2795 MaybeObject* SetValue(uint32_t index, Object* value); | 2888 MaybeObject* SetValue(uint32_t index, Object* value); |
| 2796 | 2889 |
| 2797 // Casting. | 2890 // Casting. |
| 2798 static inline ExternalUnsignedIntArray* cast(Object* obj); | 2891 static inline ExternalUnsignedIntArray* cast(Object* obj); |
| 2799 | 2892 |
| 2893 #ifdef OBJECT_PRINT |
| 2894 inline void ExternalUnsignedIntArrayPrint() { |
| 2895 ExternalUnsignedIntArrayPrint(stdout); |
| 2896 } |
| 2897 void ExternalUnsignedIntArrayPrint(FILE* out); |
| 2898 #endif |
| 2800 #ifdef DEBUG | 2899 #ifdef DEBUG |
| 2801 void ExternalUnsignedIntArrayPrint(); | |
| 2802 void ExternalUnsignedIntArrayVerify(); | 2900 void ExternalUnsignedIntArrayVerify(); |
| 2803 #endif // DEBUG | 2901 #endif // DEBUG |
| 2804 | 2902 |
| 2805 private: | 2903 private: |
| 2806 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray); | 2904 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray); |
| 2807 }; | 2905 }; |
| 2808 | 2906 |
| 2809 | 2907 |
| 2810 class ExternalFloatArray: public ExternalArray { | 2908 class ExternalFloatArray: public ExternalArray { |
| 2811 public: | 2909 public: |
| 2812 // Setter and getter. | 2910 // Setter and getter. |
| 2813 inline float get(int index); | 2911 inline float get(int index); |
| 2814 inline void set(int index, float value); | 2912 inline void set(int index, float value); |
| 2815 | 2913 |
| 2816 // This accessor applies the correct conversion from Smi, HeapNumber | 2914 // This accessor applies the correct conversion from Smi, HeapNumber |
| 2817 // and undefined. | 2915 // and undefined. |
| 2818 MaybeObject* SetValue(uint32_t index, Object* value); | 2916 MaybeObject* SetValue(uint32_t index, Object* value); |
| 2819 | 2917 |
| 2820 // Casting. | 2918 // Casting. |
| 2821 static inline ExternalFloatArray* cast(Object* obj); | 2919 static inline ExternalFloatArray* cast(Object* obj); |
| 2822 | 2920 |
| 2921 #ifdef OBJECT_PRINT |
| 2922 inline void ExternalFloatArrayPrint() { |
| 2923 ExternalFloatArrayPrint(stdout); |
| 2924 } |
| 2925 void ExternalFloatArrayPrint(FILE* out); |
| 2926 #endif |
| 2823 #ifdef DEBUG | 2927 #ifdef DEBUG |
| 2824 void ExternalFloatArrayPrint(); | |
| 2825 void ExternalFloatArrayVerify(); | 2928 void ExternalFloatArrayVerify(); |
| 2826 #endif // DEBUG | 2929 #endif // DEBUG |
| 2827 | 2930 |
| 2828 private: | 2931 private: |
| 2829 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray); | 2932 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray); |
| 2830 }; | 2933 }; |
| 2831 | 2934 |
| 2832 | 2935 |
| 2833 // DeoptimizationInputData is a fixed array used to hold the deoptimization | 2936 // DeoptimizationInputData is a fixed array used to hold the deoptimization |
| 2834 // data for code generated by the Hydrogen/Lithium compiler. It also | 2937 // data for code generated by the Hydrogen/Lithium compiler. It also |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2894 return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize; | 2997 return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize; |
| 2895 } | 2998 } |
| 2896 | 2999 |
| 2897 // Allocates a DeoptimizationInputData. | 3000 // Allocates a DeoptimizationInputData. |
| 2898 MUST_USE_RESULT static MaybeObject* Allocate(int deopt_entry_count, | 3001 MUST_USE_RESULT static MaybeObject* Allocate(int deopt_entry_count, |
| 2899 PretenureFlag pretenure); | 3002 PretenureFlag pretenure); |
| 2900 | 3003 |
| 2901 // Casting. | 3004 // Casting. |
| 2902 static inline DeoptimizationInputData* cast(Object* obj); | 3005 static inline DeoptimizationInputData* cast(Object* obj); |
| 2903 | 3006 |
| 2904 #ifdef DEBUG | 3007 #ifdef OBJECT_PRINT |
| 2905 void DeoptimizationInputDataPrint(); | 3008 void DeoptimizationInputDataPrint(FILE* out); |
| 2906 #endif | 3009 #endif |
| 2907 | 3010 |
| 2908 private: | 3011 private: |
| 2909 static int IndexForEntry(int i) { | 3012 static int IndexForEntry(int i) { |
| 2910 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize); | 3013 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize); |
| 2911 } | 3014 } |
| 2912 | 3015 |
| 2913 static int LengthFor(int entry_count) { | 3016 static int LengthFor(int entry_count) { |
| 2914 return IndexForEntry(entry_count); | 3017 return IndexForEntry(entry_count); |
| 2915 } | 3018 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2933 return deopt_points * 2; | 3036 return deopt_points * 2; |
| 2934 } | 3037 } |
| 2935 | 3038 |
| 2936 // Allocates a DeoptimizationOutputData. | 3039 // Allocates a DeoptimizationOutputData. |
| 2937 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_deopt_points, | 3040 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_deopt_points, |
| 2938 PretenureFlag pretenure); | 3041 PretenureFlag pretenure); |
| 2939 | 3042 |
| 2940 // Casting. | 3043 // Casting. |
| 2941 static inline DeoptimizationOutputData* cast(Object* obj); | 3044 static inline DeoptimizationOutputData* cast(Object* obj); |
| 2942 | 3045 |
| 2943 #ifdef DEBUG | 3046 #ifdef OBJECT_PRINT |
| 2944 void DeoptimizationOutputDataPrint(); | 3047 void DeoptimizationOutputDataPrint(FILE* out); |
| 2945 #endif | 3048 #endif |
| 2946 }; | 3049 }; |
| 2947 | 3050 |
| 2948 | 3051 |
| 2949 // Code describes objects with on-the-fly generated machine code. | 3052 // Code describes objects with on-the-fly generated machine code. |
| 2950 class Code: public HeapObject { | 3053 class Code: public HeapObject { |
| 2951 public: | 3054 public: |
| 2952 // Opaque data type for encapsulating code flags like kind, inline | 3055 // Opaque data type for encapsulating code flags like kind, inline |
| 2953 // cache state, and arguments count. | 3056 // cache state, and arguments count. |
| 2954 // FLAGS_MIN_VALUE and FLAGS_MAX_VALUE are specified to ensure that | 3057 // FLAGS_MIN_VALUE and FLAGS_MAX_VALUE are specified to ensure that |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2983 | 3086 |
| 2984 enum { | 3087 enum { |
| 2985 NUMBER_OF_KINDS = LAST_IC_KIND + 1 | 3088 NUMBER_OF_KINDS = LAST_IC_KIND + 1 |
| 2986 }; | 3089 }; |
| 2987 | 3090 |
| 2988 #ifdef ENABLE_DISASSEMBLER | 3091 #ifdef ENABLE_DISASSEMBLER |
| 2989 // Printing | 3092 // Printing |
| 2990 static const char* Kind2String(Kind kind); | 3093 static const char* Kind2String(Kind kind); |
| 2991 static const char* ICState2String(InlineCacheState state); | 3094 static const char* ICState2String(InlineCacheState state); |
| 2992 static const char* PropertyType2String(PropertyType type); | 3095 static const char* PropertyType2String(PropertyType type); |
| 2993 void Disassemble(const char* name); | 3096 inline void Disassemble(const char* name) { |
| 3097 Disassemble(name, stdout); |
| 3098 } |
| 3099 void Disassemble(const char* name, FILE* out); |
| 2994 #endif // ENABLE_DISASSEMBLER | 3100 #endif // ENABLE_DISASSEMBLER |
| 2995 | 3101 |
| 2996 // [instruction_size]: Size of the native instructions | 3102 // [instruction_size]: Size of the native instructions |
| 2997 inline int instruction_size(); | 3103 inline int instruction_size(); |
| 2998 inline void set_instruction_size(int value); | 3104 inline void set_instruction_size(int value); |
| 2999 | 3105 |
| 3000 // [relocation_info]: Code relocation information | 3106 // [relocation_info]: Code relocation information |
| 3001 DECL_ACCESSORS(relocation_info, ByteArray) | 3107 DECL_ACCESSORS(relocation_info, ByteArray) |
| 3002 void InvalidateRelocation(); | 3108 void InvalidateRelocation(); |
| 3003 | 3109 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3176 | 3282 |
| 3177 // Casting. | 3283 // Casting. |
| 3178 static inline Code* cast(Object* obj); | 3284 static inline Code* cast(Object* obj); |
| 3179 | 3285 |
| 3180 // Dispatched behavior. | 3286 // Dispatched behavior. |
| 3181 int CodeSize() { return SizeFor(body_size()); } | 3287 int CodeSize() { return SizeFor(body_size()); } |
| 3182 inline void CodeIterateBody(ObjectVisitor* v); | 3288 inline void CodeIterateBody(ObjectVisitor* v); |
| 3183 | 3289 |
| 3184 template<typename StaticVisitor> | 3290 template<typename StaticVisitor> |
| 3185 inline void CodeIterateBody(); | 3291 inline void CodeIterateBody(); |
| 3292 #ifdef OBJECT_PRINT |
| 3293 inline void CodePrint() { |
| 3294 CodePrint(stdout); |
| 3295 } |
| 3296 void CodePrint(FILE* out); |
| 3297 #endif |
| 3186 #ifdef DEBUG | 3298 #ifdef DEBUG |
| 3187 void CodePrint(); | |
| 3188 void CodeVerify(); | 3299 void CodeVerify(); |
| 3189 #endif | 3300 #endif |
| 3190 | 3301 |
| 3191 // Max loop nesting marker used to postpose OSR. We don't take loop | 3302 // Max loop nesting marker used to postpose OSR. We don't take loop |
| 3192 // nesting that is deeper than 5 levels into account. | 3303 // nesting that is deeper than 5 levels into account. |
| 3193 static const int kMaxLoopNestingMarker = 6; | 3304 static const int kMaxLoopNestingMarker = 6; |
| 3194 | 3305 |
| 3195 // Layout description. | 3306 // Layout description. |
| 3196 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; | 3307 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; |
| 3197 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; | 3308 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3465 // This is undone in MarkCompactCollector::ClearNonLiveTransitions(). | 3576 // This is undone in MarkCompactCollector::ClearNonLiveTransitions(). |
| 3466 void CreateBackPointers(); | 3577 void CreateBackPointers(); |
| 3467 | 3578 |
| 3468 // Set all map transitions from this map to dead maps to null. | 3579 // Set all map transitions from this map to dead maps to null. |
| 3469 // Also, restore the original prototype on the targets of these | 3580 // Also, restore the original prototype on the targets of these |
| 3470 // transitions, so that we do not process this map again while | 3581 // transitions, so that we do not process this map again while |
| 3471 // following back pointers. | 3582 // following back pointers. |
| 3472 void ClearNonLiveTransitions(Object* real_prototype); | 3583 void ClearNonLiveTransitions(Object* real_prototype); |
| 3473 | 3584 |
| 3474 // Dispatched behavior. | 3585 // Dispatched behavior. |
| 3586 #ifdef OBJECT_PRINT |
| 3587 inline void MapPrint() { |
| 3588 MapPrint(stdout); |
| 3589 } |
| 3590 void MapPrint(FILE* out); |
| 3591 #endif |
| 3475 #ifdef DEBUG | 3592 #ifdef DEBUG |
| 3476 void MapPrint(); | |
| 3477 void MapVerify(); | 3593 void MapVerify(); |
| 3478 void SharedMapVerify(); | 3594 void SharedMapVerify(); |
| 3479 #endif | 3595 #endif |
| 3480 | 3596 |
| 3481 inline int visitor_id(); | 3597 inline int visitor_id(); |
| 3482 inline void set_visitor_id(int visitor_id); | 3598 inline void set_visitor_id(int visitor_id); |
| 3483 | 3599 |
| 3484 typedef void (*TraverseCallback)(Map* map, void* data); | 3600 typedef void (*TraverseCallback)(Map* map, void* data); |
| 3485 | 3601 |
| 3486 void TraverseTransitionTree(TraverseCallback callback, void* data); | 3602 void TraverseTransitionTree(TraverseCallback callback, void* data); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3622 // [eval_from_instructions_offset]: the instruction offset in the code for the | 3738 // [eval_from_instructions_offset]: the instruction offset in the code for the |
| 3623 // function from which eval was called where eval was called. | 3739 // function from which eval was called where eval was called. |
| 3624 DECL_ACCESSORS(eval_from_instructions_offset, Smi) | 3740 DECL_ACCESSORS(eval_from_instructions_offset, Smi) |
| 3625 | 3741 |
| 3626 static inline Script* cast(Object* obj); | 3742 static inline Script* cast(Object* obj); |
| 3627 | 3743 |
| 3628 // If script source is an external string, check that the underlying | 3744 // If script source is an external string, check that the underlying |
| 3629 // resource is accessible. Otherwise, always return true. | 3745 // resource is accessible. Otherwise, always return true. |
| 3630 inline bool HasValidSource(); | 3746 inline bool HasValidSource(); |
| 3631 | 3747 |
| 3748 #ifdef OBJECT_PRINT |
| 3749 inline void ScriptPrint() { |
| 3750 ScriptPrint(stdout); |
| 3751 } |
| 3752 void ScriptPrint(FILE* out); |
| 3753 #endif |
| 3632 #ifdef DEBUG | 3754 #ifdef DEBUG |
| 3633 void ScriptPrint(); | |
| 3634 void ScriptVerify(); | 3755 void ScriptVerify(); |
| 3635 #endif | 3756 #endif |
| 3636 | 3757 |
| 3637 static const int kSourceOffset = HeapObject::kHeaderSize; | 3758 static const int kSourceOffset = HeapObject::kHeaderSize; |
| 3638 static const int kNameOffset = kSourceOffset + kPointerSize; | 3759 static const int kNameOffset = kSourceOffset + kPointerSize; |
| 3639 static const int kLineOffsetOffset = kNameOffset + kPointerSize; | 3760 static const int kLineOffsetOffset = kNameOffset + kPointerSize; |
| 3640 static const int kColumnOffsetOffset = kLineOffsetOffset + kPointerSize; | 3761 static const int kColumnOffsetOffset = kLineOffsetOffset + kPointerSize; |
| 3641 static const int kDataOffset = kColumnOffsetOffset + kPointerSize; | 3762 static const int kDataOffset = kColumnOffsetOffset + kPointerSize; |
| 3642 static const int kContextOffset = kDataOffset + kPointerSize; | 3763 static const int kContextOffset = kDataOffset + kPointerSize; |
| 3643 static const int kWrapperOffset = kContextOffset + kPointerSize; | 3764 static const int kWrapperOffset = kContextOffset + kPointerSize; |
| 3644 static const int kTypeOffset = kWrapperOffset + kPointerSize; | 3765 static const int kTypeOffset = kWrapperOffset + kPointerSize; |
| 3645 static const int kCompilationTypeOffset = kTypeOffset + kPointerSize; | 3766 static const int kCompilationTypeOffset = kTypeOffset + kPointerSize; |
| 3646 static const int kLineEndsOffset = kCompilationTypeOffset + kPointerSize; | 3767 static const int kLineEndsOffset = kCompilationTypeOffset + kPointerSize; |
| 3647 static const int kIdOffset = kLineEndsOffset + kPointerSize; | 3768 static const int kIdOffset = kLineEndsOffset + kPointerSize; |
| 3648 static const int kEvalFromSharedOffset = kIdOffset + kPointerSize; | 3769 static const int kEvalFromSharedOffset = kIdOffset + kPointerSize; |
| 3649 static const int kEvalFrominstructionsOffsetOffset = | 3770 static const int kEvalFrominstructionsOffsetOffset = |
| 3650 kEvalFromSharedOffset + kPointerSize; | 3771 kEvalFromSharedOffset + kPointerSize; |
| 3651 static const int kSize = kEvalFrominstructionsOffsetOffset + kPointerSize; | 3772 static const int kSize = kEvalFrominstructionsOffsetOffset + kPointerSize; |
| 3652 | 3773 |
| 3653 private: | 3774 private: |
| 3654 DISALLOW_IMPLICIT_CONSTRUCTORS(Script); | 3775 DISALLOW_IMPLICIT_CONSTRUCTORS(Script); |
| 3655 }; | 3776 }; |
| 3656 | 3777 |
| 3657 | 3778 |
| 3658 enum MathFunctionId { | 3779 // List of builtin functions we want to identify to improve code |
| 3659 kNotSpecialMathFunction = 0, | 3780 // generation. |
| 3660 // These numbers must be kept in sync with the ones in math.js. | 3781 // |
| 3661 kMathFloor = 1, | 3782 // Each entry has a name of a global object property holding an object |
| 3662 kMathRound = 2, | 3783 // optionally followed by ".prototype", a name of a builtin function |
| 3663 kMathCeil = 3, | 3784 // on the object (the one the id is set for), and a label. |
| 3664 kMathAbs = 4, | 3785 // |
| 3665 kMathLog = 5, | 3786 // Installation of ids for the selected builtin functions is handled |
| 3666 kMathSin = 6, | 3787 // by the bootstrapper. |
| 3667 kMathCos = 7, | 3788 // |
| 3668 kMathTan = 8, | 3789 // NOTE: Order is important: math functions should be at the end of |
| 3669 kMathASin = 9, | 3790 // the list and MathFloor should be the first math function. |
| 3670 kMathACos = 0xa, | 3791 #define FUNCTIONS_WITH_ID_LIST(V) \ |
| 3671 kMathATan = 0xb, | 3792 V(Array.prototype, push, ArrayPush) \ |
| 3672 kMathExp = 0xc, | 3793 V(Array.prototype, pop, ArrayPop) \ |
| 3673 kMathSqrt = 0xd, | 3794 V(String.prototype, charCodeAt, StringCharCodeAt) \ |
| 3674 kMathPow = 0xe, | 3795 V(String.prototype, charAt, StringCharAt) \ |
| 3675 kMathPowHalf = 0xf | 3796 V(String, fromCharCode, StringFromCharCode) \ |
| 3797 V(Math, floor, MathFloor) \ |
| 3798 V(Math, round, MathRound) \ |
| 3799 V(Math, ceil, MathCeil) \ |
| 3800 V(Math, abs, MathAbs) \ |
| 3801 V(Math, log, MathLog) \ |
| 3802 V(Math, sin, MathSin) \ |
| 3803 V(Math, cos, MathCos) \ |
| 3804 V(Math, tan, MathTan) \ |
| 3805 V(Math, asin, MathASin) \ |
| 3806 V(Math, acos, MathACos) \ |
| 3807 V(Math, atan, MathATan) \ |
| 3808 V(Math, exp, MathExp) \ |
| 3809 V(Math, sqrt, MathSqrt) \ |
| 3810 V(Math, pow, MathPow) |
| 3811 |
| 3812 |
| 3813 enum BuiltinFunctionId { |
| 3814 #define DECLARE_FUNCTION_ID(ignored1, ignore2, name) \ |
| 3815 k##name, |
| 3816 FUNCTIONS_WITH_ID_LIST(DECLARE_FUNCTION_ID) |
| 3817 #undef DECLARE_FUNCTION_ID |
| 3818 // Fake id for a special case of Math.pow. Note, it continues the |
| 3819 // list of math functions. |
| 3820 kMathPowHalf, |
| 3821 kFirstMathFunctionId = kMathFloor |
| 3676 }; | 3822 }; |
| 3677 | 3823 |
| 3678 | 3824 |
| 3679 // SharedFunctionInfo describes the JSFunction information that can be | 3825 // SharedFunctionInfo describes the JSFunction information that can be |
| 3680 // shared by multiple instances of the function. | 3826 // shared by multiple instances of the function. |
| 3681 class SharedFunctionInfo: public HeapObject { | 3827 class SharedFunctionInfo: public HeapObject { |
| 3682 public: | 3828 public: |
| 3683 // [name]: Function name. | 3829 // [name]: Function name. |
| 3684 DECL_ACCESSORS(name, Object) | 3830 DECL_ACCESSORS(name, Object) |
| 3685 | 3831 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3806 // May go back from true to false after GC. | 3952 // May go back from true to false after GC. |
| 3807 inline bool live_objects_may_exist(); | 3953 inline bool live_objects_may_exist(); |
| 3808 | 3954 |
| 3809 inline void set_live_objects_may_exist(bool value); | 3955 inline void set_live_objects_may_exist(bool value); |
| 3810 | 3956 |
| 3811 // [instance class name]: class name for instances. | 3957 // [instance class name]: class name for instances. |
| 3812 DECL_ACCESSORS(instance_class_name, Object) | 3958 DECL_ACCESSORS(instance_class_name, Object) |
| 3813 | 3959 |
| 3814 // [function data]: This field holds some additional data for function. | 3960 // [function data]: This field holds some additional data for function. |
| 3815 // Currently it either has FunctionTemplateInfo to make benefit the API | 3961 // Currently it either has FunctionTemplateInfo to make benefit the API |
| 3816 // or Smi identifying a custom call generator. | 3962 // or Smi identifying a builtin function. |
| 3817 // In the long run we don't want all functions to have this field but | 3963 // In the long run we don't want all functions to have this field but |
| 3818 // we can fix that when we have a better model for storing hidden data | 3964 // we can fix that when we have a better model for storing hidden data |
| 3819 // on objects. | 3965 // on objects. |
| 3820 DECL_ACCESSORS(function_data, Object) | 3966 DECL_ACCESSORS(function_data, Object) |
| 3821 | 3967 |
| 3822 inline bool IsApiFunction(); | 3968 inline bool IsApiFunction(); |
| 3823 inline FunctionTemplateInfo* get_api_func_data(); | 3969 inline FunctionTemplateInfo* get_api_func_data(); |
| 3824 inline bool HasCustomCallGenerator(); | 3970 inline bool HasBuiltinFunctionId(); |
| 3825 inline int custom_call_generator_id(); | 3971 inline bool IsBuiltinMathFunction(); |
| 3972 inline BuiltinFunctionId builtin_function_id(); |
| 3826 | 3973 |
| 3827 // [script info]: Script from which the function originates. | 3974 // [script info]: Script from which the function originates. |
| 3828 DECL_ACCESSORS(script, Object) | 3975 DECL_ACCESSORS(script, Object) |
| 3829 | 3976 |
| 3830 // [num_literals]: Number of literals used by this function. | 3977 // [num_literals]: Number of literals used by this function. |
| 3831 inline int num_literals(); | 3978 inline int num_literals(); |
| 3832 inline void set_num_literals(int value); | 3979 inline void set_num_literals(int value); |
| 3833 | 3980 |
| 3834 // [start_position_and_type]: Field used to store both the source code | 3981 // [start_position_and_type]: Field used to store both the source code |
| 3835 // position, whether or not the function is a function expression, | 3982 // position, whether or not the function is a function expression, |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3960 | 4107 |
| 3961 // Calculate the instance size. | 4108 // Calculate the instance size. |
| 3962 int CalculateInstanceSize(); | 4109 int CalculateInstanceSize(); |
| 3963 | 4110 |
| 3964 // Calculate the number of in-object properties. | 4111 // Calculate the number of in-object properties. |
| 3965 int CalculateInObjectProperties(); | 4112 int CalculateInObjectProperties(); |
| 3966 | 4113 |
| 3967 // Dispatched behavior. | 4114 // Dispatched behavior. |
| 3968 // Set max_length to -1 for unlimited length. | 4115 // Set max_length to -1 for unlimited length. |
| 3969 void SourceCodePrint(StringStream* accumulator, int max_length); | 4116 void SourceCodePrint(StringStream* accumulator, int max_length); |
| 4117 #ifdef OBJECT_PRINT |
| 4118 inline void SharedFunctionInfoPrint() { |
| 4119 SharedFunctionInfoPrint(stdout); |
| 4120 } |
| 4121 void SharedFunctionInfoPrint(FILE* out); |
| 4122 #endif |
| 3970 #ifdef DEBUG | 4123 #ifdef DEBUG |
| 3971 void SharedFunctionInfoPrint(); | |
| 3972 void SharedFunctionInfoVerify(); | 4124 void SharedFunctionInfoVerify(); |
| 3973 #endif | 4125 #endif |
| 3974 | 4126 |
| 3975 // Casting. | 4127 // Casting. |
| 3976 static inline SharedFunctionInfo* cast(Object* obj); | 4128 static inline SharedFunctionInfo* cast(Object* obj); |
| 3977 | 4129 |
| 3978 // Constants. | 4130 // Constants. |
| 3979 static const int kDontAdaptArgumentsSentinel = -1; | 4131 static const int kDontAdaptArgumentsSentinel = -1; |
| 3980 | 4132 |
| 3981 // Layout description. | 4133 // Layout description. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4066 #if __BYTE_ORDER == __LITTLE_ENDIAN | 4218 #if __BYTE_ORDER == __LITTLE_ENDIAN |
| 4067 static const int kConstructionCountOffset = kCompilerHintsOffset + 3; | 4219 static const int kConstructionCountOffset = kCompilerHintsOffset + 3; |
| 4068 #elif __BYTE_ORDER == __BIG_ENDIAN | 4220 #elif __BYTE_ORDER == __BIG_ENDIAN |
| 4069 static const int kConstructionCountOffset = kCompilerHintsOffset + 0; | 4221 static const int kConstructionCountOffset = kCompilerHintsOffset + 0; |
| 4070 #else | 4222 #else |
| 4071 #error Unknown byte ordering | 4223 #error Unknown byte ordering |
| 4072 #endif | 4224 #endif |
| 4073 | 4225 |
| 4074 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); | 4226 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); |
| 4075 | 4227 |
| 4076 // Get/set a special tag on the functions from math.js so we can inline | |
| 4077 // efficient versions of them in the code. | |
| 4078 inline MathFunctionId math_function_id(); | |
| 4079 inline void set_math_function_id(int id); | |
| 4080 static inline int max_math_id_number() { return kMathFunctionMask; } | |
| 4081 | |
| 4082 typedef FixedBodyDescriptor<kNameOffset, | 4228 typedef FixedBodyDescriptor<kNameOffset, |
| 4083 kThisPropertyAssignmentsOffset + kPointerSize, | 4229 kThisPropertyAssignmentsOffset + kPointerSize, |
| 4084 kSize> BodyDescriptor; | 4230 kSize> BodyDescriptor; |
| 4085 | 4231 |
| 4086 private: | 4232 private: |
| 4087 // Bit positions in start_position_and_type. | 4233 // Bit positions in start_position_and_type. |
| 4088 // The source code start position is in the 30 most significant bits of | 4234 // The source code start position is in the 30 most significant bits of |
| 4089 // the start_position_and_type field. | 4235 // the start_position_and_type field. |
| 4090 static const int kIsExpressionBit = 0; | 4236 static const int kIsExpressionBit = 0; |
| 4091 static const int kIsTopLevelBit = 1; | 4237 static const int kIsTopLevelBit = 1; |
| 4092 static const int kStartPositionShift = 2; | 4238 static const int kStartPositionShift = 2; |
| 4093 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 4239 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
| 4094 | 4240 |
| 4095 // Bit positions in compiler_hints. | 4241 // Bit positions in compiler_hints. |
| 4096 static const int kHasOnlySimpleThisPropertyAssignments = 0; | 4242 static const int kHasOnlySimpleThisPropertyAssignments = 0; |
| 4097 static const int kTryFullCodegen = 1; | 4243 static const int kTryFullCodegen = 1; |
| 4098 static const int kAllowLazyCompilation = 2; | 4244 static const int kAllowLazyCompilation = 2; |
| 4099 static const int kMathFunctionShift = 3; | 4245 static const int kLiveObjectsMayExist = 3; |
| 4100 static const int kMathFunctionMask = 0x1f; | 4246 static const int kCodeAgeShift = 4; |
| 4101 static const int kLiveObjectsMayExist = 8; | |
| 4102 static const int kCodeAgeShift = 9; | |
| 4103 static const int kCodeAgeMask = 0x7; | 4247 static const int kCodeAgeMask = 0x7; |
| 4104 static const int kOptimizationDisabled = 12; | 4248 static const int kOptimizationDisabled = 7; |
| 4105 | 4249 |
| 4106 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); | 4250 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); |
| 4107 }; | 4251 }; |
| 4108 | 4252 |
| 4109 | 4253 |
| 4110 // JSFunction describes JavaScript functions. | 4254 // JSFunction describes JavaScript functions. |
| 4111 class JSFunction: public JSObject { | 4255 class JSFunction: public JSObject { |
| 4112 public: | 4256 public: |
| 4113 // [prototype_or_initial_map]: | 4257 // [prototype_or_initial_map]: |
| 4114 DECL_ACCESSORS(prototype_or_initial_map, Object) | 4258 DECL_ACCESSORS(prototype_or_initial_map, Object) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4201 Object* SetInstanceClassName(String* name); | 4345 Object* SetInstanceClassName(String* name); |
| 4202 | 4346 |
| 4203 // Returns if this function has been compiled to native code yet. | 4347 // Returns if this function has been compiled to native code yet. |
| 4204 inline bool is_compiled(); | 4348 inline bool is_compiled(); |
| 4205 | 4349 |
| 4206 // [next_function_link]: Field for linking functions. This list is treated as | 4350 // [next_function_link]: Field for linking functions. This list is treated as |
| 4207 // a weak list by the GC. | 4351 // a weak list by the GC. |
| 4208 DECL_ACCESSORS(next_function_link, Object) | 4352 DECL_ACCESSORS(next_function_link, Object) |
| 4209 | 4353 |
| 4210 // Prints the name of the function using PrintF. | 4354 // Prints the name of the function using PrintF. |
| 4211 void PrintName(); | 4355 inline void PrintName() { |
| 4356 PrintName(stdout); |
| 4357 } |
| 4358 void PrintName(FILE* out); |
| 4212 | 4359 |
| 4213 // Casting. | 4360 // Casting. |
| 4214 static inline JSFunction* cast(Object* obj); | 4361 static inline JSFunction* cast(Object* obj); |
| 4215 | 4362 |
| 4216 // Iterates the objects, including code objects indirectly referenced | 4363 // Iterates the objects, including code objects indirectly referenced |
| 4217 // through pointers to the first instruction in the code object. | 4364 // through pointers to the first instruction in the code object. |
| 4218 void JSFunctionIterateBody(int object_size, ObjectVisitor* v); | 4365 void JSFunctionIterateBody(int object_size, ObjectVisitor* v); |
| 4219 | 4366 |
| 4220 // Dispatched behavior. | 4367 // Dispatched behavior. |
| 4368 #ifdef OBJECT_PRINT |
| 4369 inline void JSFunctionPrint() { |
| 4370 JSFunctionPrint(stdout); |
| 4371 } |
| 4372 void JSFunctionPrint(FILE* out); |
| 4373 #endif |
| 4221 #ifdef DEBUG | 4374 #ifdef DEBUG |
| 4222 void JSFunctionPrint(); | |
| 4223 void JSFunctionVerify(); | 4375 void JSFunctionVerify(); |
| 4224 #endif | 4376 #endif |
| 4225 | 4377 |
| 4226 // Returns the number of allocated literals. | 4378 // Returns the number of allocated literals. |
| 4227 inline int NumberOfLiterals(); | 4379 inline int NumberOfLiterals(); |
| 4228 | 4380 |
| 4229 // Retrieve the global context from a function's literal array. | 4381 // Retrieve the global context from a function's literal array. |
| 4230 static Context* GlobalContextFromLiterals(FixedArray* literals); | 4382 static Context* GlobalContextFromLiterals(FixedArray* literals); |
| 4231 | 4383 |
| 4232 // Layout descriptors. The last property (from kNonWeakFieldsEndOffset to | 4384 // Layout descriptors. The last property (from kNonWeakFieldsEndOffset to |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4261 class JSGlobalProxy : public JSObject { | 4413 class JSGlobalProxy : public JSObject { |
| 4262 public: | 4414 public: |
| 4263 // [context]: the owner global context of this proxy object. | 4415 // [context]: the owner global context of this proxy object. |
| 4264 // It is null value if this object is not used by any context. | 4416 // It is null value if this object is not used by any context. |
| 4265 DECL_ACCESSORS(context, Object) | 4417 DECL_ACCESSORS(context, Object) |
| 4266 | 4418 |
| 4267 // Casting. | 4419 // Casting. |
| 4268 static inline JSGlobalProxy* cast(Object* obj); | 4420 static inline JSGlobalProxy* cast(Object* obj); |
| 4269 | 4421 |
| 4270 // Dispatched behavior. | 4422 // Dispatched behavior. |
| 4423 #ifdef OBJECT_PRINT |
| 4424 inline void JSGlobalProxyPrint() { |
| 4425 JSGlobalProxyPrint(stdout); |
| 4426 } |
| 4427 void JSGlobalProxyPrint(FILE* out); |
| 4428 #endif |
| 4271 #ifdef DEBUG | 4429 #ifdef DEBUG |
| 4272 void JSGlobalProxyPrint(); | |
| 4273 void JSGlobalProxyVerify(); | 4430 void JSGlobalProxyVerify(); |
| 4274 #endif | 4431 #endif |
| 4275 | 4432 |
| 4276 // Layout description. | 4433 // Layout description. |
| 4277 static const int kContextOffset = JSObject::kHeaderSize; | 4434 static const int kContextOffset = JSObject::kHeaderSize; |
| 4278 static const int kSize = kContextOffset + kPointerSize; | 4435 static const int kSize = kContextOffset + kPointerSize; |
| 4279 | 4436 |
| 4280 private: | 4437 private: |
| 4281 | 4438 |
| 4282 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); | 4439 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4332 | 4489 |
| 4333 | 4490 |
| 4334 // JavaScript global object. | 4491 // JavaScript global object. |
| 4335 class JSGlobalObject: public GlobalObject { | 4492 class JSGlobalObject: public GlobalObject { |
| 4336 public: | 4493 public: |
| 4337 | 4494 |
| 4338 // Casting. | 4495 // Casting. |
| 4339 static inline JSGlobalObject* cast(Object* obj); | 4496 static inline JSGlobalObject* cast(Object* obj); |
| 4340 | 4497 |
| 4341 // Dispatched behavior. | 4498 // Dispatched behavior. |
| 4499 #ifdef OBJECT_PRINT |
| 4500 inline void JSGlobalObjectPrint() { |
| 4501 JSGlobalObjectPrint(stdout); |
| 4502 } |
| 4503 void JSGlobalObjectPrint(FILE* out); |
| 4504 #endif |
| 4342 #ifdef DEBUG | 4505 #ifdef DEBUG |
| 4343 void JSGlobalObjectPrint(); | |
| 4344 void JSGlobalObjectVerify(); | 4506 void JSGlobalObjectVerify(); |
| 4345 #endif | 4507 #endif |
| 4346 | 4508 |
| 4347 // Layout description. | 4509 // Layout description. |
| 4348 static const int kSize = GlobalObject::kHeaderSize; | 4510 static const int kSize = GlobalObject::kHeaderSize; |
| 4349 | 4511 |
| 4350 private: | 4512 private: |
| 4351 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalObject); | 4513 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalObject); |
| 4352 }; | 4514 }; |
| 4353 | 4515 |
| 4354 | 4516 |
| 4355 // Builtins global object which holds the runtime routines written in | 4517 // Builtins global object which holds the runtime routines written in |
| 4356 // JavaScript. | 4518 // JavaScript. |
| 4357 class JSBuiltinsObject: public GlobalObject { | 4519 class JSBuiltinsObject: public GlobalObject { |
| 4358 public: | 4520 public: |
| 4359 // Accessors for the runtime routines written in JavaScript. | 4521 // Accessors for the runtime routines written in JavaScript. |
| 4360 inline Object* javascript_builtin(Builtins::JavaScript id); | 4522 inline Object* javascript_builtin(Builtins::JavaScript id); |
| 4361 inline void set_javascript_builtin(Builtins::JavaScript id, Object* value); | 4523 inline void set_javascript_builtin(Builtins::JavaScript id, Object* value); |
| 4362 | 4524 |
| 4363 // Accessors for code of the runtime routines written in JavaScript. | 4525 // Accessors for code of the runtime routines written in JavaScript. |
| 4364 inline Code* javascript_builtin_code(Builtins::JavaScript id); | 4526 inline Code* javascript_builtin_code(Builtins::JavaScript id); |
| 4365 inline void set_javascript_builtin_code(Builtins::JavaScript id, Code* value); | 4527 inline void set_javascript_builtin_code(Builtins::JavaScript id, Code* value); |
| 4366 | 4528 |
| 4367 // Casting. | 4529 // Casting. |
| 4368 static inline JSBuiltinsObject* cast(Object* obj); | 4530 static inline JSBuiltinsObject* cast(Object* obj); |
| 4369 | 4531 |
| 4370 // Dispatched behavior. | 4532 // Dispatched behavior. |
| 4533 #ifdef OBJECT_PRINT |
| 4534 inline void JSBuiltinsObjectPrint() { |
| 4535 JSBuiltinsObjectPrint(stdout); |
| 4536 } |
| 4537 void JSBuiltinsObjectPrint(FILE* out); |
| 4538 #endif |
| 4371 #ifdef DEBUG | 4539 #ifdef DEBUG |
| 4372 void JSBuiltinsObjectPrint(); | |
| 4373 void JSBuiltinsObjectVerify(); | 4540 void JSBuiltinsObjectVerify(); |
| 4374 #endif | 4541 #endif |
| 4375 | 4542 |
| 4376 // Layout description. The size of the builtins object includes | 4543 // Layout description. The size of the builtins object includes |
| 4377 // room for two pointers per runtime routine written in javascript | 4544 // room for two pointers per runtime routine written in javascript |
| 4378 // (function and code object). | 4545 // (function and code object). |
| 4379 static const int kJSBuiltinsCount = Builtins::id_count; | 4546 static const int kJSBuiltinsCount = Builtins::id_count; |
| 4380 static const int kJSBuiltinsOffset = GlobalObject::kHeaderSize; | 4547 static const int kJSBuiltinsOffset = GlobalObject::kHeaderSize; |
| 4381 static const int kJSBuiltinsCodeOffset = | 4548 static const int kJSBuiltinsCodeOffset = |
| 4382 GlobalObject::kHeaderSize + (kJSBuiltinsCount * kPointerSize); | 4549 GlobalObject::kHeaderSize + (kJSBuiltinsCount * kPointerSize); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 4399 // Representation for JS Wrapper objects, String, Number, Boolean, Date, etc. | 4566 // Representation for JS Wrapper objects, String, Number, Boolean, Date, etc. |
| 4400 class JSValue: public JSObject { | 4567 class JSValue: public JSObject { |
| 4401 public: | 4568 public: |
| 4402 // [value]: the object being wrapped. | 4569 // [value]: the object being wrapped. |
| 4403 DECL_ACCESSORS(value, Object) | 4570 DECL_ACCESSORS(value, Object) |
| 4404 | 4571 |
| 4405 // Casting. | 4572 // Casting. |
| 4406 static inline JSValue* cast(Object* obj); | 4573 static inline JSValue* cast(Object* obj); |
| 4407 | 4574 |
| 4408 // Dispatched behavior. | 4575 // Dispatched behavior. |
| 4576 #ifdef OBJECT_PRINT |
| 4577 inline void JSValuePrint() { |
| 4578 JSValuePrint(stdout); |
| 4579 } |
| 4580 void JSValuePrint(FILE* out); |
| 4581 #endif |
| 4409 #ifdef DEBUG | 4582 #ifdef DEBUG |
| 4410 void JSValuePrint(); | |
| 4411 void JSValueVerify(); | 4583 void JSValueVerify(); |
| 4412 #endif | 4584 #endif |
| 4413 | 4585 |
| 4414 // Layout description. | 4586 // Layout description. |
| 4415 static const int kValueOffset = JSObject::kHeaderSize; | 4587 static const int kValueOffset = JSObject::kHeaderSize; |
| 4416 static const int kSize = kValueOffset + kPointerSize; | 4588 static const int kSize = kValueOffset + kPointerSize; |
| 4417 | 4589 |
| 4418 private: | 4590 private: |
| 4419 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); | 4591 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); |
| 4420 }; | 4592 }; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4589 // code object is not in that cache. This index can be used to later call | 4761 // code object is not in that cache. This index can be used to later call |
| 4590 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and | 4762 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and |
| 4591 // RemoveByIndex. | 4763 // RemoveByIndex. |
| 4592 int GetIndex(Object* name, Code* code); | 4764 int GetIndex(Object* name, Code* code); |
| 4593 | 4765 |
| 4594 // Remove an object from the cache with the provided internal index. | 4766 // Remove an object from the cache with the provided internal index. |
| 4595 void RemoveByIndex(Object* name, Code* code, int index); | 4767 void RemoveByIndex(Object* name, Code* code, int index); |
| 4596 | 4768 |
| 4597 static inline CodeCache* cast(Object* obj); | 4769 static inline CodeCache* cast(Object* obj); |
| 4598 | 4770 |
| 4771 #ifdef OBJECT_PRINT |
| 4772 inline void CodeCachePrint() { |
| 4773 CodeCachePrint(stdout); |
| 4774 } |
| 4775 void CodeCachePrint(FILE* out); |
| 4776 #endif |
| 4599 #ifdef DEBUG | 4777 #ifdef DEBUG |
| 4600 void CodeCachePrint(); | |
| 4601 void CodeCacheVerify(); | 4778 void CodeCacheVerify(); |
| 4602 #endif | 4779 #endif |
| 4603 | 4780 |
| 4604 static const int kDefaultCacheOffset = HeapObject::kHeaderSize; | 4781 static const int kDefaultCacheOffset = HeapObject::kHeaderSize; |
| 4605 static const int kNormalTypeCacheOffset = | 4782 static const int kNormalTypeCacheOffset = |
| 4606 kDefaultCacheOffset + kPointerSize; | 4783 kDefaultCacheOffset + kPointerSize; |
| 4607 static const int kSize = kNormalTypeCacheOffset + kPointerSize; | 4784 static const int kSize = kNormalTypeCacheOffset + kPointerSize; |
| 4608 | 4785 |
| 4609 private: | 4786 private: |
| 4610 MUST_USE_RESULT MaybeObject* UpdateDefaultCache(String* name, Code* code); | 4787 MUST_USE_RESULT MaybeObject* UpdateDefaultCache(String* name, Code* code); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4891 // Casting. | 5068 // Casting. |
| 4892 static inline String* cast(Object* obj); | 5069 static inline String* cast(Object* obj); |
| 4893 | 5070 |
| 4894 void PrintOn(FILE* out); | 5071 void PrintOn(FILE* out); |
| 4895 | 5072 |
| 4896 // For use during stack traces. Performs rudimentary sanity check. | 5073 // For use during stack traces. Performs rudimentary sanity check. |
| 4897 bool LooksValid(); | 5074 bool LooksValid(); |
| 4898 | 5075 |
| 4899 // Dispatched behavior. | 5076 // Dispatched behavior. |
| 4900 void StringShortPrint(StringStream* accumulator); | 5077 void StringShortPrint(StringStream* accumulator); |
| 5078 #ifdef OBJECT_PRINT |
| 5079 inline void StringPrint() { |
| 5080 StringPrint(stdout); |
| 5081 } |
| 5082 void StringPrint(FILE* out); |
| 5083 #endif |
| 4901 #ifdef DEBUG | 5084 #ifdef DEBUG |
| 4902 void StringPrint(); | |
| 4903 void StringVerify(); | 5085 void StringVerify(); |
| 4904 #endif | 5086 #endif |
| 4905 inline bool IsFlat(); | 5087 inline bool IsFlat(); |
| 4906 | 5088 |
| 4907 // Layout description. | 5089 // Layout description. |
| 4908 static const int kLengthOffset = HeapObject::kHeaderSize; | 5090 static const int kLengthOffset = HeapObject::kHeaderSize; |
| 4909 static const int kHashFieldOffset = kLengthOffset + kPointerSize; | 5091 static const int kHashFieldOffset = kLengthOffset + kPointerSize; |
| 4910 static const int kSize = kHashFieldOffset + kPointerSize; | 5092 static const int kSize = kHashFieldOffset + kPointerSize; |
| 4911 | 5093 |
| 4912 // Maximum number of characters to consider when trying to convert a string | 5094 // Maximum number of characters to consider when trying to convert a string |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5447 class JSGlobalPropertyCell: public HeapObject { | 5629 class JSGlobalPropertyCell: public HeapObject { |
| 5448 public: | 5630 public: |
| 5449 // [value]: value of the global property. | 5631 // [value]: value of the global property. |
| 5450 DECL_ACCESSORS(value, Object) | 5632 DECL_ACCESSORS(value, Object) |
| 5451 | 5633 |
| 5452 // Casting. | 5634 // Casting. |
| 5453 static inline JSGlobalPropertyCell* cast(Object* obj); | 5635 static inline JSGlobalPropertyCell* cast(Object* obj); |
| 5454 | 5636 |
| 5455 #ifdef DEBUG | 5637 #ifdef DEBUG |
| 5456 void JSGlobalPropertyCellVerify(); | 5638 void JSGlobalPropertyCellVerify(); |
| 5457 void JSGlobalPropertyCellPrint(); | 5639 #endif |
| 5640 #ifdef OBJECT_PRINT |
| 5641 inline void JSGlobalPropertyCellPrint() { |
| 5642 JSGlobalPropertyCellPrint(stdout); |
| 5643 } |
| 5644 void JSGlobalPropertyCellPrint(FILE* out); |
| 5458 #endif | 5645 #endif |
| 5459 | 5646 |
| 5460 // Layout description. | 5647 // Layout description. |
| 5461 static const int kValueOffset = HeapObject::kHeaderSize; | 5648 static const int kValueOffset = HeapObject::kHeaderSize; |
| 5462 static const int kSize = kValueOffset + kPointerSize; | 5649 static const int kSize = kValueOffset + kPointerSize; |
| 5463 | 5650 |
| 5464 typedef FixedBodyDescriptor<kValueOffset, | 5651 typedef FixedBodyDescriptor<kValueOffset, |
| 5465 kValueOffset + kPointerSize, | 5652 kValueOffset + kPointerSize, |
| 5466 kSize> BodyDescriptor; | 5653 kSize> BodyDescriptor; |
| 5467 | 5654 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 5482 | 5669 |
| 5483 // Casting. | 5670 // Casting. |
| 5484 static inline Proxy* cast(Object* obj); | 5671 static inline Proxy* cast(Object* obj); |
| 5485 | 5672 |
| 5486 // Dispatched behavior. | 5673 // Dispatched behavior. |
| 5487 inline void ProxyIterateBody(ObjectVisitor* v); | 5674 inline void ProxyIterateBody(ObjectVisitor* v); |
| 5488 | 5675 |
| 5489 template<typename StaticVisitor> | 5676 template<typename StaticVisitor> |
| 5490 inline void ProxyIterateBody(); | 5677 inline void ProxyIterateBody(); |
| 5491 | 5678 |
| 5679 #ifdef OBJECT_PRINT |
| 5680 inline void ProxyPrint() { |
| 5681 ProxyPrint(stdout); |
| 5682 } |
| 5683 void ProxyPrint(FILE* out); |
| 5684 #endif |
| 5492 #ifdef DEBUG | 5685 #ifdef DEBUG |
| 5493 void ProxyPrint(); | |
| 5494 void ProxyVerify(); | 5686 void ProxyVerify(); |
| 5495 #endif | 5687 #endif |
| 5496 | 5688 |
| 5497 // Layout description. | 5689 // Layout description. |
| 5498 | 5690 |
| 5499 static const int kProxyOffset = HeapObject::kHeaderSize; | 5691 static const int kProxyOffset = HeapObject::kHeaderSize; |
| 5500 static const int kSize = kProxyOffset + kPointerSize; | 5692 static const int kSize = kProxyOffset + kPointerSize; |
| 5501 | 5693 |
| 5502 STATIC_CHECK(kProxyOffset == Internals::kProxyProxyOffset); | 5694 STATIC_CHECK(kProxyOffset == Internals::kProxyProxyOffset); |
| 5503 | 5695 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 5532 inline void SetContent(FixedArray* storage); | 5724 inline void SetContent(FixedArray* storage); |
| 5533 | 5725 |
| 5534 // Casting. | 5726 // Casting. |
| 5535 static inline JSArray* cast(Object* obj); | 5727 static inline JSArray* cast(Object* obj); |
| 5536 | 5728 |
| 5537 // Uses handles. Ensures that the fixed array backing the JSArray has at | 5729 // Uses handles. Ensures that the fixed array backing the JSArray has at |
| 5538 // least the stated size. | 5730 // least the stated size. |
| 5539 inline void EnsureSize(int minimum_size_of_backing_fixed_array); | 5731 inline void EnsureSize(int minimum_size_of_backing_fixed_array); |
| 5540 | 5732 |
| 5541 // Dispatched behavior. | 5733 // Dispatched behavior. |
| 5734 #ifdef OBJECT_PRINT |
| 5735 inline void JSArrayPrint() { |
| 5736 JSArrayPrint(stdout); |
| 5737 } |
| 5738 void JSArrayPrint(FILE* out); |
| 5739 #endif |
| 5542 #ifdef DEBUG | 5740 #ifdef DEBUG |
| 5543 void JSArrayPrint(); | |
| 5544 void JSArrayVerify(); | 5741 void JSArrayVerify(); |
| 5545 #endif | 5742 #endif |
| 5546 | 5743 |
| 5547 // Number of element slots to pre-allocate for an empty array. | 5744 // Number of element slots to pre-allocate for an empty array. |
| 5548 static const int kPreallocatedArrayElements = 4; | 5745 static const int kPreallocatedArrayElements = 4; |
| 5549 | 5746 |
| 5550 // Layout description. | 5747 // Layout description. |
| 5551 static const int kLengthOffset = JSObject::kHeaderSize; | 5748 static const int kLengthOffset = JSObject::kHeaderSize; |
| 5552 static const int kSize = kLengthOffset + kPointerSize; | 5749 static const int kSize = kLengthOffset + kPointerSize; |
| 5553 | 5750 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5604 inline void set_all_can_write(bool value); | 5801 inline void set_all_can_write(bool value); |
| 5605 | 5802 |
| 5606 inline bool prohibits_overwriting(); | 5803 inline bool prohibits_overwriting(); |
| 5607 inline void set_prohibits_overwriting(bool value); | 5804 inline void set_prohibits_overwriting(bool value); |
| 5608 | 5805 |
| 5609 inline PropertyAttributes property_attributes(); | 5806 inline PropertyAttributes property_attributes(); |
| 5610 inline void set_property_attributes(PropertyAttributes attributes); | 5807 inline void set_property_attributes(PropertyAttributes attributes); |
| 5611 | 5808 |
| 5612 static inline AccessorInfo* cast(Object* obj); | 5809 static inline AccessorInfo* cast(Object* obj); |
| 5613 | 5810 |
| 5811 #ifdef OBJECT_PRINT |
| 5812 inline void AccessorInfoPrint() { |
| 5813 AccessorInfoPrint(stdout); |
| 5814 } |
| 5815 void AccessorInfoPrint(FILE* out); |
| 5816 #endif |
| 5614 #ifdef DEBUG | 5817 #ifdef DEBUG |
| 5615 void AccessorInfoPrint(); | |
| 5616 void AccessorInfoVerify(); | 5818 void AccessorInfoVerify(); |
| 5617 #endif | 5819 #endif |
| 5618 | 5820 |
| 5619 static const int kGetterOffset = HeapObject::kHeaderSize; | 5821 static const int kGetterOffset = HeapObject::kHeaderSize; |
| 5620 static const int kSetterOffset = kGetterOffset + kPointerSize; | 5822 static const int kSetterOffset = kGetterOffset + kPointerSize; |
| 5621 static const int kDataOffset = kSetterOffset + kPointerSize; | 5823 static const int kDataOffset = kSetterOffset + kPointerSize; |
| 5622 static const int kNameOffset = kDataOffset + kPointerSize; | 5824 static const int kNameOffset = kDataOffset + kPointerSize; |
| 5623 static const int kFlagOffset = kNameOffset + kPointerSize; | 5825 static const int kFlagOffset = kNameOffset + kPointerSize; |
| 5624 static const int kSize = kFlagOffset + kPointerSize; | 5826 static const int kSize = kFlagOffset + kPointerSize; |
| 5625 | 5827 |
| 5626 private: | 5828 private: |
| 5627 // Bit positions in flag. | 5829 // Bit positions in flag. |
| 5628 static const int kAllCanReadBit = 0; | 5830 static const int kAllCanReadBit = 0; |
| 5629 static const int kAllCanWriteBit = 1; | 5831 static const int kAllCanWriteBit = 1; |
| 5630 static const int kProhibitsOverwritingBit = 2; | 5832 static const int kProhibitsOverwritingBit = 2; |
| 5631 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; | 5833 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; |
| 5632 | 5834 |
| 5633 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); | 5835 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); |
| 5634 }; | 5836 }; |
| 5635 | 5837 |
| 5636 | 5838 |
| 5637 class AccessCheckInfo: public Struct { | 5839 class AccessCheckInfo: public Struct { |
| 5638 public: | 5840 public: |
| 5639 DECL_ACCESSORS(named_callback, Object) | 5841 DECL_ACCESSORS(named_callback, Object) |
| 5640 DECL_ACCESSORS(indexed_callback, Object) | 5842 DECL_ACCESSORS(indexed_callback, Object) |
| 5641 DECL_ACCESSORS(data, Object) | 5843 DECL_ACCESSORS(data, Object) |
| 5642 | 5844 |
| 5643 static inline AccessCheckInfo* cast(Object* obj); | 5845 static inline AccessCheckInfo* cast(Object* obj); |
| 5644 | 5846 |
| 5847 #ifdef OBJECT_PRINT |
| 5848 inline void AccessCheckInfoPrint() { |
| 5849 AccessCheckInfoPrint(stdout); |
| 5850 } |
| 5851 void AccessCheckInfoPrint(FILE* out); |
| 5852 #endif |
| 5645 #ifdef DEBUG | 5853 #ifdef DEBUG |
| 5646 void AccessCheckInfoPrint(); | |
| 5647 void AccessCheckInfoVerify(); | 5854 void AccessCheckInfoVerify(); |
| 5648 #endif | 5855 #endif |
| 5649 | 5856 |
| 5650 static const int kNamedCallbackOffset = HeapObject::kHeaderSize; | 5857 static const int kNamedCallbackOffset = HeapObject::kHeaderSize; |
| 5651 static const int kIndexedCallbackOffset = kNamedCallbackOffset + kPointerSize; | 5858 static const int kIndexedCallbackOffset = kNamedCallbackOffset + kPointerSize; |
| 5652 static const int kDataOffset = kIndexedCallbackOffset + kPointerSize; | 5859 static const int kDataOffset = kIndexedCallbackOffset + kPointerSize; |
| 5653 static const int kSize = kDataOffset + kPointerSize; | 5860 static const int kSize = kDataOffset + kPointerSize; |
| 5654 | 5861 |
| 5655 private: | 5862 private: |
| 5656 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessCheckInfo); | 5863 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessCheckInfo); |
| 5657 }; | 5864 }; |
| 5658 | 5865 |
| 5659 | 5866 |
| 5660 class InterceptorInfo: public Struct { | 5867 class InterceptorInfo: public Struct { |
| 5661 public: | 5868 public: |
| 5662 DECL_ACCESSORS(getter, Object) | 5869 DECL_ACCESSORS(getter, Object) |
| 5663 DECL_ACCESSORS(setter, Object) | 5870 DECL_ACCESSORS(setter, Object) |
| 5664 DECL_ACCESSORS(query, Object) | 5871 DECL_ACCESSORS(query, Object) |
| 5665 DECL_ACCESSORS(deleter, Object) | 5872 DECL_ACCESSORS(deleter, Object) |
| 5666 DECL_ACCESSORS(enumerator, Object) | 5873 DECL_ACCESSORS(enumerator, Object) |
| 5667 DECL_ACCESSORS(data, Object) | 5874 DECL_ACCESSORS(data, Object) |
| 5668 | 5875 |
| 5669 static inline InterceptorInfo* cast(Object* obj); | 5876 static inline InterceptorInfo* cast(Object* obj); |
| 5670 | 5877 |
| 5878 #ifdef OBJECT_PRINT |
| 5879 inline void InterceptorInfoPrint() { |
| 5880 InterceptorInfoPrint(stdout); |
| 5881 } |
| 5882 void InterceptorInfoPrint(FILE* out); |
| 5883 #endif |
| 5671 #ifdef DEBUG | 5884 #ifdef DEBUG |
| 5672 void InterceptorInfoPrint(); | |
| 5673 void InterceptorInfoVerify(); | 5885 void InterceptorInfoVerify(); |
| 5674 #endif | 5886 #endif |
| 5675 | 5887 |
| 5676 static const int kGetterOffset = HeapObject::kHeaderSize; | 5888 static const int kGetterOffset = HeapObject::kHeaderSize; |
| 5677 static const int kSetterOffset = kGetterOffset + kPointerSize; | 5889 static const int kSetterOffset = kGetterOffset + kPointerSize; |
| 5678 static const int kQueryOffset = kSetterOffset + kPointerSize; | 5890 static const int kQueryOffset = kSetterOffset + kPointerSize; |
| 5679 static const int kDeleterOffset = kQueryOffset + kPointerSize; | 5891 static const int kDeleterOffset = kQueryOffset + kPointerSize; |
| 5680 static const int kEnumeratorOffset = kDeleterOffset + kPointerSize; | 5892 static const int kEnumeratorOffset = kDeleterOffset + kPointerSize; |
| 5681 static const int kDataOffset = kEnumeratorOffset + kPointerSize; | 5893 static const int kDataOffset = kEnumeratorOffset + kPointerSize; |
| 5682 static const int kSize = kDataOffset + kPointerSize; | 5894 static const int kSize = kDataOffset + kPointerSize; |
| 5683 | 5895 |
| 5684 private: | 5896 private: |
| 5685 DISALLOW_IMPLICIT_CONSTRUCTORS(InterceptorInfo); | 5897 DISALLOW_IMPLICIT_CONSTRUCTORS(InterceptorInfo); |
| 5686 }; | 5898 }; |
| 5687 | 5899 |
| 5688 | 5900 |
| 5689 class CallHandlerInfo: public Struct { | 5901 class CallHandlerInfo: public Struct { |
| 5690 public: | 5902 public: |
| 5691 DECL_ACCESSORS(callback, Object) | 5903 DECL_ACCESSORS(callback, Object) |
| 5692 DECL_ACCESSORS(data, Object) | 5904 DECL_ACCESSORS(data, Object) |
| 5693 | 5905 |
| 5694 static inline CallHandlerInfo* cast(Object* obj); | 5906 static inline CallHandlerInfo* cast(Object* obj); |
| 5695 | 5907 |
| 5908 #ifdef OBJECT_PRINT |
| 5909 inline void CallHandlerInfoPrint() { |
| 5910 CallHandlerInfoPrint(stdout); |
| 5911 } |
| 5912 void CallHandlerInfoPrint(FILE* out); |
| 5913 #endif |
| 5696 #ifdef DEBUG | 5914 #ifdef DEBUG |
| 5697 void CallHandlerInfoPrint(); | |
| 5698 void CallHandlerInfoVerify(); | 5915 void CallHandlerInfoVerify(); |
| 5699 #endif | 5916 #endif |
| 5700 | 5917 |
| 5701 static const int kCallbackOffset = HeapObject::kHeaderSize; | 5918 static const int kCallbackOffset = HeapObject::kHeaderSize; |
| 5702 static const int kDataOffset = kCallbackOffset + kPointerSize; | 5919 static const int kDataOffset = kCallbackOffset + kPointerSize; |
| 5703 static const int kSize = kDataOffset + kPointerSize; | 5920 static const int kSize = kDataOffset + kPointerSize; |
| 5704 | 5921 |
| 5705 private: | 5922 private: |
| 5706 DISALLOW_IMPLICIT_CONSTRUCTORS(CallHandlerInfo); | 5923 DISALLOW_IMPLICIT_CONSTRUCTORS(CallHandlerInfo); |
| 5707 }; | 5924 }; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5743 | 5960 |
| 5744 // Following properties use flag bits. | 5961 // Following properties use flag bits. |
| 5745 DECL_BOOLEAN_ACCESSORS(hidden_prototype) | 5962 DECL_BOOLEAN_ACCESSORS(hidden_prototype) |
| 5746 DECL_BOOLEAN_ACCESSORS(undetectable) | 5963 DECL_BOOLEAN_ACCESSORS(undetectable) |
| 5747 // If the bit is set, object instances created by this function | 5964 // If the bit is set, object instances created by this function |
| 5748 // requires access check. | 5965 // requires access check. |
| 5749 DECL_BOOLEAN_ACCESSORS(needs_access_check) | 5966 DECL_BOOLEAN_ACCESSORS(needs_access_check) |
| 5750 | 5967 |
| 5751 static inline FunctionTemplateInfo* cast(Object* obj); | 5968 static inline FunctionTemplateInfo* cast(Object* obj); |
| 5752 | 5969 |
| 5970 #ifdef OBJECT_PRINT |
| 5971 inline void FunctionTemplateInfoPrint() { |
| 5972 FunctionTemplateInfoPrint(stdout); |
| 5973 } |
| 5974 void FunctionTemplateInfoPrint(FILE* out); |
| 5975 #endif |
| 5753 #ifdef DEBUG | 5976 #ifdef DEBUG |
| 5754 void FunctionTemplateInfoPrint(); | |
| 5755 void FunctionTemplateInfoVerify(); | 5977 void FunctionTemplateInfoVerify(); |
| 5756 #endif | 5978 #endif |
| 5757 | 5979 |
| 5758 static const int kSerialNumberOffset = TemplateInfo::kHeaderSize; | 5980 static const int kSerialNumberOffset = TemplateInfo::kHeaderSize; |
| 5759 static const int kCallCodeOffset = kSerialNumberOffset + kPointerSize; | 5981 static const int kCallCodeOffset = kSerialNumberOffset + kPointerSize; |
| 5760 static const int kPropertyAccessorsOffset = kCallCodeOffset + kPointerSize; | 5982 static const int kPropertyAccessorsOffset = kCallCodeOffset + kPointerSize; |
| 5761 static const int kPrototypeTemplateOffset = | 5983 static const int kPrototypeTemplateOffset = |
| 5762 kPropertyAccessorsOffset + kPointerSize; | 5984 kPropertyAccessorsOffset + kPointerSize; |
| 5763 static const int kParentTemplateOffset = | 5985 static const int kParentTemplateOffset = |
| 5764 kPrototypeTemplateOffset + kPointerSize; | 5986 kPrototypeTemplateOffset + kPointerSize; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 5786 }; | 6008 }; |
| 5787 | 6009 |
| 5788 | 6010 |
| 5789 class ObjectTemplateInfo: public TemplateInfo { | 6011 class ObjectTemplateInfo: public TemplateInfo { |
| 5790 public: | 6012 public: |
| 5791 DECL_ACCESSORS(constructor, Object) | 6013 DECL_ACCESSORS(constructor, Object) |
| 5792 DECL_ACCESSORS(internal_field_count, Object) | 6014 DECL_ACCESSORS(internal_field_count, Object) |
| 5793 | 6015 |
| 5794 static inline ObjectTemplateInfo* cast(Object* obj); | 6016 static inline ObjectTemplateInfo* cast(Object* obj); |
| 5795 | 6017 |
| 6018 #ifdef OBJECT_PRINT |
| 6019 inline void ObjectTemplateInfoPrint() { |
| 6020 ObjectTemplateInfoPrint(stdout); |
| 6021 } |
| 6022 void ObjectTemplateInfoPrint(FILE* out); |
| 6023 #endif |
| 5796 #ifdef DEBUG | 6024 #ifdef DEBUG |
| 5797 void ObjectTemplateInfoPrint(); | |
| 5798 void ObjectTemplateInfoVerify(); | 6025 void ObjectTemplateInfoVerify(); |
| 5799 #endif | 6026 #endif |
| 5800 | 6027 |
| 5801 static const int kConstructorOffset = TemplateInfo::kHeaderSize; | 6028 static const int kConstructorOffset = TemplateInfo::kHeaderSize; |
| 5802 static const int kInternalFieldCountOffset = | 6029 static const int kInternalFieldCountOffset = |
| 5803 kConstructorOffset + kPointerSize; | 6030 kConstructorOffset + kPointerSize; |
| 5804 static const int kSize = kInternalFieldCountOffset + kPointerSize; | 6031 static const int kSize = kInternalFieldCountOffset + kPointerSize; |
| 5805 }; | 6032 }; |
| 5806 | 6033 |
| 5807 | 6034 |
| 5808 class SignatureInfo: public Struct { | 6035 class SignatureInfo: public Struct { |
| 5809 public: | 6036 public: |
| 5810 DECL_ACCESSORS(receiver, Object) | 6037 DECL_ACCESSORS(receiver, Object) |
| 5811 DECL_ACCESSORS(args, Object) | 6038 DECL_ACCESSORS(args, Object) |
| 5812 | 6039 |
| 5813 static inline SignatureInfo* cast(Object* obj); | 6040 static inline SignatureInfo* cast(Object* obj); |
| 5814 | 6041 |
| 6042 #ifdef OBJECT_PRINT |
| 6043 inline void SignatureInfoPrint() { |
| 6044 SignatureInfoPrint(stdout); |
| 6045 } |
| 6046 void SignatureInfoPrint(FILE* out); |
| 6047 #endif |
| 5815 #ifdef DEBUG | 6048 #ifdef DEBUG |
| 5816 void SignatureInfoPrint(); | |
| 5817 void SignatureInfoVerify(); | 6049 void SignatureInfoVerify(); |
| 5818 #endif | 6050 #endif |
| 5819 | 6051 |
| 5820 static const int kReceiverOffset = Struct::kHeaderSize; | 6052 static const int kReceiverOffset = Struct::kHeaderSize; |
| 5821 static const int kArgsOffset = kReceiverOffset + kPointerSize; | 6053 static const int kArgsOffset = kReceiverOffset + kPointerSize; |
| 5822 static const int kSize = kArgsOffset + kPointerSize; | 6054 static const int kSize = kArgsOffset + kPointerSize; |
| 5823 | 6055 |
| 5824 private: | 6056 private: |
| 5825 DISALLOW_IMPLICIT_CONSTRUCTORS(SignatureInfo); | 6057 DISALLOW_IMPLICIT_CONSTRUCTORS(SignatureInfo); |
| 5826 }; | 6058 }; |
| 5827 | 6059 |
| 5828 | 6060 |
| 5829 class TypeSwitchInfo: public Struct { | 6061 class TypeSwitchInfo: public Struct { |
| 5830 public: | 6062 public: |
| 5831 DECL_ACCESSORS(types, Object) | 6063 DECL_ACCESSORS(types, Object) |
| 5832 | 6064 |
| 5833 static inline TypeSwitchInfo* cast(Object* obj); | 6065 static inline TypeSwitchInfo* cast(Object* obj); |
| 5834 | 6066 |
| 6067 #ifdef OBJECT_PRINT |
| 6068 inline void TypeSwitchInfoPrint() { |
| 6069 TypeSwitchInfoPrint(stdout); |
| 6070 } |
| 6071 void TypeSwitchInfoPrint(FILE* out); |
| 6072 #endif |
| 5835 #ifdef DEBUG | 6073 #ifdef DEBUG |
| 5836 void TypeSwitchInfoPrint(); | |
| 5837 void TypeSwitchInfoVerify(); | 6074 void TypeSwitchInfoVerify(); |
| 5838 #endif | 6075 #endif |
| 5839 | 6076 |
| 5840 static const int kTypesOffset = Struct::kHeaderSize; | 6077 static const int kTypesOffset = Struct::kHeaderSize; |
| 5841 static const int kSize = kTypesOffset + kPointerSize; | 6078 static const int kSize = kTypesOffset + kPointerSize; |
| 5842 }; | 6079 }; |
| 5843 | 6080 |
| 5844 | 6081 |
| 5845 #ifdef ENABLE_DEBUGGER_SUPPORT | 6082 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 5846 // The DebugInfo class holds additional information for a function being | 6083 // The DebugInfo class holds additional information for a function being |
| (...skipping 25 matching lines...) Expand all Loading... |
| 5872 // Get the break point objects for a code position. | 6109 // Get the break point objects for a code position. |
| 5873 Object* GetBreakPointObjects(int code_position); | 6110 Object* GetBreakPointObjects(int code_position); |
| 5874 // Find the break point info holding this break point object. | 6111 // Find the break point info holding this break point object. |
| 5875 static Object* FindBreakPointInfo(Handle<DebugInfo> debug_info, | 6112 static Object* FindBreakPointInfo(Handle<DebugInfo> debug_info, |
| 5876 Handle<Object> break_point_object); | 6113 Handle<Object> break_point_object); |
| 5877 // Get the number of break points for this function. | 6114 // Get the number of break points for this function. |
| 5878 int GetBreakPointCount(); | 6115 int GetBreakPointCount(); |
| 5879 | 6116 |
| 5880 static inline DebugInfo* cast(Object* obj); | 6117 static inline DebugInfo* cast(Object* obj); |
| 5881 | 6118 |
| 6119 #ifdef OBJECT_PRINT |
| 6120 inline void DebugInfoPrint() { |
| 6121 DebugInfoPrint(stdout); |
| 6122 } |
| 6123 void DebugInfoPrint(FILE* out); |
| 6124 #endif |
| 5882 #ifdef DEBUG | 6125 #ifdef DEBUG |
| 5883 void DebugInfoPrint(); | |
| 5884 void DebugInfoVerify(); | 6126 void DebugInfoVerify(); |
| 5885 #endif | 6127 #endif |
| 5886 | 6128 |
| 5887 static const int kSharedFunctionInfoIndex = Struct::kHeaderSize; | 6129 static const int kSharedFunctionInfoIndex = Struct::kHeaderSize; |
| 5888 static const int kOriginalCodeIndex = kSharedFunctionInfoIndex + kPointerSize; | 6130 static const int kOriginalCodeIndex = kSharedFunctionInfoIndex + kPointerSize; |
| 5889 static const int kPatchedCodeIndex = kOriginalCodeIndex + kPointerSize; | 6131 static const int kPatchedCodeIndex = kOriginalCodeIndex + kPointerSize; |
| 5890 static const int kActiveBreakPointsCountIndex = | 6132 static const int kActiveBreakPointsCountIndex = |
| 5891 kPatchedCodeIndex + kPointerSize; | 6133 kPatchedCodeIndex + kPointerSize; |
| 5892 static const int kBreakPointsStateIndex = | 6134 static const int kBreakPointsStateIndex = |
| 5893 kActiveBreakPointsCountIndex + kPointerSize; | 6135 kActiveBreakPointsCountIndex + kPointerSize; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5925 static void SetBreakPoint(Handle<BreakPointInfo> info, | 6167 static void SetBreakPoint(Handle<BreakPointInfo> info, |
| 5926 Handle<Object> break_point_object); | 6168 Handle<Object> break_point_object); |
| 5927 // Check if break point info has this break point object. | 6169 // Check if break point info has this break point object. |
| 5928 static bool HasBreakPointObject(Handle<BreakPointInfo> info, | 6170 static bool HasBreakPointObject(Handle<BreakPointInfo> info, |
| 5929 Handle<Object> break_point_object); | 6171 Handle<Object> break_point_object); |
| 5930 // Get the number of break points for this code position. | 6172 // Get the number of break points for this code position. |
| 5931 int GetBreakPointCount(); | 6173 int GetBreakPointCount(); |
| 5932 | 6174 |
| 5933 static inline BreakPointInfo* cast(Object* obj); | 6175 static inline BreakPointInfo* cast(Object* obj); |
| 5934 | 6176 |
| 6177 #ifdef OBJECT_PRINT |
| 6178 inline void BreakPointInfoPrint() { |
| 6179 BreakPointInfoPrint(stdout); |
| 6180 } |
| 6181 void BreakPointInfoPrint(FILE* out); |
| 6182 #endif |
| 5935 #ifdef DEBUG | 6183 #ifdef DEBUG |
| 5936 void BreakPointInfoPrint(); | |
| 5937 void BreakPointInfoVerify(); | 6184 void BreakPointInfoVerify(); |
| 5938 #endif | 6185 #endif |
| 5939 | 6186 |
| 5940 static const int kCodePositionIndex = Struct::kHeaderSize; | 6187 static const int kCodePositionIndex = Struct::kHeaderSize; |
| 5941 static const int kSourcePositionIndex = kCodePositionIndex + kPointerSize; | 6188 static const int kSourcePositionIndex = kCodePositionIndex + kPointerSize; |
| 5942 static const int kStatementPositionIndex = | 6189 static const int kStatementPositionIndex = |
| 5943 kSourcePositionIndex + kPointerSize; | 6190 kSourcePositionIndex + kPointerSize; |
| 5944 static const int kBreakPointObjectsIndex = | 6191 static const int kBreakPointObjectsIndex = |
| 5945 kStatementPositionIndex + kPointerSize; | 6192 kStatementPositionIndex + kPointerSize; |
| 5946 static const int kSize = kBreakPointObjectsIndex + kPointerSize; | 6193 static const int kSize = kBreakPointObjectsIndex + kPointerSize; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6042 } else { | 6289 } else { |
| 6043 value &= ~(1 << bit_position); | 6290 value &= ~(1 << bit_position); |
| 6044 } | 6291 } |
| 6045 return value; | 6292 return value; |
| 6046 } | 6293 } |
| 6047 }; | 6294 }; |
| 6048 | 6295 |
| 6049 } } // namespace v8::internal | 6296 } } // namespace v8::internal |
| 6050 | 6297 |
| 6051 #endif // V8_OBJECTS_H_ | 6298 #endif // V8_OBJECTS_H_ |
| OLD | NEW |