Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Side by Side Diff: src/objects.h

Issue 1368753003: Add C++ implementation of Object.defineProperties (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: refactored Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 class FixedArrayBase; 852 class FixedArrayBase;
853 class FunctionLiteral; 853 class FunctionLiteral;
854 class GlobalObject; 854 class GlobalObject;
855 class JSBuiltinsObject; 855 class JSBuiltinsObject;
856 class LayoutDescriptor; 856 class LayoutDescriptor;
857 class LiteralsArray; 857 class LiteralsArray;
858 class LookupIterator; 858 class LookupIterator;
859 class ObjectHashTable; 859 class ObjectHashTable;
860 class ObjectVisitor; 860 class ObjectVisitor;
861 class PropertyCell; 861 class PropertyCell;
862 class PropertyDescriptor;
862 class SafepointEntry; 863 class SafepointEntry;
863 class SharedFunctionInfo; 864 class SharedFunctionInfo;
864 class StringStream; 865 class StringStream;
865 class TypeFeedbackInfo; 866 class TypeFeedbackInfo;
866 class TypeFeedbackVector; 867 class TypeFeedbackVector;
867 class WeakCell; 868 class WeakCell;
868 869
869 // We cannot just say "class HeapType;" if it is created from a template... =8-? 870 // We cannot just say "class HeapType;" if it is created from a template... =8-?
870 template<class> class TypeImpl; 871 template<class> class TypeImpl;
871 struct HeapTypeConfig; 872 struct HeapTypeConfig;
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 LanguageMode language_mode = SLOPPY); 1810 LanguageMode language_mode = SLOPPY);
1810 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty( 1811 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty(
1811 Handle<JSReceiver> object, Handle<Name> name, 1812 Handle<JSReceiver> object, Handle<Name> name,
1812 LanguageMode language_mode = SLOPPY); 1813 LanguageMode language_mode = SLOPPY);
1813 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty( 1814 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty(
1814 LookupIterator* it, LanguageMode language_mode); 1815 LookupIterator* it, LanguageMode language_mode);
1815 MUST_USE_RESULT static MaybeHandle<Object> DeleteElement( 1816 MUST_USE_RESULT static MaybeHandle<Object> DeleteElement(
1816 Handle<JSReceiver> object, uint32_t index, 1817 Handle<JSReceiver> object, uint32_t index,
1817 LanguageMode language_mode = SLOPPY); 1818 LanguageMode language_mode = SLOPPY);
1818 1819
1820 MUST_USE_RESULT static Object* DefineProperty(Isolate* isolate,
1821 Handle<Object> o,
Toon Verwaest 2015/10/06 15:55:18 Please write out o as object
Jakob Kummerow 2015/10/09 13:46:12 Done. (I was following the spec's naming.)
1822 Handle<Object> name,
Toon Verwaest 2015/10/06 15:55:18 Whenever type is object, I'd rather talk about "ke
Jakob Kummerow 2015/10/09 13:46:12 Done.
1823 Handle<Object> attributes);
1824 MUST_USE_RESULT static Object* DefineProperties(Isolate* isolate,
1825 Handle<Object> o,
1826 Handle<Object> properties);
1827
1828 // "virtual" dispatcher to the correct [[DefineOwnProperty]] implementation.
1829 static bool DefineOwnProperty(Isolate* isolate, Handle<JSObject> obj,
1830 Handle<Object> name, PropertyDescriptor* desc,
1831 bool should_throw);
1832
1833 static bool OrdinaryDefineOwnProperty(Isolate* isolate, Handle<JSObject> o,
1834 Handle<Object> name,
1835 PropertyDescriptor* desc,
1836 bool should_throw);
Toon Verwaest 2015/10/06 15:55:18 replace bool should_throw with enum
Jakob Kummerow 2015/10/09 13:46:12 Done.
1837 static bool OrdinaryDefineOwnProperty(LookupIterator* it,
1838 PropertyDescriptor* desc,
1839 bool should_throw);
1840
1841 static bool GetOwnPropertyDescriptor(Isolate* isolate, Handle<JSObject> obj,
Toon Verwaest 2015/10/06 15:55:18 obj -> object
Jakob Kummerow 2015/10/09 13:46:12 Done.
1842 Handle<Object> name,
1843 PropertyDescriptor* desc);
1844 static bool GetOwnPropertyDescriptor(LookupIterator* it,
1845 PropertyDescriptor* desc);
1846
1819 // Tests for the fast common case for property enumeration. 1847 // Tests for the fast common case for property enumeration.
1820 bool IsSimpleEnum(); 1848 bool IsSimpleEnum();
1821 1849
1822 // Returns the class name ([[Class]] property in the specification). 1850 // Returns the class name ([[Class]] property in the specification).
1823 String* class_name(); 1851 String* class_name();
1824 1852
1825 // Returns the constructor name (the name (possibly, inferred name) of the 1853 // Returns the constructor name (the name (possibly, inferred name) of the
1826 // function that was used to instantiate the object). 1854 // function that was used to instantiate the object).
1827 String* constructor_name(); 1855 String* constructor_name();
1828 1856
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 Handle<Name> name, 2083 Handle<Name> name,
2056 AccessorComponent component); 2084 AccessorComponent component);
2057 2085
2058 // Defines an AccessorPair property on the given object. 2086 // Defines an AccessorPair property on the given object.
2059 // TODO(mstarzinger): Rename to SetAccessor(). 2087 // TODO(mstarzinger): Rename to SetAccessor().
2060 static MaybeHandle<Object> DefineAccessor(Handle<JSObject> object, 2088 static MaybeHandle<Object> DefineAccessor(Handle<JSObject> object,
2061 Handle<Name> name, 2089 Handle<Name> name,
2062 Handle<Object> getter, 2090 Handle<Object> getter,
2063 Handle<Object> setter, 2091 Handle<Object> setter,
2064 PropertyAttributes attributes); 2092 PropertyAttributes attributes);
2093 static MaybeHandle<Object> DefineAccessor(LookupIterator* it,
2094 Handle<Object> getter,
2095 Handle<Object> setter,
2096 PropertyAttributes attributes);
2065 2097
2066 // Defines an AccessorInfo property on the given object. 2098 // Defines an AccessorInfo property on the given object.
2067 MUST_USE_RESULT static MaybeHandle<Object> SetAccessor( 2099 MUST_USE_RESULT static MaybeHandle<Object> SetAccessor(
2068 Handle<JSObject> object, 2100 Handle<JSObject> object,
2069 Handle<AccessorInfo> info); 2101 Handle<AccessorInfo> info);
2070 2102
2071 // The result must be checked first for exceptions. If there's no exception, 2103 // The result must be checked first for exceptions. If there's no exception,
2072 // the output parameter |done| indicates whether the interceptor has a result 2104 // the output parameter |done| indicates whether the interceptor has a result
2073 // or not. 2105 // or not.
2074 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithInterceptor( 2106 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithInterceptor(
(...skipping 7939 matching lines...) Expand 10 before | Expand all | Expand 10 after
10014 10046
10015 static void SetLength(Handle<JSArray> array, uint32_t length); 10047 static void SetLength(Handle<JSArray> array, uint32_t length);
10016 // Same as above but will also queue splice records if |array| is observed. 10048 // Same as above but will also queue splice records if |array| is observed.
10017 static MaybeHandle<Object> ObservableSetLength(Handle<JSArray> array, 10049 static MaybeHandle<Object> ObservableSetLength(Handle<JSArray> array,
10018 uint32_t length); 10050 uint32_t length);
10019 10051
10020 // Set the content of the array to the content of storage. 10052 // Set the content of the array to the content of storage.
10021 static inline void SetContent(Handle<JSArray> array, 10053 static inline void SetContent(Handle<JSArray> array,
10022 Handle<FixedArrayBase> storage); 10054 Handle<FixedArrayBase> storage);
10023 10055
10056 static bool DefineOwnProperty(Isolate* isolate, Handle<JSArray> o,
10057 Handle<Object> name, PropertyDescriptor* desc,
10058 bool should_throw);
10059
10060 static bool ArraySetLength(Isolate* isolate, Handle<JSArray> a,
10061 PropertyDescriptor* desc, bool should_throw);
10062
10024 DECLARE_CAST(JSArray) 10063 DECLARE_CAST(JSArray)
10025 10064
10026 // Dispatched behavior. 10065 // Dispatched behavior.
10027 DECLARE_PRINTER(JSArray) 10066 DECLARE_PRINTER(JSArray)
10028 DECLARE_VERIFIER(JSArray) 10067 DECLARE_VERIFIER(JSArray)
10029 10068
10030 // Number of element slots to pre-allocate for an empty array. 10069 // Number of element slots to pre-allocate for an empty array.
10031 static const int kPreallocatedArrayElements = 4; 10070 static const int kPreallocatedArrayElements = 4;
10032 10071
10033 // Layout description. 10072 // Layout description.
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
10662 Handle<FixedArray> keys_; 10701 Handle<FixedArray> keys_;
10663 Handle<OrderedHashSet> set_; 10702 Handle<OrderedHashSet> set_;
10664 int length_; 10703 int length_;
10665 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); 10704 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator);
10666 }; 10705 };
10667 10706
10668 } // NOLINT, false-positive due to second-order macros. 10707 } // NOLINT, false-positive due to second-order macros.
10669 } // NOLINT, false-positive due to second-order macros. 10708 } // NOLINT, false-positive due to second-order macros.
10670 10709
10671 #endif // V8_OBJECTS_H_ 10710 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698