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

Side by Side Diff: src/objects.h

Issue 2807333003: [api] Add DefineProperty() method that skips interceptors.
Patch Set: Change enum to enum class Created 3 years, 6 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/builtins/builtins-object.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 LanguageMode language_mode = SLOPPY); 1975 LanguageMode language_mode = SLOPPY);
1976 MUST_USE_RESULT static Maybe<bool> DeleteProperty( 1976 MUST_USE_RESULT static Maybe<bool> DeleteProperty(
1977 Handle<JSReceiver> object, Handle<Name> name, 1977 Handle<JSReceiver> object, Handle<Name> name,
1978 LanguageMode language_mode = SLOPPY); 1978 LanguageMode language_mode = SLOPPY);
1979 MUST_USE_RESULT static Maybe<bool> DeleteProperty(LookupIterator* it, 1979 MUST_USE_RESULT static Maybe<bool> DeleteProperty(LookupIterator* it,
1980 LanguageMode language_mode); 1980 LanguageMode language_mode);
1981 MUST_USE_RESULT static Maybe<bool> DeleteElement( 1981 MUST_USE_RESULT static Maybe<bool> DeleteElement(
1982 Handle<JSReceiver> object, uint32_t index, 1982 Handle<JSReceiver> object, uint32_t index,
1983 LanguageMode language_mode = SLOPPY); 1983 LanguageMode language_mode = SLOPPY);
1984 1984
1985 MUST_USE_RESULT static Object* DefineProperty(Isolate* isolate, 1985 MUST_USE_RESULT static Object* DefineProperty(
1986 Handle<Object> object, 1986 Isolate* isolate, Handle<Object> object, Handle<Object> name,
1987 Handle<Object> name, 1987 Handle<Object> attributes,
1988 Handle<Object> attributes); 1988 CallInterceptors call_interceptors = CallInterceptors::kDontSkip);
1989
1989 MUST_USE_RESULT static MaybeHandle<Object> DefineProperties( 1990 MUST_USE_RESULT static MaybeHandle<Object> DefineProperties(
1990 Isolate* isolate, Handle<Object> object, Handle<Object> properties); 1991 Isolate* isolate, Handle<Object> object, Handle<Object> properties);
1991 1992
1992 // "virtual" dispatcher to the correct [[DefineOwnProperty]] implementation. 1993 // "virtual" dispatcher to the correct [[DefineOwnProperty]] implementation.
1993 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty( 1994 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty(
1994 Isolate* isolate, Handle<JSReceiver> object, Handle<Object> key, 1995 Isolate* isolate, Handle<JSReceiver> object, Handle<Object> key,
1995 PropertyDescriptor* desc, ShouldThrow should_throw); 1996 PropertyDescriptor* desc, ShouldThrow should_throw,
1997 CallInterceptors call_interceptors = CallInterceptors::kDontSkip);
1996 1998
1997 // ES6 7.3.4 (when passed DONT_THROW) 1999 // ES6 7.3.4 (when passed DONT_THROW)
1998 MUST_USE_RESULT static Maybe<bool> CreateDataProperty( 2000 MUST_USE_RESULT static Maybe<bool> CreateDataProperty(
1999 LookupIterator* it, Handle<Object> value, ShouldThrow should_throw); 2001 LookupIterator* it, Handle<Object> value, ShouldThrow should_throw);
2000 2002
2001 // ES6 9.1.6.1 2003 // ES6 9.1.6.1
2002 MUST_USE_RESULT static Maybe<bool> OrdinaryDefineOwnProperty( 2004 MUST_USE_RESULT static Maybe<bool> OrdinaryDefineOwnProperty(
2003 Isolate* isolate, Handle<JSObject> object, Handle<Object> key, 2005 Isolate* isolate, Handle<JSObject> object, Handle<Object> key,
2004 PropertyDescriptor* desc, ShouldThrow should_throw); 2006 PropertyDescriptor* desc, ShouldThrow should_throw,
2007 CallInterceptors call_interceptors = CallInterceptors::kDontSkip);
2005 MUST_USE_RESULT static Maybe<bool> OrdinaryDefineOwnProperty( 2008 MUST_USE_RESULT static Maybe<bool> OrdinaryDefineOwnProperty(
2006 LookupIterator* it, PropertyDescriptor* desc, ShouldThrow should_throw); 2009 LookupIterator* it, PropertyDescriptor* desc, ShouldThrow should_throw);
2010
2007 // ES6 9.1.6.2 2011 // ES6 9.1.6.2
2008 MUST_USE_RESULT static Maybe<bool> IsCompatiblePropertyDescriptor( 2012 MUST_USE_RESULT static Maybe<bool> IsCompatiblePropertyDescriptor(
2009 Isolate* isolate, bool extensible, PropertyDescriptor* desc, 2013 Isolate* isolate, bool extensible, PropertyDescriptor* desc,
2010 PropertyDescriptor* current, Handle<Name> property_name, 2014 PropertyDescriptor* current, Handle<Name> property_name,
2011 ShouldThrow should_throw); 2015 ShouldThrow should_throw);
2012 // ES6 9.1.6.3 2016 // ES6 9.1.6.3
2013 // |it| can be NULL in cases where the ES spec passes |undefined| as the 2017 // |it| can be NULL in cases where the ES spec passes |undefined| as the
2014 // receiver. Exactly one of |it| and |property_name| must be provided. 2018 // receiver. Exactly one of |it| and |property_name| must be provided.
2015 MUST_USE_RESULT static Maybe<bool> ValidateAndApplyPropertyDescriptor( 2019 MUST_USE_RESULT static Maybe<bool> ValidateAndApplyPropertyDescriptor(
2016 Isolate* isolate, LookupIterator* it, bool extensible, 2020 Isolate* isolate, LookupIterator* it, bool extensible,
(...skipping 6208 matching lines...) Expand 10 before | Expand all | Expand 10 after
8225 Handle<JSProxy> proxy, ShouldThrow should_throw); 8229 Handle<JSProxy> proxy, ShouldThrow should_throw);
8226 8230
8227 // ES6 9.5.5 8231 // ES6 9.5.5
8228 MUST_USE_RESULT static Maybe<bool> GetOwnPropertyDescriptor( 8232 MUST_USE_RESULT static Maybe<bool> GetOwnPropertyDescriptor(
8229 Isolate* isolate, Handle<JSProxy> proxy, Handle<Name> name, 8233 Isolate* isolate, Handle<JSProxy> proxy, Handle<Name> name,
8230 PropertyDescriptor* desc); 8234 PropertyDescriptor* desc);
8231 8235
8232 // ES6 9.5.6 8236 // ES6 9.5.6
8233 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty( 8237 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty(
8234 Isolate* isolate, Handle<JSProxy> object, Handle<Object> key, 8238 Isolate* isolate, Handle<JSProxy> object, Handle<Object> key,
8235 PropertyDescriptor* desc, ShouldThrow should_throw); 8239 PropertyDescriptor* desc, ShouldThrow should_throw,
8240 CallInterceptors call_interceptors = CallInterceptors::kDontSkip);
8236 8241
8237 // ES6 9.5.7 8242 // ES6 9.5.7
8238 MUST_USE_RESULT static Maybe<bool> HasProperty(Isolate* isolate, 8243 MUST_USE_RESULT static Maybe<bool> HasProperty(Isolate* isolate,
8239 Handle<JSProxy> proxy, 8244 Handle<JSProxy> proxy,
8240 Handle<Name> name); 8245 Handle<Name> name);
8241 8246
8242 // ES6 9.5.8 8247 // ES6 9.5.8
8243 MUST_USE_RESULT static MaybeHandle<Object> GetProperty( 8248 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(
8244 Isolate* isolate, Handle<JSProxy> proxy, Handle<Name> name, 8249 Isolate* isolate, Handle<JSProxy> proxy, Handle<Name> name,
8245 Handle<Object> receiver, bool* was_found); 8250 Handle<Object> receiver, bool* was_found);
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
8633 8638
8634 class JSTypedArray: public JSArrayBufferView { 8639 class JSTypedArray: public JSArrayBufferView {
8635 public: 8640 public:
8636 // [length]: length of typed array in elements. 8641 // [length]: length of typed array in elements.
8637 DECL_ACCESSORS(length, Object) 8642 DECL_ACCESSORS(length, Object)
8638 inline uint32_t length_value() const; 8643 inline uint32_t length_value() const;
8639 8644
8640 // ES6 9.4.5.3 8645 // ES6 9.4.5.3
8641 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty( 8646 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty(
8642 Isolate* isolate, Handle<JSTypedArray> o, Handle<Object> key, 8647 Isolate* isolate, Handle<JSTypedArray> o, Handle<Object> key,
8643 PropertyDescriptor* desc, ShouldThrow should_throw); 8648 PropertyDescriptor* desc, ShouldThrow should_throw,
8649 CallInterceptors call_interceptors = CallInterceptors::kDontSkip);
8644 8650
8645 DECLARE_CAST(JSTypedArray) 8651 DECLARE_CAST(JSTypedArray)
8646 8652
8647 ExternalArrayType type(); 8653 ExternalArrayType type();
8648 V8_EXPORT_PRIVATE size_t element_size(); 8654 V8_EXPORT_PRIVATE size_t element_size();
8649 8655
8650 Handle<JSArrayBuffer> GetBuffer(); 8656 Handle<JSArrayBuffer> GetBuffer();
8651 8657
8652 static inline MaybeHandle<JSTypedArray> Validate(Isolate* isolate, 8658 static inline MaybeHandle<JSTypedArray> Validate(Isolate* isolate,
8653 Handle<Object> receiver, 8659 Handle<Object> receiver,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
8761 8767
8762 static void SetLength(Handle<JSArray> array, uint32_t length); 8768 static void SetLength(Handle<JSArray> array, uint32_t length);
8763 8769
8764 // Set the content of the array to the content of storage. 8770 // Set the content of the array to the content of storage.
8765 static inline void SetContent(Handle<JSArray> array, 8771 static inline void SetContent(Handle<JSArray> array,
8766 Handle<FixedArrayBase> storage); 8772 Handle<FixedArrayBase> storage);
8767 8773
8768 // ES6 9.4.2.1 8774 // ES6 9.4.2.1
8769 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty( 8775 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty(
8770 Isolate* isolate, Handle<JSArray> o, Handle<Object> name, 8776 Isolate* isolate, Handle<JSArray> o, Handle<Object> name,
8771 PropertyDescriptor* desc, ShouldThrow should_throw); 8777 PropertyDescriptor* desc, ShouldThrow should_throw,
8778 CallInterceptors call_interceptors = CallInterceptors::kDontSkip);
8772 8779
8773 static bool AnythingToArrayLength(Isolate* isolate, 8780 static bool AnythingToArrayLength(Isolate* isolate,
8774 Handle<Object> length_object, 8781 Handle<Object> length_object,
8775 uint32_t* output); 8782 uint32_t* output);
8776 MUST_USE_RESULT static Maybe<bool> ArraySetLength(Isolate* isolate, 8783 MUST_USE_RESULT static Maybe<bool> ArraySetLength(
8777 Handle<JSArray> a, 8784 Isolate* isolate, Handle<JSArray> a, PropertyDescriptor* desc,
8778 PropertyDescriptor* desc, 8785 ShouldThrow should_throw,
8779 ShouldThrow should_throw); 8786 CallInterceptors call_interceptors = CallInterceptors::kDontSkip);
8780 8787
8781 // Checks whether the Array has the current realm's Array.prototype as its 8788 // Checks whether the Array has the current realm's Array.prototype as its
8782 // prototype. This function is best-effort and only gives a conservative 8789 // prototype. This function is best-effort and only gives a conservative
8783 // approximation, erring on the side of false, in particular with respect 8790 // approximation, erring on the side of false, in particular with respect
8784 // to Proxies and objects with a hidden prototype. 8791 // to Proxies and objects with a hidden prototype.
8785 inline bool HasArrayPrototype(Isolate* isolate); 8792 inline bool HasArrayPrototype(Isolate* isolate);
8786 8793
8787 DECLARE_CAST(JSArray) 8794 DECLARE_CAST(JSArray)
8788 8795
8789 // Dispatched behavior. 8796 // Dispatched behavior.
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
9342 } 9349 }
9343 }; 9350 };
9344 9351
9345 9352
9346 } // NOLINT, false-positive due to second-order macros. 9353 } // NOLINT, false-positive due to second-order macros.
9347 } // NOLINT, false-positive due to second-order macros. 9354 } // NOLINT, false-positive due to second-order macros.
9348 9355
9349 #include "src/objects/object-macros-undef.h" 9356 #include "src/objects/object-macros-undef.h"
9350 9357
9351 #endif // V8_OBJECTS_H_ 9358 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/builtins/builtins-object.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698