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 5965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5976 inline Object* GetBackPointer(); | 5976 inline Object* GetBackPointer(); |
5977 inline void SetBackPointer(Object* value, | 5977 inline void SetBackPointer(Object* value, |
5978 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 5978 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
5979 inline void init_back_pointer(Object* undefined); | 5979 inline void init_back_pointer(Object* undefined); |
5980 | 5980 |
5981 // [prototype transitions]: cache of prototype transitions. | 5981 // [prototype transitions]: cache of prototype transitions. |
5982 // Prototype transition is a transition that happens | 5982 // Prototype transition is a transition that happens |
5983 // when we change object's prototype to a new one. | 5983 // when we change object's prototype to a new one. |
5984 // Cache format: | 5984 // Cache format: |
5985 // 0: finger - index of the first free cell in the cache | 5985 // 0: finger - index of the first free cell in the cache |
5986 // 1: back pointer that overlaps with prototype transitions field. | 5986 // 1 + i: target map |
5987 // 2 + 2 * i: prototype | |
5988 // 3 + 2 * i: target map | |
5989 inline FixedArray* GetPrototypeTransitions(); | 5987 inline FixedArray* GetPrototypeTransitions(); |
5990 inline bool HasPrototypeTransitions(); | 5988 inline bool HasPrototypeTransitions(); |
5991 | 5989 |
| 5990 static const int kProtoTransitionNumberOfEntriesOffset = 0; |
5992 static const int kProtoTransitionHeaderSize = 1; | 5991 static const int kProtoTransitionHeaderSize = 1; |
5993 static const int kProtoTransitionNumberOfEntriesOffset = 0; | |
5994 static const int kProtoTransitionElementsPerEntry = 2; | |
5995 static const int kProtoTransitionPrototypeOffset = 0; | |
5996 static const int kProtoTransitionMapOffset = 1; | |
5997 | 5992 |
5998 inline int NumberOfProtoTransitions() { | 5993 inline int NumberOfProtoTransitions() { |
5999 FixedArray* cache = GetPrototypeTransitions(); | 5994 FixedArray* cache = GetPrototypeTransitions(); |
6000 if (cache->length() == 0) return 0; | 5995 if (cache->length() == 0) return 0; |
6001 return | 5996 return |
6002 Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value(); | 5997 Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value(); |
6003 } | 5998 } |
6004 | 5999 |
6005 inline void SetNumberOfProtoTransitions(int value) { | 6000 inline void SetNumberOfProtoTransitions(int value) { |
6006 FixedArray* cache = GetPrototypeTransitions(); | 6001 FixedArray* cache = GetPrototypeTransitions(); |
(...skipping 4976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10983 } else { | 10978 } else { |
10984 value &= ~(1 << bit_position); | 10979 value &= ~(1 << bit_position); |
10985 } | 10980 } |
10986 return value; | 10981 return value; |
10987 } | 10982 } |
10988 }; | 10983 }; |
10989 | 10984 |
10990 } } // namespace v8::internal | 10985 } } // namespace v8::internal |
10991 | 10986 |
10992 #endif // V8_OBJECTS_H_ | 10987 #endif // V8_OBJECTS_H_ |
OLD | NEW |