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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 V(JSGlobalObject) \ | 984 V(JSGlobalObject) \ |
985 V(JSBuiltinsObject) \ | 985 V(JSBuiltinsObject) \ |
986 V(JSGlobalProxy) \ | 986 V(JSGlobalProxy) \ |
987 V(UndetectableObject) \ | 987 V(UndetectableObject) \ |
988 V(AccessCheckNeeded) \ | 988 V(AccessCheckNeeded) \ |
989 V(Cell) \ | 989 V(Cell) \ |
990 V(PropertyCell) \ | 990 V(PropertyCell) \ |
991 V(WeakCell) \ | 991 V(WeakCell) \ |
992 V(ObjectHashTable) \ | 992 V(ObjectHashTable) \ |
993 V(WeakHashTable) \ | 993 V(WeakHashTable) \ |
994 V(WeakValueHashTable) \ | |
995 V(OrderedHashTable) | 994 V(OrderedHashTable) |
996 | 995 |
997 // Object is the abstract superclass for all classes in the | 996 // Object is the abstract superclass for all classes in the |
998 // object hierarchy. | 997 // object hierarchy. |
999 // Object does not use any virtual functions to avoid the | 998 // Object does not use any virtual functions to avoid the |
1000 // allocation of the C++ vtable. | 999 // allocation of the C++ vtable. |
1001 // Since both Smi and HeapObject are subclasses of Object no | 1000 // Since both Smi and HeapObject are subclasses of Object no |
1002 // data members can be present in Object. | 1001 // data members can be present in Object. |
1003 class Object { | 1002 class Object { |
1004 public: | 1003 public: |
(...skipping 2730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3735 | 3734 |
3736 void AddEntry(int entry, Handle<WeakCell> key, Handle<HeapObject> value); | 3735 void AddEntry(int entry, Handle<WeakCell> key, Handle<HeapObject> value); |
3737 | 3736 |
3738 // Returns the index to the value of an entry. | 3737 // Returns the index to the value of an entry. |
3739 static inline int EntryToValueIndex(int entry) { | 3738 static inline int EntryToValueIndex(int entry) { |
3740 return EntryToIndex(entry) + 1; | 3739 return EntryToIndex(entry) + 1; |
3741 } | 3740 } |
3742 }; | 3741 }; |
3743 | 3742 |
3744 | 3743 |
3745 class WeakValueHashTable : public ObjectHashTable { | |
3746 public: | |
3747 DECLARE_CAST(WeakValueHashTable) | |
3748 | |
3749 #ifdef DEBUG | |
3750 // Looks up the value associated with the given key. The hole value is | |
3751 // returned in case the key is not present. | |
3752 Object* LookupWeak(Handle<Object> key); | |
3753 #endif // DEBUG | |
3754 | |
3755 // Adds (or overwrites) the value associated with the given key. Mapping a | |
3756 // key to the hole value causes removal of the whole entry. | |
3757 MUST_USE_RESULT static Handle<WeakValueHashTable> PutWeak( | |
3758 Handle<WeakValueHashTable> table, Handle<Object> key, | |
3759 Handle<HeapObject> value); | |
3760 | |
3761 static Handle<FixedArray> GetWeakValues(Handle<WeakValueHashTable> table); | |
3762 }; | |
3763 | |
3764 | |
3765 // ScopeInfo represents information about different scopes of a source | 3744 // ScopeInfo represents information about different scopes of a source |
3766 // program and the allocation of the scope's variables. Scope information | 3745 // program and the allocation of the scope's variables. Scope information |
3767 // is stored in a compressed form in ScopeInfo objects and is used | 3746 // is stored in a compressed form in ScopeInfo objects and is used |
3768 // at runtime (stack dumps, deoptimization, etc.). | 3747 // at runtime (stack dumps, deoptimization, etc.). |
3769 | 3748 |
3770 // This object provides quick access to scope info details for runtime | 3749 // This object provides quick access to scope info details for runtime |
3771 // routines. | 3750 // routines. |
3772 class ScopeInfo : public FixedArray { | 3751 class ScopeInfo : public FixedArray { |
3773 public: | 3752 public: |
3774 DECLARE_CAST(ScopeInfo) | 3753 DECLARE_CAST(ScopeInfo) |
(...skipping 6481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10256 } else { | 10235 } else { |
10257 value &= ~(1 << bit_position); | 10236 value &= ~(1 << bit_position); |
10258 } | 10237 } |
10259 return value; | 10238 return value; |
10260 } | 10239 } |
10261 }; | 10240 }; |
10262 | 10241 |
10263 } } // namespace v8::internal | 10242 } } // namespace v8::internal |
10264 | 10243 |
10265 #endif // V8_OBJECTS_H_ | 10244 #endif // V8_OBJECTS_H_ |
OLD | NEW |