| 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 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 MUST_USE_RESULT MaybeObject* SetProperty( | 1656 MUST_USE_RESULT MaybeObject* SetProperty( |
| 1657 LookupResult* result, | 1657 LookupResult* result, |
| 1658 Name* key, | 1658 Name* key, |
| 1659 Object* value, | 1659 Object* value, |
| 1660 PropertyAttributes attributes, | 1660 PropertyAttributes attributes, |
| 1661 StrictModeFlag strict_mode, | 1661 StrictModeFlag strict_mode, |
| 1662 StoreFromKeyed store_from_keyed = MAY_BE_STORE_FROM_KEYED); | 1662 StoreFromKeyed store_from_keyed = MAY_BE_STORE_FROM_KEYED); |
| 1663 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSReceiver* setter, | 1663 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSReceiver* setter, |
| 1664 Object* value); | 1664 Object* value); |
| 1665 | 1665 |
| 1666 MUST_USE_RESULT MaybeObject* DeleteProperty(Name* name, DeleteMode mode); | 1666 static Handle<Object> DeleteProperty(Handle<JSReceiver> object, |
| 1667 Handle<Name> name, |
| 1668 DeleteMode mode = NORMAL_DELETION); |
| 1667 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); | 1669 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); |
| 1668 | 1670 |
| 1669 // Set the index'th array element. | 1671 // Set the index'th array element. |
| 1670 // Can cause GC, or return failure if GC is required. | 1672 // Can cause GC, or return failure if GC is required. |
| 1671 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, | 1673 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, |
| 1672 Object* value, | 1674 Object* value, |
| 1673 PropertyAttributes attributes, | 1675 PropertyAttributes attributes, |
| 1674 StrictModeFlag strict_mode, | 1676 StrictModeFlag strict_mode, |
| 1675 bool check_prototype); | 1677 bool check_prototype); |
| 1676 | 1678 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1894 // Handles the special representation of JS global objects. | 1896 // Handles the special representation of JS global objects. |
| 1895 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object, | 1897 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object, |
| 1896 Handle<Name> key, | 1898 Handle<Name> key, |
| 1897 Handle<Object> value, | 1899 Handle<Object> value, |
| 1898 PropertyDetails details); | 1900 PropertyDetails details); |
| 1899 | 1901 |
| 1900 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(Name* name, | 1902 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(Name* name, |
| 1901 Object* value, | 1903 Object* value, |
| 1902 PropertyDetails details); | 1904 PropertyDetails details); |
| 1903 | 1905 |
| 1904 // Deletes the named property in a normalized object. | |
| 1905 MUST_USE_RESULT MaybeObject* DeleteNormalizedProperty(Name* name, | |
| 1906 DeleteMode mode); | |
| 1907 | |
| 1908 static void OptimizeAsPrototype(Handle<JSObject> object); | 1906 static void OptimizeAsPrototype(Handle<JSObject> object); |
| 1909 MUST_USE_RESULT MaybeObject* OptimizeAsPrototype(); | 1907 MUST_USE_RESULT MaybeObject* OptimizeAsPrototype(); |
| 1910 | 1908 |
| 1911 // Retrieve interceptors. | 1909 // Retrieve interceptors. |
| 1912 InterceptorInfo* GetNamedInterceptor(); | 1910 InterceptorInfo* GetNamedInterceptor(); |
| 1913 InterceptorInfo* GetIndexedInterceptor(); | 1911 InterceptorInfo* GetIndexedInterceptor(); |
| 1914 | 1912 |
| 1915 // Used from JSReceiver. | 1913 // Used from JSReceiver. |
| 1916 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, | 1914 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, |
| 1917 Name* name, | 1915 Name* name, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1988 // Deletes a hidden property. Deleting a non-existing property is | 1986 // Deletes a hidden property. Deleting a non-existing property is |
| 1989 // considered successful. | 1987 // considered successful. |
| 1990 void DeleteHiddenProperty(Name* key); | 1988 void DeleteHiddenProperty(Name* key); |
| 1991 // Returns true if the object has a property with the hidden string as name. | 1989 // Returns true if the object has a property with the hidden string as name. |
| 1992 bool HasHiddenProperties(); | 1990 bool HasHiddenProperties(); |
| 1993 | 1991 |
| 1994 static int GetIdentityHash(Handle<JSObject> obj); | 1992 static int GetIdentityHash(Handle<JSObject> obj); |
| 1995 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 1993 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); |
| 1996 MUST_USE_RESULT MaybeObject* SetIdentityHash(Smi* hash, CreationFlag flag); | 1994 MUST_USE_RESULT MaybeObject* SetIdentityHash(Smi* hash, CreationFlag flag); |
| 1997 | 1995 |
| 1998 static Handle<Object> DeleteProperty(Handle<JSObject> obj, | |
| 1999 Handle<Name> name); | |
| 2000 // Can cause GC. | |
| 2001 MUST_USE_RESULT MaybeObject* DeleteProperty(Name* name, DeleteMode mode); | |
| 2002 | |
| 2003 static Handle<Object> DeleteElement(Handle<JSObject> obj, uint32_t index); | 1996 static Handle<Object> DeleteElement(Handle<JSObject> obj, uint32_t index); |
| 2004 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); | 1997 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); |
| 2005 | 1998 |
| 2006 inline void ValidateElements(); | 1999 inline void ValidateElements(); |
| 2007 | 2000 |
| 2008 // Makes sure that this object can contain HeapObject as elements. | 2001 // Makes sure that this object can contain HeapObject as elements. |
| 2009 MUST_USE_RESULT inline MaybeObject* EnsureCanContainHeapObjectElements(); | 2002 MUST_USE_RESULT inline MaybeObject* EnsureCanContainHeapObjectElements(); |
| 2010 | 2003 |
| 2011 // Makes sure that this object can contain the specified elements. | 2004 // Makes sure that this object can contain the specified elements. |
| 2012 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( | 2005 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2423 static void EnqueueChangeRecord(Handle<JSObject> object, | 2416 static void EnqueueChangeRecord(Handle<JSObject> object, |
| 2424 const char* type, | 2417 const char* type, |
| 2425 Handle<Name> name, | 2418 Handle<Name> name, |
| 2426 Handle<Object> old_value); | 2419 Handle<Object> old_value); |
| 2427 | 2420 |
| 2428 // Deliver change records to observers. May cause GC. | 2421 // Deliver change records to observers. May cause GC. |
| 2429 static void DeliverChangeRecords(Isolate* isolate); | 2422 static void DeliverChangeRecords(Isolate* isolate); |
| 2430 | 2423 |
| 2431 private: | 2424 private: |
| 2432 friend class DictionaryElementsAccessor; | 2425 friend class DictionaryElementsAccessor; |
| 2426 friend class JSReceiver; |
| 2433 | 2427 |
| 2434 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, | 2428 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, |
| 2435 Object* structure, | 2429 Object* structure, |
| 2436 uint32_t index, | 2430 uint32_t index, |
| 2437 Object* holder); | 2431 Object* holder); |
| 2438 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( | 2432 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( |
| 2439 JSReceiver* receiver, | 2433 JSReceiver* receiver, |
| 2440 uint32_t index, | 2434 uint32_t index, |
| 2441 bool continue_search); | 2435 bool continue_search); |
| 2442 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( | 2436 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2468 // has a setter, invoke it and set '*done' to true. If it is found and is | 2462 // has a setter, invoke it and set '*done' to true. If it is found and is |
| 2469 // read-only, reject and set '*done' to true. Otherwise, set '*done' to | 2463 // read-only, reject and set '*done' to true. Otherwise, set '*done' to |
| 2470 // false. Can cause GC and can return a failure result with '*done==true'. | 2464 // false. Can cause GC and can return a failure result with '*done==true'. |
| 2471 MUST_USE_RESULT MaybeObject* SetPropertyViaPrototypes( | 2465 MUST_USE_RESULT MaybeObject* SetPropertyViaPrototypes( |
| 2472 Name* name, | 2466 Name* name, |
| 2473 Object* value, | 2467 Object* value, |
| 2474 PropertyAttributes attributes, | 2468 PropertyAttributes attributes, |
| 2475 StrictModeFlag strict_mode, | 2469 StrictModeFlag strict_mode, |
| 2476 bool* done); | 2470 bool* done); |
| 2477 | 2471 |
| 2478 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(Name* name, | 2472 static Handle<Object> DeleteProperty(Handle<JSObject> object, |
| 2479 DeleteMode mode); | 2473 Handle<Name> name, |
| 2480 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(Name* name); | 2474 DeleteMode mode); |
| 2475 static Handle<Object> DeletePropertyPostInterceptor(Handle<JSObject> object, |
| 2476 Handle<Name> name, |
| 2477 DeleteMode mode); |
| 2478 static Handle<Object> DeletePropertyWithInterceptor(Handle<JSObject> object, |
| 2479 Handle<Name> name); |
| 2480 |
| 2481 // Deletes the named property in a normalized object. |
| 2482 static Handle<Object> DeleteNormalizedProperty(Handle<JSObject> object, |
| 2483 Handle<Name> name, |
| 2484 DeleteMode mode); |
| 2481 | 2485 |
| 2482 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index); | 2486 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index); |
| 2483 | 2487 |
| 2484 MUST_USE_RESULT MaybeObject* DeleteFastElement(uint32_t index); | 2488 MUST_USE_RESULT MaybeObject* DeleteFastElement(uint32_t index); |
| 2485 MUST_USE_RESULT MaybeObject* DeleteDictionaryElement(uint32_t index, | 2489 MUST_USE_RESULT MaybeObject* DeleteDictionaryElement(uint32_t index, |
| 2486 DeleteMode mode); | 2490 DeleteMode mode); |
| 2487 | 2491 |
| 2488 bool ReferencesObjectFromElements(FixedArray* elements, | 2492 bool ReferencesObjectFromElements(FixedArray* elements, |
| 2489 ElementsKind kind, | 2493 ElementsKind kind, |
| 2490 Object* object); | 2494 Object* object); |
| (...skipping 2953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5444 inline bool is_deprecated(); | 5448 inline bool is_deprecated(); |
| 5445 inline bool CanBeDeprecated(); | 5449 inline bool CanBeDeprecated(); |
| 5446 // Returns a non-deprecated version of the input. If the input was not | 5450 // Returns a non-deprecated version of the input. If the input was not |
| 5447 // deprecated, it is directly returned. Otherwise, the non-deprecated version | 5451 // deprecated, it is directly returned. Otherwise, the non-deprecated version |
| 5448 // is found by re-transitioning from the root of the transition tree using the | 5452 // is found by re-transitioning from the root of the transition tree using the |
| 5449 // descriptor array of the map. Returns NULL if no updated map is found. | 5453 // descriptor array of the map. Returns NULL if no updated map is found. |
| 5450 Map* CurrentMapForDeprecated(); | 5454 Map* CurrentMapForDeprecated(); |
| 5451 | 5455 |
| 5452 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); | 5456 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); |
| 5453 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); | 5457 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); |
| 5458 static Handle<Map> CopyDropDescriptors(Handle<Map> map); |
| 5454 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); | 5459 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); |
| 5455 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors( | 5460 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors( |
| 5456 DescriptorArray* descriptors, | 5461 DescriptorArray* descriptors, |
| 5457 TransitionFlag flag, | 5462 TransitionFlag flag, |
| 5458 Name* name = NULL, | 5463 Name* name = NULL, |
| 5459 SimpleTransitionFlag simple_flag = FULL_TRANSITION); | 5464 SimpleTransitionFlag simple_flag = FULL_TRANSITION); |
| 5460 MUST_USE_RESULT MaybeObject* CopyInstallDescriptors( | 5465 MUST_USE_RESULT MaybeObject* CopyInstallDescriptors( |
| 5461 int new_descriptor, | 5466 int new_descriptor, |
| 5462 DescriptorArray* descriptors); | 5467 DescriptorArray* descriptors); |
| 5463 MUST_USE_RESULT MaybeObject* ShareDescriptor(DescriptorArray* descriptors, | 5468 MUST_USE_RESULT MaybeObject* ShareDescriptor(DescriptorArray* descriptors, |
| (...skipping 3191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8655 // that is read-only, throw. In all these cases set '*done' to true, | 8660 // that is read-only, throw. In all these cases set '*done' to true, |
| 8656 // otherwise set it to false. | 8661 // otherwise set it to false. |
| 8657 MUST_USE_RESULT MaybeObject* SetPropertyViaPrototypesWithHandler( | 8662 MUST_USE_RESULT MaybeObject* SetPropertyViaPrototypesWithHandler( |
| 8658 JSReceiver* receiver, | 8663 JSReceiver* receiver, |
| 8659 Name* name, | 8664 Name* name, |
| 8660 Object* value, | 8665 Object* value, |
| 8661 PropertyAttributes attributes, | 8666 PropertyAttributes attributes, |
| 8662 StrictModeFlag strict_mode, | 8667 StrictModeFlag strict_mode, |
| 8663 bool* done); | 8668 bool* done); |
| 8664 | 8669 |
| 8665 MUST_USE_RESULT MaybeObject* DeletePropertyWithHandler( | |
| 8666 Name* name, | |
| 8667 DeleteMode mode); | |
| 8668 MUST_USE_RESULT MaybeObject* DeleteElementWithHandler( | |
| 8669 uint32_t index, | |
| 8670 DeleteMode mode); | |
| 8671 | |
| 8672 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( | 8670 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( |
| 8673 JSReceiver* receiver, | 8671 JSReceiver* receiver, |
| 8674 Name* name); | 8672 Name* name); |
| 8675 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithHandler( | 8673 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithHandler( |
| 8676 JSReceiver* receiver, | 8674 JSReceiver* receiver, |
| 8677 uint32_t index); | 8675 uint32_t index); |
| 8678 | 8676 |
| 8679 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 8677 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); |
| 8680 | 8678 |
| 8681 // Turn this into an (empty) JSObject. | 8679 // Turn this into an (empty) JSObject. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 8705 static const int kHeaderSize = kPaddingOffset; | 8703 static const int kHeaderSize = kPaddingOffset; |
| 8706 static const int kPaddingSize = kSize - kPaddingOffset; | 8704 static const int kPaddingSize = kSize - kPaddingOffset; |
| 8707 | 8705 |
| 8708 STATIC_CHECK(kPaddingSize >= 0); | 8706 STATIC_CHECK(kPaddingSize >= 0); |
| 8709 | 8707 |
| 8710 typedef FixedBodyDescriptor<kHandlerOffset, | 8708 typedef FixedBodyDescriptor<kHandlerOffset, |
| 8711 kPaddingOffset, | 8709 kPaddingOffset, |
| 8712 kSize> BodyDescriptor; | 8710 kSize> BodyDescriptor; |
| 8713 | 8711 |
| 8714 private: | 8712 private: |
| 8713 friend class JSReceiver; |
| 8714 |
| 8715 static Handle<Object> DeletePropertyWithHandler(Handle<JSProxy> object, |
| 8716 Handle<Name> name, |
| 8717 DeleteMode mode); |
| 8718 MUST_USE_RESULT MaybeObject* DeleteElementWithHandler(uint32_t index, |
| 8719 DeleteMode mode); |
| 8720 |
| 8715 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); | 8721 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); |
| 8716 }; | 8722 }; |
| 8717 | 8723 |
| 8718 | 8724 |
| 8719 class JSFunctionProxy: public JSProxy { | 8725 class JSFunctionProxy: public JSProxy { |
| 8720 public: | 8726 public: |
| 8721 // [call_trap]: The call trap. | 8727 // [call_trap]: The call trap. |
| 8722 DECL_ACCESSORS(call_trap, Object) | 8728 DECL_ACCESSORS(call_trap, Object) |
| 8723 | 8729 |
| 8724 // [construct_trap]: The construct trap. | 8730 // [construct_trap]: The construct trap. |
| (...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9743 } else { | 9749 } else { |
| 9744 value &= ~(1 << bit_position); | 9750 value &= ~(1 << bit_position); |
| 9745 } | 9751 } |
| 9746 return value; | 9752 return value; |
| 9747 } | 9753 } |
| 9748 }; | 9754 }; |
| 9749 | 9755 |
| 9750 } } // namespace v8::internal | 9756 } } // namespace v8::internal |
| 9751 | 9757 |
| 9752 #endif // V8_OBJECTS_H_ | 9758 #endif // V8_OBJECTS_H_ |
| OLD | NEW |