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 8563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9560 typedef FixedBodyDescriptor<kValueOffset, | 9564 typedef FixedBodyDescriptor<kValueOffset, |
9561 kSize, | 9565 kSize, |
9562 kSize> BodyDescriptor; | 9566 kSize> BodyDescriptor; |
9563 | 9567 |
9564 private: | 9568 private: |
9565 DECL_ACCESSORS(type_raw, Object) | 9569 DECL_ACCESSORS(type_raw, Object) |
9566 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); | 9570 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); |
9567 }; | 9571 }; |
9568 | 9572 |
9569 | 9573 |
| 9574 class WeakCell : public HeapObject { |
| 9575 public: |
| 9576 inline HeapObject* value() const; |
| 9577 |
| 9578 // This should not be called by anyone except GC. |
| 9579 inline void clear(HeapObject* undefined); |
| 9580 |
| 9581 // This should not be called by anyone except allocator. |
| 9582 inline void initialize(HeapObject* value); |
| 9583 |
| 9584 DECL_ACCESSORS(next, Object) |
| 9585 |
| 9586 DECLARE_CAST(WeakCell) |
| 9587 |
| 9588 DECLARE_PRINTER(WeakCell) |
| 9589 DECLARE_VERIFIER(WeakCell) |
| 9590 |
| 9591 // Layout description. |
| 9592 static const int kValueOffset = HeapObject::kHeaderSize; |
| 9593 static const int kNextOffset = kValueOffset + kPointerSize; |
| 9594 static const int kSize = kNextOffset + kPointerSize; |
| 9595 |
| 9596 typedef FixedBodyDescriptor<kValueOffset, kSize, kSize> BodyDescriptor; |
| 9597 |
| 9598 private: |
| 9599 DISALLOW_IMPLICIT_CONSTRUCTORS(WeakCell); |
| 9600 }; |
| 9601 |
| 9602 |
9570 // The JSProxy describes EcmaScript Harmony proxies | 9603 // The JSProxy describes EcmaScript Harmony proxies |
9571 class JSProxy: public JSReceiver { | 9604 class JSProxy: public JSReceiver { |
9572 public: | 9605 public: |
9573 // [handler]: The handler property. | 9606 // [handler]: The handler property. |
9574 DECL_ACCESSORS(handler, Object) | 9607 DECL_ACCESSORS(handler, Object) |
9575 | 9608 |
9576 // [hash]: The hash code property (undefined if not initialized yet). | 9609 // [hash]: The hash code property (undefined if not initialized yet). |
9577 DECL_ACCESSORS(hash, Object) | 9610 DECL_ACCESSORS(hash, Object) |
9578 | 9611 |
9579 DECLARE_CAST(JSProxy) | 9612 DECLARE_CAST(JSProxy) |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10865 } else { | 10898 } else { |
10866 value &= ~(1 << bit_position); | 10899 value &= ~(1 << bit_position); |
10867 } | 10900 } |
10868 return value; | 10901 return value; |
10869 } | 10902 } |
10870 }; | 10903 }; |
10871 | 10904 |
10872 } } // namespace v8::internal | 10905 } } // namespace v8::internal |
10873 | 10906 |
10874 #endif // V8_OBJECTS_H_ | 10907 #endif // V8_OBJECTS_H_ |
OLD | NEW |