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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 V(TYPE_SWITCH_INFO_TYPE) \ | 382 V(TYPE_SWITCH_INFO_TYPE) \ |
383 V(ALLOCATION_MEMENTO_TYPE) \ | 383 V(ALLOCATION_MEMENTO_TYPE) \ |
384 V(ALLOCATION_SITE_TYPE) \ | 384 V(ALLOCATION_SITE_TYPE) \ |
385 V(SCRIPT_TYPE) \ | 385 V(SCRIPT_TYPE) \ |
386 V(TYPE_FEEDBACK_INFO_TYPE) \ | 386 V(TYPE_FEEDBACK_INFO_TYPE) \ |
387 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 387 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
388 V(BOX_TYPE) \ | 388 V(BOX_TYPE) \ |
389 V(PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE) \ | 389 V(PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE) \ |
390 V(PROMISE_REACTION_JOB_INFO_TYPE) \ | 390 V(PROMISE_REACTION_JOB_INFO_TYPE) \ |
391 V(PROTOTYPE_INFO_TYPE) \ | 391 V(PROTOTYPE_INFO_TYPE) \ |
| 392 V(TUPLE2_TYPE) \ |
392 V(TUPLE3_TYPE) \ | 393 V(TUPLE3_TYPE) \ |
393 V(CONTEXT_EXTENSION_TYPE) \ | 394 V(CONTEXT_EXTENSION_TYPE) \ |
394 V(MODULE_TYPE) \ | 395 V(MODULE_TYPE) \ |
395 V(MODULE_INFO_ENTRY_TYPE) \ | 396 V(MODULE_INFO_ENTRY_TYPE) \ |
396 \ | 397 \ |
397 V(FIXED_ARRAY_TYPE) \ | 398 V(FIXED_ARRAY_TYPE) \ |
398 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 399 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
399 V(SHARED_FUNCTION_INFO_TYPE) \ | 400 V(SHARED_FUNCTION_INFO_TYPE) \ |
400 V(WEAK_CELL_TYPE) \ | 401 V(WEAK_CELL_TYPE) \ |
401 V(TRANSITION_ARRAY_TYPE) \ | 402 V(TRANSITION_ARRAY_TYPE) \ |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 550 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
550 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 551 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
551 V(SCRIPT, Script, script) \ | 552 V(SCRIPT, Script, script) \ |
552 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ | 553 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ |
553 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ | 554 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ |
554 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ | 555 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ |
555 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ | 556 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ |
556 V(DEBUG_INFO, DebugInfo, debug_info) \ | 557 V(DEBUG_INFO, DebugInfo, debug_info) \ |
557 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ | 558 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ |
558 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \ | 559 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \ |
| 560 V(TUPLE2, Tuple2, tuple2) \ |
559 V(TUPLE3, Tuple3, tuple3) \ | 561 V(TUPLE3, Tuple3, tuple3) \ |
560 V(MODULE, Module, module) \ | 562 V(MODULE, Module, module) \ |
561 V(MODULE_INFO_ENTRY, ModuleInfoEntry, module_info_entry) \ | 563 V(MODULE_INFO_ENTRY, ModuleInfoEntry, module_info_entry) \ |
562 V(CONTEXT_EXTENSION, ContextExtension, context_extension) | 564 V(CONTEXT_EXTENSION, ContextExtension, context_extension) |
563 | 565 |
564 // We use the full 8 bits of the instance_type field to encode heap object | 566 // We use the full 8 bits of the instance_type field to encode heap object |
565 // instance types. The high-order bit (bit 7) is set if the object is not a | 567 // instance types. The high-order bit (bit 7) is set if the object is not a |
566 // string, and cleared if it is a string. | 568 // string, and cleared if it is a string. |
567 const uint32_t kIsNotStringMask = 0x80; | 569 const uint32_t kIsNotStringMask = 0x80; |
568 const uint32_t kStringTag = 0x0; | 570 const uint32_t kStringTag = 0x0; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 PROMISE_REACTION_JOB_INFO_TYPE, | 730 PROMISE_REACTION_JOB_INFO_TYPE, |
729 DEBUG_INFO_TYPE, | 731 DEBUG_INFO_TYPE, |
730 BREAK_POINT_INFO_TYPE, | 732 BREAK_POINT_INFO_TYPE, |
731 FIXED_ARRAY_TYPE, | 733 FIXED_ARRAY_TYPE, |
732 SHARED_FUNCTION_INFO_TYPE, | 734 SHARED_FUNCTION_INFO_TYPE, |
733 CELL_TYPE, | 735 CELL_TYPE, |
734 WEAK_CELL_TYPE, | 736 WEAK_CELL_TYPE, |
735 TRANSITION_ARRAY_TYPE, | 737 TRANSITION_ARRAY_TYPE, |
736 PROPERTY_CELL_TYPE, | 738 PROPERTY_CELL_TYPE, |
737 PROTOTYPE_INFO_TYPE, | 739 PROTOTYPE_INFO_TYPE, |
| 740 TUPLE2_TYPE, |
738 TUPLE3_TYPE, | 741 TUPLE3_TYPE, |
739 CONTEXT_EXTENSION_TYPE, | 742 CONTEXT_EXTENSION_TYPE, |
740 MODULE_TYPE, | 743 MODULE_TYPE, |
741 MODULE_INFO_ENTRY_TYPE, | 744 MODULE_INFO_ENTRY_TYPE, |
742 | 745 |
743 // All the following types are subtypes of JSReceiver, which corresponds to | 746 // All the following types are subtypes of JSReceiver, which corresponds to |
744 // objects in the JS sense. The first and the last type in this range are | 747 // objects in the JS sense. The first and the last type in this range are |
745 // the two forms of function. This organization enables using the same | 748 // the two forms of function. This organization enables using the same |
746 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. | 749 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. |
747 JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE | 750 JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE |
(...skipping 3257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4005 class SeededNumberDictionary | 4008 class SeededNumberDictionary |
4006 : public Dictionary<SeededNumberDictionary, | 4009 : public Dictionary<SeededNumberDictionary, |
4007 SeededNumberDictionaryShape, | 4010 SeededNumberDictionaryShape, |
4008 uint32_t> { | 4011 uint32_t> { |
4009 public: | 4012 public: |
4010 DECLARE_CAST(SeededNumberDictionary) | 4013 DECLARE_CAST(SeededNumberDictionary) |
4011 | 4014 |
4012 // Type specific at put (default NONE attributes is used when adding). | 4015 // Type specific at put (default NONE attributes is used when adding). |
4013 MUST_USE_RESULT static Handle<SeededNumberDictionary> AtNumberPut( | 4016 MUST_USE_RESULT static Handle<SeededNumberDictionary> AtNumberPut( |
4014 Handle<SeededNumberDictionary> dictionary, uint32_t key, | 4017 Handle<SeededNumberDictionary> dictionary, uint32_t key, |
4015 Handle<Object> value, bool used_as_prototype); | 4018 Handle<Object> value, Handle<JSObject> dictionary_holder); |
4016 MUST_USE_RESULT static Handle<SeededNumberDictionary> AddNumberEntry( | 4019 MUST_USE_RESULT static Handle<SeededNumberDictionary> AddNumberEntry( |
4017 Handle<SeededNumberDictionary> dictionary, uint32_t key, | 4020 Handle<SeededNumberDictionary> dictionary, uint32_t key, |
4018 Handle<Object> value, PropertyDetails details, bool used_as_prototype); | 4021 Handle<Object> value, PropertyDetails details, |
| 4022 Handle<JSObject> dictionary_holder); |
4019 | 4023 |
4020 // Set an existing entry or add a new one if needed. | 4024 // Set an existing entry or add a new one if needed. |
4021 // Return the updated dictionary. | 4025 // Return the updated dictionary. |
4022 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set( | 4026 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set( |
4023 Handle<SeededNumberDictionary> dictionary, uint32_t key, | 4027 Handle<SeededNumberDictionary> dictionary, uint32_t key, |
4024 Handle<Object> value, PropertyDetails details, bool used_as_prototype); | 4028 Handle<Object> value, PropertyDetails details, |
| 4029 Handle<JSObject> dictionary_holder); |
4025 | 4030 |
4026 void UpdateMaxNumberKey(uint32_t key, bool used_as_prototype); | 4031 void UpdateMaxNumberKey(uint32_t key, Handle<JSObject> dictionary_holder); |
4027 | 4032 |
4028 // Returns true if the dictionary contains any elements that are non-writable, | 4033 // Returns true if the dictionary contains any elements that are non-writable, |
4029 // non-configurable, non-enumerable, or have getters/setters. | 4034 // non-configurable, non-enumerable, or have getters/setters. |
4030 bool HasComplexElements(); | 4035 bool HasComplexElements(); |
4031 | 4036 |
4032 // If slow elements are required we will never go back to fast-case | 4037 // If slow elements are required we will never go back to fast-case |
4033 // for the elements kept in this dictionary. We require slow | 4038 // for the elements kept in this dictionary. We require slow |
4034 // elements if an element has been added at an index larger than | 4039 // elements if an element has been added at an index larger than |
4035 // kRequiresSlowElementsLimit or set_requires_slow_elements() has been called | 4040 // kRequiresSlowElementsLimit or set_requires_slow_elements() has been called |
4036 // when defining a getter or setter with a number key. | 4041 // when defining a getter or setter with a number key. |
(...skipping 2945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6982 | 6987 |
6983 // Bit field usage. | 6988 // Bit field usage. |
6984 static const int kShouldBeFastBit = 0; | 6989 static const int kShouldBeFastBit = 0; |
6985 | 6990 |
6986 private: | 6991 private: |
6987 DECL_ACCESSORS(object_create_map, Object) | 6992 DECL_ACCESSORS(object_create_map, Object) |
6988 | 6993 |
6989 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo); | 6994 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo); |
6990 }; | 6995 }; |
6991 | 6996 |
6992 class Tuple3 : public Struct { | 6997 class Tuple2 : public Struct { |
6993 public: | 6998 public: |
6994 DECL_ACCESSORS(value1, Object) | 6999 DECL_ACCESSORS(value1, Object) |
6995 DECL_ACCESSORS(value2, Object) | 7000 DECL_ACCESSORS(value2, Object) |
| 7001 |
| 7002 DECLARE_CAST(Tuple2) |
| 7003 |
| 7004 // Dispatched behavior. |
| 7005 DECLARE_PRINTER(Tuple2) |
| 7006 DECLARE_VERIFIER(Tuple2) |
| 7007 |
| 7008 static const int kValue1Offset = HeapObject::kHeaderSize; |
| 7009 static const int kValue2Offset = kValue1Offset + kPointerSize; |
| 7010 static const int kSize = kValue2Offset + kPointerSize; |
| 7011 |
| 7012 private: |
| 7013 DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple2); |
| 7014 }; |
| 7015 |
| 7016 class Tuple3 : public Tuple2 { |
| 7017 public: |
6996 DECL_ACCESSORS(value3, Object) | 7018 DECL_ACCESSORS(value3, Object) |
6997 | 7019 |
6998 DECLARE_CAST(Tuple3) | 7020 DECLARE_CAST(Tuple3) |
6999 | 7021 |
7000 // Dispatched behavior. | 7022 // Dispatched behavior. |
7001 DECLARE_PRINTER(Tuple3) | 7023 DECLARE_PRINTER(Tuple3) |
7002 DECLARE_VERIFIER(Tuple3) | 7024 DECLARE_VERIFIER(Tuple3) |
7003 | 7025 |
7004 static const int kValue1Offset = HeapObject::kHeaderSize; | 7026 static const int kValue3Offset = Tuple2::kSize; |
7005 static const int kValue2Offset = kValue1Offset + kPointerSize; | |
7006 static const int kValue3Offset = kValue2Offset + kPointerSize; | |
7007 static const int kSize = kValue3Offset + kPointerSize; | 7027 static const int kSize = kValue3Offset + kPointerSize; |
7008 | 7028 |
7009 private: | 7029 private: |
7010 DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple3); | 7030 DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple3); |
7011 }; | 7031 }; |
7012 | 7032 |
7013 // Pair used to store both a ScopeInfo and an extension object in the extension | 7033 // Pair used to store both a ScopeInfo and an extension object in the extension |
7014 // slot of a block, catch, or with context. Needed in the rare case where a | 7034 // slot of a block, catch, or with context. Needed in the rare case where a |
7015 // declaration block scope (a "varblock" as used to desugar parameter | 7035 // declaration block scope (a "varblock" as used to desugar parameter |
7016 // destructuring) also contains a sloppy direct eval, or for with and catch | 7036 // destructuring) also contains a sloppy direct eval, or for with and catch |
(...skipping 4922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11939 } | 11959 } |
11940 return value; | 11960 return value; |
11941 } | 11961 } |
11942 }; | 11962 }; |
11943 | 11963 |
11944 | 11964 |
11945 } // NOLINT, false-positive due to second-order macros. | 11965 } // NOLINT, false-positive due to second-order macros. |
11946 } // NOLINT, false-positive due to second-order macros. | 11966 } // NOLINT, false-positive due to second-order macros. |
11947 | 11967 |
11948 #endif // V8_OBJECTS_H_ | 11968 #endif // V8_OBJECTS_H_ |
OLD | NEW |