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