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

Side by Side Diff: src/objects.h

Issue 2807333003: [api] Add DefineProperty() method that skips interceptors.
Patch Set: Created 3 years, 8 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 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(Isolate* isolate,
1964 Handle<Object> object, 1964 Handle<Object> object,
1965 Handle<Object> name, 1965 Handle<Object> name,
1966 Handle<Object> attributes); 1966 Handle<Object> attributes);
1967
1968 MUST_USE_RESULT static Object* DefinePropertyWithoutInterceptors(
1969 Isolate* isolate, Handle<Object> object, Handle<Object> name,
1970 Handle<Object> attributes);
1971
1967 MUST_USE_RESULT static MaybeHandle<Object> DefineProperties( 1972 MUST_USE_RESULT static MaybeHandle<Object> DefineProperties(
1968 Isolate* isolate, Handle<Object> object, Handle<Object> properties); 1973 Isolate* isolate, Handle<Object> object, Handle<Object> properties);
1969 1974
1970 // "virtual" dispatcher to the correct [[DefineOwnProperty]] implementation. 1975 // "virtual" dispatcher to the correct [[DefineOwnProperty]] implementation.
1971 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty( 1976 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty(
1972 Isolate* isolate, Handle<JSReceiver> object, Handle<Object> key, 1977 Isolate* isolate, Handle<JSReceiver> object, Handle<Object> key,
1973 PropertyDescriptor* desc, ShouldThrow should_throw); 1978 PropertyDescriptor* desc, ShouldThrow should_throw);
1974 1979
1980 // "virtual" dispatcher to the correct [[DefineOwnPropertyWithoutIntercept]]
1981 // implementation.
1982 MUST_USE_RESULT static Maybe<bool> DefineOwnPropertyWithoutIntercept(
1983 Isolate* isolate, Handle<JSReceiver> object, Handle<Object> key,
1984 PropertyDescriptor* desc, ShouldThrow should_throw);
Franzi 2017/04/12 08:58:17 I think you call this function only with dont_thro
1985
1975 // ES6 7.3.4 (when passed DONT_THROW) 1986 // ES6 7.3.4 (when passed DONT_THROW)
1976 MUST_USE_RESULT static Maybe<bool> CreateDataProperty( 1987 MUST_USE_RESULT static Maybe<bool> CreateDataProperty(
1977 LookupIterator* it, Handle<Object> value, ShouldThrow should_throw); 1988 LookupIterator* it, Handle<Object> value, ShouldThrow should_throw);
1978 1989
1979 // ES6 9.1.6.1 1990 // ES6 9.1.6.1
1980 MUST_USE_RESULT static Maybe<bool> OrdinaryDefineOwnProperty( 1991 MUST_USE_RESULT static Maybe<bool> OrdinaryDefineOwnProperty(
1981 Isolate* isolate, Handle<JSObject> object, Handle<Object> key, 1992 Isolate* isolate, Handle<JSObject> object, Handle<Object> key,
1982 PropertyDescriptor* desc, ShouldThrow should_throw); 1993 PropertyDescriptor* desc, ShouldThrow should_throw);
1983 MUST_USE_RESULT static Maybe<bool> OrdinaryDefineOwnProperty( 1994 MUST_USE_RESULT static Maybe<bool> OrdinaryDefineOwnProperty(
1984 LookupIterator* it, PropertyDescriptor* desc, ShouldThrow should_throw); 1995 LookupIterator* it, PropertyDescriptor* desc, ShouldThrow should_throw);
1996
1997 MUST_USE_RESULT static Maybe<bool> OrdinaryDefineOwnPropertyWithoutIntercept(
1998 Isolate* isolate, Handle<JSObject> object, Handle<Object> key,
1999 PropertyDescriptor* desc, ShouldThrow should_throw);
2000
1985 // ES6 9.1.6.2 2001 // ES6 9.1.6.2
1986 MUST_USE_RESULT static Maybe<bool> IsCompatiblePropertyDescriptor( 2002 MUST_USE_RESULT static Maybe<bool> IsCompatiblePropertyDescriptor(
1987 Isolate* isolate, bool extensible, PropertyDescriptor* desc, 2003 Isolate* isolate, bool extensible, PropertyDescriptor* desc,
1988 PropertyDescriptor* current, Handle<Name> property_name, 2004 PropertyDescriptor* current, Handle<Name> property_name,
1989 ShouldThrow should_throw); 2005 ShouldThrow should_throw);
1990 // ES6 9.1.6.3 2006 // ES6 9.1.6.3
1991 // |it| can be NULL in cases where the ES spec passes |undefined| as the 2007 // |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. 2008 // receiver. Exactly one of |it| and |property_name| must be provided.
1993 MUST_USE_RESULT static Maybe<bool> ValidateAndApplyPropertyDescriptor( 2009 MUST_USE_RESULT static Maybe<bool> ValidateAndApplyPropertyDescriptor(
1994 Isolate* isolate, LookupIterator* it, bool extensible, 2010 Isolate* isolate, LookupIterator* it, bool extensible,
(...skipping 8146 matching lines...) Expand 10 before | Expand all | Expand 10 after
10141 // ES6 9.5.5 10157 // ES6 9.5.5
10142 MUST_USE_RESULT static Maybe<bool> GetOwnPropertyDescriptor( 10158 MUST_USE_RESULT static Maybe<bool> GetOwnPropertyDescriptor(
10143 Isolate* isolate, Handle<JSProxy> proxy, Handle<Name> name, 10159 Isolate* isolate, Handle<JSProxy> proxy, Handle<Name> name,
10144 PropertyDescriptor* desc); 10160 PropertyDescriptor* desc);
10145 10161
10146 // ES6 9.5.6 10162 // ES6 9.5.6
10147 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty( 10163 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty(
10148 Isolate* isolate, Handle<JSProxy> object, Handle<Object> key, 10164 Isolate* isolate, Handle<JSProxy> object, Handle<Object> key,
10149 PropertyDescriptor* desc, ShouldThrow should_throw); 10165 PropertyDescriptor* desc, ShouldThrow should_throw);
10150 10166
10167 MUST_USE_RESULT static Maybe<bool> DefineOwnPropertyWithoutIntercept(
10168 Isolate* isolate, Handle<JSProxy> object, Handle<Object> key,
10169 PropertyDescriptor* desc, ShouldThrow should_throw);
10170
10151 // ES6 9.5.7 10171 // ES6 9.5.7
10152 MUST_USE_RESULT static Maybe<bool> HasProperty(Isolate* isolate, 10172 MUST_USE_RESULT static Maybe<bool> HasProperty(Isolate* isolate,
10153 Handle<JSProxy> proxy, 10173 Handle<JSProxy> proxy,
10154 Handle<Name> name); 10174 Handle<Name> name);
10155 10175
10156 // ES6 9.5.8 10176 // ES6 9.5.8
10157 MUST_USE_RESULT static MaybeHandle<Object> GetProperty( 10177 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(
10158 Isolate* isolate, Handle<JSProxy> proxy, Handle<Name> name, 10178 Isolate* isolate, Handle<JSProxy> proxy, Handle<Name> name,
10159 Handle<Object> receiver, bool* was_found); 10179 Handle<Object> receiver, bool* was_found);
10160 10180
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
10622 public: 10642 public:
10623 // [length]: length of typed array in elements. 10643 // [length]: length of typed array in elements.
10624 DECL_ACCESSORS(length, Object) 10644 DECL_ACCESSORS(length, Object)
10625 inline uint32_t length_value() const; 10645 inline uint32_t length_value() const;
10626 10646
10627 // ES6 9.4.5.3 10647 // ES6 9.4.5.3
10628 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty( 10648 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty(
10629 Isolate* isolate, Handle<JSTypedArray> o, Handle<Object> key, 10649 Isolate* isolate, Handle<JSTypedArray> o, Handle<Object> key,
10630 PropertyDescriptor* desc, ShouldThrow should_throw); 10650 PropertyDescriptor* desc, ShouldThrow should_throw);
10631 10651
10652 MUST_USE_RESULT static Maybe<bool> DefineOwnPropertyWithoutIntercept(
10653 Isolate* isolate, Handle<JSTypedArray> o, Handle<Object> key,
10654 PropertyDescriptor* desc, ShouldThrow should_throw);
10655
10632 DECLARE_CAST(JSTypedArray) 10656 DECLARE_CAST(JSTypedArray)
10633 10657
10634 ExternalArrayType type(); 10658 ExternalArrayType type();
10635 V8_EXPORT_PRIVATE size_t element_size(); 10659 V8_EXPORT_PRIVATE size_t element_size();
10636 10660
10637 Handle<JSArrayBuffer> GetBuffer(); 10661 Handle<JSArrayBuffer> GetBuffer();
10638 10662
10639 static inline MaybeHandle<JSTypedArray> Validate(Isolate* isolate, 10663 static inline MaybeHandle<JSTypedArray> Validate(Isolate* isolate,
10640 Handle<Object> receiver, 10664 Handle<Object> receiver,
10641 const char* method_name); 10665 const char* method_name);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
10740 10764
10741 // Set the content of the array to the content of storage. 10765 // Set the content of the array to the content of storage.
10742 static inline void SetContent(Handle<JSArray> array, 10766 static inline void SetContent(Handle<JSArray> array,
10743 Handle<FixedArrayBase> storage); 10767 Handle<FixedArrayBase> storage);
10744 10768
10745 // ES6 9.4.2.1 10769 // ES6 9.4.2.1
10746 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty( 10770 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty(
10747 Isolate* isolate, Handle<JSArray> o, Handle<Object> name, 10771 Isolate* isolate, Handle<JSArray> o, Handle<Object> name,
10748 PropertyDescriptor* desc, ShouldThrow should_throw); 10772 PropertyDescriptor* desc, ShouldThrow should_throw);
10749 10773
10774 MUST_USE_RESULT static Maybe<bool> DefineOwnPropertyWithoutIntercept(
10775 Isolate* isolate, Handle<JSArray> o, Handle<Object> name,
10776 PropertyDescriptor* desc, ShouldThrow should_throw);
10777
10750 static bool AnythingToArrayLength(Isolate* isolate, 10778 static bool AnythingToArrayLength(Isolate* isolate,
10751 Handle<Object> length_object, 10779 Handle<Object> length_object,
10752 uint32_t* output); 10780 uint32_t* output);
10753 MUST_USE_RESULT static Maybe<bool> ArraySetLength(Isolate* isolate, 10781 MUST_USE_RESULT static Maybe<bool> ArraySetLength(Isolate* isolate,
10754 Handle<JSArray> a, 10782 Handle<JSArray> a,
10755 PropertyDescriptor* desc, 10783 PropertyDescriptor* desc,
10756 ShouldThrow should_throw); 10784 ShouldThrow should_throw);
10757 10785
10758 // Checks whether the Array has the current realm's Array.prototype as its 10786 // 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 10787 // prototype. This function is best-effort and only gives a conservative
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
11439 } 11467 }
11440 }; 11468 };
11441 11469
11442 11470
11443 } // NOLINT, false-positive due to second-order macros. 11471 } // NOLINT, false-positive due to second-order macros.
11444 } // NOLINT, false-positive due to second-order macros. 11472 } // NOLINT, false-positive due to second-order macros.
11445 11473
11446 #include "src/objects/object-macros-undef.h" 11474 #include "src/objects/object-macros-undef.h"
11447 11475
11448 #endif // V8_OBJECTS_H_ 11476 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698