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 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
912 MUST_USE_RESULT MaybeObject* GetPropertyWithDefinedGetter(Object* receiver, | 912 MUST_USE_RESULT MaybeObject* GetPropertyWithDefinedGetter(Object* receiver, |
913 JSReceiver* getter); | 913 JSReceiver* getter); |
914 | 914 |
915 static Handle<Object> GetElement(Handle<Object> object, uint32_t index); | 915 static Handle<Object> GetElement(Handle<Object> object, uint32_t index); |
916 inline MaybeObject* GetElement(uint32_t index); | 916 inline MaybeObject* GetElement(uint32_t index); |
917 // For use when we know that no exception can be thrown. | 917 // For use when we know that no exception can be thrown. |
918 inline Object* GetElementNoExceptionThrown(uint32_t index); | 918 inline Object* GetElementNoExceptionThrown(uint32_t index); |
919 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); | 919 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); |
920 | 920 |
921 // Return the object's prototype (might be Heap::null_value()). | 921 // Return the object's prototype (might be Heap::null_value()). |
922 static Handle<Object> GetPrototype(Handle<Object> obj); | |
922 Object* GetPrototype(); | 923 Object* GetPrototype(); |
923 | 924 |
924 // Returns the permanent hash code associated with this object depending on | 925 // Returns the permanent hash code associated with this object depending on |
925 // the actual object type. Might return a failure in case no hash was | 926 // the actual object type. Might return a failure in case no hash was |
926 // created yet or GC was caused by creation. | 927 // created yet or GC was caused by creation. |
927 MUST_USE_RESULT MaybeObject* GetHash(CreationFlag flag); | 928 MUST_USE_RESULT MaybeObject* GetHash(CreationFlag flag); |
928 | 929 |
929 // Checks whether this object has the same value as the given one. This | 930 // Checks whether this object has the same value as the given one. This |
930 // function is implemented according to ES5, section 9.12 and can be used | 931 // function is implemented according to ES5, section 9.12 and can be used |
931 // to implement the Harmony "egal" function. | 932 // to implement the Harmony "egal" function. |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1335 public: | 1336 public: |
1336 enum DeleteMode { | 1337 enum DeleteMode { |
1337 NORMAL_DELETION, | 1338 NORMAL_DELETION, |
1338 STRICT_DELETION, | 1339 STRICT_DELETION, |
1339 FORCE_DELETION | 1340 FORCE_DELETION |
1340 }; | 1341 }; |
1341 | 1342 |
1342 // Casting. | 1343 // Casting. |
1343 static inline JSReceiver* cast(Object* obj); | 1344 static inline JSReceiver* cast(Object* obj); |
1344 | 1345 |
1346 static Handle<Object> SetProperty(Handle<JSReceiver> object, | |
Kevin Millikin (Chromium)
2012/01/04 13:00:32
For these functions that return an empty handle on
ulan
2012/01/05 11:16:35
(a), I would prefer to get compiler warnings when
| |
1347 Handle<String> key, | |
1348 Handle<Object> value, | |
1349 PropertyAttributes attributes, | |
1350 StrictModeFlag strict_mode); | |
1345 // Can cause GC. | 1351 // Can cause GC. |
1346 MUST_USE_RESULT MaybeObject* SetProperty(String* key, | 1352 MUST_USE_RESULT MaybeObject* SetProperty(String* key, |
1347 Object* value, | 1353 Object* value, |
1348 PropertyAttributes attributes, | 1354 PropertyAttributes attributes, |
1349 StrictModeFlag strict_mode); | 1355 StrictModeFlag strict_mode); |
1350 MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result, | 1356 MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result, |
1351 String* key, | 1357 String* key, |
1352 Object* value, | 1358 Object* value, |
1353 PropertyAttributes attributes, | 1359 PropertyAttributes attributes, |
1354 StrictModeFlag strict_mode); | 1360 StrictModeFlag strict_mode); |
(...skipping 27 matching lines...) Expand all Loading... | |
1382 | 1388 |
1383 // Can cause a GC. | 1389 // Can cause a GC. |
1384 inline bool HasProperty(String* name); | 1390 inline bool HasProperty(String* name); |
1385 inline bool HasLocalProperty(String* name); | 1391 inline bool HasLocalProperty(String* name); |
1386 inline bool HasElement(uint32_t index); | 1392 inline bool HasElement(uint32_t index); |
1387 | 1393 |
1388 // Return the object's prototype (might be Heap::null_value()). | 1394 // Return the object's prototype (might be Heap::null_value()). |
1389 inline Object* GetPrototype(); | 1395 inline Object* GetPrototype(); |
1390 | 1396 |
1391 // Set the object's prototype (only JSReceiver and null are allowed). | 1397 // Set the object's prototype (only JSReceiver and null are allowed). |
1398 static Handle<Object> SetPrototype(Handle<JSReceiver> obj, | |
Kevin Millikin (Chromium)
2012/01/04 13:00:32
It doesn't look like you added any calls to this (
ulan
2012/01/05 11:16:35
Deleting for now.
| |
1399 Handle<Object> value); | |
1392 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value, | 1400 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value, |
1393 bool skip_hidden_prototypes); | 1401 bool skip_hidden_prototypes); |
1394 | 1402 |
1395 // Retrieves a permanent object identity hash code. The undefined value might | 1403 // Retrieves a permanent object identity hash code. The undefined value might |
1396 // be returned in case no hash was created yet and OMIT_CREATION was used. | 1404 // be returned in case no hash was created yet and OMIT_CREATION was used. |
1397 inline MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 1405 inline MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); |
1398 | 1406 |
1399 // Lookup a property. If found, the result is valid and has | 1407 // Lookup a property. If found, the result is valid and has |
1400 // detailed information. | 1408 // detailed information. |
1401 void LocalLookup(String* name, LookupResult* result); | 1409 void LocalLookup(String* name, LookupResult* result); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1509 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor( | 1517 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor( |
1510 String* name, | 1518 String* name, |
1511 Object* value, | 1519 Object* value, |
1512 PropertyAttributes attributes, | 1520 PropertyAttributes attributes, |
1513 StrictModeFlag strict_mode); | 1521 StrictModeFlag strict_mode); |
1514 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor( | 1522 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor( |
1515 String* name, | 1523 String* name, |
1516 Object* value, | 1524 Object* value, |
1517 PropertyAttributes attributes, | 1525 PropertyAttributes attributes, |
1518 StrictModeFlag strict_mode); | 1526 StrictModeFlag strict_mode); |
1527 | |
1528 static Handle<Object> SetLocalPropertyIgnoreAttributes( | |
1529 Handle<JSObject> object, | |
1530 Handle<String> key, | |
1531 Handle<Object> value, | |
1532 PropertyAttributes attributes); | |
1533 | |
1534 // Can cause GC. | |
1519 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( | 1535 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( |
1520 String* key, | 1536 String* key, |
1521 Object* value, | 1537 Object* value, |
1522 PropertyAttributes attributes); | 1538 PropertyAttributes attributes); |
1523 | 1539 |
1540 // Used to set local properties on the object we totally control | |
1541 // and which therefore has no accessors and alikes. | |
1542 static void SetLocalPropertyNoThrow(Handle<JSObject> object, | |
1543 Handle<String> key, | |
1544 Handle<Object> value, | |
1545 PropertyAttributes attributes = NONE); | |
1546 | |
1524 // Retrieve a value in a normalized object given a lookup result. | 1547 // Retrieve a value in a normalized object given a lookup result. |
1525 // Handles the special representation of JS global objects. | 1548 // Handles the special representation of JS global objects. |
1526 Object* GetNormalizedProperty(LookupResult* result); | 1549 Object* GetNormalizedProperty(LookupResult* result); |
1527 | 1550 |
1528 // Sets the property value in a normalized object given a lookup result. | 1551 // Sets the property value in a normalized object given a lookup result. |
1529 // Handles the special representation of JS global objects. | 1552 // Handles the special representation of JS global objects. |
1530 Object* SetNormalizedProperty(LookupResult* result, Object* value); | 1553 Object* SetNormalizedProperty(LookupResult* result, Object* value); |
1531 | 1554 |
1532 // Sets the property value in a normalized object given (key, value, details). | 1555 // Sets the property value in a normalized object given (key, value, details). |
1533 // Handles the special representation of JS global objects. | 1556 // Handles the special representation of JS global objects. |
1557 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object, | |
1558 Handle<String> key, | |
1559 Handle<Object> value, | |
1560 PropertyDetails details); | |
1561 | |
1534 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(String* name, | 1562 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(String* name, |
1535 Object* value, | 1563 Object* value, |
1536 PropertyDetails details); | 1564 PropertyDetails details); |
1537 | 1565 |
1538 // Deletes the named property in a normalized object. | 1566 // Deletes the named property in a normalized object. |
1539 MUST_USE_RESULT MaybeObject* DeleteNormalizedProperty(String* name, | 1567 MUST_USE_RESULT MaybeObject* DeleteNormalizedProperty(String* name, |
1540 DeleteMode mode); | 1568 DeleteMode mode); |
1541 | 1569 |
1542 // Retrieve interceptors. | 1570 // Retrieve interceptors. |
1543 InterceptorInfo* GetNamedInterceptor(); | 1571 InterceptorInfo* GetNamedInterceptor(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1593 // Accessors for hidden properties object. | 1621 // Accessors for hidden properties object. |
1594 // | 1622 // |
1595 // Hidden properties are not local properties of the object itself. | 1623 // Hidden properties are not local properties of the object itself. |
1596 // Instead they are stored in an auxiliary structure kept as a local | 1624 // Instead they are stored in an auxiliary structure kept as a local |
1597 // property with a special name Heap::hidden_symbol(). But if the | 1625 // property with a special name Heap::hidden_symbol(). But if the |
1598 // receiver is a JSGlobalProxy then the auxiliary object is a property | 1626 // receiver is a JSGlobalProxy then the auxiliary object is a property |
1599 // of its prototype, and if it's a detached proxy, then you can't have | 1627 // of its prototype, and if it's a detached proxy, then you can't have |
1600 // hidden properties. | 1628 // hidden properties. |
1601 | 1629 |
1602 // Sets a hidden property on this object. Returns this object if successful, | 1630 // Sets a hidden property on this object. Returns this object if successful, |
1603 // undefined if called on a detached proxy, and a failure if a GC | 1631 // undefined if called on a detached proxy. |
1604 // is required | 1632 static Handle<Object> SetHiddenProperty(Handle<JSObject> obj, |
1633 Handle<String> key, | |
Kevin Millikin (Chromium)
2012/01/04 13:00:32
Indentation is off here.
ulan
2012/01/05 11:16:35
Done.
| |
1634 Handle<Object> value); | |
1635 // Returns a failure if a GC is required. | |
1605 MaybeObject* SetHiddenProperty(String* key, Object* value); | 1636 MaybeObject* SetHiddenProperty(String* key, Object* value); |
1606 // Gets the value of a hidden property with the given key. Returns undefined | 1637 // Gets the value of a hidden property with the given key. Returns undefined |
1607 // if the property doesn't exist (or if called on a detached proxy), | 1638 // if the property doesn't exist (or if called on a detached proxy), |
1608 // otherwise returns the value set for the key. | 1639 // otherwise returns the value set for the key. |
1609 Object* GetHiddenProperty(String* key); | 1640 Object* GetHiddenProperty(String* key); |
1610 // Deletes a hidden property. Deleting a non-existing property is | 1641 // Deletes a hidden property. Deleting a non-existing property is |
1611 // considered successful. | 1642 // considered successful. |
1612 void DeleteHiddenProperty(String* key); | 1643 void DeleteHiddenProperty(String* key); |
1613 // Returns true if the object has a property with the hidden symbol as name. | 1644 // Returns true if the object has a property with the hidden symbol as name. |
1614 bool HasHiddenProperties(); | 1645 bool HasHiddenProperties(); |
1615 | 1646 |
1647 static int GetIdentityHash(Handle<JSObject> obj); | |
1616 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 1648 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); |
1617 MUST_USE_RESULT MaybeObject* SetIdentityHash(Object* hash, CreationFlag flag); | 1649 MUST_USE_RESULT MaybeObject* SetIdentityHash(Object* hash, CreationFlag flag); |
1618 | 1650 |
1651 static Handle<Object> DeleteProperty(Handle<JSObject> obj, | |
1652 Handle<String> name); | |
1619 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); | 1653 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); |
1654 | |
1655 static Handle<Object> DeleteElement(Handle<JSObject> obj, uint32_t index); | |
1620 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); | 1656 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); |
1621 | 1657 |
1622 inline void ValidateSmiOnlyElements(); | 1658 inline void ValidateSmiOnlyElements(); |
1623 | 1659 |
1624 // Makes sure that this object can contain HeapObject as elements. | 1660 // Makes sure that this object can contain HeapObject as elements. |
1625 inline MaybeObject* EnsureCanContainHeapObjectElements(); | 1661 inline MaybeObject* EnsureCanContainHeapObjectElements(); |
1626 | 1662 |
1627 // Makes sure that this object can contain the specified elements. | 1663 // Makes sure that this object can contain the specified elements. |
1628 inline MaybeObject* EnsureCanContainElements(Object** elements, | 1664 inline MaybeObject* EnsureCanContainElements(Object** elements, |
1629 uint32_t count, | 1665 uint32_t count, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1688 Object* value, | 1724 Object* value, |
1689 StrictModeFlag strict_mode, | 1725 StrictModeFlag strict_mode, |
1690 bool check_prototype); | 1726 bool check_prototype); |
1691 | 1727 |
1692 MUST_USE_RESULT MaybeObject* SetFastDoubleElement( | 1728 MUST_USE_RESULT MaybeObject* SetFastDoubleElement( |
1693 uint32_t index, | 1729 uint32_t index, |
1694 Object* value, | 1730 Object* value, |
1695 StrictModeFlag strict_mode, | 1731 StrictModeFlag strict_mode, |
1696 bool check_prototype = true); | 1732 bool check_prototype = true); |
1697 | 1733 |
1698 // Set the index'th array element. | 1734 |
1735 static Handle<Object> SetOwnElement(Handle<JSObject> object, | |
1736 uint32_t index, | |
1737 Handle<Object> value, | |
1738 StrictModeFlag strict_mode); | |
1739 | |
1740 // Empty handle is returned if the element cannot be set to the given value. | |
1741 static MUST_USE_RESULT Handle<Object> SetElement(Handle<JSObject> object, | |
1742 uint32_t index, | |
1743 Handle<Object> value, | |
1744 StrictModeFlag strict_mode); | |
1745 | |
1699 // A Failure object is returned if GC is needed. | 1746 // A Failure object is returned if GC is needed. |
1700 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, | 1747 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, |
1701 Object* value, | 1748 Object* value, |
1702 StrictModeFlag strict_mode, | 1749 StrictModeFlag strict_mode, |
1703 bool check_prototype); | 1750 bool check_prototype); |
1704 | 1751 |
1705 // Returns the index'th element. | 1752 // Returns the index'th element. |
1706 // The undefined object if index is out of bounds. | 1753 // The undefined object if index is out of bounds. |
1707 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); | 1754 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); |
1708 | 1755 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1797 Object* value, | 1844 Object* value, |
1798 PropertyAttributes attributes); | 1845 PropertyAttributes attributes); |
1799 | 1846 |
1800 // Returns a new map with all transitions dropped from the object's current | 1847 // Returns a new map with all transitions dropped from the object's current |
1801 // map and the ElementsKind set. | 1848 // map and the ElementsKind set. |
1802 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, | 1849 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, |
1803 ElementsKind to_kind); | 1850 ElementsKind to_kind); |
1804 MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( | 1851 MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( |
1805 ElementsKind elements_kind); | 1852 ElementsKind elements_kind); |
1806 | 1853 |
1854 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, | |
1855 ElementsKind to_kind); | |
1856 | |
1807 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); | 1857 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); |
1808 | 1858 |
1809 // Converts a descriptor of any other type to a real field, | 1859 // Converts a descriptor of any other type to a real field, |
1810 // backed by the properties array. Descriptors of visible | 1860 // backed by the properties array. Descriptors of visible |
1811 // types, such as CONSTANT_FUNCTION, keep their enumeration order. | 1861 // types, such as CONSTANT_FUNCTION, keep their enumeration order. |
1812 // Converts the descriptor on the original object's map to a | 1862 // Converts the descriptor on the original object's map to a |
1813 // map transition, and the the new field is on the object's new map. | 1863 // map transition, and the the new field is on the object's new map. |
1814 MUST_USE_RESULT MaybeObject* ConvertDescriptorToFieldAndMapTransition( | 1864 MUST_USE_RESULT MaybeObject* ConvertDescriptorToFieldAndMapTransition( |
1815 String* name, | 1865 String* name, |
1816 Object* new_value, | 1866 Object* new_value, |
(...skipping 20 matching lines...) Expand all Loading... | |
1837 // Add a property to an object. | 1887 // Add a property to an object. |
1838 MUST_USE_RESULT MaybeObject* AddProperty(String* name, | 1888 MUST_USE_RESULT MaybeObject* AddProperty(String* name, |
1839 Object* value, | 1889 Object* value, |
1840 PropertyAttributes attributes, | 1890 PropertyAttributes attributes, |
1841 StrictModeFlag strict_mode); | 1891 StrictModeFlag strict_mode); |
1842 | 1892 |
1843 // Convert the object to use the canonical dictionary | 1893 // Convert the object to use the canonical dictionary |
1844 // representation. If the object is expected to have additional properties | 1894 // representation. If the object is expected to have additional properties |
1845 // added this number can be indicated to have the backing store allocated to | 1895 // added this number can be indicated to have the backing store allocated to |
1846 // an initial capacity for holding these properties. | 1896 // an initial capacity for holding these properties. |
1897 static void NormalizeProperties(Handle<JSObject> object, | |
1898 PropertyNormalizationMode mode, | |
1899 int expected_additional_properties); | |
1900 | |
1847 MUST_USE_RESULT MaybeObject* NormalizeProperties( | 1901 MUST_USE_RESULT MaybeObject* NormalizeProperties( |
1848 PropertyNormalizationMode mode, | 1902 PropertyNormalizationMode mode, |
1849 int expected_additional_properties); | 1903 int expected_additional_properties); |
1850 | 1904 |
1851 // Convert and update the elements backing store to be a NumberDictionary | 1905 // Convert and update the elements backing store to be a NumberDictionary |
1852 // dictionary. Returns the backing after conversion. | 1906 // dictionary. Returns the backing after conversion. |
1907 static Handle<NumberDictionary> NormalizeElements(Handle<JSObject> object); | |
1908 | |
1853 MUST_USE_RESULT MaybeObject* NormalizeElements(); | 1909 MUST_USE_RESULT MaybeObject* NormalizeElements(); |
1854 | 1910 |
1855 static void UpdateMapCodeCache(Handle<JSObject> object, | 1911 static void UpdateMapCodeCache(Handle<JSObject> object, |
1856 Handle<String> name, | 1912 Handle<String> name, |
1857 Handle<Code> code); | 1913 Handle<Code> code); |
1858 | 1914 |
1859 MUST_USE_RESULT MaybeObject* UpdateMapCodeCache(String* name, Code* code); | 1915 MUST_USE_RESULT MaybeObject* UpdateMapCodeCache(String* name, Code* code); |
1860 | 1916 |
1861 // Transform slow named properties to fast variants. | 1917 // Transform slow named properties to fast variants. |
1862 // Returns failure if allocation failed. | 1918 // Returns failure if allocation failed. |
1919 static void TransformToFastProperties(Handle<JSObject> object, | |
1920 int unused_property_fields); | |
1921 | |
1863 MUST_USE_RESULT MaybeObject* TransformToFastProperties( | 1922 MUST_USE_RESULT MaybeObject* TransformToFastProperties( |
1864 int unused_property_fields); | 1923 int unused_property_fields); |
1865 | 1924 |
1866 // Access fast-case object properties at index. | 1925 // Access fast-case object properties at index. |
1867 inline Object* FastPropertyAt(int index); | 1926 inline Object* FastPropertyAt(int index); |
1868 inline Object* FastPropertyAtPut(int index, Object* value); | 1927 inline Object* FastPropertyAtPut(int index, Object* value); |
1869 | 1928 |
1870 // Access to in object properties. | 1929 // Access to in object properties. |
1871 inline int GetInObjectPropertyOffset(int index); | 1930 inline int GetInObjectPropertyOffset(int index); |
1872 inline Object* InObjectPropertyAt(int index); | 1931 inline Object* InObjectPropertyAt(int index); |
(...skipping 11 matching lines...) Expand all Loading... | |
1884 Object* pre_allocated_value, | 1943 Object* pre_allocated_value, |
1885 Object* filler_value); | 1944 Object* filler_value); |
1886 | 1945 |
1887 // Check whether this object references another object | 1946 // Check whether this object references another object |
1888 bool ReferencesObject(Object* obj); | 1947 bool ReferencesObject(Object* obj); |
1889 | 1948 |
1890 // Casting. | 1949 // Casting. |
1891 static inline JSObject* cast(Object* obj); | 1950 static inline JSObject* cast(Object* obj); |
1892 | 1951 |
1893 // Disalow further properties to be added to the object. | 1952 // Disalow further properties to be added to the object. |
1953 static Handle<Object> PreventExtensions(Handle<JSObject> object); | |
1894 MUST_USE_RESULT MaybeObject* PreventExtensions(); | 1954 MUST_USE_RESULT MaybeObject* PreventExtensions(); |
1895 | 1955 |
1896 | 1956 |
1897 // Dispatched behavior. | 1957 // Dispatched behavior. |
1898 void JSObjectShortPrint(StringStream* accumulator); | 1958 void JSObjectShortPrint(StringStream* accumulator); |
1899 #ifdef OBJECT_PRINT | 1959 #ifdef OBJECT_PRINT |
1900 inline void JSObjectPrint() { | 1960 inline void JSObjectPrint() { |
1901 JSObjectPrint(stdout); | 1961 JSObjectPrint(stdout); |
1902 } | 1962 } |
1903 void JSObjectPrint(FILE* out); | 1963 void JSObjectPrint(FILE* out); |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2959 return reinterpret_cast<NumberDictionary*>(obj); | 3019 return reinterpret_cast<NumberDictionary*>(obj); |
2960 } | 3020 } |
2961 | 3021 |
2962 // Type specific at put (default NONE attributes is used when adding). | 3022 // Type specific at put (default NONE attributes is used when adding). |
2963 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value); | 3023 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value); |
2964 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, | 3024 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, |
2965 Object* value, | 3025 Object* value, |
2966 PropertyDetails details); | 3026 PropertyDetails details); |
2967 | 3027 |
2968 // Set an existing entry or add a new one if needed. | 3028 // Set an existing entry or add a new one if needed. |
3029 // Return the updated dictionary. | |
3030 MUST_USE_RESULT static Handle<NumberDictionary> Set( | |
3031 Handle<NumberDictionary> dictionary, | |
3032 uint32_t index, | |
3033 Handle<Object> value, | |
3034 PropertyDetails details); | |
3035 | |
2969 MUST_USE_RESULT MaybeObject* Set(uint32_t key, | 3036 MUST_USE_RESULT MaybeObject* Set(uint32_t key, |
2970 Object* value, | 3037 Object* value, |
2971 PropertyDetails details); | 3038 PropertyDetails details); |
2972 | 3039 |
2973 void UpdateMaxNumberKey(uint32_t key); | 3040 void UpdateMaxNumberKey(uint32_t key); |
2974 | 3041 |
2975 // If slow elements are required we will never go back to fast-case | 3042 // If slow elements are required we will never go back to fast-case |
2976 // for the elements kept in this dictionary. We require slow | 3043 // for the elements kept in this dictionary. We require slow |
2977 // elements if an element has been added at an index larger than | 3044 // elements if an element has been added at an index larger than |
2978 // kRequiresSlowElementsLimit or set_requires_slow_elements() has been called | 3045 // kRequiresSlowElementsLimit or set_requires_slow_elements() has been called |
(...skipping 5022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8001 } else { | 8068 } else { |
8002 value &= ~(1 << bit_position); | 8069 value &= ~(1 << bit_position); |
8003 } | 8070 } |
8004 return value; | 8071 return value; |
8005 } | 8072 } |
8006 }; | 8073 }; |
8007 | 8074 |
8008 } } // namespace v8::internal | 8075 } } // namespace v8::internal |
8009 | 8076 |
8010 #endif // V8_OBJECTS_H_ | 8077 #endif // V8_OBJECTS_H_ |
OLD | NEW |