OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // - CallHandlerInfo | 136 // - CallHandlerInfo |
137 // - TemplateInfo | 137 // - TemplateInfo |
138 // - FunctionTemplateInfo | 138 // - FunctionTemplateInfo |
139 // - ObjectTemplateInfo | 139 // - ObjectTemplateInfo |
140 // - Script | 140 // - Script |
141 // - SignatureInfo | 141 // - SignatureInfo |
142 // - TypeSwitchInfo | 142 // - TypeSwitchInfo |
143 // - DebugInfo | 143 // - DebugInfo |
144 // - BreakPointInfo | 144 // - BreakPointInfo |
145 // - CodeCache | 145 // - CodeCache |
| 146 // - WeakCell |
146 // | 147 // |
147 // Formats of Object*: | 148 // Formats of Object*: |
148 // Smi: [31 bit signed int] 0 | 149 // Smi: [31 bit signed int] 0 |
149 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 | 150 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 |
150 | 151 |
151 namespace v8 { | 152 namespace v8 { |
152 namespace internal { | 153 namespace internal { |
153 | 154 |
154 enum KeyedAccessStoreMode { | 155 enum KeyedAccessStoreMode { |
155 STANDARD_STORE, | 156 STANDARD_STORE, |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 V(CODE_CACHE_TYPE) \ | 419 V(CODE_CACHE_TYPE) \ |
419 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | 420 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
420 V(TYPE_FEEDBACK_INFO_TYPE) \ | 421 V(TYPE_FEEDBACK_INFO_TYPE) \ |
421 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 422 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
422 V(BOX_TYPE) \ | 423 V(BOX_TYPE) \ |
423 \ | 424 \ |
424 V(FIXED_ARRAY_TYPE) \ | 425 V(FIXED_ARRAY_TYPE) \ |
425 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 426 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
426 V(CONSTANT_POOL_ARRAY_TYPE) \ | 427 V(CONSTANT_POOL_ARRAY_TYPE) \ |
427 V(SHARED_FUNCTION_INFO_TYPE) \ | 428 V(SHARED_FUNCTION_INFO_TYPE) \ |
| 429 V(WEAK_CELL_TYPE) \ |
428 \ | 430 \ |
429 V(JS_MESSAGE_OBJECT_TYPE) \ | 431 V(JS_MESSAGE_OBJECT_TYPE) \ |
430 \ | 432 \ |
431 V(JS_VALUE_TYPE) \ | 433 V(JS_VALUE_TYPE) \ |
432 V(JS_DATE_TYPE) \ | 434 V(JS_DATE_TYPE) \ |
433 V(JS_OBJECT_TYPE) \ | 435 V(JS_OBJECT_TYPE) \ |
434 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 436 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
435 V(JS_GENERATOR_OBJECT_TYPE) \ | 437 V(JS_GENERATOR_OBJECT_TYPE) \ |
436 V(JS_MODULE_TYPE) \ | 438 V(JS_MODULE_TYPE) \ |
437 V(JS_GLOBAL_OBJECT_TYPE) \ | 439 V(JS_GLOBAL_OBJECT_TYPE) \ |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 CODE_CACHE_TYPE, | 716 CODE_CACHE_TYPE, |
715 POLYMORPHIC_CODE_CACHE_TYPE, | 717 POLYMORPHIC_CODE_CACHE_TYPE, |
716 TYPE_FEEDBACK_INFO_TYPE, | 718 TYPE_FEEDBACK_INFO_TYPE, |
717 ALIASED_ARGUMENTS_ENTRY_TYPE, | 719 ALIASED_ARGUMENTS_ENTRY_TYPE, |
718 BOX_TYPE, | 720 BOX_TYPE, |
719 DEBUG_INFO_TYPE, | 721 DEBUG_INFO_TYPE, |
720 BREAK_POINT_INFO_TYPE, | 722 BREAK_POINT_INFO_TYPE, |
721 FIXED_ARRAY_TYPE, | 723 FIXED_ARRAY_TYPE, |
722 CONSTANT_POOL_ARRAY_TYPE, | 724 CONSTANT_POOL_ARRAY_TYPE, |
723 SHARED_FUNCTION_INFO_TYPE, | 725 SHARED_FUNCTION_INFO_TYPE, |
| 726 WEAK_CELL_TYPE, |
724 | 727 |
725 // All the following types are subtypes of JSReceiver, which corresponds to | 728 // All the following types are subtypes of JSReceiver, which corresponds to |
726 // objects in the JS sense. The first and the last type in this range are | 729 // objects in the JS sense. The first and the last type in this range are |
727 // the two forms of function. This organization enables using the same | 730 // the two forms of function. This organization enables using the same |
728 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the | 731 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the |
729 // NONCALLABLE_JS_OBJECT range. | 732 // NONCALLABLE_JS_OBJECT range. |
730 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE | 733 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE |
731 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE | 734 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE |
732 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE | 735 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE |
733 JS_MESSAGE_OBJECT_TYPE, | 736 JS_MESSAGE_OBJECT_TYPE, |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 V(MapCache) \ | 980 V(MapCache) \ |
978 V(Primitive) \ | 981 V(Primitive) \ |
979 V(GlobalObject) \ | 982 V(GlobalObject) \ |
980 V(JSGlobalObject) \ | 983 V(JSGlobalObject) \ |
981 V(JSBuiltinsObject) \ | 984 V(JSBuiltinsObject) \ |
982 V(JSGlobalProxy) \ | 985 V(JSGlobalProxy) \ |
983 V(UndetectableObject) \ | 986 V(UndetectableObject) \ |
984 V(AccessCheckNeeded) \ | 987 V(AccessCheckNeeded) \ |
985 V(Cell) \ | 988 V(Cell) \ |
986 V(PropertyCell) \ | 989 V(PropertyCell) \ |
| 990 V(WeakCell) \ |
987 V(ObjectHashTable) \ | 991 V(ObjectHashTable) \ |
988 V(WeakHashTable) \ | 992 V(WeakHashTable) \ |
989 V(OrderedHashTable) | 993 V(OrderedHashTable) |
990 | 994 |
991 // Object is the abstract superclass for all classes in the | 995 // Object is the abstract superclass for all classes in the |
992 // object hierarchy. | 996 // object hierarchy. |
993 // Object does not use any virtual functions to avoid the | 997 // Object does not use any virtual functions to avoid the |
994 // allocation of the C++ vtable. | 998 // allocation of the C++ vtable. |
995 // Since both Smi and HeapObject are subclasses of Object no | 999 // Since both Smi and HeapObject are subclasses of Object no |
996 // data members can be present in Object. | 1000 // data members can be present in Object. |
(...skipping 8552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9549 typedef FixedBodyDescriptor<kValueOffset, | 9553 typedef FixedBodyDescriptor<kValueOffset, |
9550 kSize, | 9554 kSize, |
9551 kSize> BodyDescriptor; | 9555 kSize> BodyDescriptor; |
9552 | 9556 |
9553 private: | 9557 private: |
9554 DECL_ACCESSORS(type_raw, Object) | 9558 DECL_ACCESSORS(type_raw, Object) |
9555 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); | 9559 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); |
9556 }; | 9560 }; |
9557 | 9561 |
9558 | 9562 |
| 9563 class WeakCell : public HeapObject { |
| 9564 public: |
| 9565 inline HeapObject* value() const; |
| 9566 |
| 9567 // This should not be called by anyone except GC. |
| 9568 inline void update_value_from_gc(HeapObject* val); |
| 9569 |
| 9570 DECL_ACCESSORS(next, Object) |
| 9571 |
| 9572 DECLARE_CAST(WeakCell) |
| 9573 |
| 9574 DECLARE_PRINTER(WeakCell) |
| 9575 DECLARE_VERIFIER(WeakCell) |
| 9576 |
| 9577 // Layout description. |
| 9578 static const int kValueOffset = HeapObject::kHeaderSize; |
| 9579 static const int kNextOffset = kValueOffset + kPointerSize; |
| 9580 static const int kSize = kNextOffset + kPointerSize; |
| 9581 |
| 9582 typedef FixedBodyDescriptor<kValueOffset, kSize, kSize> BodyDescriptor; |
| 9583 |
| 9584 private: |
| 9585 DISALLOW_IMPLICIT_CONSTRUCTORS(WeakCell); |
| 9586 }; |
| 9587 |
| 9588 |
9559 // The JSProxy describes EcmaScript Harmony proxies | 9589 // The JSProxy describes EcmaScript Harmony proxies |
9560 class JSProxy: public JSReceiver { | 9590 class JSProxy: public JSReceiver { |
9561 public: | 9591 public: |
9562 // [handler]: The handler property. | 9592 // [handler]: The handler property. |
9563 DECL_ACCESSORS(handler, Object) | 9593 DECL_ACCESSORS(handler, Object) |
9564 | 9594 |
9565 // [hash]: The hash code property (undefined if not initialized yet). | 9595 // [hash]: The hash code property (undefined if not initialized yet). |
9566 DECL_ACCESSORS(hash, Object) | 9596 DECL_ACCESSORS(hash, Object) |
9567 | 9597 |
9568 DECLARE_CAST(JSProxy) | 9598 DECLARE_CAST(JSProxy) |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10854 } else { | 10884 } else { |
10855 value &= ~(1 << bit_position); | 10885 value &= ~(1 << bit_position); |
10856 } | 10886 } |
10857 return value; | 10887 return value; |
10858 } | 10888 } |
10859 }; | 10889 }; |
10860 | 10890 |
10861 } } // namespace v8::internal | 10891 } } // namespace v8::internal |
10862 | 10892 |
10863 #endif // V8_OBJECTS_H_ | 10893 #endif // V8_OBJECTS_H_ |
OLD | NEW |