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

Side by Side Diff: src/objects.h

Issue 2272383002: [api] Add interceptor for defineProperty(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@DefineProperty
Patch Set: Add test for intercepting Object.freeze(). Created 4 years, 3 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/counters.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 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 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2134 uint32_t limit); 2134 uint32_t limit);
2135 // As PrepareElementsForSort, but only on objects where elements is 2135 // As PrepareElementsForSort, but only on objects where elements is
2136 // a dictionary, and it will stay a dictionary. Collates undefined and 2136 // a dictionary, and it will stay a dictionary. Collates undefined and
2137 // unexisting elements below limit from position zero of the elements. 2137 // unexisting elements below limit from position zero of the elements.
2138 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, 2138 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object,
2139 uint32_t limit); 2139 uint32_t limit);
2140 2140
2141 MUST_USE_RESULT static Maybe<bool> SetPropertyWithInterceptor( 2141 MUST_USE_RESULT static Maybe<bool> SetPropertyWithInterceptor(
2142 LookupIterator* it, ShouldThrow should_throw, Handle<Object> value); 2142 LookupIterator* it, ShouldThrow should_throw, Handle<Object> value);
2143 2143
2144 MUST_USE_RESULT static Maybe<bool> DefinePropertyWithInterceptor(
2145 LookupIterator* it, ShouldThrow should_throw, PropertyDescriptor& desc);
2146
2144 // The API currently still wants DefineOwnPropertyIgnoreAttributes to convert 2147 // The API currently still wants DefineOwnPropertyIgnoreAttributes to convert
2145 // AccessorInfo objects to data fields. We allow FORCE_FIELD as an exception 2148 // AccessorInfo objects to data fields. We allow FORCE_FIELD as an exception
2146 // to the default behavior that calls the setter. 2149 // to the default behavior that calls the setter.
2147 enum AccessorInfoHandling { FORCE_FIELD, DONT_FORCE_FIELD }; 2150 enum AccessorInfoHandling { FORCE_FIELD, DONT_FORCE_FIELD };
2148 2151
2149 MUST_USE_RESULT static MaybeHandle<Object> DefineOwnPropertyIgnoreAttributes( 2152 MUST_USE_RESULT static MaybeHandle<Object> DefineOwnPropertyIgnoreAttributes(
2150 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, 2153 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes,
2151 AccessorInfoHandling handling = DONT_FORCE_FIELD); 2154 AccessorInfoHandling handling = DONT_FORCE_FIELD);
2152 2155
2153 MUST_USE_RESULT static Maybe<bool> DefineOwnPropertyIgnoreAttributes( 2156 MUST_USE_RESULT static Maybe<bool> DefineOwnPropertyIgnoreAttributes(
(...skipping 8602 matching lines...) Expand 10 before | Expand all | Expand 10 after
10756 }; 10759 };
10757 10760
10758 10761
10759 class InterceptorInfo: public Struct { 10762 class InterceptorInfo: public Struct {
10760 public: 10763 public:
10761 DECL_ACCESSORS(getter, Object) 10764 DECL_ACCESSORS(getter, Object)
10762 DECL_ACCESSORS(setter, Object) 10765 DECL_ACCESSORS(setter, Object)
10763 DECL_ACCESSORS(query, Object) 10766 DECL_ACCESSORS(query, Object)
10764 DECL_ACCESSORS(deleter, Object) 10767 DECL_ACCESSORS(deleter, Object)
10765 DECL_ACCESSORS(enumerator, Object) 10768 DECL_ACCESSORS(enumerator, Object)
10769 DECL_ACCESSORS(definer, Object)
10766 DECL_ACCESSORS(data, Object) 10770 DECL_ACCESSORS(data, Object)
10767 DECL_BOOLEAN_ACCESSORS(can_intercept_symbols) 10771 DECL_BOOLEAN_ACCESSORS(can_intercept_symbols)
10768 DECL_BOOLEAN_ACCESSORS(all_can_read) 10772 DECL_BOOLEAN_ACCESSORS(all_can_read)
10769 DECL_BOOLEAN_ACCESSORS(non_masking) 10773 DECL_BOOLEAN_ACCESSORS(non_masking)
10770 10774
10771 inline int flags() const; 10775 inline int flags() const;
10772 inline void set_flags(int flags); 10776 inline void set_flags(int flags);
10773 10777
10774 DECLARE_CAST(InterceptorInfo) 10778 DECLARE_CAST(InterceptorInfo)
10775 10779
10776 // Dispatched behavior. 10780 // Dispatched behavior.
10777 DECLARE_PRINTER(InterceptorInfo) 10781 DECLARE_PRINTER(InterceptorInfo)
10778 DECLARE_VERIFIER(InterceptorInfo) 10782 DECLARE_VERIFIER(InterceptorInfo)
10779 10783
10780 static const int kGetterOffset = HeapObject::kHeaderSize; 10784 static const int kGetterOffset = HeapObject::kHeaderSize;
10781 static const int kSetterOffset = kGetterOffset + kPointerSize; 10785 static const int kSetterOffset = kGetterOffset + kPointerSize;
10782 static const int kQueryOffset = kSetterOffset + kPointerSize; 10786 static const int kQueryOffset = kSetterOffset + kPointerSize;
10783 static const int kDeleterOffset = kQueryOffset + kPointerSize; 10787 static const int kDeleterOffset = kQueryOffset + kPointerSize;
10784 static const int kEnumeratorOffset = kDeleterOffset + kPointerSize; 10788 static const int kEnumeratorOffset = kDeleterOffset + kPointerSize;
10785 static const int kDataOffset = kEnumeratorOffset + kPointerSize; 10789 static const int kDefinerOffset = kEnumeratorOffset + kPointerSize;
10790 static const int kDataOffset = kDefinerOffset + kPointerSize;
10786 static const int kFlagsOffset = kDataOffset + kPointerSize; 10791 static const int kFlagsOffset = kDataOffset + kPointerSize;
10787 static const int kSize = kFlagsOffset + kPointerSize; 10792 static const int kSize = kFlagsOffset + kPointerSize;
10788 10793
10789 static const int kCanInterceptSymbolsBit = 0; 10794 static const int kCanInterceptSymbolsBit = 0;
10790 static const int kAllCanReadBit = 1; 10795 static const int kAllCanReadBit = 1;
10791 static const int kNonMasking = 2; 10796 static const int kNonMasking = 2;
10792 10797
10793 private: 10798 private:
10794 DISALLOW_IMPLICIT_CONSTRUCTORS(InterceptorInfo); 10799 DISALLOW_IMPLICIT_CONSTRUCTORS(InterceptorInfo);
10795 }; 10800 };
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
11173 } 11178 }
11174 return value; 11179 return value;
11175 } 11180 }
11176 }; 11181 };
11177 11182
11178 11183
11179 } // NOLINT, false-positive due to second-order macros. 11184 } // NOLINT, false-positive due to second-order macros.
11180 } // NOLINT, false-positive due to second-order macros. 11185 } // NOLINT, false-positive due to second-order macros.
11181 11186
11182 #endif // V8_OBJECTS_H_ 11187 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/counters.h ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698