| 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 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 V(TYPE_SWITCH_INFO_TYPE) \ | 395 V(TYPE_SWITCH_INFO_TYPE) \ |
| 396 V(ALLOCATION_MEMENTO_TYPE) \ | 396 V(ALLOCATION_MEMENTO_TYPE) \ |
| 397 V(ALLOCATION_SITE_TYPE) \ | 397 V(ALLOCATION_SITE_TYPE) \ |
| 398 V(SCRIPT_TYPE) \ | 398 V(SCRIPT_TYPE) \ |
| 399 V(TYPE_FEEDBACK_INFO_TYPE) \ | 399 V(TYPE_FEEDBACK_INFO_TYPE) \ |
| 400 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 400 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
| 401 V(BOX_TYPE) \ | 401 V(BOX_TYPE) \ |
| 402 V(PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE) \ | 402 V(PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE) \ |
| 403 V(PROMISE_REACTION_JOB_INFO_TYPE) \ | 403 V(PROMISE_REACTION_JOB_INFO_TYPE) \ |
| 404 V(PROTOTYPE_INFO_TYPE) \ | 404 V(PROTOTYPE_INFO_TYPE) \ |
| 405 V(TUPLE2_TYPE) \ | |
| 406 V(TUPLE3_TYPE) \ | 405 V(TUPLE3_TYPE) \ |
| 407 V(CONTEXT_EXTENSION_TYPE) \ | 406 V(CONTEXT_EXTENSION_TYPE) \ |
| 408 V(MODULE_TYPE) \ | 407 V(MODULE_TYPE) \ |
| 409 V(MODULE_INFO_ENTRY_TYPE) \ | 408 V(MODULE_INFO_ENTRY_TYPE) \ |
| 410 \ | 409 \ |
| 411 V(FIXED_ARRAY_TYPE) \ | 410 V(FIXED_ARRAY_TYPE) \ |
| 412 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 411 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
| 413 V(SHARED_FUNCTION_INFO_TYPE) \ | 412 V(SHARED_FUNCTION_INFO_TYPE) \ |
| 414 V(WEAK_CELL_TYPE) \ | 413 V(WEAK_CELL_TYPE) \ |
| 415 V(TRANSITION_ARRAY_TYPE) \ | 414 V(TRANSITION_ARRAY_TYPE) \ |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 562 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
| 564 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 563 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
| 565 V(SCRIPT, Script, script) \ | 564 V(SCRIPT, Script, script) \ |
| 566 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ | 565 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ |
| 567 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ | 566 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ |
| 568 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ | 567 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ |
| 569 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ | 568 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ |
| 570 V(DEBUG_INFO, DebugInfo, debug_info) \ | 569 V(DEBUG_INFO, DebugInfo, debug_info) \ |
| 571 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ | 570 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ |
| 572 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \ | 571 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \ |
| 573 V(TUPLE2, Tuple2, tuple2) \ | |
| 574 V(TUPLE3, Tuple3, tuple3) \ | 572 V(TUPLE3, Tuple3, tuple3) \ |
| 575 V(MODULE, Module, module) \ | 573 V(MODULE, Module, module) \ |
| 576 V(MODULE_INFO_ENTRY, ModuleInfoEntry, module_info_entry) \ | 574 V(MODULE_INFO_ENTRY, ModuleInfoEntry, module_info_entry) \ |
| 577 V(CONTEXT_EXTENSION, ContextExtension, context_extension) | 575 V(CONTEXT_EXTENSION, ContextExtension, context_extension) |
| 578 | 576 |
| 579 // We use the full 8 bits of the instance_type field to encode heap object | 577 // We use the full 8 bits of the instance_type field to encode heap object |
| 580 // instance types. The high-order bit (bit 7) is set if the object is not a | 578 // instance types. The high-order bit (bit 7) is set if the object is not a |
| 581 // string, and cleared if it is a string. | 579 // string, and cleared if it is a string. |
| 582 const uint32_t kIsNotStringMask = 0x80; | 580 const uint32_t kIsNotStringMask = 0x80; |
| 583 const uint32_t kStringTag = 0x0; | 581 const uint32_t kStringTag = 0x0; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 PROMISE_REACTION_JOB_INFO_TYPE, | 741 PROMISE_REACTION_JOB_INFO_TYPE, |
| 744 DEBUG_INFO_TYPE, | 742 DEBUG_INFO_TYPE, |
| 745 BREAK_POINT_INFO_TYPE, | 743 BREAK_POINT_INFO_TYPE, |
| 746 FIXED_ARRAY_TYPE, | 744 FIXED_ARRAY_TYPE, |
| 747 SHARED_FUNCTION_INFO_TYPE, | 745 SHARED_FUNCTION_INFO_TYPE, |
| 748 CELL_TYPE, | 746 CELL_TYPE, |
| 749 WEAK_CELL_TYPE, | 747 WEAK_CELL_TYPE, |
| 750 TRANSITION_ARRAY_TYPE, | 748 TRANSITION_ARRAY_TYPE, |
| 751 PROPERTY_CELL_TYPE, | 749 PROPERTY_CELL_TYPE, |
| 752 PROTOTYPE_INFO_TYPE, | 750 PROTOTYPE_INFO_TYPE, |
| 753 TUPLE2_TYPE, | |
| 754 TUPLE3_TYPE, | 751 TUPLE3_TYPE, |
| 755 CONTEXT_EXTENSION_TYPE, | 752 CONTEXT_EXTENSION_TYPE, |
| 756 MODULE_TYPE, | 753 MODULE_TYPE, |
| 757 MODULE_INFO_ENTRY_TYPE, | 754 MODULE_INFO_ENTRY_TYPE, |
| 758 | 755 |
| 759 // All the following types are subtypes of JSReceiver, which corresponds to | 756 // All the following types are subtypes of JSReceiver, which corresponds to |
| 760 // objects in the JS sense. The first and the last type in this range are | 757 // objects in the JS sense. The first and the last type in this range are |
| 761 // the two forms of function. This organization enables using the same | 758 // the two forms of function. This organization enables using the same |
| 762 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. | 759 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. |
| 763 JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE | 760 JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE |
| (...skipping 3257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4021 class SeededNumberDictionary | 4018 class SeededNumberDictionary |
| 4022 : public Dictionary<SeededNumberDictionary, | 4019 : public Dictionary<SeededNumberDictionary, |
| 4023 SeededNumberDictionaryShape, | 4020 SeededNumberDictionaryShape, |
| 4024 uint32_t> { | 4021 uint32_t> { |
| 4025 public: | 4022 public: |
| 4026 DECLARE_CAST(SeededNumberDictionary) | 4023 DECLARE_CAST(SeededNumberDictionary) |
| 4027 | 4024 |
| 4028 // Type specific at put (default NONE attributes is used when adding). | 4025 // Type specific at put (default NONE attributes is used when adding). |
| 4029 MUST_USE_RESULT static Handle<SeededNumberDictionary> AtNumberPut( | 4026 MUST_USE_RESULT static Handle<SeededNumberDictionary> AtNumberPut( |
| 4030 Handle<SeededNumberDictionary> dictionary, uint32_t key, | 4027 Handle<SeededNumberDictionary> dictionary, uint32_t key, |
| 4031 Handle<Object> value, Handle<JSObject> dictionary_holder); | 4028 Handle<Object> value, bool used_as_prototype); |
| 4032 MUST_USE_RESULT static Handle<SeededNumberDictionary> AddNumberEntry( | 4029 MUST_USE_RESULT static Handle<SeededNumberDictionary> AddNumberEntry( |
| 4033 Handle<SeededNumberDictionary> dictionary, uint32_t key, | 4030 Handle<SeededNumberDictionary> dictionary, uint32_t key, |
| 4034 Handle<Object> value, PropertyDetails details, | 4031 Handle<Object> value, PropertyDetails details, bool used_as_prototype); |
| 4035 Handle<JSObject> dictionary_holder); | |
| 4036 | 4032 |
| 4037 // Set an existing entry or add a new one if needed. | 4033 // Set an existing entry or add a new one if needed. |
| 4038 // Return the updated dictionary. | 4034 // Return the updated dictionary. |
| 4039 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set( | 4035 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set( |
| 4040 Handle<SeededNumberDictionary> dictionary, uint32_t key, | 4036 Handle<SeededNumberDictionary> dictionary, uint32_t key, |
| 4041 Handle<Object> value, PropertyDetails details, | 4037 Handle<Object> value, PropertyDetails details, bool used_as_prototype); |
| 4042 Handle<JSObject> dictionary_holder); | |
| 4043 | 4038 |
| 4044 void UpdateMaxNumberKey(uint32_t key, Handle<JSObject> dictionary_holder); | 4039 void UpdateMaxNumberKey(uint32_t key, bool used_as_prototype); |
| 4045 | 4040 |
| 4046 // Returns true if the dictionary contains any elements that are non-writable, | 4041 // Returns true if the dictionary contains any elements that are non-writable, |
| 4047 // non-configurable, non-enumerable, or have getters/setters. | 4042 // non-configurable, non-enumerable, or have getters/setters. |
| 4048 bool HasComplexElements(); | 4043 bool HasComplexElements(); |
| 4049 | 4044 |
| 4050 // If slow elements are required we will never go back to fast-case | 4045 // If slow elements are required we will never go back to fast-case |
| 4051 // for the elements kept in this dictionary. We require slow | 4046 // for the elements kept in this dictionary. We require slow |
| 4052 // elements if an element has been added at an index larger than | 4047 // elements if an element has been added at an index larger than |
| 4053 // kRequiresSlowElementsLimit or set_requires_slow_elements() has been called | 4048 // kRequiresSlowElementsLimit or set_requires_slow_elements() has been called |
| 4054 // when defining a getter or setter with a number key. | 4049 // when defining a getter or setter with a number key. |
| (...skipping 2916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6971 | 6966 |
| 6972 // Bit field usage. | 6967 // Bit field usage. |
| 6973 static const int kShouldBeFastBit = 0; | 6968 static const int kShouldBeFastBit = 0; |
| 6974 | 6969 |
| 6975 private: | 6970 private: |
| 6976 DECL_ACCESSORS(object_create_map, Object) | 6971 DECL_ACCESSORS(object_create_map, Object) |
| 6977 | 6972 |
| 6978 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo); | 6973 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo); |
| 6979 }; | 6974 }; |
| 6980 | 6975 |
| 6981 class Tuple2 : public Struct { | 6976 class Tuple3 : public Struct { |
| 6982 public: | 6977 public: |
| 6983 DECL_ACCESSORS(value1, Object) | 6978 DECL_ACCESSORS(value1, Object) |
| 6984 DECL_ACCESSORS(value2, Object) | 6979 DECL_ACCESSORS(value2, Object) |
| 6985 | |
| 6986 DECLARE_CAST(Tuple2) | |
| 6987 | |
| 6988 // Dispatched behavior. | |
| 6989 DECLARE_PRINTER(Tuple2) | |
| 6990 DECLARE_VERIFIER(Tuple2) | |
| 6991 | |
| 6992 static const int kValue1Offset = HeapObject::kHeaderSize; | |
| 6993 static const int kValue2Offset = kValue1Offset + kPointerSize; | |
| 6994 static const int kSize = kValue2Offset + kPointerSize; | |
| 6995 | |
| 6996 private: | |
| 6997 DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple2); | |
| 6998 }; | |
| 6999 | |
| 7000 class Tuple3 : public Tuple2 { | |
| 7001 public: | |
| 7002 DECL_ACCESSORS(value3, Object) | 6980 DECL_ACCESSORS(value3, Object) |
| 7003 | 6981 |
| 7004 DECLARE_CAST(Tuple3) | 6982 DECLARE_CAST(Tuple3) |
| 7005 | 6983 |
| 7006 // Dispatched behavior. | 6984 // Dispatched behavior. |
| 7007 DECLARE_PRINTER(Tuple3) | 6985 DECLARE_PRINTER(Tuple3) |
| 7008 DECLARE_VERIFIER(Tuple3) | 6986 DECLARE_VERIFIER(Tuple3) |
| 7009 | 6987 |
| 7010 static const int kValue3Offset = Tuple2::kSize; | 6988 static const int kValue1Offset = HeapObject::kHeaderSize; |
| 6989 static const int kValue2Offset = kValue1Offset + kPointerSize; |
| 6990 static const int kValue3Offset = kValue2Offset + kPointerSize; |
| 7011 static const int kSize = kValue3Offset + kPointerSize; | 6991 static const int kSize = kValue3Offset + kPointerSize; |
| 7012 | 6992 |
| 7013 private: | 6993 private: |
| 7014 DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple3); | 6994 DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple3); |
| 7015 }; | 6995 }; |
| 7016 | 6996 |
| 7017 // Pair used to store both a ScopeInfo and an extension object in the extension | 6997 // Pair used to store both a ScopeInfo and an extension object in the extension |
| 7018 // slot of a block, catch, or with context. Needed in the rare case where a | 6998 // slot of a block, catch, or with context. Needed in the rare case where a |
| 7019 // declaration block scope (a "varblock" as used to desugar parameter | 6999 // declaration block scope (a "varblock" as used to desugar parameter |
| 7020 // destructuring) also contains a sloppy direct eval, or for with and catch | 7000 // destructuring) also contains a sloppy direct eval, or for with and catch |
| (...skipping 4876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11897 } | 11877 } |
| 11898 return value; | 11878 return value; |
| 11899 } | 11879 } |
| 11900 }; | 11880 }; |
| 11901 | 11881 |
| 11902 | 11882 |
| 11903 } // NOLINT, false-positive due to second-order macros. | 11883 } // NOLINT, false-positive due to second-order macros. |
| 11904 } // NOLINT, false-positive due to second-order macros. | 11884 } // NOLINT, false-positive due to second-order macros. |
| 11905 | 11885 |
| 11906 #endif // V8_OBJECTS_H_ | 11886 #endif // V8_OBJECTS_H_ |
| OLD | NEW |