| OLD | NEW |
| 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 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // - Cell | 127 // - Cell |
| 128 // - PropertyCell | 128 // - PropertyCell |
| 129 // - Code | 129 // - Code |
| 130 // - Map | 130 // - Map |
| 131 // - Oddball | 131 // - Oddball |
| 132 // - Foreign | 132 // - Foreign |
| 133 // - SharedFunctionInfo | 133 // - SharedFunctionInfo |
| 134 // - Struct | 134 // - Struct |
| 135 // - Box | 135 // - Box |
| 136 // - AccessorInfo | 136 // - AccessorInfo |
| 137 // - ExecutableAccessorInfo | |
| 138 // - AccessorPair | 137 // - AccessorPair |
| 139 // - AccessCheckInfo | 138 // - AccessCheckInfo |
| 140 // - InterceptorInfo | 139 // - InterceptorInfo |
| 141 // - CallHandlerInfo | 140 // - CallHandlerInfo |
| 142 // - TemplateInfo | 141 // - TemplateInfo |
| 143 // - FunctionTemplateInfo | 142 // - FunctionTemplateInfo |
| 144 // - ObjectTemplateInfo | 143 // - ObjectTemplateInfo |
| 145 // - Script | 144 // - Script |
| 146 // - DebugInfo | 145 // - DebugInfo |
| 147 // - BreakPointInfo | 146 // - BreakPointInfo |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 V(FIXED_INT16_ARRAY_TYPE) \ | 376 V(FIXED_INT16_ARRAY_TYPE) \ |
| 378 V(FIXED_UINT16_ARRAY_TYPE) \ | 377 V(FIXED_UINT16_ARRAY_TYPE) \ |
| 379 V(FIXED_INT32_ARRAY_TYPE) \ | 378 V(FIXED_INT32_ARRAY_TYPE) \ |
| 380 V(FIXED_UINT32_ARRAY_TYPE) \ | 379 V(FIXED_UINT32_ARRAY_TYPE) \ |
| 381 V(FIXED_FLOAT32_ARRAY_TYPE) \ | 380 V(FIXED_FLOAT32_ARRAY_TYPE) \ |
| 382 V(FIXED_FLOAT64_ARRAY_TYPE) \ | 381 V(FIXED_FLOAT64_ARRAY_TYPE) \ |
| 383 V(FIXED_UINT8_CLAMPED_ARRAY_TYPE) \ | 382 V(FIXED_UINT8_CLAMPED_ARRAY_TYPE) \ |
| 384 \ | 383 \ |
| 385 V(FILLER_TYPE) \ | 384 V(FILLER_TYPE) \ |
| 386 \ | 385 \ |
| 387 V(DECLARED_ACCESSOR_DESCRIPTOR_TYPE) \ | 386 V(ACCESSOR_INFO_TYPE) \ |
| 388 V(DECLARED_ACCESSOR_INFO_TYPE) \ | |
| 389 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \ | |
| 390 V(ACCESSOR_PAIR_TYPE) \ | 387 V(ACCESSOR_PAIR_TYPE) \ |
| 391 V(ACCESS_CHECK_INFO_TYPE) \ | 388 V(ACCESS_CHECK_INFO_TYPE) \ |
| 392 V(INTERCEPTOR_INFO_TYPE) \ | 389 V(INTERCEPTOR_INFO_TYPE) \ |
| 393 V(CALL_HANDLER_INFO_TYPE) \ | 390 V(CALL_HANDLER_INFO_TYPE) \ |
| 394 V(FUNCTION_TEMPLATE_INFO_TYPE) \ | 391 V(FUNCTION_TEMPLATE_INFO_TYPE) \ |
| 395 V(OBJECT_TEMPLATE_INFO_TYPE) \ | 392 V(OBJECT_TEMPLATE_INFO_TYPE) \ |
| 396 V(SIGNATURE_INFO_TYPE) \ | 393 V(SIGNATURE_INFO_TYPE) \ |
| 397 V(TYPE_SWITCH_INFO_TYPE) \ | 394 V(TYPE_SWITCH_INFO_TYPE) \ |
| 398 V(ALLOCATION_MEMENTO_TYPE) \ | 395 V(ALLOCATION_MEMENTO_TYPE) \ |
| 399 V(ALLOCATION_SITE_TYPE) \ | 396 V(ALLOCATION_SITE_TYPE) \ |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 // object type in this causes the compiler to generate most of the boilerplate | 495 // object type in this causes the compiler to generate most of the boilerplate |
| 499 // code for the class including allocation and garbage collection routines, | 496 // code for the class including allocation and garbage collection routines, |
| 500 // casts and predicates. All you need to define is the class, methods and | 497 // casts and predicates. All you need to define is the class, methods and |
| 501 // object verification routines. Easy, no? | 498 // object verification routines. Easy, no? |
| 502 // | 499 // |
| 503 // Note that for subtle reasons related to the ordering or numerical values of | 500 // Note that for subtle reasons related to the ordering or numerical values of |
| 504 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST | 501 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST |
| 505 // manually. | 502 // manually. |
| 506 #define STRUCT_LIST(V) \ | 503 #define STRUCT_LIST(V) \ |
| 507 V(BOX, Box, box) \ | 504 V(BOX, Box, box) \ |
| 508 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, \ | 505 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ |
| 509 executable_accessor_info) \ | |
| 510 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ | 506 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ |
| 511 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ | 507 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ |
| 512 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ | 508 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ |
| 513 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ | 509 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ |
| 514 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 510 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
| 515 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 511 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
| 516 V(SCRIPT, Script, script) \ | 512 V(SCRIPT, Script, script) \ |
| 517 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ | 513 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ |
| 518 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ | 514 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ |
| 519 V(CODE_CACHE, CodeCache, code_cache) \ | 515 V(CODE_CACHE, CodeCache, code_cache) \ |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 FIXED_UINT16_ARRAY_TYPE, | 665 FIXED_UINT16_ARRAY_TYPE, |
| 670 FIXED_INT32_ARRAY_TYPE, | 666 FIXED_INT32_ARRAY_TYPE, |
| 671 FIXED_UINT32_ARRAY_TYPE, | 667 FIXED_UINT32_ARRAY_TYPE, |
| 672 FIXED_FLOAT32_ARRAY_TYPE, | 668 FIXED_FLOAT32_ARRAY_TYPE, |
| 673 FIXED_FLOAT64_ARRAY_TYPE, | 669 FIXED_FLOAT64_ARRAY_TYPE, |
| 674 FIXED_UINT8_CLAMPED_ARRAY_TYPE, // LAST_FIXED_TYPED_ARRAY_TYPE | 670 FIXED_UINT8_CLAMPED_ARRAY_TYPE, // LAST_FIXED_TYPED_ARRAY_TYPE |
| 675 FIXED_DOUBLE_ARRAY_TYPE, | 671 FIXED_DOUBLE_ARRAY_TYPE, |
| 676 FILLER_TYPE, // LAST_DATA_TYPE | 672 FILLER_TYPE, // LAST_DATA_TYPE |
| 677 | 673 |
| 678 // Structs. | 674 // Structs. |
| 679 DECLARED_ACCESSOR_DESCRIPTOR_TYPE, | 675 ACCESSOR_INFO_TYPE, |
| 680 DECLARED_ACCESSOR_INFO_TYPE, | |
| 681 EXECUTABLE_ACCESSOR_INFO_TYPE, | |
| 682 ACCESSOR_PAIR_TYPE, | 676 ACCESSOR_PAIR_TYPE, |
| 683 ACCESS_CHECK_INFO_TYPE, | 677 ACCESS_CHECK_INFO_TYPE, |
| 684 INTERCEPTOR_INFO_TYPE, | 678 INTERCEPTOR_INFO_TYPE, |
| 685 CALL_HANDLER_INFO_TYPE, | 679 CALL_HANDLER_INFO_TYPE, |
| 686 FUNCTION_TEMPLATE_INFO_TYPE, | 680 FUNCTION_TEMPLATE_INFO_TYPE, |
| 687 OBJECT_TEMPLATE_INFO_TYPE, | 681 OBJECT_TEMPLATE_INFO_TYPE, |
| 688 SIGNATURE_INFO_TYPE, | 682 SIGNATURE_INFO_TYPE, |
| 689 TYPE_SWITCH_INFO_TYPE, | 683 TYPE_SWITCH_INFO_TYPE, |
| 690 ALLOCATION_SITE_TYPE, | 684 ALLOCATION_SITE_TYPE, |
| 691 ALLOCATION_MEMENTO_TYPE, | 685 ALLOCATION_MEMENTO_TYPE, |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 | 1030 |
| 1037 #define MAYBE_RETURN(call, value) \ | 1031 #define MAYBE_RETURN(call, value) \ |
| 1038 do { \ | 1032 do { \ |
| 1039 if ((call).IsNothing()) return value; \ | 1033 if ((call).IsNothing()) return value; \ |
| 1040 } while (false) | 1034 } while (false) |
| 1041 | 1035 |
| 1042 #define MAYBE_RETURN_NULL(call) MAYBE_RETURN(call, MaybeHandle<Object>()) | 1036 #define MAYBE_RETURN_NULL(call) MAYBE_RETURN(call, MaybeHandle<Object>()) |
| 1043 | 1037 |
| 1044 INLINE(bool IsFixedArrayBase() const); | 1038 INLINE(bool IsFixedArrayBase() const); |
| 1045 INLINE(bool IsExternal() const); | 1039 INLINE(bool IsExternal() const); |
| 1046 INLINE(bool IsAccessorInfo() const); | |
| 1047 | 1040 |
| 1048 INLINE(bool IsStruct() const); | 1041 INLINE(bool IsStruct() const); |
| 1049 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ | 1042 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ |
| 1050 INLINE(bool Is##Name() const); | 1043 INLINE(bool Is##Name() const); |
| 1051 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) | 1044 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) |
| 1052 #undef DECLARE_STRUCT_PREDICATE | 1045 #undef DECLARE_STRUCT_PREDICATE |
| 1053 | 1046 |
| 1054 // ES6, section 7.2.2 IsArray. NOT to be confused with %_IsArray. | 1047 // ES6, section 7.2.2 IsArray. NOT to be confused with %_IsArray. |
| 1055 MUST_USE_RESULT static Maybe<bool> IsArray(Handle<Object> object); | 1048 MUST_USE_RESULT static Maybe<bool> IsArray(Handle<Object> object); |
| 1056 | 1049 |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2065 // As PrepareElementsForSort, but only on objects where elements is | 2058 // As PrepareElementsForSort, but only on objects where elements is |
| 2066 // a dictionary, and it will stay a dictionary. Collates undefined and | 2059 // a dictionary, and it will stay a dictionary. Collates undefined and |
| 2067 // unexisting elements below limit from position zero of the elements. | 2060 // unexisting elements below limit from position zero of the elements. |
| 2068 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, | 2061 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, |
| 2069 uint32_t limit); | 2062 uint32_t limit); |
| 2070 | 2063 |
| 2071 MUST_USE_RESULT static Maybe<bool> SetPropertyWithInterceptor( | 2064 MUST_USE_RESULT static Maybe<bool> SetPropertyWithInterceptor( |
| 2072 LookupIterator* it, Handle<Object> value); | 2065 LookupIterator* it, Handle<Object> value); |
| 2073 | 2066 |
| 2074 // SetLocalPropertyIgnoreAttributes converts callbacks to fields. We need to | 2067 // SetLocalPropertyIgnoreAttributes converts callbacks to fields. We need to |
| 2075 // grant an exemption to ExecutableAccessor callbacks in some cases. | 2068 // grant an exemption to AccessorInfo callbacks in some cases. |
| 2076 enum ExecutableAccessorInfoHandling { DEFAULT_HANDLING, DONT_FORCE_FIELD }; | 2069 enum AccessorInfoHandling { DEFAULT_HANDLING, DONT_FORCE_FIELD }; |
| 2077 | 2070 |
| 2078 MUST_USE_RESULT static MaybeHandle<Object> DefineOwnPropertyIgnoreAttributes( | 2071 MUST_USE_RESULT static MaybeHandle<Object> DefineOwnPropertyIgnoreAttributes( |
| 2079 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, | 2072 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, |
| 2080 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); | 2073 AccessorInfoHandling handling = DEFAULT_HANDLING); |
| 2081 | 2074 |
| 2082 MUST_USE_RESULT static Maybe<bool> DefineOwnPropertyIgnoreAttributes( | 2075 MUST_USE_RESULT static Maybe<bool> DefineOwnPropertyIgnoreAttributes( |
| 2083 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, | 2076 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, |
| 2084 ShouldThrow should_throw, | 2077 ShouldThrow should_throw, |
| 2085 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); | 2078 AccessorInfoHandling handling = DEFAULT_HANDLING); |
| 2086 | 2079 |
| 2087 MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes( | 2080 MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes( |
| 2088 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, | 2081 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, |
| 2089 PropertyAttributes attributes, | 2082 PropertyAttributes attributes, |
| 2090 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); | 2083 AccessorInfoHandling handling = DEFAULT_HANDLING); |
| 2091 | 2084 |
| 2092 MUST_USE_RESULT static MaybeHandle<Object> SetOwnElementIgnoreAttributes( | 2085 MUST_USE_RESULT static MaybeHandle<Object> SetOwnElementIgnoreAttributes( |
| 2093 Handle<JSObject> object, uint32_t index, Handle<Object> value, | 2086 Handle<JSObject> object, uint32_t index, Handle<Object> value, |
| 2094 PropertyAttributes attributes, | 2087 PropertyAttributes attributes, |
| 2095 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); | 2088 AccessorInfoHandling handling = DEFAULT_HANDLING); |
| 2096 | 2089 |
| 2097 // Equivalent to one of the above depending on whether |name| can be converted | 2090 // Equivalent to one of the above depending on whether |name| can be converted |
| 2098 // to an array index. | 2091 // to an array index. |
| 2099 MUST_USE_RESULT static MaybeHandle<Object> | 2092 MUST_USE_RESULT static MaybeHandle<Object> |
| 2100 DefinePropertyOrElementIgnoreAttributes( | 2093 DefinePropertyOrElementIgnoreAttributes( |
| 2101 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, | 2094 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, |
| 2102 PropertyAttributes attributes = NONE, | 2095 PropertyAttributes attributes = NONE, |
| 2103 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); | 2096 AccessorInfoHandling handling = DEFAULT_HANDLING); |
| 2104 | 2097 |
| 2105 // Adds or reconfigures a property to attributes NONE. It will fail when it | 2098 // Adds or reconfigures a property to attributes NONE. It will fail when it |
| 2106 // cannot. | 2099 // cannot. |
| 2107 MUST_USE_RESULT static Maybe<bool> CreateDataProperty(LookupIterator* it, | 2100 MUST_USE_RESULT static Maybe<bool> CreateDataProperty(LookupIterator* it, |
| 2108 Handle<Object> value); | 2101 Handle<Object> value); |
| 2109 | 2102 |
| 2110 static void AddProperty(Handle<JSObject> object, Handle<Name> name, | 2103 static void AddProperty(Handle<JSObject> object, Handle<Name> name, |
| 2111 Handle<Object> value, PropertyAttributes attributes); | 2104 Handle<Object> value, PropertyAttributes attributes); |
| 2112 | 2105 |
| 2113 MUST_USE_RESULT static Maybe<bool> AddDataElement( | 2106 MUST_USE_RESULT static Maybe<bool> AddDataElement( |
| (...skipping 8061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10175 static const int kInputOffset = kIndexOffset + kPointerSize; | 10168 static const int kInputOffset = kIndexOffset + kPointerSize; |
| 10176 static const int kSize = kInputOffset + kPointerSize; | 10169 static const int kSize = kInputOffset + kPointerSize; |
| 10177 // Indices of in-object properties. | 10170 // Indices of in-object properties. |
| 10178 static const int kIndexIndex = 0; | 10171 static const int kIndexIndex = 0; |
| 10179 static const int kInputIndex = 1; | 10172 static const int kInputIndex = 1; |
| 10180 private: | 10173 private: |
| 10181 DISALLOW_IMPLICIT_CONSTRUCTORS(JSRegExpResult); | 10174 DISALLOW_IMPLICIT_CONSTRUCTORS(JSRegExpResult); |
| 10182 }; | 10175 }; |
| 10183 | 10176 |
| 10184 | 10177 |
| 10178 // An accessor must have a getter, but can have no setter. |
| 10179 // |
| 10180 // When setting a property, V8 searches accessors in prototypes. |
| 10181 // If an accessor was found and it does not have a setter, |
| 10182 // the request is ignored. |
| 10183 // |
| 10184 // If the accessor in the prototype has the READ_ONLY property attribute, then |
| 10185 // a new value is added to the derived object when the property is set. |
| 10186 // This shadows the accessor in the prototype. |
| 10185 class AccessorInfo: public Struct { | 10187 class AccessorInfo: public Struct { |
| 10186 public: | 10188 public: |
| 10187 DECL_ACCESSORS(name, Object) | 10189 DECL_ACCESSORS(name, Object) |
| 10188 DECL_INT_ACCESSORS(flag) | 10190 DECL_INT_ACCESSORS(flag) |
| 10189 DECL_ACCESSORS(expected_receiver_type, Object) | 10191 DECL_ACCESSORS(expected_receiver_type, Object) |
| 10192 DECL_ACCESSORS(getter, Object) |
| 10193 DECL_ACCESSORS(setter, Object) |
| 10194 DECL_ACCESSORS(data, Object) |
| 10195 |
| 10196 // Dispatched behavior. |
| 10197 DECLARE_PRINTER(AccessorInfo) |
| 10198 |
| 10199 static void ClearSetter(Handle<AccessorInfo> info); |
| 10190 | 10200 |
| 10191 inline bool all_can_read(); | 10201 inline bool all_can_read(); |
| 10192 inline void set_all_can_read(bool value); | 10202 inline void set_all_can_read(bool value); |
| 10193 | 10203 |
| 10194 inline bool all_can_write(); | 10204 inline bool all_can_write(); |
| 10195 inline void set_all_can_write(bool value); | 10205 inline void set_all_can_write(bool value); |
| 10196 | 10206 |
| 10197 inline bool is_special_data_property(); | 10207 inline bool is_special_data_property(); |
| 10198 inline void set_is_special_data_property(bool value); | 10208 inline void set_is_special_data_property(bool value); |
| 10199 | 10209 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 10213 | 10223 |
| 10214 // Append all descriptors to the array that are not already there. | 10224 // Append all descriptors to the array that are not already there. |
| 10215 // Return number added. | 10225 // Return number added. |
| 10216 static int AppendUnique(Handle<Object> descriptors, | 10226 static int AppendUnique(Handle<Object> descriptors, |
| 10217 Handle<FixedArray> array, | 10227 Handle<FixedArray> array, |
| 10218 int valid_descriptors); | 10228 int valid_descriptors); |
| 10219 | 10229 |
| 10220 static const int kNameOffset = HeapObject::kHeaderSize; | 10230 static const int kNameOffset = HeapObject::kHeaderSize; |
| 10221 static const int kFlagOffset = kNameOffset + kPointerSize; | 10231 static const int kFlagOffset = kNameOffset + kPointerSize; |
| 10222 static const int kExpectedReceiverTypeOffset = kFlagOffset + kPointerSize; | 10232 static const int kExpectedReceiverTypeOffset = kFlagOffset + kPointerSize; |
| 10223 static const int kSize = kExpectedReceiverTypeOffset + kPointerSize; | 10233 static const int kGetterOffset = kExpectedReceiverTypeOffset + kPointerSize; |
| 10234 static const int kSetterOffset = kGetterOffset + kPointerSize; |
| 10235 static const int kDataOffset = kSetterOffset + kPointerSize; |
| 10236 static const int kSize = kDataOffset + kPointerSize; |
| 10237 |
| 10224 | 10238 |
| 10225 private: | 10239 private: |
| 10226 inline bool HasExpectedReceiverType(); | 10240 inline bool HasExpectedReceiverType(); |
| 10227 | 10241 |
| 10228 // Bit positions in flag. | 10242 // Bit positions in flag. |
| 10229 static const int kAllCanReadBit = 0; | 10243 static const int kAllCanReadBit = 0; |
| 10230 static const int kAllCanWriteBit = 1; | 10244 static const int kAllCanWriteBit = 1; |
| 10231 static const int kSpecialDataProperty = 2; | 10245 static const int kSpecialDataProperty = 2; |
| 10232 class AttributesField : public BitField<PropertyAttributes, 3, 3> {}; | 10246 class AttributesField : public BitField<PropertyAttributes, 3, 3> {}; |
| 10233 | 10247 |
| 10234 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); | 10248 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); |
| 10235 }; | 10249 }; |
| 10236 | 10250 |
| 10237 | 10251 |
| 10238 // An accessor must have a getter, but can have no setter. | |
| 10239 // | |
| 10240 // When setting a property, V8 searches accessors in prototypes. | |
| 10241 // If an accessor was found and it does not have a setter, | |
| 10242 // the request is ignored. | |
| 10243 // | |
| 10244 // If the accessor in the prototype has the READ_ONLY property attribute, then | |
| 10245 // a new value is added to the derived object when the property is set. | |
| 10246 // This shadows the accessor in the prototype. | |
| 10247 class ExecutableAccessorInfo: public AccessorInfo { | |
| 10248 public: | |
| 10249 DECL_ACCESSORS(getter, Object) | |
| 10250 DECL_ACCESSORS(setter, Object) | |
| 10251 DECL_ACCESSORS(data, Object) | |
| 10252 | |
| 10253 DECLARE_CAST(ExecutableAccessorInfo) | |
| 10254 | |
| 10255 // Dispatched behavior. | |
| 10256 DECLARE_PRINTER(ExecutableAccessorInfo) | |
| 10257 DECLARE_VERIFIER(ExecutableAccessorInfo) | |
| 10258 | |
| 10259 static const int kGetterOffset = AccessorInfo::kSize; | |
| 10260 static const int kSetterOffset = kGetterOffset + kPointerSize; | |
| 10261 static const int kDataOffset = kSetterOffset + kPointerSize; | |
| 10262 static const int kSize = kDataOffset + kPointerSize; | |
| 10263 | |
| 10264 static void ClearSetter(Handle<ExecutableAccessorInfo> info); | |
| 10265 | |
| 10266 private: | |
| 10267 DISALLOW_IMPLICIT_CONSTRUCTORS(ExecutableAccessorInfo); | |
| 10268 }; | |
| 10269 | |
| 10270 | |
| 10271 // Support for JavaScript accessors: A pair of a getter and a setter. Each | 10252 // Support for JavaScript accessors: A pair of a getter and a setter. Each |
| 10272 // accessor can either be | 10253 // accessor can either be |
| 10273 // * a pointer to a JavaScript function or proxy: a real accessor | 10254 // * a pointer to a JavaScript function or proxy: a real accessor |
| 10274 // * undefined: considered an accessor by the spec, too, strangely enough | 10255 // * undefined: considered an accessor by the spec, too, strangely enough |
| 10275 // * the hole: an accessor which has not been set | 10256 // * the hole: an accessor which has not been set |
| 10276 // * a pointer to a map: a transition used to ensure map sharing | 10257 // * a pointer to a map: a transition used to ensure map sharing |
| 10277 class AccessorPair: public Struct { | 10258 class AccessorPair: public Struct { |
| 10278 public: | 10259 public: |
| 10279 DECL_ACCESSORS(getter, Object) | 10260 DECL_ACCESSORS(getter, Object) |
| 10280 DECL_ACCESSORS(setter, Object) | 10261 DECL_ACCESSORS(setter, Object) |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10742 } | 10723 } |
| 10743 return value; | 10724 return value; |
| 10744 } | 10725 } |
| 10745 }; | 10726 }; |
| 10746 | 10727 |
| 10747 | 10728 |
| 10748 } // NOLINT, false-positive due to second-order macros. | 10729 } // NOLINT, false-positive due to second-order macros. |
| 10749 } // NOLINT, false-positive due to second-order macros. | 10730 } // NOLINT, false-positive due to second-order macros. |
| 10750 | 10731 |
| 10751 #endif // V8_OBJECTS_H_ | 10732 #endif // V8_OBJECTS_H_ |
| OLD | NEW |