OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1341 }; | 1341 }; |
1342 | 1342 |
1343 | 1343 |
1344 enum EnsureElementsMode { | 1344 enum EnsureElementsMode { |
1345 DONT_ALLOW_DOUBLE_ELEMENTS, | 1345 DONT_ALLOW_DOUBLE_ELEMENTS, |
1346 ALLOW_COPIED_DOUBLE_ELEMENTS, | 1346 ALLOW_COPIED_DOUBLE_ELEMENTS, |
1347 ALLOW_CONVERTED_DOUBLE_ELEMENTS | 1347 ALLOW_CONVERTED_DOUBLE_ELEMENTS |
1348 }; | 1348 }; |
1349 | 1349 |
1350 | 1350 |
1351 // Indicates whether a property should be set or (re)defined. Setting of a | |
1352 // property causes attributes to remain unchanged, writability to be checked | |
1353 // and callbacks to be called. Defining of a property causes attributes to | |
1354 // remain unchanged and callbacks to be overridden. | |
Sven Panne
2012/02/23 11:04:20
Defining => attributes get updated
Michael Starzinger
2012/02/23 11:43:42
Done.
| |
1355 enum SetPropertyMode { | |
1356 SET_PROPERTY, | |
1357 DEFINE_PROPERTY | |
1358 }; | |
1359 | |
1360 | |
1351 // JSReceiver includes types on which properties can be defined, i.e., | 1361 // JSReceiver includes types on which properties can be defined, i.e., |
1352 // JSObject and JSProxy. | 1362 // JSObject and JSProxy. |
1353 class JSReceiver: public HeapObject { | 1363 class JSReceiver: public HeapObject { |
1354 public: | 1364 public: |
1355 enum DeleteMode { | 1365 enum DeleteMode { |
1356 NORMAL_DELETION, | 1366 NORMAL_DELETION, |
1357 STRICT_DELETION, | 1367 STRICT_DELETION, |
1358 FORCE_DELETION | 1368 FORCE_DELETION |
1359 }; | 1369 }; |
1360 | 1370 |
(...skipping 18 matching lines...) Expand all Loading... | |
1379 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSReceiver* setter, | 1389 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSReceiver* setter, |
1380 Object* value); | 1390 Object* value); |
1381 | 1391 |
1382 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); | 1392 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); |
1383 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); | 1393 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); |
1384 | 1394 |
1385 // Set the index'th array element. | 1395 // Set the index'th array element. |
1386 // Can cause GC, or return failure if GC is required. | 1396 // Can cause GC, or return failure if GC is required. |
1387 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, | 1397 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, |
1388 Object* value, | 1398 Object* value, |
1399 PropertyAttributes attributes, | |
1389 StrictModeFlag strict_mode, | 1400 StrictModeFlag strict_mode, |
1390 bool check_prototype); | 1401 bool check_prototype); |
1391 | 1402 |
1392 // Tests for the fast common case for property enumeration. | 1403 // Tests for the fast common case for property enumeration. |
1393 bool IsSimpleEnum(); | 1404 bool IsSimpleEnum(); |
1394 | 1405 |
1395 // Returns the class name ([[Class]] property in the specification). | 1406 // Returns the class name ([[Class]] property in the specification). |
1396 String* class_name(); | 1407 String* class_name(); |
1397 | 1408 |
1398 // Returns the constructor name (the name (possibly, inferred name) of the | 1409 // Returns the constructor name (the name (possibly, inferred name) of the |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1732 LocalElementType HasLocalElement(uint32_t index); | 1743 LocalElementType HasLocalElement(uint32_t index); |
1733 | 1744 |
1734 bool HasElementWithInterceptor(JSReceiver* receiver, uint32_t index); | 1745 bool HasElementWithInterceptor(JSReceiver* receiver, uint32_t index); |
1735 bool HasElementPostInterceptor(JSReceiver* receiver, uint32_t index); | 1746 bool HasElementPostInterceptor(JSReceiver* receiver, uint32_t index); |
1736 | 1747 |
1737 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index, | 1748 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index, |
1738 Object* value, | 1749 Object* value, |
1739 StrictModeFlag strict_mode, | 1750 StrictModeFlag strict_mode, |
1740 bool check_prototype); | 1751 bool check_prototype); |
1741 | 1752 |
1742 MUST_USE_RESULT MaybeObject* SetDictionaryElement(uint32_t index, | 1753 MUST_USE_RESULT MaybeObject* SetDictionaryElement( |
1743 Object* value, | 1754 uint32_t index, |
1744 StrictModeFlag strict_mode, | 1755 Object* value, |
1745 bool check_prototype); | 1756 PropertyAttributes attributes, |
1757 StrictModeFlag strict_mode, | |
1758 bool check_prototype, | |
1759 SetPropertyMode set_mode = SET_PROPERTY); | |
1746 | 1760 |
1747 MUST_USE_RESULT MaybeObject* SetFastDoubleElement( | 1761 MUST_USE_RESULT MaybeObject* SetFastDoubleElement( |
1748 uint32_t index, | 1762 uint32_t index, |
1749 Object* value, | 1763 Object* value, |
1750 StrictModeFlag strict_mode, | 1764 StrictModeFlag strict_mode, |
1751 bool check_prototype = true); | 1765 bool check_prototype = true); |
1752 | 1766 |
1753 | |
1754 static Handle<Object> SetOwnElement(Handle<JSObject> object, | 1767 static Handle<Object> SetOwnElement(Handle<JSObject> object, |
1755 uint32_t index, | 1768 uint32_t index, |
1756 Handle<Object> value, | 1769 Handle<Object> value, |
1757 StrictModeFlag strict_mode); | 1770 StrictModeFlag strict_mode); |
1758 | 1771 |
1759 // Empty handle is returned if the element cannot be set to the given value. | 1772 // Empty handle is returned if the element cannot be set to the given value. |
1760 static MUST_USE_RESULT Handle<Object> SetElement(Handle<JSObject> object, | 1773 static MUST_USE_RESULT Handle<Object> SetElement( |
1761 uint32_t index, | 1774 Handle<JSObject> object, |
1762 Handle<Object> value, | 1775 uint32_t index, |
1763 StrictModeFlag strict_mode); | 1776 Handle<Object> value, |
1777 PropertyAttributes attr, | |
1778 StrictModeFlag strict_mode, | |
1779 SetPropertyMode set_mode = SET_PROPERTY); | |
1764 | 1780 |
1765 // A Failure object is returned if GC is needed. | 1781 // A Failure object is returned if GC is needed. |
1766 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, | 1782 MUST_USE_RESULT MaybeObject* SetElement( |
1767 Object* value, | 1783 uint32_t index, |
1768 StrictModeFlag strict_mode, | 1784 Object* value, |
1769 bool check_prototype); | 1785 PropertyAttributes attributes, |
1786 StrictModeFlag strict_mode, | |
1787 bool check_prototype = true, | |
1788 SetPropertyMode set_mode = SET_PROPERTY); | |
1770 | 1789 |
1771 // Returns the index'th element. | 1790 // Returns the index'th element. |
1772 // The undefined object if index is out of bounds. | 1791 // The undefined object if index is out of bounds. |
1773 MUST_USE_RESULT MaybeObject* GetElementWithInterceptor(Object* receiver, | 1792 MUST_USE_RESULT MaybeObject* GetElementWithInterceptor(Object* receiver, |
1774 uint32_t index); | 1793 uint32_t index); |
1775 | 1794 |
1776 enum SetFastElementsCapacityMode { | 1795 enum SetFastElementsCapacityMode { |
1777 kAllowSmiOnlyElements, | 1796 kAllowSmiOnlyElements, |
1778 kForceSmiOnlyElements, | 1797 kForceSmiOnlyElements, |
1779 kDontAllowSmiOnlyElements | 1798 kDontAllowSmiOnlyElements |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2080 Object* holder); | 2099 Object* holder); |
2081 MUST_USE_RESULT MaybeObject* SetElementWithCallback( | 2100 MUST_USE_RESULT MaybeObject* SetElementWithCallback( |
2082 Object* structure, | 2101 Object* structure, |
2083 uint32_t index, | 2102 uint32_t index, |
2084 Object* value, | 2103 Object* value, |
2085 JSObject* holder, | 2104 JSObject* holder, |
2086 StrictModeFlag strict_mode); | 2105 StrictModeFlag strict_mode); |
2087 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor( | 2106 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor( |
2088 uint32_t index, | 2107 uint32_t index, |
2089 Object* value, | 2108 Object* value, |
2109 PropertyAttributes attributes, | |
2090 StrictModeFlag strict_mode, | 2110 StrictModeFlag strict_mode, |
2091 bool check_prototype); | 2111 bool check_prototype, |
2112 SetPropertyMode set_mode); | |
2092 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( | 2113 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( |
2093 uint32_t index, | 2114 uint32_t index, |
2094 Object* value, | 2115 Object* value, |
2116 PropertyAttributes attributes, | |
2095 StrictModeFlag strict_mode, | 2117 StrictModeFlag strict_mode, |
2096 bool check_prototype); | 2118 bool check_prototype, |
2119 SetPropertyMode set_mode); | |
2097 | 2120 |
2098 // Searches the prototype chain for a callback setter and sets the property | 2121 // Searches the prototype chain for a callback setter and sets the property |
2099 // with the setter if it finds one. The '*found' flag indicates whether | 2122 // with the setter if it finds one. The '*found' flag indicates whether |
2100 // a setter was found or not. | 2123 // a setter was found or not. |
2101 // This function can cause GC and can return a failure result with | 2124 // This function can cause GC and can return a failure result with |
2102 // '*found==true'. | 2125 // '*found==true'. |
2103 MUST_USE_RESULT MaybeObject* SetPropertyWithCallbackSetterInPrototypes( | 2126 MUST_USE_RESULT MaybeObject* SetPropertyWithCallbackSetterInPrototypes( |
2104 String* name, | 2127 String* name, |
2105 Object* value, | 2128 Object* value, |
2106 PropertyAttributes attributes, | 2129 PropertyAttributes attributes, |
(...skipping 6252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8359 } else { | 8382 } else { |
8360 value &= ~(1 << bit_position); | 8383 value &= ~(1 << bit_position); |
8361 } | 8384 } |
8362 return value; | 8385 return value; |
8363 } | 8386 } |
8364 }; | 8387 }; |
8365 | 8388 |
8366 } } // namespace v8::internal | 8389 } } // namespace v8::internal |
8367 | 8390 |
8368 #endif // V8_OBJECTS_H_ | 8391 #endif // V8_OBJECTS_H_ |
OLD | NEW |