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

Side by Side Diff: src/objects.h

Issue 2807333003: [api] Add DefineProperty() method that skips interceptors.
Patch Set: Extend DefineProperty API Created 3 years, 7 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #include <memory> 9 #include <memory>
10 10
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 LanguageMode language_mode = SLOPPY); 1953 LanguageMode language_mode = SLOPPY);
1954 MUST_USE_RESULT static Maybe<bool> DeleteProperty( 1954 MUST_USE_RESULT static Maybe<bool> DeleteProperty(
1955 Handle<JSReceiver> object, Handle<Name> name, 1955 Handle<JSReceiver> object, Handle<Name> name,
1956 LanguageMode language_mode = SLOPPY); 1956 LanguageMode language_mode = SLOPPY);
1957 MUST_USE_RESULT static Maybe<bool> DeleteProperty(LookupIterator* it, 1957 MUST_USE_RESULT static Maybe<bool> DeleteProperty(LookupIterator* it,
1958 LanguageMode language_mode); 1958 LanguageMode language_mode);
1959 MUST_USE_RESULT static Maybe<bool> DeleteElement( 1959 MUST_USE_RESULT static Maybe<bool> DeleteElement(
1960 Handle<JSReceiver> object, uint32_t index, 1960 Handle<JSReceiver> object, uint32_t index,
1961 LanguageMode language_mode = SLOPPY); 1961 LanguageMode language_mode = SLOPPY);
1962 1962
1963 MUST_USE_RESULT static Object* DefineProperty(Isolate* isolate, 1963 MUST_USE_RESULT static Object* DefineProperty(
1964 Handle<Object> object, 1964 Isolate* isolate, Handle<Object> object, Handle<Object> name,
1965 Handle<Object> name, 1965 Handle<Object> attributes, bool bypass_interceptor = false);
1966 Handle<Object> attributes); 1966
1967 MUST_USE_RESULT static MaybeHandle<Object> DefineProperties( 1967 MUST_USE_RESULT static MaybeHandle<Object> DefineProperties(
1968 Isolate* isolate, Handle<Object> object, Handle<Object> properties); 1968 Isolate* isolate, Handle<Object> object, Handle<Object> properties);
1969 1969
1970 // "virtual" dispatcher to the correct [[DefineOwnProperty]] implementation. 1970 // "virtual" dispatcher to the correct [[DefineOwnProperty]] implementation.
1971 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty( 1971 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty(
1972 Isolate* isolate, Handle<JSReceiver> object, Handle<Object> key, 1972 Isolate* isolate, Handle<JSReceiver> object, Handle<Object> key,
1973 PropertyDescriptor* desc, ShouldThrow should_throw); 1973 PropertyDescriptor* desc, ShouldThrow should_throw,
1974 bool bypass_interceptor = false);
1974 1975
1975 // ES6 7.3.4 (when passed DONT_THROW) 1976 // ES6 7.3.4 (when passed DONT_THROW)
1976 MUST_USE_RESULT static Maybe<bool> CreateDataProperty( 1977 MUST_USE_RESULT static Maybe<bool> CreateDataProperty(
1977 LookupIterator* it, Handle<Object> value, ShouldThrow should_throw); 1978 LookupIterator* it, Handle<Object> value, ShouldThrow should_throw);
1978 1979
1979 // ES6 9.1.6.1 1980 // ES6 9.1.6.1
1980 MUST_USE_RESULT static Maybe<bool> OrdinaryDefineOwnProperty( 1981 MUST_USE_RESULT static Maybe<bool> OrdinaryDefineOwnProperty(
1981 Isolate* isolate, Handle<JSObject> object, Handle<Object> key, 1982 Isolate* isolate, Handle<JSObject> object, Handle<Object> key,
1982 PropertyDescriptor* desc, ShouldThrow should_throw); 1983 PropertyDescriptor* desc, ShouldThrow should_throw,
1984 bool bypass_interceptor = false);
1983 MUST_USE_RESULT static Maybe<bool> OrdinaryDefineOwnProperty( 1985 MUST_USE_RESULT static Maybe<bool> OrdinaryDefineOwnProperty(
1984 LookupIterator* it, PropertyDescriptor* desc, ShouldThrow should_throw); 1986 LookupIterator* it, PropertyDescriptor* desc, ShouldThrow should_throw);
1987
1985 // ES6 9.1.6.2 1988 // ES6 9.1.6.2
1986 MUST_USE_RESULT static Maybe<bool> IsCompatiblePropertyDescriptor( 1989 MUST_USE_RESULT static Maybe<bool> IsCompatiblePropertyDescriptor(
1987 Isolate* isolate, bool extensible, PropertyDescriptor* desc, 1990 Isolate* isolate, bool extensible, PropertyDescriptor* desc,
1988 PropertyDescriptor* current, Handle<Name> property_name, 1991 PropertyDescriptor* current, Handle<Name> property_name,
1989 ShouldThrow should_throw); 1992 ShouldThrow should_throw);
1990 // ES6 9.1.6.3 1993 // ES6 9.1.6.3
1991 // |it| can be NULL in cases where the ES spec passes |undefined| as the 1994 // |it| can be NULL in cases where the ES spec passes |undefined| as the
1992 // receiver. Exactly one of |it| and |property_name| must be provided. 1995 // receiver. Exactly one of |it| and |property_name| must be provided.
1993 MUST_USE_RESULT static Maybe<bool> ValidateAndApplyPropertyDescriptor( 1996 MUST_USE_RESULT static Maybe<bool> ValidateAndApplyPropertyDescriptor(
1994 Isolate* isolate, LookupIterator* it, bool extensible, 1997 Isolate* isolate, LookupIterator* it, bool extensible,
(...skipping 8144 matching lines...) Expand 10 before | Expand all | Expand 10 after
10139 Handle<JSProxy> proxy, ShouldThrow should_throw); 10142 Handle<JSProxy> proxy, ShouldThrow should_throw);
10140 10143
10141 // ES6 9.5.5 10144 // ES6 9.5.5
10142 MUST_USE_RESULT static Maybe<bool> GetOwnPropertyDescriptor( 10145 MUST_USE_RESULT static Maybe<bool> GetOwnPropertyDescriptor(
10143 Isolate* isolate, Handle<JSProxy> proxy, Handle<Name> name, 10146 Isolate* isolate, Handle<JSProxy> proxy, Handle<Name> name,
10144 PropertyDescriptor* desc); 10147 PropertyDescriptor* desc);
10145 10148
10146 // ES6 9.5.6 10149 // ES6 9.5.6
10147 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty( 10150 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty(
10148 Isolate* isolate, Handle<JSProxy> object, Handle<Object> key, 10151 Isolate* isolate, Handle<JSProxy> object, Handle<Object> key,
10149 PropertyDescriptor* desc, ShouldThrow should_throw); 10152 PropertyDescriptor* desc, ShouldThrow should_throw,
10153 bool bypass_interceptor = false);
10150 10154
10151 // ES6 9.5.7 10155 // ES6 9.5.7
10152 MUST_USE_RESULT static Maybe<bool> HasProperty(Isolate* isolate, 10156 MUST_USE_RESULT static Maybe<bool> HasProperty(Isolate* isolate,
10153 Handle<JSProxy> proxy, 10157 Handle<JSProxy> proxy,
10154 Handle<Name> name); 10158 Handle<Name> name);
10155 10159
10156 // ES6 9.5.8 10160 // ES6 9.5.8
10157 MUST_USE_RESULT static MaybeHandle<Object> GetProperty( 10161 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(
10158 Isolate* isolate, Handle<JSProxy> proxy, Handle<Name> name, 10162 Isolate* isolate, Handle<JSProxy> proxy, Handle<Name> name,
10159 Handle<Object> receiver, bool* was_found); 10163 Handle<Object> receiver, bool* was_found);
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
10620 10624
10621 class JSTypedArray: public JSArrayBufferView { 10625 class JSTypedArray: public JSArrayBufferView {
10622 public: 10626 public:
10623 // [length]: length of typed array in elements. 10627 // [length]: length of typed array in elements.
10624 DECL_ACCESSORS(length, Object) 10628 DECL_ACCESSORS(length, Object)
10625 inline uint32_t length_value() const; 10629 inline uint32_t length_value() const;
10626 10630
10627 // ES6 9.4.5.3 10631 // ES6 9.4.5.3
10628 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty( 10632 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty(
10629 Isolate* isolate, Handle<JSTypedArray> o, Handle<Object> key, 10633 Isolate* isolate, Handle<JSTypedArray> o, Handle<Object> key,
10630 PropertyDescriptor* desc, ShouldThrow should_throw); 10634 PropertyDescriptor* desc, ShouldThrow should_throw,
10635 bool bypass_interceptor = false);
10631 10636
10632 DECLARE_CAST(JSTypedArray) 10637 DECLARE_CAST(JSTypedArray)
10633 10638
10634 ExternalArrayType type(); 10639 ExternalArrayType type();
10635 V8_EXPORT_PRIVATE size_t element_size(); 10640 V8_EXPORT_PRIVATE size_t element_size();
10636 10641
10637 Handle<JSArrayBuffer> GetBuffer(); 10642 Handle<JSArrayBuffer> GetBuffer();
10638 10643
10639 static inline MaybeHandle<JSTypedArray> Validate(Isolate* isolate, 10644 static inline MaybeHandle<JSTypedArray> Validate(Isolate* isolate,
10640 Handle<Object> receiver, 10645 Handle<Object> receiver,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
10738 10743
10739 static void SetLength(Handle<JSArray> array, uint32_t length); 10744 static void SetLength(Handle<JSArray> array, uint32_t length);
10740 10745
10741 // Set the content of the array to the content of storage. 10746 // Set the content of the array to the content of storage.
10742 static inline void SetContent(Handle<JSArray> array, 10747 static inline void SetContent(Handle<JSArray> array,
10743 Handle<FixedArrayBase> storage); 10748 Handle<FixedArrayBase> storage);
10744 10749
10745 // ES6 9.4.2.1 10750 // ES6 9.4.2.1
10746 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty( 10751 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty(
10747 Isolate* isolate, Handle<JSArray> o, Handle<Object> name, 10752 Isolate* isolate, Handle<JSArray> o, Handle<Object> name,
10748 PropertyDescriptor* desc, ShouldThrow should_throw); 10753 PropertyDescriptor* desc, ShouldThrow should_throw,
10754 bool bypass_interceptor = false);
10749 10755
10750 static bool AnythingToArrayLength(Isolate* isolate, 10756 static bool AnythingToArrayLength(Isolate* isolate,
10751 Handle<Object> length_object, 10757 Handle<Object> length_object,
10752 uint32_t* output); 10758 uint32_t* output);
10753 MUST_USE_RESULT static Maybe<bool> ArraySetLength(Isolate* isolate, 10759 MUST_USE_RESULT static Maybe<bool> ArraySetLength(Isolate* isolate,
10754 Handle<JSArray> a, 10760 Handle<JSArray> a,
10755 PropertyDescriptor* desc, 10761 PropertyDescriptor* desc,
10756 ShouldThrow should_throw); 10762 ShouldThrow should_throw,
10763 bool bypass_interceptor);
10757 10764
10758 // Checks whether the Array has the current realm's Array.prototype as its 10765 // Checks whether the Array has the current realm's Array.prototype as its
10759 // prototype. This function is best-effort and only gives a conservative 10766 // prototype. This function is best-effort and only gives a conservative
10760 // approximation, erring on the side of false, in particular with respect 10767 // approximation, erring on the side of false, in particular with respect
10761 // to Proxies and objects with a hidden prototype. 10768 // to Proxies and objects with a hidden prototype.
10762 inline bool HasArrayPrototype(Isolate* isolate); 10769 inline bool HasArrayPrototype(Isolate* isolate);
10763 10770
10764 DECLARE_CAST(JSArray) 10771 DECLARE_CAST(JSArray)
10765 10772
10766 // Dispatched behavior. 10773 // Dispatched behavior.
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
11439 } 11446 }
11440 }; 11447 };
11441 11448
11442 11449
11443 } // NOLINT, false-positive due to second-order macros. 11450 } // NOLINT, false-positive due to second-order macros.
11444 } // NOLINT, false-positive due to second-order macros. 11451 } // NOLINT, false-positive due to second-order macros.
11445 11452
11446 #include "src/objects/object-macros-undef.h" 11453 #include "src/objects/object-macros-undef.h"
11447 11454
11448 #endif // V8_OBJECTS_H_ 11455 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698