| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 | 788 |
| 789 // Returns true if this object is an instance of the specified | 789 // Returns true if this object is an instance of the specified |
| 790 // function template. | 790 // function template. |
| 791 inline bool IsInstanceOf(FunctionTemplateInfo* type); | 791 inline bool IsInstanceOf(FunctionTemplateInfo* type); |
| 792 | 792 |
| 793 inline bool IsStruct(); | 793 inline bool IsStruct(); |
| 794 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name(); | 794 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name(); |
| 795 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) | 795 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) |
| 796 #undef DECLARE_STRUCT_PREDICATE | 796 #undef DECLARE_STRUCT_PREDICATE |
| 797 | 797 |
| 798 INLINE(bool IsSpecObject()); |
| 799 |
| 798 // Oddball testing. | 800 // Oddball testing. |
| 799 INLINE(bool IsUndefined()); | 801 INLINE(bool IsUndefined()); |
| 800 INLINE(bool IsNull()); | 802 INLINE(bool IsNull()); |
| 801 INLINE(bool IsTheHole()); // Shadows MaybeObject's implementation. | 803 INLINE(bool IsTheHole()); // Shadows MaybeObject's implementation. |
| 802 INLINE(bool IsTrue()); | 804 INLINE(bool IsTrue()); |
| 803 INLINE(bool IsFalse()); | 805 INLINE(bool IsFalse()); |
| 804 inline bool IsArgumentsMarker(); | 806 inline bool IsArgumentsMarker(); |
| 805 inline bool NonFailureIsHeapObject(); | 807 inline bool NonFailureIsHeapObject(); |
| 806 | 808 |
| 807 // Filler objects (fillers and free space objects). | 809 // Filler objects (fillers and free space objects). |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 | 1250 |
| 1249 private: | 1251 private: |
| 1250 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); | 1252 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); |
| 1251 }; | 1253 }; |
| 1252 | 1254 |
| 1253 | 1255 |
| 1254 // JSReceiver includes types on which properties can be defined, i.e., | 1256 // JSReceiver includes types on which properties can be defined, i.e., |
| 1255 // JSObject and JSProxy. | 1257 // JSObject and JSProxy. |
| 1256 class JSReceiver: public HeapObject { | 1258 class JSReceiver: public HeapObject { |
| 1257 public: | 1259 public: |
| 1260 enum DeleteMode { |
| 1261 NORMAL_DELETION, |
| 1262 STRICT_DELETION, |
| 1263 FORCE_DELETION |
| 1264 }; |
| 1265 |
| 1258 // Casting. | 1266 // Casting. |
| 1259 static inline JSReceiver* cast(Object* obj); | 1267 static inline JSReceiver* cast(Object* obj); |
| 1260 | 1268 |
| 1261 // Can cause GC. | 1269 // Can cause GC. |
| 1262 MUST_USE_RESULT MaybeObject* SetProperty(String* key, | 1270 MUST_USE_RESULT MaybeObject* SetProperty(String* key, |
| 1263 Object* value, | 1271 Object* value, |
| 1264 PropertyAttributes attributes, | 1272 PropertyAttributes attributes, |
| 1265 StrictModeFlag strict_mode); | 1273 StrictModeFlag strict_mode); |
| 1266 MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result, | 1274 MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result, |
| 1267 String* key, | 1275 String* key, |
| 1268 Object* value, | 1276 Object* value, |
| 1269 PropertyAttributes attributes, | 1277 PropertyAttributes attributes, |
| 1270 StrictModeFlag strict_mode); | 1278 StrictModeFlag strict_mode); |
| 1271 | 1279 |
| 1280 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); |
| 1281 |
| 1272 // Returns the class name ([[Class]] property in the specification). | 1282 // Returns the class name ([[Class]] property in the specification). |
| 1273 String* class_name(); | 1283 String* class_name(); |
| 1274 | 1284 |
| 1275 // Returns the constructor name (the name (possibly, inferred name) of the | 1285 // Returns the constructor name (the name (possibly, inferred name) of the |
| 1276 // function that was used to instantiate the object). | 1286 // function that was used to instantiate the object). |
| 1277 String* constructor_name(); | 1287 String* constructor_name(); |
| 1278 | 1288 |
| 1279 inline PropertyAttributes GetPropertyAttribute(String* name); | 1289 inline PropertyAttributes GetPropertyAttribute(String* name); |
| 1280 PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver, | 1290 PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver, |
| 1281 String* name); | 1291 String* name); |
| 1282 PropertyAttributes GetLocalPropertyAttribute(String* name); | 1292 PropertyAttributes GetLocalPropertyAttribute(String* name); |
| 1283 | 1293 |
| 1284 // Can cause a GC. | 1294 // Can cause a GC. |
| 1285 bool HasProperty(String* name) { | 1295 inline bool HasProperty(String* name); |
| 1286 return GetPropertyAttribute(name) != ABSENT; | 1296 inline bool HasLocalProperty(String* name); |
| 1287 } | |
| 1288 | |
| 1289 // Can cause a GC. | |
| 1290 bool HasLocalProperty(String* name) { | |
| 1291 return GetLocalPropertyAttribute(name) != ABSENT; | |
| 1292 } | |
| 1293 | 1297 |
| 1294 // Return the object's prototype (might be Heap::null_value()). | 1298 // Return the object's prototype (might be Heap::null_value()). |
| 1295 inline Object* GetPrototype(); | 1299 inline Object* GetPrototype(); |
| 1296 | 1300 |
| 1297 // Set the object's prototype (only JSReceiver and null are allowed). | 1301 // Set the object's prototype (only JSReceiver and null are allowed). |
| 1298 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value, | 1302 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value, |
| 1299 bool skip_hidden_prototypes); | 1303 bool skip_hidden_prototypes); |
| 1300 | 1304 |
| 1301 // Lookup a property. If found, the result is valid and has | 1305 // Lookup a property. If found, the result is valid and has |
| 1302 // detailed information. | 1306 // detailed information. |
| 1303 void LocalLookup(String* name, LookupResult* result); | 1307 void LocalLookup(String* name, LookupResult* result); |
| 1304 void Lookup(String* name, LookupResult* result); | 1308 void Lookup(String* name, LookupResult* result); |
| 1305 | 1309 |
| 1306 private: | 1310 private: |
| 1307 PropertyAttributes GetPropertyAttribute(JSReceiver* receiver, | 1311 PropertyAttributes GetPropertyAttribute(JSReceiver* receiver, |
| 1308 LookupResult* result, | 1312 LookupResult* result, |
| 1309 String* name, | 1313 String* name, |
| 1310 bool continue_search); | 1314 bool continue_search); |
| 1311 | 1315 |
| 1312 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); | 1316 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); |
| 1313 }; | 1317 }; |
| 1314 | 1318 |
| 1315 // The JSObject describes real heap allocated JavaScript objects with | 1319 // The JSObject describes real heap allocated JavaScript objects with |
| 1316 // properties. | 1320 // properties. |
| 1317 // Note that the map of JSObject changes during execution to enable inline | 1321 // Note that the map of JSObject changes during execution to enable inline |
| 1318 // caching. | 1322 // caching. |
| 1319 class JSObject: public JSReceiver { | 1323 class JSObject: public JSReceiver { |
| 1320 public: | 1324 public: |
| 1321 enum DeleteMode { | |
| 1322 NORMAL_DELETION, | |
| 1323 STRICT_DELETION, | |
| 1324 FORCE_DELETION | |
| 1325 }; | |
| 1326 | |
| 1327 enum ElementsKind { | 1325 enum ElementsKind { |
| 1328 // The "fast" kind for tagged values. Must be first to make it possible | 1326 // The "fast" kind for tagged values. Must be first to make it possible |
| 1329 // to efficiently check maps if they have fast elements. | 1327 // to efficiently check maps if they have fast elements. |
| 1330 FAST_ELEMENTS, | 1328 FAST_ELEMENTS, |
| 1331 | 1329 |
| 1332 // The "fast" kind for unwrapped, non-tagged double values. | 1330 // The "fast" kind for unwrapped, non-tagged double values. |
| 1333 FAST_DOUBLE_ELEMENTS, | 1331 FAST_DOUBLE_ELEMENTS, |
| 1334 | 1332 |
| 1335 // The "slow" kind. | 1333 // The "slow" kind. |
| 1336 DICTIONARY_ELEMENTS, | 1334 DICTIONARY_ELEMENTS, |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 // Has/Get/SetHiddenPropertiesObject methods don't allow the holder to be | 1527 // Has/Get/SetHiddenPropertiesObject methods don't allow the holder to be |
| 1530 // a JSGlobalProxy. Use BypassGlobalProxy method above to get to the real | 1528 // a JSGlobalProxy. Use BypassGlobalProxy method above to get to the real |
| 1531 // holder. | 1529 // holder. |
| 1532 // | 1530 // |
| 1533 // These accessors do not touch interceptors or accessors. | 1531 // These accessors do not touch interceptors or accessors. |
| 1534 inline bool HasHiddenPropertiesObject(); | 1532 inline bool HasHiddenPropertiesObject(); |
| 1535 inline Object* GetHiddenPropertiesObject(); | 1533 inline Object* GetHiddenPropertiesObject(); |
| 1536 MUST_USE_RESULT inline MaybeObject* SetHiddenPropertiesObject( | 1534 MUST_USE_RESULT inline MaybeObject* SetHiddenPropertiesObject( |
| 1537 Object* hidden_obj); | 1535 Object* hidden_obj); |
| 1538 | 1536 |
| 1537 // Indicates whether the hidden properties object should be created. |
| 1538 enum HiddenPropertiesFlag { ALLOW_CREATION, OMIT_CREATION }; |
| 1539 |
| 1540 // Retrieves the hidden properties object. |
| 1541 // |
| 1542 // The undefined value might be returned in case no hidden properties object |
| 1543 // is present and creation was omitted. |
| 1544 inline bool HasHiddenProperties(); |
| 1545 MUST_USE_RESULT MaybeObject* GetHiddenProperties(HiddenPropertiesFlag flag); |
| 1546 |
| 1547 // Retrieves a permanent object identity hash code. |
| 1548 // |
| 1549 // The identity hash is stored as a hidden property. The undefined value might |
| 1550 // be returned in case no hidden properties object is present and creation was |
| 1551 // omitted. |
| 1552 MUST_USE_RESULT MaybeObject* GetIdentityHash(HiddenPropertiesFlag flag); |
| 1553 |
| 1539 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); | 1554 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); |
| 1540 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); | 1555 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); |
| 1541 | 1556 |
| 1542 // Tests for the fast common case for property enumeration. | 1557 // Tests for the fast common case for property enumeration. |
| 1543 bool IsSimpleEnum(); | 1558 bool IsSimpleEnum(); |
| 1544 | 1559 |
| 1545 // Do we want to keep the elements in fast case when increasing the | 1560 // Do we want to keep the elements in fast case when increasing the |
| 1546 // capacity? | 1561 // capacity? |
| 1547 bool ShouldConvertToSlowElements(int new_capacity); | 1562 bool ShouldConvertToSlowElements(int new_capacity); |
| 1548 // Returns true if the backing storage for the slow-case elements of | 1563 // Returns true if the backing storage for the slow-case elements of |
| 1549 // this object takes up nearly as much space as a fast-case backing | 1564 // this object takes up nearly as much space as a fast-case backing |
| 1550 // storage would. In that case the JSObject should have fast | 1565 // storage would. In that case the JSObject should have fast |
| 1551 // elements. | 1566 // elements. |
| 1552 bool ShouldConvertToFastElements(); | 1567 bool ShouldConvertToFastElements(); |
| 1553 // Returns true if the elements of JSObject contains only values that can be | 1568 // Returns true if the elements of JSObject contains only values that can be |
| 1554 // represented in a FixedDoubleArray. | 1569 // represented in a FixedDoubleArray. |
| 1555 bool ShouldConvertToFastDoubleElements(); | 1570 bool CanConvertToFastDoubleElements(); |
| 1556 | 1571 |
| 1557 // Tells whether the index'th element is present. | 1572 // Tells whether the index'th element is present. |
| 1558 inline bool HasElement(uint32_t index); | 1573 inline bool HasElement(uint32_t index); |
| 1559 bool HasElementWithReceiver(JSReceiver* receiver, uint32_t index); | 1574 bool HasElementWithReceiver(JSReceiver* receiver, uint32_t index); |
| 1560 | 1575 |
| 1561 // Computes the new capacity when expanding the elements of a JSObject. | 1576 // Computes the new capacity when expanding the elements of a JSObject. |
| 1562 static int NewElementsCapacity(int old_capacity) { | 1577 static int NewElementsCapacity(int old_capacity) { |
| 1563 // (old_capacity + 50%) + 16 | 1578 // (old_capacity + 50%) + 16 |
| 1564 return old_capacity + (old_capacity >> 1) + 16; | 1579 return old_capacity + (old_capacity >> 1) + 16; |
| 1565 } | 1580 } |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 | 1854 |
| 1840 // Maximal number of fast properties for the JSObject. Used to | 1855 // Maximal number of fast properties for the JSObject. Used to |
| 1841 // restrict the number of map transitions to avoid an explosion in | 1856 // restrict the number of map transitions to avoid an explosion in |
| 1842 // the number of maps for objects used as dictionaries. | 1857 // the number of maps for objects used as dictionaries. |
| 1843 inline int MaxFastProperties(); | 1858 inline int MaxFastProperties(); |
| 1844 | 1859 |
| 1845 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). | 1860 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). |
| 1846 // Also maximal value of JSArray's length property. | 1861 // Also maximal value of JSArray's length property. |
| 1847 static const uint32_t kMaxElementCount = 0xffffffffu; | 1862 static const uint32_t kMaxElementCount = 0xffffffffu; |
| 1848 | 1863 |
| 1864 // Constants for heuristics controlling conversion of fast elements |
| 1865 // to slow elements. |
| 1866 |
| 1867 // Maximal gap that can be introduced by adding an element beyond |
| 1868 // the current elements length. |
| 1849 static const uint32_t kMaxGap = 1024; | 1869 static const uint32_t kMaxGap = 1024; |
| 1850 static const int kMaxFastElementsLength = 5000; | 1870 |
| 1871 // Maximal length of fast elements array that won't be checked for |
| 1872 // being dense enough on expansion. |
| 1873 static const int kMaxUncheckedFastElementsLength = 5000; |
| 1874 |
| 1875 // Same as above but for old arrays. This limit is more strict. We |
| 1876 // don't want to be wasteful with long lived objects. |
| 1877 static const int kMaxUncheckedOldFastElementsLength = 500; |
| 1878 |
| 1851 static const int kInitialMaxFastElementArray = 100000; | 1879 static const int kInitialMaxFastElementArray = 100000; |
| 1852 static const int kMaxFastProperties = 12; | 1880 static const int kMaxFastProperties = 12; |
| 1853 static const int kMaxInstanceSize = 255 * kPointerSize; | 1881 static const int kMaxInstanceSize = 255 * kPointerSize; |
| 1854 // When extending the backing storage for property values, we increase | 1882 // When extending the backing storage for property values, we increase |
| 1855 // its size by more than the 1 entry necessary, so sequentially adding fields | 1883 // its size by more than the 1 entry necessary, so sequentially adding fields |
| 1856 // to the same object requires fewer allocations and copies. | 1884 // to the same object requires fewer allocations and copies. |
| 1857 static const int kFieldsAdded = 3; | 1885 static const int kFieldsAdded = 3; |
| 1858 | 1886 |
| 1859 // Layout description. | 1887 // Layout description. |
| 1860 static const int kPropertiesOffset = HeapObject::kHeaderSize; | 1888 static const int kPropertiesOffset = HeapObject::kHeaderSize; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1906 bool ReferencesObjectFromElements(FixedArray* elements, | 1934 bool ReferencesObjectFromElements(FixedArray* elements, |
| 1907 ElementsKind kind, | 1935 ElementsKind kind, |
| 1908 Object* object); | 1936 Object* object); |
| 1909 bool HasElementInElements(FixedArray* elements, | 1937 bool HasElementInElements(FixedArray* elements, |
| 1910 ElementsKind kind, | 1938 ElementsKind kind, |
| 1911 uint32_t index); | 1939 uint32_t index); |
| 1912 | 1940 |
| 1913 // Returns true if most of the elements backing storage is used. | 1941 // Returns true if most of the elements backing storage is used. |
| 1914 bool HasDenseElements(); | 1942 bool HasDenseElements(); |
| 1915 | 1943 |
| 1944 // Gets the current elements capacity and the number of used elements. |
| 1945 void GetElementsCapacityAndUsage(int* capacity, int* used); |
| 1946 |
| 1916 bool CanSetCallback(String* name); | 1947 bool CanSetCallback(String* name); |
| 1917 MUST_USE_RESULT MaybeObject* SetElementCallback( | 1948 MUST_USE_RESULT MaybeObject* SetElementCallback( |
| 1918 uint32_t index, | 1949 uint32_t index, |
| 1919 Object* structure, | 1950 Object* structure, |
| 1920 PropertyAttributes attributes); | 1951 PropertyAttributes attributes); |
| 1921 MUST_USE_RESULT MaybeObject* SetPropertyCallback( | 1952 MUST_USE_RESULT MaybeObject* SetPropertyCallback( |
| 1922 String* name, | 1953 String* name, |
| 1923 Object* structure, | 1954 Object* structure, |
| 1924 PropertyAttributes attributes); | 1955 PropertyAttributes attributes); |
| 1925 MUST_USE_RESULT MaybeObject* DefineGetterSetter( | 1956 MUST_USE_RESULT MaybeObject* DefineGetterSetter( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1941 inline void set_length(int value); | 1972 inline void set_length(int value); |
| 1942 | 1973 |
| 1943 inline static FixedArrayBase* cast(Object* object); | 1974 inline static FixedArrayBase* cast(Object* object); |
| 1944 | 1975 |
| 1945 // Layout description. | 1976 // Layout description. |
| 1946 // Length is smi tagged when it is stored. | 1977 // Length is smi tagged when it is stored. |
| 1947 static const int kLengthOffset = HeapObject::kHeaderSize; | 1978 static const int kLengthOffset = HeapObject::kHeaderSize; |
| 1948 static const int kHeaderSize = kLengthOffset + kPointerSize; | 1979 static const int kHeaderSize = kLengthOffset + kPointerSize; |
| 1949 }; | 1980 }; |
| 1950 | 1981 |
| 1982 class FixedDoubleArray; |
| 1951 | 1983 |
| 1952 // FixedArray describes fixed-sized arrays with element type Object*. | 1984 // FixedArray describes fixed-sized arrays with element type Object*. |
| 1953 class FixedArray: public FixedArrayBase { | 1985 class FixedArray: public FixedArrayBase { |
| 1954 public: | 1986 public: |
| 1955 // Setter and getter for elements. | 1987 // Setter and getter for elements. |
| 1956 inline Object* get(int index); | 1988 inline Object* get(int index); |
| 1957 // Setter that uses write barrier. | 1989 // Setter that uses write barrier. |
| 1958 inline void set(int index, Object* value); | 1990 inline void set(int index, Object* value); |
| 1959 | 1991 |
| 1960 // Setter that doesn't need write barrier). | 1992 // Setter that doesn't need write barrier). |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1983 // Copy operations. | 2015 // Copy operations. |
| 1984 MUST_USE_RESULT inline MaybeObject* Copy(); | 2016 MUST_USE_RESULT inline MaybeObject* Copy(); |
| 1985 MUST_USE_RESULT MaybeObject* CopySize(int new_length); | 2017 MUST_USE_RESULT MaybeObject* CopySize(int new_length); |
| 1986 | 2018 |
| 1987 // Add the elements of a JSArray to this FixedArray. | 2019 // Add the elements of a JSArray to this FixedArray. |
| 1988 MUST_USE_RESULT MaybeObject* AddKeysFromJSArray(JSArray* array); | 2020 MUST_USE_RESULT MaybeObject* AddKeysFromJSArray(JSArray* array); |
| 1989 | 2021 |
| 1990 // Compute the union of this and other. | 2022 // Compute the union of this and other. |
| 1991 MUST_USE_RESULT MaybeObject* UnionOfKeys(FixedArray* other); | 2023 MUST_USE_RESULT MaybeObject* UnionOfKeys(FixedArray* other); |
| 1992 | 2024 |
| 2025 // Compute the union of this and other. |
| 2026 MUST_USE_RESULT MaybeObject* UnionOfDoubleKeys( |
| 2027 FixedDoubleArray* other); |
| 2028 |
| 1993 // Copy a sub array from the receiver to dest. | 2029 // Copy a sub array from the receiver to dest. |
| 1994 void CopyTo(int pos, FixedArray* dest, int dest_pos, int len); | 2030 void CopyTo(int pos, FixedArray* dest, int dest_pos, int len); |
| 1995 | 2031 |
| 1996 // Garbage collection support. | 2032 // Garbage collection support. |
| 1997 static int SizeFor(int length) { return kHeaderSize + length * kPointerSize; } | 2033 static int SizeFor(int length) { return kHeaderSize + length * kPointerSize; } |
| 1998 | 2034 |
| 1999 // Code Generation support. | 2035 // Code Generation support. |
| 2000 static int OffsetOfElementAt(int index) { return SizeFor(index); } | 2036 static int OffsetOfElementAt(int index) { return SizeFor(index); } |
| 2001 | 2037 |
| 2002 // Casting. | 2038 // Casting. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2062 inline void set_the_hole(int index); | 2098 inline void set_the_hole(int index); |
| 2063 | 2099 |
| 2064 // Checking for the hole. | 2100 // Checking for the hole. |
| 2065 inline bool is_the_hole(int index); | 2101 inline bool is_the_hole(int index); |
| 2066 | 2102 |
| 2067 // Garbage collection support. | 2103 // Garbage collection support. |
| 2068 inline static int SizeFor(int length) { | 2104 inline static int SizeFor(int length) { |
| 2069 return kHeaderSize + length * kDoubleSize; | 2105 return kHeaderSize + length * kDoubleSize; |
| 2070 } | 2106 } |
| 2071 | 2107 |
| 2072 // The following can't be declared inline as const static | 2108 // Code Generation support. |
| 2073 // because they're 64-bit. | 2109 static int OffsetOfElementAt(int index) { return SizeFor(index); } |
| 2074 static uint64_t kCanonicalNonHoleNanLower32; | |
| 2075 static uint64_t kCanonicalNonHoleNanInt64; | |
| 2076 static uint64_t kHoleNanInt64; | |
| 2077 | 2110 |
| 2078 inline static bool is_the_hole_nan(double value) { | 2111 inline static bool is_the_hole_nan(double value); |
| 2079 return BitCast<uint64_t, double>(value) == kHoleNanInt64; | 2112 inline static double hole_nan_as_double(); |
| 2080 } | 2113 inline static double canonical_not_the_hole_nan_as_double(); |
| 2081 | |
| 2082 inline static double hole_nan_as_double() { | |
| 2083 return BitCast<double, uint64_t>(kHoleNanInt64); | |
| 2084 } | |
| 2085 | |
| 2086 inline static double canonical_not_the_hole_nan_as_double() { | |
| 2087 return BitCast<double, uint64_t>(kCanonicalNonHoleNanInt64); | |
| 2088 } | |
| 2089 | 2114 |
| 2090 // Casting. | 2115 // Casting. |
| 2091 static inline FixedDoubleArray* cast(Object* obj); | 2116 static inline FixedDoubleArray* cast(Object* obj); |
| 2092 | 2117 |
| 2093 // Maximal allowed size, in bytes, of a single FixedDoubleArray. | 2118 // Maximal allowed size, in bytes, of a single FixedDoubleArray. |
| 2094 // Prevents overflowing size computations, as well as extreme memory | 2119 // Prevents overflowing size computations, as well as extreme memory |
| 2095 // consumption. | 2120 // consumption. |
| 2096 static const int kMaxSize = 512 * MB; | 2121 static const int kMaxSize = 512 * MB; |
| 2097 // Maximally allowed length of a FixedArray. | 2122 // Maximally allowed length of a FixedArray. |
| 2098 static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize; | 2123 static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2388 void ElementsRemoved(int n) { | 2413 void ElementsRemoved(int n) { |
| 2389 SetNumberOfElements(NumberOfElements() - n); | 2414 SetNumberOfElements(NumberOfElements() - n); |
| 2390 SetNumberOfDeletedElements(NumberOfDeletedElements() + n); | 2415 SetNumberOfDeletedElements(NumberOfDeletedElements() + n); |
| 2391 } | 2416 } |
| 2392 | 2417 |
| 2393 // Returns a new HashTable object. Might return Failure. | 2418 // Returns a new HashTable object. Might return Failure. |
| 2394 MUST_USE_RESULT static MaybeObject* Allocate( | 2419 MUST_USE_RESULT static MaybeObject* Allocate( |
| 2395 int at_least_space_for, | 2420 int at_least_space_for, |
| 2396 PretenureFlag pretenure = NOT_TENURED); | 2421 PretenureFlag pretenure = NOT_TENURED); |
| 2397 | 2422 |
| 2423 // Computes the required capacity for a table holding the given |
| 2424 // number of elements. May be more than HashTable::kMaxCapacity. |
| 2425 static int ComputeCapacity(int at_least_space_for); |
| 2426 |
| 2398 // Returns the key at entry. | 2427 // Returns the key at entry. |
| 2399 Object* KeyAt(int entry) { return get(EntryToIndex(entry)); } | 2428 Object* KeyAt(int entry) { return get(EntryToIndex(entry)); } |
| 2400 | 2429 |
| 2401 // Tells whether k is a real key. Null and undefined are not allowed | 2430 // Tells whether k is a real key. Null and undefined are not allowed |
| 2402 // as keys and can be used to indicate missing or deleted elements. | 2431 // as keys and can be used to indicate missing or deleted elements. |
| 2403 bool IsKey(Object* k) { | 2432 bool IsKey(Object* k) { |
| 2404 return !k->IsNull() && !k->IsUndefined(); | 2433 return !k->IsNull() && !k->IsUndefined(); |
| 2405 } | 2434 } |
| 2406 | 2435 |
| 2407 // Garbage collection support. | 2436 // Garbage collection support. |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2810 // Remove all entries were key is a number and (from <= key && key < to). | 2839 // Remove all entries were key is a number and (from <= key && key < to). |
| 2811 void RemoveNumberEntries(uint32_t from, uint32_t to); | 2840 void RemoveNumberEntries(uint32_t from, uint32_t to); |
| 2812 | 2841 |
| 2813 // Bit masks. | 2842 // Bit masks. |
| 2814 static const int kRequiresSlowElementsMask = 1; | 2843 static const int kRequiresSlowElementsMask = 1; |
| 2815 static const int kRequiresSlowElementsTagSize = 1; | 2844 static const int kRequiresSlowElementsTagSize = 1; |
| 2816 static const uint32_t kRequiresSlowElementsLimit = (1 << 29) - 1; | 2845 static const uint32_t kRequiresSlowElementsLimit = (1 << 29) - 1; |
| 2817 }; | 2846 }; |
| 2818 | 2847 |
| 2819 | 2848 |
| 2849 class ObjectHashTableShape { |
| 2850 public: |
| 2851 static inline bool IsMatch(JSObject* key, Object* other); |
| 2852 static inline uint32_t Hash(JSObject* key); |
| 2853 static inline uint32_t HashForObject(JSObject* key, Object* object); |
| 2854 MUST_USE_RESULT static inline MaybeObject* AsObject(JSObject* key); |
| 2855 static const int kPrefixSize = 0; |
| 2856 static const int kEntrySize = 2; |
| 2857 }; |
| 2858 |
| 2859 |
| 2860 // ObjectHashTable maps keys that are JavaScript objects to object values by |
| 2861 // using the identity hash of the key for hashing purposes. |
| 2862 class ObjectHashTable: public HashTable<ObjectHashTableShape, JSObject*> { |
| 2863 public: |
| 2864 static inline ObjectHashTable* cast(Object* obj) { |
| 2865 ASSERT(obj->IsHashTable()); |
| 2866 return reinterpret_cast<ObjectHashTable*>(obj); |
| 2867 } |
| 2868 |
| 2869 // Looks up the value associated with the given key. The undefined value is |
| 2870 // returned in case the key is not present. |
| 2871 Object* Lookup(JSObject* key); |
| 2872 |
| 2873 // Adds (or overwrites) the value associated with the given key. Mapping a |
| 2874 // key to the undefined value causes removal of the whole entry. |
| 2875 MUST_USE_RESULT MaybeObject* Put(JSObject* key, Object* value); |
| 2876 |
| 2877 private: |
| 2878 void AddEntry(int entry, JSObject* key, Object* value); |
| 2879 void RemoveEntry(int entry); |
| 2880 }; |
| 2881 |
| 2882 |
| 2820 // JSFunctionResultCache caches results of some JSFunction invocation. | 2883 // JSFunctionResultCache caches results of some JSFunction invocation. |
| 2821 // It is a fixed array with fixed structure: | 2884 // It is a fixed array with fixed structure: |
| 2822 // [0]: factory function | 2885 // [0]: factory function |
| 2823 // [1]: finger index | 2886 // [1]: finger index |
| 2824 // [2]: current cache size | 2887 // [2]: current cache size |
| 2825 // [3]: dummy field. | 2888 // [3]: dummy field. |
| 2826 // The rest of array are key/value pairs. | 2889 // The rest of array are key/value pairs. |
| 2827 class JSFunctionResultCache: public FixedArray { | 2890 class JSFunctionResultCache: public FixedArray { |
| 2828 public: | 2891 public: |
| 2829 static const int kFactoryIndex = 0; | 2892 static const int kFactoryIndex = 0; |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3423 BUILTIN, | 3486 BUILTIN, |
| 3424 LOAD_IC, | 3487 LOAD_IC, |
| 3425 KEYED_LOAD_IC, | 3488 KEYED_LOAD_IC, |
| 3426 CALL_IC, | 3489 CALL_IC, |
| 3427 KEYED_CALL_IC, | 3490 KEYED_CALL_IC, |
| 3428 STORE_IC, | 3491 STORE_IC, |
| 3429 KEYED_STORE_IC, | 3492 KEYED_STORE_IC, |
| 3430 UNARY_OP_IC, | 3493 UNARY_OP_IC, |
| 3431 BINARY_OP_IC, | 3494 BINARY_OP_IC, |
| 3432 COMPARE_IC, | 3495 COMPARE_IC, |
| 3496 TO_BOOLEAN_IC, |
| 3433 // No more than 16 kinds. The value currently encoded in four bits in | 3497 // No more than 16 kinds. The value currently encoded in four bits in |
| 3434 // Flags. | 3498 // Flags. |
| 3435 | 3499 |
| 3436 // Pseudo-kinds. | 3500 // Pseudo-kinds. |
| 3437 REGEXP = BUILTIN, | 3501 REGEXP = BUILTIN, |
| 3438 FIRST_IC_KIND = LOAD_IC, | 3502 FIRST_IC_KIND = LOAD_IC, |
| 3439 LAST_IC_KIND = COMPARE_IC | 3503 LAST_IC_KIND = TO_BOOLEAN_IC |
| 3440 }; | 3504 }; |
| 3441 | 3505 |
| 3442 enum { | 3506 enum { |
| 3443 NUMBER_OF_KINDS = LAST_IC_KIND + 1 | 3507 NUMBER_OF_KINDS = LAST_IC_KIND + 1 |
| 3444 }; | 3508 }; |
| 3445 | 3509 |
| 3446 typedef int ExtraICState; | 3510 typedef int ExtraICState; |
| 3447 | 3511 |
| 3448 static const ExtraICState kNoExtraICState = 0; | 3512 static const ExtraICState kNoExtraICState = 0; |
| 3449 | 3513 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3495 inline int arguments_count(); // Only valid for call IC stubs. | 3559 inline int arguments_count(); // Only valid for call IC stubs. |
| 3496 | 3560 |
| 3497 // Testers for IC stub kinds. | 3561 // Testers for IC stub kinds. |
| 3498 inline bool is_inline_cache_stub(); | 3562 inline bool is_inline_cache_stub(); |
| 3499 inline bool is_load_stub() { return kind() == LOAD_IC; } | 3563 inline bool is_load_stub() { return kind() == LOAD_IC; } |
| 3500 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } | 3564 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } |
| 3501 inline bool is_store_stub() { return kind() == STORE_IC; } | 3565 inline bool is_store_stub() { return kind() == STORE_IC; } |
| 3502 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; } | 3566 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; } |
| 3503 inline bool is_call_stub() { return kind() == CALL_IC; } | 3567 inline bool is_call_stub() { return kind() == CALL_IC; } |
| 3504 inline bool is_keyed_call_stub() { return kind() == KEYED_CALL_IC; } | 3568 inline bool is_keyed_call_stub() { return kind() == KEYED_CALL_IC; } |
| 3505 inline bool is_unary_op_stub() { | 3569 inline bool is_unary_op_stub() { return kind() == UNARY_OP_IC; } |
| 3506 return kind() == UNARY_OP_IC; | 3570 inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; } |
| 3507 } | |
| 3508 inline bool is_binary_op_stub() { | |
| 3509 return kind() == BINARY_OP_IC; | |
| 3510 } | |
| 3511 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; } | 3571 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; } |
| 3572 inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; } |
| 3512 | 3573 |
| 3513 // [major_key]: For kind STUB or BINARY_OP_IC, the major key. | 3574 // [major_key]: For kind STUB or BINARY_OP_IC, the major key. |
| 3514 inline int major_key(); | 3575 inline int major_key(); |
| 3515 inline void set_major_key(int value); | 3576 inline void set_major_key(int value); |
| 3516 | 3577 |
| 3517 // [optimizable]: For FUNCTION kind, tells if it is optimizable. | 3578 // [optimizable]: For FUNCTION kind, tells if it is optimizable. |
| 3518 inline bool optimizable(); | 3579 inline bool optimizable(); |
| 3519 inline void set_optimizable(bool value); | 3580 inline void set_optimizable(bool value); |
| 3520 | 3581 |
| 3521 // [has_deoptimization_support]: For FUNCTION kind, tells if it has | 3582 // [has_deoptimization_support]: For FUNCTION kind, tells if it has |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3543 // [stack_check_table_start]: For kind FUNCTION, the offset in the | 3604 // [stack_check_table_start]: For kind FUNCTION, the offset in the |
| 3544 // instruction stream where the stack check table starts. | 3605 // instruction stream where the stack check table starts. |
| 3545 inline unsigned stack_check_table_offset(); | 3606 inline unsigned stack_check_table_offset(); |
| 3546 inline void set_stack_check_table_offset(unsigned offset); | 3607 inline void set_stack_check_table_offset(unsigned offset); |
| 3547 | 3608 |
| 3548 // [check type]: For kind CALL_IC, tells how to check if the | 3609 // [check type]: For kind CALL_IC, tells how to check if the |
| 3549 // receiver is valid for the given call. | 3610 // receiver is valid for the given call. |
| 3550 inline CheckType check_type(); | 3611 inline CheckType check_type(); |
| 3551 inline void set_check_type(CheckType value); | 3612 inline void set_check_type(CheckType value); |
| 3552 | 3613 |
| 3553 // [type-recording unary op type]: For all UNARY_OP_IC. | 3614 // [type-recording unary op type]: For kind UNARY_OP_IC. |
| 3554 inline byte unary_op_type(); | 3615 inline byte unary_op_type(); |
| 3555 inline void set_unary_op_type(byte value); | 3616 inline void set_unary_op_type(byte value); |
| 3556 | 3617 |
| 3557 // [type-recording binary op type]: For all TYPE_RECORDING_BINARY_OP_IC. | 3618 // [type-recording binary op type]: For kind BINARY_OP_IC. |
| 3558 inline byte binary_op_type(); | 3619 inline byte binary_op_type(); |
| 3559 inline void set_binary_op_type(byte value); | 3620 inline void set_binary_op_type(byte value); |
| 3560 inline byte binary_op_result_type(); | 3621 inline byte binary_op_result_type(); |
| 3561 inline void set_binary_op_result_type(byte value); | 3622 inline void set_binary_op_result_type(byte value); |
| 3562 | 3623 |
| 3563 // [compare state]: For kind compare IC stubs, tells what state the | 3624 // [compare state]: For kind COMPARE_IC, tells what state the stub is in. |
| 3564 // stub is in. | |
| 3565 inline byte compare_state(); | 3625 inline byte compare_state(); |
| 3566 inline void set_compare_state(byte value); | 3626 inline void set_compare_state(byte value); |
| 3567 | 3627 |
| 3628 // [to_boolean_foo]: For kind TO_BOOLEAN_IC tells what state the stub is in. |
| 3629 inline byte to_boolean_state(); |
| 3630 inline void set_to_boolean_state(byte value); |
| 3631 |
| 3568 // Get the safepoint entry for the given pc. | 3632 // Get the safepoint entry for the given pc. |
| 3569 SafepointEntry GetSafepointEntry(Address pc); | 3633 SafepointEntry GetSafepointEntry(Address pc); |
| 3570 | 3634 |
| 3571 // Mark this code object as not having a stack check table. Assumes kind | 3635 // Mark this code object as not having a stack check table. Assumes kind |
| 3572 // is FUNCTION. | 3636 // is FUNCTION. |
| 3573 void SetNoStackCheckTable(); | 3637 void SetNoStackCheckTable(); |
| 3574 | 3638 |
| 3575 // Find the first map in an IC stub. | 3639 // Find the first map in an IC stub. |
| 3576 Map* FindFirstMap(); | 3640 Map* FindFirstMap(); |
| 3577 | 3641 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3695 // the Code object header. | 3759 // the Code object header. |
| 3696 static const int kHeaderSize = | 3760 static const int kHeaderSize = |
| 3697 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; | 3761 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; |
| 3698 | 3762 |
| 3699 // Byte offsets within kKindSpecificFlagsOffset. | 3763 // Byte offsets within kKindSpecificFlagsOffset. |
| 3700 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset; | 3764 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset; |
| 3701 static const int kOptimizableOffset = kKindSpecificFlagsOffset; | 3765 static const int kOptimizableOffset = kKindSpecificFlagsOffset; |
| 3702 static const int kStackSlotsOffset = kKindSpecificFlagsOffset; | 3766 static const int kStackSlotsOffset = kKindSpecificFlagsOffset; |
| 3703 static const int kCheckTypeOffset = kKindSpecificFlagsOffset; | 3767 static const int kCheckTypeOffset = kKindSpecificFlagsOffset; |
| 3704 | 3768 |
| 3705 static const int kCompareStateOffset = kStubMajorKeyOffset + 1; | |
| 3706 static const int kUnaryOpTypeOffset = kStubMajorKeyOffset + 1; | 3769 static const int kUnaryOpTypeOffset = kStubMajorKeyOffset + 1; |
| 3707 static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1; | 3770 static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1; |
| 3771 static const int kCompareStateOffset = kStubMajorKeyOffset + 1; |
| 3772 static const int kToBooleanTypeOffset = kStubMajorKeyOffset + 1; |
| 3708 static const int kHasDeoptimizationSupportOffset = kOptimizableOffset + 1; | 3773 static const int kHasDeoptimizationSupportOffset = kOptimizableOffset + 1; |
| 3709 | 3774 |
| 3710 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1; | 3775 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1; |
| 3711 static const int kAllowOSRAtLoopNestingLevelOffset = | 3776 static const int kAllowOSRAtLoopNestingLevelOffset = |
| 3712 kHasDeoptimizationSupportOffset + 1; | 3777 kHasDeoptimizationSupportOffset + 1; |
| 3713 | 3778 |
| 3714 static const int kSafepointTableOffsetOffset = kStackSlotsOffset + kIntSize; | 3779 static const int kSafepointTableOffsetOffset = kStackSlotsOffset + kIntSize; |
| 3715 static const int kStackCheckTableOffsetOffset = kStackSlotsOffset + kIntSize; | 3780 static const int kStackCheckTableOffsetOffset = kStackSlotsOffset + kIntSize; |
| 3716 | 3781 |
| 3717 // Flags layout. | 3782 // Flags layout. |
| (...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5783 // For use during stack traces. Performs rudimentary sanity check. | 5848 // For use during stack traces. Performs rudimentary sanity check. |
| 5784 bool LooksValid(); | 5849 bool LooksValid(); |
| 5785 | 5850 |
| 5786 // Dispatched behavior. | 5851 // Dispatched behavior. |
| 5787 void StringShortPrint(StringStream* accumulator); | 5852 void StringShortPrint(StringStream* accumulator); |
| 5788 #ifdef OBJECT_PRINT | 5853 #ifdef OBJECT_PRINT |
| 5789 inline void StringPrint() { | 5854 inline void StringPrint() { |
| 5790 StringPrint(stdout); | 5855 StringPrint(stdout); |
| 5791 } | 5856 } |
| 5792 void StringPrint(FILE* out); | 5857 void StringPrint(FILE* out); |
| 5858 |
| 5859 char* ToAsciiArray(); |
| 5793 #endif | 5860 #endif |
| 5794 #ifdef DEBUG | 5861 #ifdef DEBUG |
| 5795 void StringVerify(); | 5862 void StringVerify(); |
| 5796 #endif | 5863 #endif |
| 5797 inline bool IsFlat(); | 5864 inline bool IsFlat(); |
| 5798 | 5865 |
| 5799 // Layout description. | 5866 // Layout description. |
| 5800 static const int kLengthOffset = HeapObject::kHeaderSize; | 5867 static const int kLengthOffset = HeapObject::kHeaderSize; |
| 5801 static const int kHashFieldOffset = kLengthOffset + kPointerSize; | 5868 static const int kHashFieldOffset = kLengthOffset + kPointerSize; |
| 5802 static const int kSize = kHashFieldOffset + kPointerSize; | 5869 static const int kSize = kHashFieldOffset + kPointerSize; |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6404 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); | 6471 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); |
| 6405 }; | 6472 }; |
| 6406 | 6473 |
| 6407 | 6474 |
| 6408 // The JSProxy describes EcmaScript Harmony proxies | 6475 // The JSProxy describes EcmaScript Harmony proxies |
| 6409 class JSProxy: public JSReceiver { | 6476 class JSProxy: public JSReceiver { |
| 6410 public: | 6477 public: |
| 6411 // [handler]: The handler property. | 6478 // [handler]: The handler property. |
| 6412 DECL_ACCESSORS(handler, Object) | 6479 DECL_ACCESSORS(handler, Object) |
| 6413 | 6480 |
| 6481 // [padding]: The padding slot (unused, see below). |
| 6482 DECL_ACCESSORS(padding, Object) |
| 6483 |
| 6414 // Casting. | 6484 // Casting. |
| 6415 static inline JSProxy* cast(Object* obj); | 6485 static inline JSProxy* cast(Object* obj); |
| 6416 | 6486 |
| 6487 bool HasPropertyWithHandler(String* name); |
| 6488 |
| 6417 MUST_USE_RESULT MaybeObject* SetPropertyWithHandler( | 6489 MUST_USE_RESULT MaybeObject* SetPropertyWithHandler( |
| 6418 String* name_raw, | 6490 String* name, |
| 6419 Object* value_raw, | 6491 Object* value, |
| 6420 PropertyAttributes attributes, | 6492 PropertyAttributes attributes, |
| 6421 StrictModeFlag strict_mode); | 6493 StrictModeFlag strict_mode); |
| 6422 | 6494 |
| 6495 MUST_USE_RESULT MaybeObject* DeletePropertyWithHandler( |
| 6496 String* name, |
| 6497 DeleteMode mode); |
| 6498 |
| 6423 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( | 6499 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( |
| 6424 JSReceiver* receiver, | 6500 JSReceiver* receiver, |
| 6425 String* name_raw, | 6501 String* name, |
| 6426 bool* has_exception); | 6502 bool* has_exception); |
| 6427 | 6503 |
| 6504 // Turn this into an (empty) JSObject. |
| 6505 void Fix(); |
| 6506 |
| 6428 // Dispatched behavior. | 6507 // Dispatched behavior. |
| 6429 #ifdef OBJECT_PRINT | 6508 #ifdef OBJECT_PRINT |
| 6430 inline void JSProxyPrint() { | 6509 inline void JSProxyPrint() { |
| 6431 JSProxyPrint(stdout); | 6510 JSProxyPrint(stdout); |
| 6432 } | 6511 } |
| 6433 void JSProxyPrint(FILE* out); | 6512 void JSProxyPrint(FILE* out); |
| 6434 #endif | 6513 #endif |
| 6435 #ifdef DEBUG | 6514 #ifdef DEBUG |
| 6436 void JSProxyVerify(); | 6515 void JSProxyVerify(); |
| 6437 #endif | 6516 #endif |
| 6438 | 6517 |
| 6439 // Layout description. | 6518 // Layout description. We add padding so that a proxy has the same |
| 6519 // size as a virgin JSObject. This is essential for becoming a JSObject |
| 6520 // upon freeze. |
| 6440 static const int kHandlerOffset = HeapObject::kHeaderSize; | 6521 static const int kHandlerOffset = HeapObject::kHeaderSize; |
| 6441 static const int kSize = kHandlerOffset + kPointerSize; | 6522 static const int kPaddingOffset = kHandlerOffset + kPointerSize; |
| 6523 static const int kSize = kPaddingOffset + kPointerSize; |
| 6524 |
| 6525 STATIC_CHECK(kSize == JSObject::kHeaderSize); |
| 6442 | 6526 |
| 6443 typedef FixedBodyDescriptor<kHandlerOffset, | 6527 typedef FixedBodyDescriptor<kHandlerOffset, |
| 6444 kHandlerOffset + kPointerSize, | 6528 kHandlerOffset + kPointerSize, |
| 6445 kSize> BodyDescriptor; | 6529 kSize> BodyDescriptor; |
| 6446 | 6530 |
| 6447 private: | 6531 private: |
| 6448 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); | 6532 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); |
| 6449 }; | 6533 }; |
| 6450 | 6534 |
| 6451 | 6535 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6752 DECL_ACCESSORS(prototype_template, Object) | 6836 DECL_ACCESSORS(prototype_template, Object) |
| 6753 DECL_ACCESSORS(parent_template, Object) | 6837 DECL_ACCESSORS(parent_template, Object) |
| 6754 DECL_ACCESSORS(named_property_handler, Object) | 6838 DECL_ACCESSORS(named_property_handler, Object) |
| 6755 DECL_ACCESSORS(indexed_property_handler, Object) | 6839 DECL_ACCESSORS(indexed_property_handler, Object) |
| 6756 DECL_ACCESSORS(instance_template, Object) | 6840 DECL_ACCESSORS(instance_template, Object) |
| 6757 DECL_ACCESSORS(class_name, Object) | 6841 DECL_ACCESSORS(class_name, Object) |
| 6758 DECL_ACCESSORS(signature, Object) | 6842 DECL_ACCESSORS(signature, Object) |
| 6759 DECL_ACCESSORS(instance_call_handler, Object) | 6843 DECL_ACCESSORS(instance_call_handler, Object) |
| 6760 DECL_ACCESSORS(access_check_info, Object) | 6844 DECL_ACCESSORS(access_check_info, Object) |
| 6761 DECL_ACCESSORS(flag, Smi) | 6845 DECL_ACCESSORS(flag, Smi) |
| 6762 DECL_ACCESSORS(prototype_attributes, Smi) | |
| 6763 | 6846 |
| 6764 // Following properties use flag bits. | 6847 // Following properties use flag bits. |
| 6765 DECL_BOOLEAN_ACCESSORS(hidden_prototype) | 6848 DECL_BOOLEAN_ACCESSORS(hidden_prototype) |
| 6766 DECL_BOOLEAN_ACCESSORS(undetectable) | 6849 DECL_BOOLEAN_ACCESSORS(undetectable) |
| 6767 // If the bit is set, object instances created by this function | 6850 // If the bit is set, object instances created by this function |
| 6768 // requires access check. | 6851 // requires access check. |
| 6769 DECL_BOOLEAN_ACCESSORS(needs_access_check) | 6852 DECL_BOOLEAN_ACCESSORS(needs_access_check) |
| 6853 DECL_BOOLEAN_ACCESSORS(read_only_prototype) |
| 6770 | 6854 |
| 6771 static inline FunctionTemplateInfo* cast(Object* obj); | 6855 static inline FunctionTemplateInfo* cast(Object* obj); |
| 6772 | 6856 |
| 6773 #ifdef OBJECT_PRINT | 6857 #ifdef OBJECT_PRINT |
| 6774 inline void FunctionTemplateInfoPrint() { | 6858 inline void FunctionTemplateInfoPrint() { |
| 6775 FunctionTemplateInfoPrint(stdout); | 6859 FunctionTemplateInfoPrint(stdout); |
| 6776 } | 6860 } |
| 6777 void FunctionTemplateInfoPrint(FILE* out); | 6861 void FunctionTemplateInfoPrint(FILE* out); |
| 6778 #endif | 6862 #endif |
| 6779 #ifdef DEBUG | 6863 #ifdef DEBUG |
| (...skipping 12 matching lines...) Expand all Loading... |
| 6792 static const int kIndexedPropertyHandlerOffset = | 6876 static const int kIndexedPropertyHandlerOffset = |
| 6793 kNamedPropertyHandlerOffset + kPointerSize; | 6877 kNamedPropertyHandlerOffset + kPointerSize; |
| 6794 static const int kInstanceTemplateOffset = | 6878 static const int kInstanceTemplateOffset = |
| 6795 kIndexedPropertyHandlerOffset + kPointerSize; | 6879 kIndexedPropertyHandlerOffset + kPointerSize; |
| 6796 static const int kClassNameOffset = kInstanceTemplateOffset + kPointerSize; | 6880 static const int kClassNameOffset = kInstanceTemplateOffset + kPointerSize; |
| 6797 static const int kSignatureOffset = kClassNameOffset + kPointerSize; | 6881 static const int kSignatureOffset = kClassNameOffset + kPointerSize; |
| 6798 static const int kInstanceCallHandlerOffset = kSignatureOffset + kPointerSize; | 6882 static const int kInstanceCallHandlerOffset = kSignatureOffset + kPointerSize; |
| 6799 static const int kAccessCheckInfoOffset = | 6883 static const int kAccessCheckInfoOffset = |
| 6800 kInstanceCallHandlerOffset + kPointerSize; | 6884 kInstanceCallHandlerOffset + kPointerSize; |
| 6801 static const int kFlagOffset = kAccessCheckInfoOffset + kPointerSize; | 6885 static const int kFlagOffset = kAccessCheckInfoOffset + kPointerSize; |
| 6802 static const int kPrototypeAttributesOffset = kFlagOffset + kPointerSize; | 6886 static const int kSize = kFlagOffset + kPointerSize; |
| 6803 static const int kSize = kPrototypeAttributesOffset + kPointerSize; | |
| 6804 | 6887 |
| 6805 private: | 6888 private: |
| 6806 // Bit position in the flag, from least significant bit position. | 6889 // Bit position in the flag, from least significant bit position. |
| 6807 static const int kHiddenPrototypeBit = 0; | 6890 static const int kHiddenPrototypeBit = 0; |
| 6808 static const int kUndetectableBit = 1; | 6891 static const int kUndetectableBit = 1; |
| 6809 static const int kNeedsAccessCheckBit = 2; | 6892 static const int kNeedsAccessCheckBit = 2; |
| 6893 static const int kReadOnlyPrototypeBit = 3; |
| 6810 | 6894 |
| 6811 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo); | 6895 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo); |
| 6812 }; | 6896 }; |
| 6813 | 6897 |
| 6814 | 6898 |
| 6815 class ObjectTemplateInfo: public TemplateInfo { | 6899 class ObjectTemplateInfo: public TemplateInfo { |
| 6816 public: | 6900 public: |
| 6817 DECL_ACCESSORS(constructor, Object) | 6901 DECL_ACCESSORS(constructor, Object) |
| 6818 DECL_ACCESSORS(internal_field_count, Object) | 6902 DECL_ACCESSORS(internal_field_count, Object) |
| 6819 | 6903 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7096 } else { | 7180 } else { |
| 7097 value &= ~(1 << bit_position); | 7181 value &= ~(1 << bit_position); |
| 7098 } | 7182 } |
| 7099 return value; | 7183 return value; |
| 7100 } | 7184 } |
| 7101 }; | 7185 }; |
| 7102 | 7186 |
| 7103 } } // namespace v8::internal | 7187 } } // namespace v8::internal |
| 7104 | 7188 |
| 7105 #endif // V8_OBJECTS_H_ | 7189 #endif // V8_OBJECTS_H_ |
| OLD | NEW |