OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 inline NumberDictionary* element_dictionary(); // Gets slow elements. | 1268 inline NumberDictionary* element_dictionary(); // Gets slow elements. |
1269 // Requires: this->HasFastElements(). | 1269 // Requires: this->HasFastElements(). |
1270 inline Object* EnsureWritableFastElements(); | 1270 inline Object* EnsureWritableFastElements(); |
1271 | 1271 |
1272 // Collects elements starting at index 0. | 1272 // Collects elements starting at index 0. |
1273 // Undefined values are placed after non-undefined values. | 1273 // Undefined values are placed after non-undefined values. |
1274 // Returns the number of non-undefined values. | 1274 // Returns the number of non-undefined values. |
1275 Object* PrepareElementsForSort(uint32_t limit); | 1275 Object* PrepareElementsForSort(uint32_t limit); |
1276 // As PrepareElementsForSort, but only on objects where elements is | 1276 // As PrepareElementsForSort, but only on objects where elements is |
1277 // a dictionary, and it will stay a dictionary. | 1277 // a dictionary, and it will stay a dictionary. |
1278 Object* PrepareSlowElementsForSort(uint32_t limit); | 1278 NOIGNORE Object* PrepareSlowElementsForSort(uint32_t limit); |
1279 | 1279 |
1280 Object* SetProperty(String* key, | 1280 Object* SetProperty(String* key, |
1281 Object* value, | 1281 Object* value, |
1282 PropertyAttributes attributes); | 1282 PropertyAttributes attributes); |
1283 Object* SetProperty(LookupResult* result, | 1283 Object* SetProperty(LookupResult* result, |
1284 String* key, | 1284 String* key, |
1285 Object* value, | 1285 Object* value, |
1286 PropertyAttributes attributes); | 1286 PropertyAttributes attributes); |
1287 Object* SetPropertyWithFailedAccessCheck(LookupResult* result, | 1287 Object* SetPropertyWithFailedAccessCheck(LookupResult* result, |
1288 String* name, | 1288 String* name, |
(...skipping 17 matching lines...) Expand all Loading... |
1306 // Retrieve a value in a normalized object given a lookup result. | 1306 // Retrieve a value in a normalized object given a lookup result. |
1307 // Handles the special representation of JS global objects. | 1307 // Handles the special representation of JS global objects. |
1308 Object* GetNormalizedProperty(LookupResult* result); | 1308 Object* GetNormalizedProperty(LookupResult* result); |
1309 | 1309 |
1310 // Sets the property value in a normalized object given a lookup result. | 1310 // Sets the property value in a normalized object given a lookup result. |
1311 // Handles the special representation of JS global objects. | 1311 // Handles the special representation of JS global objects. |
1312 Object* SetNormalizedProperty(LookupResult* result, Object* value); | 1312 Object* SetNormalizedProperty(LookupResult* result, Object* value); |
1313 | 1313 |
1314 // Sets the property value in a normalized object given (key, value, details). | 1314 // Sets the property value in a normalized object given (key, value, details). |
1315 // Handles the special representation of JS global objects. | 1315 // Handles the special representation of JS global objects. |
1316 Object* SetNormalizedProperty(String* name, | 1316 NOIGNORE Object* SetNormalizedProperty(String* name, |
1317 Object* value, | 1317 Object* value, |
1318 PropertyDetails details); | 1318 PropertyDetails details); |
1319 | 1319 |
1320 // Deletes the named property in a normalized object. | 1320 // Deletes the named property in a normalized object. |
1321 Object* DeleteNormalizedProperty(String* name, DeleteMode mode); | 1321 NOIGNORE Object* DeleteNormalizedProperty(String* name, DeleteMode mode); |
1322 | 1322 |
1323 // Returns the class name ([[Class]] property in the specification). | 1323 // Returns the class name ([[Class]] property in the specification). |
1324 String* class_name(); | 1324 String* class_name(); |
1325 | 1325 |
1326 // Returns the constructor name (the name (possibly, inferred name) of the | 1326 // Returns the constructor name (the name (possibly, inferred name) of the |
1327 // function that was used to instantiate the object). | 1327 // function that was used to instantiate the object). |
1328 String* constructor_name(); | 1328 String* constructor_name(); |
1329 | 1329 |
1330 // Retrieve interceptors. | 1330 // Retrieve interceptors. |
1331 InterceptorInfo* GetNamedInterceptor(); | 1331 InterceptorInfo* GetNamedInterceptor(); |
1332 InterceptorInfo* GetIndexedInterceptor(); | 1332 InterceptorInfo* GetIndexedInterceptor(); |
1333 | 1333 |
1334 inline PropertyAttributes GetPropertyAttribute(String* name); | 1334 inline PropertyAttributes GetPropertyAttribute(String* name); |
1335 PropertyAttributes GetPropertyAttributeWithReceiver(JSObject* receiver, | 1335 PropertyAttributes GetPropertyAttributeWithReceiver(JSObject* receiver, |
1336 String* name); | 1336 String* name); |
1337 PropertyAttributes GetLocalPropertyAttribute(String* name); | 1337 PropertyAttributes GetLocalPropertyAttribute(String* name); |
1338 | 1338 |
1339 Object* DefineAccessor(String* name, bool is_getter, JSFunction* fun, | 1339 NOIGNORE Object* DefineAccessor(String* name, |
1340 PropertyAttributes attributes); | 1340 bool is_getter, |
| 1341 JSFunction* fun, |
| 1342 PropertyAttributes attributes); |
1341 Object* LookupAccessor(String* name, bool is_getter); | 1343 Object* LookupAccessor(String* name, bool is_getter); |
1342 | 1344 |
1343 Object* DefineAccessor(AccessorInfo* info); | 1345 NOIGNORE Object* DefineAccessor(AccessorInfo* info); |
1344 | 1346 |
1345 // Used from Object::GetProperty(). | 1347 // Used from Object::GetProperty(). |
1346 Object* GetPropertyWithFailedAccessCheck(Object* receiver, | 1348 Object* GetPropertyWithFailedAccessCheck(Object* receiver, |
1347 LookupResult* result, | 1349 LookupResult* result, |
1348 String* name, | 1350 String* name, |
1349 PropertyAttributes* attributes); | 1351 PropertyAttributes* attributes); |
1350 Object* GetPropertyWithInterceptor(JSObject* receiver, | 1352 Object* GetPropertyWithInterceptor(JSObject* receiver, |
1351 String* name, | 1353 String* name, |
1352 PropertyAttributes* attributes); | 1354 PropertyAttributes* attributes); |
1353 Object* GetPropertyPostInterceptor(JSObject* receiver, | 1355 Object* GetPropertyPostInterceptor(JSObject* receiver, |
(...skipping 30 matching lines...) Expand all Loading... |
1384 // | 1386 // |
1385 // Has/Get/SetHiddenPropertiesObject methods don't allow the holder to be | 1387 // Has/Get/SetHiddenPropertiesObject methods don't allow the holder to be |
1386 // a JSGlobalProxy. Use BypassGlobalProxy method above to get to the real | 1388 // a JSGlobalProxy. Use BypassGlobalProxy method above to get to the real |
1387 // holder. | 1389 // holder. |
1388 // | 1390 // |
1389 // These accessors do not touch interceptors or accessors. | 1391 // These accessors do not touch interceptors or accessors. |
1390 inline bool HasHiddenPropertiesObject(); | 1392 inline bool HasHiddenPropertiesObject(); |
1391 inline Object* GetHiddenPropertiesObject(); | 1393 inline Object* GetHiddenPropertiesObject(); |
1392 inline Object* SetHiddenPropertiesObject(Object* hidden_obj); | 1394 inline Object* SetHiddenPropertiesObject(Object* hidden_obj); |
1393 | 1395 |
1394 Object* DeleteProperty(String* name, DeleteMode mode); | 1396 NOIGNORE Object* DeleteProperty(String* name, DeleteMode mode); |
1395 Object* DeleteElement(uint32_t index, DeleteMode mode); | 1397 NOIGNORE Object* DeleteElement(uint32_t index, DeleteMode mode); |
1396 | 1398 |
1397 // Tests for the fast common case for property enumeration. | 1399 // Tests for the fast common case for property enumeration. |
1398 bool IsSimpleEnum(); | 1400 bool IsSimpleEnum(); |
1399 | 1401 |
1400 // Do we want to keep the elements in fast case when increasing the | 1402 // Do we want to keep the elements in fast case when increasing the |
1401 // capacity? | 1403 // capacity? |
1402 bool ShouldConvertToSlowElements(int new_capacity); | 1404 bool ShouldConvertToSlowElements(int new_capacity); |
1403 // Returns true if the backing storage for the slow-case elements of | 1405 // Returns true if the backing storage for the slow-case elements of |
1404 // this object takes up nearly as much space as a fast-case backing | 1406 // this object takes up nearly as much space as a fast-case backing |
1405 // storage would. In that case the JSObject should have fast | 1407 // storage would. In that case the JSObject should have fast |
1406 // elements. | 1408 // elements. |
1407 bool ShouldConvertToFastElements(); | 1409 bool ShouldConvertToFastElements(); |
1408 | 1410 |
1409 // Return the object's prototype (might be Heap::null_value()). | 1411 // Return the object's prototype (might be Heap::null_value()). |
1410 inline Object* GetPrototype(); | 1412 inline Object* GetPrototype(); |
1411 | 1413 |
1412 // Set the object's prototype (only JSObject and null are allowed). | 1414 // Set the object's prototype (only JSObject and null are allowed). |
1413 Object* SetPrototype(Object* value, bool skip_hidden_prototypes); | 1415 Object* SetPrototype(Object* value, bool skip_hidden_prototypes); |
1414 | 1416 |
1415 // Tells whether the index'th element is present. | 1417 // Tells whether the index'th element is present. |
1416 inline bool HasElement(uint32_t index); | 1418 inline bool HasElement(uint32_t index); |
1417 bool HasElementWithReceiver(JSObject* receiver, uint32_t index); | 1419 bool HasElementWithReceiver(JSObject* receiver, uint32_t index); |
1418 bool HasLocalElement(uint32_t index); | 1420 bool HasLocalElement(uint32_t index); |
1419 | 1421 |
1420 bool HasElementWithInterceptor(JSObject* receiver, uint32_t index); | 1422 bool HasElementWithInterceptor(JSObject* receiver, uint32_t index); |
1421 bool HasElementPostInterceptor(JSObject* receiver, uint32_t index); | 1423 bool HasElementPostInterceptor(JSObject* receiver, uint32_t index); |
1422 | 1424 |
1423 Object* SetFastElement(uint32_t index, Object* value); | 1425 NOIGNORE Object* SetFastElement(uint32_t index, Object* value); |
1424 | 1426 |
1425 // Set the index'th array element. | 1427 // Set the index'th array element. |
1426 // A Failure object is returned if GC is needed. | 1428 // A Failure object is returned if GC is needed. |
1427 Object* SetElement(uint32_t index, Object* value); | 1429 NOIGNORE Object* SetElement(uint32_t index, Object* value); |
1428 | 1430 |
1429 // Returns the index'th element. | 1431 // Returns the index'th element. |
1430 // The undefined object if index is out of bounds. | 1432 // The undefined object if index is out of bounds. |
1431 Object* GetElementWithReceiver(JSObject* receiver, uint32_t index); | 1433 Object* GetElementWithReceiver(JSObject* receiver, uint32_t index); |
1432 Object* GetElementWithInterceptor(JSObject* receiver, uint32_t index); | 1434 Object* GetElementWithInterceptor(JSObject* receiver, uint32_t index); |
1433 | 1435 |
1434 Object* SetFastElementsCapacityAndLength(int capacity, int length); | 1436 NOIGNORE Object* SetFastElementsCapacityAndLength(int capacity, int length); |
1435 Object* SetSlowElements(Object* length); | 1437 NOIGNORE Object* SetSlowElements(Object* length); |
1436 | 1438 |
1437 // Lookup interceptors are used for handling properties controlled by host | 1439 // Lookup interceptors are used for handling properties controlled by host |
1438 // objects. | 1440 // objects. |
1439 inline bool HasNamedInterceptor(); | 1441 inline bool HasNamedInterceptor(); |
1440 inline bool HasIndexedInterceptor(); | 1442 inline bool HasIndexedInterceptor(); |
1441 | 1443 |
1442 // Support functions for v8 api (needed for correct interceptor behavior). | 1444 // Support functions for v8 api (needed for correct interceptor behavior). |
1443 bool HasRealNamedProperty(String* key); | 1445 bool HasRealNamedProperty(String* key); |
1444 bool HasRealElementProperty(uint32_t index); | 1446 bool HasRealElementProperty(uint32_t index); |
1445 bool HasRealNamedCallbackProperty(String* key); | 1447 bool HasRealNamedCallbackProperty(String* key); |
1446 | 1448 |
1447 // Initializes the array to a certain length | 1449 // Initializes the array to a certain length |
1448 Object* SetElementsLength(Object* length); | 1450 NOIGNORE Object* SetElementsLength(Object* length); |
1449 | 1451 |
1450 // Get the header size for a JSObject. Used to compute the index of | 1452 // Get the header size for a JSObject. Used to compute the index of |
1451 // internal fields as well as the number of internal fields. | 1453 // internal fields as well as the number of internal fields. |
1452 inline int GetHeaderSize(); | 1454 inline int GetHeaderSize(); |
1453 | 1455 |
1454 inline int GetInternalFieldCount(); | 1456 inline int GetInternalFieldCount(); |
1455 inline Object* GetInternalField(int index); | 1457 inline Object* GetInternalField(int index); |
1456 inline void SetInternalField(int index, Object* value); | 1458 inline void SetInternalField(int index, Object* value); |
1457 | 1459 |
1458 // Lookup a property. If found, the result is valid and has | 1460 // Lookup a property. If found, the result is valid and has |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1575 // reponsibility to ensure that *v* can be collected without WB here. | 1577 // reponsibility to ensure that *v* can be collected without WB here. |
1576 inline void InitializeBody(int object_size); | 1578 inline void InitializeBody(int object_size); |
1577 | 1579 |
1578 // Check whether this object references another object | 1580 // Check whether this object references another object |
1579 bool ReferencesObject(Object* obj); | 1581 bool ReferencesObject(Object* obj); |
1580 | 1582 |
1581 // Casting. | 1583 // Casting. |
1582 static inline JSObject* cast(Object* obj); | 1584 static inline JSObject* cast(Object* obj); |
1583 | 1585 |
1584 // Disalow further properties to be added to the object. | 1586 // Disalow further properties to be added to the object. |
1585 Object* PreventExtensions(); | 1587 NOIGNORE Object* PreventExtensions(); |
1586 | 1588 |
1587 | 1589 |
1588 // Dispatched behavior. | 1590 // Dispatched behavior. |
1589 void JSObjectShortPrint(StringStream* accumulator); | 1591 void JSObjectShortPrint(StringStream* accumulator); |
1590 #ifdef DEBUG | 1592 #ifdef DEBUG |
1591 void JSObjectPrint(); | 1593 void JSObjectPrint(); |
1592 void JSObjectVerify(); | 1594 void JSObjectVerify(); |
1593 void PrintProperties(); | 1595 void PrintProperties(); |
1594 void PrintElements(); | 1596 void PrintElements(); |
1595 | 1597 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 | 1650 |
1649 private: | 1651 private: |
1650 Object* GetElementWithCallback(Object* receiver, | 1652 Object* GetElementWithCallback(Object* receiver, |
1651 Object* structure, | 1653 Object* structure, |
1652 uint32_t index, | 1654 uint32_t index, |
1653 Object* holder); | 1655 Object* holder); |
1654 Object* SetElementWithCallback(Object* structure, | 1656 Object* SetElementWithCallback(Object* structure, |
1655 uint32_t index, | 1657 uint32_t index, |
1656 Object* value, | 1658 Object* value, |
1657 JSObject* holder); | 1659 JSObject* holder); |
1658 Object* SetElementWithInterceptor(uint32_t index, Object* value); | 1660 NOIGNORE Object* SetElementWithInterceptor(uint32_t index, Object* value); |
1659 Object* SetElementWithoutInterceptor(uint32_t index, Object* value); | 1661 NOIGNORE Object* SetElementWithoutInterceptor(uint32_t index, Object* value); |
1660 | 1662 |
1661 Object* GetElementPostInterceptor(JSObject* receiver, uint32_t index); | 1663 Object* GetElementPostInterceptor(JSObject* receiver, uint32_t index); |
1662 | 1664 |
1663 Object* DeletePropertyPostInterceptor(String* name, DeleteMode mode); | 1665 NOIGNORE Object* DeletePropertyPostInterceptor(String* name, DeleteMode mode); |
1664 Object* DeletePropertyWithInterceptor(String* name); | 1666 NOIGNORE Object* DeletePropertyWithInterceptor(String* name); |
1665 | 1667 |
1666 Object* DeleteElementPostInterceptor(uint32_t index, DeleteMode mode); | 1668 NOIGNORE Object* DeleteElementPostInterceptor(uint32_t index, |
1667 Object* DeleteElementWithInterceptor(uint32_t index); | 1669 DeleteMode mode); |
| 1670 NOIGNORE Object* DeleteElementWithInterceptor(uint32_t index); |
1668 | 1671 |
1669 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, | 1672 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, |
1670 String* name, | 1673 String* name, |
1671 bool continue_search); | 1674 bool continue_search); |
1672 PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject* receiver, | 1675 PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject* receiver, |
1673 String* name, | 1676 String* name, |
1674 bool continue_search); | 1677 bool continue_search); |
1675 PropertyAttributes GetPropertyAttributeWithFailedAccessCheck( | 1678 PropertyAttributes GetPropertyAttributeWithFailedAccessCheck( |
1676 Object* receiver, | 1679 Object* receiver, |
1677 LookupResult* result, | 1680 LookupResult* result, |
1678 String* name, | 1681 String* name, |
1679 bool continue_search); | 1682 bool continue_search); |
1680 PropertyAttributes GetPropertyAttribute(JSObject* receiver, | 1683 PropertyAttributes GetPropertyAttribute(JSObject* receiver, |
1681 LookupResult* result, | 1684 LookupResult* result, |
1682 String* name, | 1685 String* name, |
1683 bool continue_search); | 1686 bool continue_search); |
1684 | 1687 |
1685 // Returns true if most of the elements backing storage is used. | 1688 // Returns true if most of the elements backing storage is used. |
1686 bool HasDenseElements(); | 1689 bool HasDenseElements(); |
1687 | 1690 |
1688 bool CanSetCallback(String* name); | 1691 bool CanSetCallback(String* name); |
1689 Object* SetElementCallback(uint32_t index, | 1692 NOIGNORE Object* SetElementCallback(uint32_t index, |
1690 Object* structure, | 1693 Object* structure, |
1691 PropertyAttributes attributes); | 1694 PropertyAttributes attributes); |
1692 Object* SetPropertyCallback(String* name, | 1695 NOIGNORE Object* SetPropertyCallback(String* name, |
1693 Object* structure, | 1696 Object* structure, |
1694 PropertyAttributes attributes); | 1697 PropertyAttributes attributes); |
1695 Object* DefineGetterSetter(String* name, PropertyAttributes attributes); | 1698 NOIGNORE Object* DefineGetterSetter(String* name, |
| 1699 PropertyAttributes attributes); |
1696 | 1700 |
1697 void LookupInDescriptor(String* name, LookupResult* result); | 1701 void LookupInDescriptor(String* name, LookupResult* result); |
1698 | 1702 |
1699 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); | 1703 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); |
1700 }; | 1704 }; |
1701 | 1705 |
1702 | 1706 |
1703 // FixedArray describes fixed-sized arrays with element type Object*. | 1707 // FixedArray describes fixed-sized arrays with element type Object*. |
1704 class FixedArray: public HeapObject { | 1708 class FixedArray: public HeapObject { |
1705 public: | 1709 public: |
(...skipping 18 matching lines...) Expand all Loading... |
1724 | 1728 |
1725 // Setters with less debug checks for the GC to use. | 1729 // Setters with less debug checks for the GC to use. |
1726 inline void set_unchecked(int index, Smi* value); | 1730 inline void set_unchecked(int index, Smi* value); |
1727 inline void set_null_unchecked(int index); | 1731 inline void set_null_unchecked(int index); |
1728 | 1732 |
1729 // Gives access to raw memory which stores the array's data. | 1733 // Gives access to raw memory which stores the array's data. |
1730 inline Object** data_start(); | 1734 inline Object** data_start(); |
1731 | 1735 |
1732 // Copy operations. | 1736 // Copy operations. |
1733 inline Object* Copy(); | 1737 inline Object* Copy(); |
1734 Object* CopySize(int new_length); | 1738 NOIGNORE Object* CopySize(int new_length); |
1735 | 1739 |
1736 // Add the elements of a JSArray to this FixedArray. | 1740 // Add the elements of a JSArray to this FixedArray. |
1737 Object* AddKeysFromJSArray(JSArray* array); | 1741 NOIGNORE Object* AddKeysFromJSArray(JSArray* array); |
1738 | 1742 |
1739 // Compute the union of this and other. | 1743 // Compute the union of this and other. |
1740 Object* UnionOfKeys(FixedArray* other); | 1744 NOIGNORE Object* UnionOfKeys(FixedArray* other); |
1741 | 1745 |
1742 // Copy a sub array from the receiver to dest. | 1746 // Copy a sub array from the receiver to dest. |
1743 void CopyTo(int pos, FixedArray* dest, int dest_pos, int len); | 1747 void CopyTo(int pos, FixedArray* dest, int dest_pos, int len); |
1744 | 1748 |
1745 // Garbage collection support. | 1749 // Garbage collection support. |
1746 static int SizeFor(int length) { return kHeaderSize + length * kPointerSize; } | 1750 static int SizeFor(int length) { return kHeaderSize + length * kPointerSize; } |
1747 | 1751 |
1748 // Code Generation support. | 1752 // Code Generation support. |
1749 static int OffsetOfElementAt(int index) { return SizeFor(index); } | 1753 static int OffsetOfElementAt(int index) { return SizeFor(index); } |
1750 | 1754 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1869 // Transfer complete descriptor from another descriptor array to | 1873 // Transfer complete descriptor from another descriptor array to |
1870 // this one. | 1874 // this one. |
1871 inline void CopyFrom(int index, DescriptorArray* src, int src_index); | 1875 inline void CopyFrom(int index, DescriptorArray* src, int src_index); |
1872 | 1876 |
1873 // Copy the descriptor array, insert a new descriptor and optionally | 1877 // Copy the descriptor array, insert a new descriptor and optionally |
1874 // remove map transitions. If the descriptor is already present, it is | 1878 // remove map transitions. If the descriptor is already present, it is |
1875 // replaced. If a replaced descriptor is a real property (not a transition | 1879 // replaced. If a replaced descriptor is a real property (not a transition |
1876 // or null), its enumeration index is kept as is. | 1880 // or null), its enumeration index is kept as is. |
1877 // If adding a real property, map transitions must be removed. If adding | 1881 // If adding a real property, map transitions must be removed. If adding |
1878 // a transition, they must not be removed. All null descriptors are removed. | 1882 // a transition, they must not be removed. All null descriptors are removed. |
1879 Object* CopyInsert(Descriptor* descriptor, TransitionFlag transition_flag); | 1883 NOIGNORE Object* CopyInsert(Descriptor* descriptor, |
| 1884 TransitionFlag transition_flag); |
1880 | 1885 |
1881 // Remove all transitions. Return a copy of the array with all transitions | 1886 // Remove all transitions. Return a copy of the array with all transitions |
1882 // removed, or a Failure object if the new array could not be allocated. | 1887 // removed, or a Failure object if the new array could not be allocated. |
1883 Object* RemoveTransitions(); | 1888 NOIGNORE Object* RemoveTransitions(); |
1884 | 1889 |
1885 // Sort the instance descriptors by the hash codes of their keys. | 1890 // Sort the instance descriptors by the hash codes of their keys. |
1886 void Sort(); | 1891 void Sort(); |
1887 | 1892 |
1888 // Search the instance descriptors for given name. | 1893 // Search the instance descriptors for given name. |
1889 inline int Search(String* name); | 1894 inline int Search(String* name); |
1890 | 1895 |
1891 // As the above, but uses DescriptorLookupCache and updates it when | 1896 // As the above, but uses DescriptorLookupCache and updates it when |
1892 // necessary. | 1897 // necessary. |
1893 inline int SearchWithCache(String* name); | 1898 inline int SearchWithCache(String* name); |
1894 | 1899 |
1895 // Tells whether the name is present int the array. | 1900 // Tells whether the name is present int the array. |
1896 bool Contains(String* name) { return kNotFound != Search(name); } | 1901 bool Contains(String* name) { return kNotFound != Search(name); } |
1897 | 1902 |
1898 // Perform a binary search in the instance descriptors represented | 1903 // Perform a binary search in the instance descriptors represented |
1899 // by this fixed array. low and high are descriptor indices. If there | 1904 // by this fixed array. low and high are descriptor indices. If there |
1900 // are three instance descriptors in this array it should be called | 1905 // are three instance descriptors in this array it should be called |
1901 // with low=0 and high=2. | 1906 // with low=0 and high=2. |
1902 int BinarySearch(String* name, int low, int high); | 1907 int BinarySearch(String* name, int low, int high); |
1903 | 1908 |
1904 // Perform a linear search in the instance descriptors represented | 1909 // Perform a linear search in the instance descriptors represented |
1905 // by this fixed array. len is the number of descriptor indices that are | 1910 // by this fixed array. len is the number of descriptor indices that are |
1906 // valid. Does not require the descriptors to be sorted. | 1911 // valid. Does not require the descriptors to be sorted. |
1907 int LinearSearch(String* name, int len); | 1912 int LinearSearch(String* name, int len); |
1908 | 1913 |
1909 // Allocates a DescriptorArray, but returns the singleton | 1914 // Allocates a DescriptorArray, but returns the singleton |
1910 // empty descriptor array object if number_of_descriptors is 0. | 1915 // empty descriptor array object if number_of_descriptors is 0. |
1911 static Object* Allocate(int number_of_descriptors); | 1916 NOIGNORE static Object* Allocate(int number_of_descriptors); |
1912 | 1917 |
1913 // Casting. | 1918 // Casting. |
1914 static inline DescriptorArray* cast(Object* obj); | 1919 static inline DescriptorArray* cast(Object* obj); |
1915 | 1920 |
1916 // Constant for denoting key was not found. | 1921 // Constant for denoting key was not found. |
1917 static const int kNotFound = -1; | 1922 static const int kNotFound = -1; |
1918 | 1923 |
1919 static const int kContentArrayIndex = 0; | 1924 static const int kContentArrayIndex = 0; |
1920 static const int kEnumerationIndexIndex = 1; | 1925 static const int kEnumerationIndexIndex = 1; |
1921 static const int kFirstIndex = 2; | 1926 static const int kFirstIndex = 2; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2041 void ElementRemoved() { | 2046 void ElementRemoved() { |
2042 SetNumberOfElements(NumberOfElements() - 1); | 2047 SetNumberOfElements(NumberOfElements() - 1); |
2043 SetNumberOfDeletedElements(NumberOfDeletedElements() + 1); | 2048 SetNumberOfDeletedElements(NumberOfDeletedElements() + 1); |
2044 } | 2049 } |
2045 void ElementsRemoved(int n) { | 2050 void ElementsRemoved(int n) { |
2046 SetNumberOfElements(NumberOfElements() - n); | 2051 SetNumberOfElements(NumberOfElements() - n); |
2047 SetNumberOfDeletedElements(NumberOfDeletedElements() + n); | 2052 SetNumberOfDeletedElements(NumberOfDeletedElements() + n); |
2048 } | 2053 } |
2049 | 2054 |
2050 // Returns a new HashTable object. Might return Failure. | 2055 // Returns a new HashTable object. Might return Failure. |
2051 static Object* Allocate(int at_least_space_for, | 2056 NOIGNORE static Object* Allocate(int at_least_space_for, |
2052 PretenureFlag pretenure = NOT_TENURED); | 2057 PretenureFlag pretenure = NOT_TENURED); |
2053 | 2058 |
2054 // Returns the key at entry. | 2059 // Returns the key at entry. |
2055 Object* KeyAt(int entry) { return get(EntryToIndex(entry)); } | 2060 Object* KeyAt(int entry) { return get(EntryToIndex(entry)); } |
2056 | 2061 |
2057 // Tells whether k is a real key. Null and undefined are not allowed | 2062 // Tells whether k is a real key. Null and undefined are not allowed |
2058 // as keys and can be used to indicate missing or deleted elements. | 2063 // as keys and can be used to indicate missing or deleted elements. |
2059 bool IsKey(Object* k) { | 2064 bool IsKey(Object* k) { |
2060 return !k->IsNull() && !k->IsUndefined(); | 2065 return !k->IsNull() && !k->IsUndefined(); |
2061 } | 2066 } |
2062 | 2067 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 | 2141 |
2137 static uint32_t FirstProbe(uint32_t hash, uint32_t size) { | 2142 static uint32_t FirstProbe(uint32_t hash, uint32_t size) { |
2138 return hash & (size - 1); | 2143 return hash & (size - 1); |
2139 } | 2144 } |
2140 | 2145 |
2141 static uint32_t NextProbe(uint32_t last, uint32_t number, uint32_t size) { | 2146 static uint32_t NextProbe(uint32_t last, uint32_t number, uint32_t size) { |
2142 return (last + number) & (size - 1); | 2147 return (last + number) & (size - 1); |
2143 } | 2148 } |
2144 | 2149 |
2145 // Ensure enough space for n additional elements. | 2150 // Ensure enough space for n additional elements. |
2146 Object* EnsureCapacity(int n, Key key); | 2151 NOIGNORE Object* EnsureCapacity(int n, Key key); |
2147 }; | 2152 }; |
2148 | 2153 |
2149 | 2154 |
2150 | 2155 |
2151 // HashTableKey is an abstract superclass for virtual key behavior. | 2156 // HashTableKey is an abstract superclass for virtual key behavior. |
2152 class HashTableKey { | 2157 class HashTableKey { |
2153 public: | 2158 public: |
2154 // Returns whether the other object matches this key. | 2159 // Returns whether the other object matches this key. |
2155 virtual bool IsMatch(Object* other) = 0; | 2160 virtual bool IsMatch(Object* other) = 0; |
2156 // Returns the hash value for this key. | 2161 // Returns the hash value for this key. |
2157 virtual uint32_t Hash() = 0; | 2162 virtual uint32_t Hash() = 0; |
2158 // Returns the hash value for object. | 2163 // Returns the hash value for object. |
2159 virtual uint32_t HashForObject(Object* key) = 0; | 2164 virtual uint32_t HashForObject(Object* key) = 0; |
2160 // Returns the key object for storing into the hash table. | 2165 // Returns the key object for storing into the hash table. |
2161 // If allocations fails a failure object is returned. | 2166 // If allocations fails a failure object is returned. |
2162 virtual Object* AsObject() = 0; | 2167 NOIGNORE virtual Object* AsObject() = 0; |
2163 // Required. | 2168 // Required. |
2164 virtual ~HashTableKey() {} | 2169 virtual ~HashTableKey() {} |
2165 }; | 2170 }; |
2166 | 2171 |
2167 class SymbolTableShape { | 2172 class SymbolTableShape { |
2168 public: | 2173 public: |
2169 static bool IsMatch(HashTableKey* key, Object* value) { | 2174 static bool IsMatch(HashTableKey* key, Object* value) { |
2170 return key->IsMatch(value); | 2175 return key->IsMatch(value); |
2171 } | 2176 } |
2172 static uint32_t Hash(HashTableKey* key) { | 2177 static uint32_t Hash(HashTableKey* key) { |
2173 return key->Hash(); | 2178 return key->Hash(); |
2174 } | 2179 } |
2175 static uint32_t HashForObject(HashTableKey* key, Object* object) { | 2180 static uint32_t HashForObject(HashTableKey* key, Object* object) { |
2176 return key->HashForObject(object); | 2181 return key->HashForObject(object); |
2177 } | 2182 } |
2178 static Object* AsObject(HashTableKey* key) { | 2183 NOIGNORE static Object* AsObject(HashTableKey* key) { |
2179 return key->AsObject(); | 2184 return key->AsObject(); |
2180 } | 2185 } |
2181 | 2186 |
2182 static const int kPrefixSize = 0; | 2187 static const int kPrefixSize = 0; |
2183 static const int kEntrySize = 1; | 2188 static const int kEntrySize = 1; |
2184 }; | 2189 }; |
2185 | 2190 |
2186 // SymbolTable. | 2191 // SymbolTable. |
2187 // | 2192 // |
2188 // No special elements in the prefix and the element size is 1 | 2193 // No special elements in the prefix and the element size is 1 |
(...skipping 29 matching lines...) Expand all Loading... |
2218 return key->IsMatch(value); | 2223 return key->IsMatch(value); |
2219 } | 2224 } |
2220 static uint32_t Hash(HashTableKey* key) { | 2225 static uint32_t Hash(HashTableKey* key) { |
2221 return key->Hash(); | 2226 return key->Hash(); |
2222 } | 2227 } |
2223 | 2228 |
2224 static uint32_t HashForObject(HashTableKey* key, Object* object) { | 2229 static uint32_t HashForObject(HashTableKey* key, Object* object) { |
2225 return key->HashForObject(object); | 2230 return key->HashForObject(object); |
2226 } | 2231 } |
2227 | 2232 |
2228 static Object* AsObject(HashTableKey* key) { | 2233 NOIGNORE static Object* AsObject(HashTableKey* key) { |
2229 return key->AsObject(); | 2234 return key->AsObject(); |
2230 } | 2235 } |
2231 | 2236 |
2232 static const int kPrefixSize = 0; | 2237 static const int kPrefixSize = 0; |
2233 static const int kEntrySize = 2; | 2238 static const int kEntrySize = 2; |
2234 }; | 2239 }; |
2235 | 2240 |
2236 | 2241 |
2237 // MapCache. | 2242 // MapCache. |
2238 // | 2243 // |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2306 // Accessors for next enumeration index. | 2311 // Accessors for next enumeration index. |
2307 void SetNextEnumerationIndex(int index) { | 2312 void SetNextEnumerationIndex(int index) { |
2308 this->fast_set(this, kNextEnumerationIndexIndex, Smi::FromInt(index)); | 2313 this->fast_set(this, kNextEnumerationIndexIndex, Smi::FromInt(index)); |
2309 } | 2314 } |
2310 | 2315 |
2311 int NextEnumerationIndex() { | 2316 int NextEnumerationIndex() { |
2312 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); | 2317 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); |
2313 } | 2318 } |
2314 | 2319 |
2315 // Returns a new array for dictionary usage. Might return Failure. | 2320 // Returns a new array for dictionary usage. Might return Failure. |
2316 static Object* Allocate(int at_least_space_for); | 2321 NOIGNORE static Object* Allocate(int at_least_space_for); |
2317 | 2322 |
2318 // Ensure enough space for n additional elements. | 2323 // Ensure enough space for n additional elements. |
2319 Object* EnsureCapacity(int n, Key key); | 2324 Object* EnsureCapacity(int n, Key key); |
2320 | 2325 |
2321 #ifdef DEBUG | 2326 #ifdef DEBUG |
2322 void Print(); | 2327 void Print(); |
2323 #endif | 2328 #endif |
2324 // Returns the key (slow). | 2329 // Returns the key (slow). |
2325 Object* SlowReverseLookup(Object* value); | 2330 Object* SlowReverseLookup(Object* value); |
2326 | 2331 |
(...skipping 21 matching lines...) Expand all Loading... |
2348 HashTable<Shape, Key>::kPrefixStartIndex; | 2353 HashTable<Shape, Key>::kPrefixStartIndex; |
2349 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1; | 2354 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1; |
2350 }; | 2355 }; |
2351 | 2356 |
2352 | 2357 |
2353 class StringDictionaryShape { | 2358 class StringDictionaryShape { |
2354 public: | 2359 public: |
2355 static inline bool IsMatch(String* key, Object* other); | 2360 static inline bool IsMatch(String* key, Object* other); |
2356 static inline uint32_t Hash(String* key); | 2361 static inline uint32_t Hash(String* key); |
2357 static inline uint32_t HashForObject(String* key, Object* object); | 2362 static inline uint32_t HashForObject(String* key, Object* object); |
2358 static inline Object* AsObject(String* key); | 2363 NOIGNORE static inline Object* AsObject(String* key); |
2359 static const int kPrefixSize = 2; | 2364 static const int kPrefixSize = 2; |
2360 static const int kEntrySize = 3; | 2365 static const int kEntrySize = 3; |
2361 static const bool kIsEnumerable = true; | 2366 static const bool kIsEnumerable = true; |
2362 }; | 2367 }; |
2363 | 2368 |
2364 | 2369 |
2365 class StringDictionary: public Dictionary<StringDictionaryShape, String*> { | 2370 class StringDictionary: public Dictionary<StringDictionaryShape, String*> { |
2366 public: | 2371 public: |
2367 static inline StringDictionary* cast(Object* obj) { | 2372 static inline StringDictionary* cast(Object* obj) { |
2368 ASSERT(obj->IsDictionary()); | 2373 ASSERT(obj->IsDictionary()); |
(...skipping 11 matching lines...) Expand all Loading... |
2380 // HashTable::FindEntry. | 2385 // HashTable::FindEntry. |
2381 int FindEntry(String* key); | 2386 int FindEntry(String* key); |
2382 }; | 2387 }; |
2383 | 2388 |
2384 | 2389 |
2385 class NumberDictionaryShape { | 2390 class NumberDictionaryShape { |
2386 public: | 2391 public: |
2387 static inline bool IsMatch(uint32_t key, Object* other); | 2392 static inline bool IsMatch(uint32_t key, Object* other); |
2388 static inline uint32_t Hash(uint32_t key); | 2393 static inline uint32_t Hash(uint32_t key); |
2389 static inline uint32_t HashForObject(uint32_t key, Object* object); | 2394 static inline uint32_t HashForObject(uint32_t key, Object* object); |
2390 static inline Object* AsObject(uint32_t key); | 2395 NOIGNORE static inline Object* AsObject(uint32_t key); |
2391 static const int kPrefixSize = 2; | 2396 static const int kPrefixSize = 2; |
2392 static const int kEntrySize = 3; | 2397 static const int kEntrySize = 3; |
2393 static const bool kIsEnumerable = false; | 2398 static const bool kIsEnumerable = false; |
2394 }; | 2399 }; |
2395 | 2400 |
2396 | 2401 |
2397 class NumberDictionary: public Dictionary<NumberDictionaryShape, uint32_t> { | 2402 class NumberDictionary: public Dictionary<NumberDictionaryShape, uint32_t> { |
2398 public: | 2403 public: |
2399 static NumberDictionary* cast(Object* obj) { | 2404 static NumberDictionary* cast(Object* obj) { |
2400 ASSERT(obj->IsDictionary()); | 2405 ASSERT(obj->IsDictionary()); |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3146 | 3151 |
3147 // [constructor]: points back to the function responsible for this map. | 3152 // [constructor]: points back to the function responsible for this map. |
3148 DECL_ACCESSORS(constructor, Object) | 3153 DECL_ACCESSORS(constructor, Object) |
3149 | 3154 |
3150 // [instance descriptors]: describes the object. | 3155 // [instance descriptors]: describes the object. |
3151 DECL_ACCESSORS(instance_descriptors, DescriptorArray) | 3156 DECL_ACCESSORS(instance_descriptors, DescriptorArray) |
3152 | 3157 |
3153 // [stub cache]: contains stubs compiled for this map. | 3158 // [stub cache]: contains stubs compiled for this map. |
3154 DECL_ACCESSORS(code_cache, Object) | 3159 DECL_ACCESSORS(code_cache, Object) |
3155 | 3160 |
3156 Object* CopyDropDescriptors(); | 3161 NOIGNORE Object* CopyDropDescriptors(); |
3157 | 3162 |
3158 Object* CopyNormalized(PropertyNormalizationMode mode); | 3163 NOIGNORE Object* CopyNormalized(PropertyNormalizationMode mode); |
3159 | 3164 |
3160 // Returns a copy of the map, with all transitions dropped from the | 3165 // Returns a copy of the map, with all transitions dropped from the |
3161 // instance descriptors. | 3166 // instance descriptors. |
3162 Object* CopyDropTransitions(); | 3167 NOIGNORE Object* CopyDropTransitions(); |
3163 | 3168 |
3164 // Returns this map if it has the fast elements bit set, otherwise | 3169 // Returns this map if it has the fast elements bit set, otherwise |
3165 // returns a copy of the map, with all transitions dropped from the | 3170 // returns a copy of the map, with all transitions dropped from the |
3166 // descriptors and the fast elements bit set. | 3171 // descriptors and the fast elements bit set. |
3167 inline Object* GetFastElementsMap(); | 3172 inline Object* GetFastElementsMap(); |
3168 | 3173 |
3169 // Returns this map if it has the fast elements bit cleared, | 3174 // Returns this map if it has the fast elements bit cleared, |
3170 // otherwise returns a copy of the map, with all transitions dropped | 3175 // otherwise returns a copy of the map, with all transitions dropped |
3171 // from the descriptors and the fast elements bit cleared. | 3176 // from the descriptors and the fast elements bit cleared. |
3172 inline Object* GetSlowElementsMap(); | 3177 inline Object* GetSlowElementsMap(); |
(...skipping 12 matching lines...) Expand all Loading... |
3185 | 3190 |
3186 // Locate an accessor in the instance descriptor. | 3191 // Locate an accessor in the instance descriptor. |
3187 AccessorDescriptor* FindAccessor(String* name); | 3192 AccessorDescriptor* FindAccessor(String* name); |
3188 | 3193 |
3189 // Code cache operations. | 3194 // Code cache operations. |
3190 | 3195 |
3191 // Clears the code cache. | 3196 // Clears the code cache. |
3192 inline void ClearCodeCache(); | 3197 inline void ClearCodeCache(); |
3193 | 3198 |
3194 // Update code cache. | 3199 // Update code cache. |
3195 Object* UpdateCodeCache(String* name, Code* code); | 3200 NOIGNORE Object* UpdateCodeCache(String* name, Code* code); |
3196 | 3201 |
3197 // Returns the found code or undefined if absent. | 3202 // Returns the found code or undefined if absent. |
3198 Object* FindInCodeCache(String* name, Code::Flags flags); | 3203 Object* FindInCodeCache(String* name, Code::Flags flags); |
3199 | 3204 |
3200 // Returns the non-negative index of the code object if it is in the | 3205 // Returns the non-negative index of the code object if it is in the |
3201 // cache and -1 otherwise. | 3206 // cache and -1 otherwise. |
3202 int IndexInCodeCache(Object* name, Code* code); | 3207 int IndexInCodeCache(Object* name, Code* code); |
3203 | 3208 |
3204 // Removes a code object from the code cache at the given index. | 3209 // Removes a code object from the code cache at the given index. |
3205 void RemoveFromCodeCache(String* name, Code* code, int index); | 3210 void RemoveFromCodeCache(String* name, Code* code, int index); |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3714 | 3719 |
3715 // Get and set the prototype property on a JSFunction. If the | 3720 // Get and set the prototype property on a JSFunction. If the |
3716 // function has an initial map the prototype is set on the initial | 3721 // function has an initial map the prototype is set on the initial |
3717 // map. Otherwise, the prototype is put in the initial map field | 3722 // map. Otherwise, the prototype is put in the initial map field |
3718 // until an initial map is needed. | 3723 // until an initial map is needed. |
3719 inline bool has_prototype(); | 3724 inline bool has_prototype(); |
3720 inline bool has_instance_prototype(); | 3725 inline bool has_instance_prototype(); |
3721 inline Object* prototype(); | 3726 inline Object* prototype(); |
3722 inline Object* instance_prototype(); | 3727 inline Object* instance_prototype(); |
3723 Object* SetInstancePrototype(Object* value); | 3728 Object* SetInstancePrototype(Object* value); |
3724 Object* SetPrototype(Object* value); | 3729 NOIGNORE Object* SetPrototype(Object* value); |
3725 | 3730 |
3726 // After prototype is removed, it will not be created when accessed, and | 3731 // After prototype is removed, it will not be created when accessed, and |
3727 // [[Construct]] from this function will not be allowed. | 3732 // [[Construct]] from this function will not be allowed. |
3728 Object* RemovePrototype(); | 3733 Object* RemovePrototype(); |
3729 inline bool should_have_prototype(); | 3734 inline bool should_have_prototype(); |
3730 | 3735 |
3731 // Accessor for this function's initial map's [[class]] | 3736 // Accessor for this function's initial map's [[class]] |
3732 // property. This is primarily used by ECMA native functions. This | 3737 // property. This is primarily used by ECMA native functions. This |
3733 // method sets the class_name field of this function's initial map | 3738 // method sets the class_name field of this function's initial map |
3734 // to a given value. It creates an initial map if this function does | 3739 // to a given value. It creates an initial map if this function does |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4055 } | 4060 } |
4056 | 4061 |
4057 static inline uint32_t Hash(HashTableKey* key) { | 4062 static inline uint32_t Hash(HashTableKey* key) { |
4058 return key->Hash(); | 4063 return key->Hash(); |
4059 } | 4064 } |
4060 | 4065 |
4061 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { | 4066 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { |
4062 return key->HashForObject(object); | 4067 return key->HashForObject(object); |
4063 } | 4068 } |
4064 | 4069 |
4065 static Object* AsObject(HashTableKey* key) { | 4070 NOIGNORE static Object* AsObject(HashTableKey* key) { |
4066 return key->AsObject(); | 4071 return key->AsObject(); |
4067 } | 4072 } |
4068 | 4073 |
4069 static const int kPrefixSize = 0; | 4074 static const int kPrefixSize = 0; |
4070 static const int kEntrySize = 2; | 4075 static const int kEntrySize = 2; |
4071 }; | 4076 }; |
4072 | 4077 |
4073 | 4078 |
4074 class CompilationCacheTable: public HashTable<CompilationCacheShape, | 4079 class CompilationCacheTable: public HashTable<CompilationCacheShape, |
4075 HashTableKey*> { | 4080 HashTableKey*> { |
(...skipping 12 matching lines...) Expand all Loading... |
4088 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); | 4093 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); |
4089 }; | 4094 }; |
4090 | 4095 |
4091 | 4096 |
4092 class CodeCache: public Struct { | 4097 class CodeCache: public Struct { |
4093 public: | 4098 public: |
4094 DECL_ACCESSORS(default_cache, FixedArray) | 4099 DECL_ACCESSORS(default_cache, FixedArray) |
4095 DECL_ACCESSORS(normal_type_cache, Object) | 4100 DECL_ACCESSORS(normal_type_cache, Object) |
4096 | 4101 |
4097 // Add the code object to the cache. | 4102 // Add the code object to the cache. |
4098 Object* Update(String* name, Code* code); | 4103 NOIGNORE Object* Update(String* name, Code* code); |
4099 | 4104 |
4100 // Lookup code object in the cache. Returns code object if found and undefined | 4105 // Lookup code object in the cache. Returns code object if found and undefined |
4101 // if not. | 4106 // if not. |
4102 Object* Lookup(String* name, Code::Flags flags); | 4107 Object* Lookup(String* name, Code::Flags flags); |
4103 | 4108 |
4104 // Get the internal index of a code object in the cache. Returns -1 if the | 4109 // Get the internal index of a code object in the cache. Returns -1 if the |
4105 // code object is not in that cache. This index can be used to later call | 4110 // code object is not in that cache. This index can be used to later call |
4106 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and | 4111 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and |
4107 // RemoveByIndex. | 4112 // RemoveByIndex. |
4108 int GetIndex(Object* name, Code* code); | 4113 int GetIndex(Object* name, Code* code); |
4109 | 4114 |
4110 // Remove an object from the cache with the provided internal index. | 4115 // Remove an object from the cache with the provided internal index. |
4111 void RemoveByIndex(Object* name, Code* code, int index); | 4116 void RemoveByIndex(Object* name, Code* code, int index); |
4112 | 4117 |
4113 static inline CodeCache* cast(Object* obj); | 4118 static inline CodeCache* cast(Object* obj); |
4114 | 4119 |
4115 #ifdef DEBUG | 4120 #ifdef DEBUG |
4116 void CodeCachePrint(); | 4121 void CodeCachePrint(); |
4117 void CodeCacheVerify(); | 4122 void CodeCacheVerify(); |
4118 #endif | 4123 #endif |
4119 | 4124 |
4120 static const int kDefaultCacheOffset = HeapObject::kHeaderSize; | 4125 static const int kDefaultCacheOffset = HeapObject::kHeaderSize; |
4121 static const int kNormalTypeCacheOffset = | 4126 static const int kNormalTypeCacheOffset = |
4122 kDefaultCacheOffset + kPointerSize; | 4127 kDefaultCacheOffset + kPointerSize; |
4123 static const int kSize = kNormalTypeCacheOffset + kPointerSize; | 4128 static const int kSize = kNormalTypeCacheOffset + kPointerSize; |
4124 | 4129 |
4125 private: | 4130 private: |
4126 Object* UpdateDefaultCache(String* name, Code* code); | 4131 NOIGNORE Object* UpdateDefaultCache(String* name, Code* code); |
4127 Object* UpdateNormalTypeCache(String* name, Code* code); | 4132 NOIGNORE Object* UpdateNormalTypeCache(String* name, Code* code); |
4128 Object* LookupDefaultCache(String* name, Code::Flags flags); | 4133 Object* LookupDefaultCache(String* name, Code::Flags flags); |
4129 Object* LookupNormalTypeCache(String* name, Code::Flags flags); | 4134 Object* LookupNormalTypeCache(String* name, Code::Flags flags); |
4130 | 4135 |
4131 // Code cache layout of the default cache. Elements are alternating name and | 4136 // Code cache layout of the default cache. Elements are alternating name and |
4132 // code objects for non normal load/store/call IC's. | 4137 // code objects for non normal load/store/call IC's. |
4133 static const int kCodeCacheEntrySize = 2; | 4138 static const int kCodeCacheEntrySize = 2; |
4134 static const int kCodeCacheEntryNameOffset = 0; | 4139 static const int kCodeCacheEntryNameOffset = 0; |
4135 static const int kCodeCacheEntryCodeOffset = 1; | 4140 static const int kCodeCacheEntryCodeOffset = 1; |
4136 | 4141 |
4137 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCache); | 4142 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCache); |
4138 }; | 4143 }; |
4139 | 4144 |
4140 | 4145 |
4141 class CodeCacheHashTableShape { | 4146 class CodeCacheHashTableShape { |
4142 public: | 4147 public: |
4143 static inline bool IsMatch(HashTableKey* key, Object* value) { | 4148 static inline bool IsMatch(HashTableKey* key, Object* value) { |
4144 return key->IsMatch(value); | 4149 return key->IsMatch(value); |
4145 } | 4150 } |
4146 | 4151 |
4147 static inline uint32_t Hash(HashTableKey* key) { | 4152 static inline uint32_t Hash(HashTableKey* key) { |
4148 return key->Hash(); | 4153 return key->Hash(); |
4149 } | 4154 } |
4150 | 4155 |
4151 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { | 4156 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { |
4152 return key->HashForObject(object); | 4157 return key->HashForObject(object); |
4153 } | 4158 } |
4154 | 4159 |
4155 static Object* AsObject(HashTableKey* key) { | 4160 NOIGNORE static Object* AsObject(HashTableKey* key) { |
4156 return key->AsObject(); | 4161 return key->AsObject(); |
4157 } | 4162 } |
4158 | 4163 |
4159 static const int kPrefixSize = 0; | 4164 static const int kPrefixSize = 0; |
4160 static const int kEntrySize = 2; | 4165 static const int kEntrySize = 2; |
4161 }; | 4166 }; |
4162 | 4167 |
4163 | 4168 |
4164 class CodeCacheHashTable: public HashTable<CodeCacheHashTableShape, | 4169 class CodeCacheHashTable: public HashTable<CodeCacheHashTableShape, |
4165 HashTableKey*> { | 4170 HashTableKey*> { |
4166 public: | 4171 public: |
4167 Object* Lookup(String* name, Code::Flags flags); | 4172 Object* Lookup(String* name, Code::Flags flags); |
4168 Object* Put(String* name, Code* code); | 4173 NOIGNORE Object* Put(String* name, Code* code); |
4169 | 4174 |
4170 int GetIndex(String* name, Code::Flags flags); | 4175 int GetIndex(String* name, Code::Flags flags); |
4171 void RemoveByIndex(int index); | 4176 void RemoveByIndex(int index); |
4172 | 4177 |
4173 static inline CodeCacheHashTable* cast(Object* obj); | 4178 static inline CodeCacheHashTable* cast(Object* obj); |
4174 | 4179 |
4175 // Initial size of the fixed array backing the hash table. | 4180 // Initial size of the fixed array backing the hash table. |
4176 static const int kInitialSize = 64; | 4181 static const int kInitialSize = 64; |
4177 | 4182 |
4178 private: | 4183 private: |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5025 // - slow, backing storage is a HashTable with numbers as keys. | 5030 // - slow, backing storage is a HashTable with numbers as keys. |
5026 class JSArray: public JSObject { | 5031 class JSArray: public JSObject { |
5027 public: | 5032 public: |
5028 // [length]: The length property. | 5033 // [length]: The length property. |
5029 DECL_ACCESSORS(length, Object) | 5034 DECL_ACCESSORS(length, Object) |
5030 | 5035 |
5031 // Overload the length setter to skip write barrier when the length | 5036 // Overload the length setter to skip write barrier when the length |
5032 // is set to a smi. This matches the set function on FixedArray. | 5037 // is set to a smi. This matches the set function on FixedArray. |
5033 inline void set_length(Smi* length); | 5038 inline void set_length(Smi* length); |
5034 | 5039 |
5035 Object* JSArrayUpdateLengthFromIndex(uint32_t index, Object* value); | 5040 NOIGNORE Object* JSArrayUpdateLengthFromIndex(uint32_t index, Object* value); |
5036 | 5041 |
5037 // Initialize the array with the given capacity. The function may | 5042 // Initialize the array with the given capacity. The function may |
5038 // fail due to out-of-memory situations, but only if the requested | 5043 // fail due to out-of-memory situations, but only if the requested |
5039 // capacity is non-zero. | 5044 // capacity is non-zero. |
5040 Object* Initialize(int capacity); | 5045 NOIGNORE Object* Initialize(int capacity); |
5041 | 5046 |
5042 // Set the content of the array to the content of storage. | 5047 // Set the content of the array to the content of storage. |
5043 inline void SetContent(FixedArray* storage); | 5048 inline void SetContent(FixedArray* storage); |
5044 | 5049 |
5045 // Casting. | 5050 // Casting. |
5046 static inline JSArray* cast(Object* obj); | 5051 static inline JSArray* cast(Object* obj); |
5047 | 5052 |
5048 // Uses handles. Ensures that the fixed array backing the JSArray has at | 5053 // Uses handles. Ensures that the fixed array backing the JSArray has at |
5049 // least the stated size. | 5054 // least the stated size. |
5050 inline void EnsureSize(int minimum_size_of_backing_fixed_array); | 5055 inline void EnsureSize(int minimum_size_of_backing_fixed_array); |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5552 } else { | 5557 } else { |
5553 value &= ~(1 << bit_position); | 5558 value &= ~(1 << bit_position); |
5554 } | 5559 } |
5555 return value; | 5560 return value; |
5556 } | 5561 } |
5557 }; | 5562 }; |
5558 | 5563 |
5559 } } // namespace v8::internal | 5564 } } // namespace v8::internal |
5560 | 5565 |
5561 #endif // V8_OBJECTS_H_ | 5566 #endif // V8_OBJECTS_H_ |
OLD | NEW |