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 6204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6215 | 6215 |
6216 // [prototype chain validity cell]: Associated with a prototype object, | 6216 // [prototype chain validity cell]: Associated with a prototype object, |
6217 // stored in that object's map's PrototypeInfo, indicates that prototype | 6217 // stored in that object's map's PrototypeInfo, indicates that prototype |
6218 // chains through this object are currently valid. The cell will be | 6218 // chains through this object are currently valid. The cell will be |
6219 // invalidated and replaced when the prototype chain changes. | 6219 // invalidated and replaced when the prototype chain changes. |
6220 static Handle<Cell> GetOrCreatePrototypeChainValidityCell(Handle<Map> map, | 6220 static Handle<Cell> GetOrCreatePrototypeChainValidityCell(Handle<Map> map, |
6221 Isolate* isolate); | 6221 Isolate* isolate); |
6222 static const int kPrototypeChainValid = 0; | 6222 static const int kPrototypeChainValid = 0; |
6223 static const int kPrototypeChainInvalid = 1; | 6223 static const int kPrototypeChainInvalid = 1; |
6224 | 6224 |
| 6225 // Returns a WeakCell object containing given prototype. The cell is cached |
| 6226 // in PrototypeInfo which is created lazily. |
| 6227 static Handle<WeakCell> GetOrCreatePrototypeWeakCell( |
| 6228 Handle<JSObject> prototype, Isolate* isolate); |
| 6229 |
6225 Map* FindRootMap(); | 6230 Map* FindRootMap(); |
6226 Map* FindFieldOwner(int descriptor); | 6231 Map* FindFieldOwner(int descriptor); |
6227 | 6232 |
6228 inline int GetInObjectPropertyOffset(int index); | 6233 inline int GetInObjectPropertyOffset(int index); |
6229 | 6234 |
6230 int NumberOfFields(); | 6235 int NumberOfFields(); |
6231 | 6236 |
6232 // TODO(ishell): candidate with JSObject::MigrateToMap(). | 6237 // TODO(ishell): candidate with JSObject::MigrateToMap(). |
6233 bool InstancesNeedRewriting(Map* target); | 6238 bool InstancesNeedRewriting(Map* target); |
6234 bool InstancesNeedRewriting(Map* target, int target_number_of_fields, | 6239 bool InstancesNeedRewriting(Map* target, int target_number_of_fields, |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6816 private: | 6821 private: |
6817 DISALLOW_IMPLICIT_CONSTRUCTORS(Box); | 6822 DISALLOW_IMPLICIT_CONSTRUCTORS(Box); |
6818 }; | 6823 }; |
6819 | 6824 |
6820 | 6825 |
6821 // Container for metadata stored on each prototype map. | 6826 // Container for metadata stored on each prototype map. |
6822 class PrototypeInfo : public Struct { | 6827 class PrototypeInfo : public Struct { |
6823 public: | 6828 public: |
6824 static const int UNREGISTERED = -1; | 6829 static const int UNREGISTERED = -1; |
6825 | 6830 |
| 6831 // [weak_cell]: A WeakCell containing this prototype. ICs cache the cell here. |
| 6832 DECL_ACCESSORS(weak_cell, Object) |
| 6833 |
6826 // [prototype_users]: WeakFixedArray containing maps using this prototype, | 6834 // [prototype_users]: WeakFixedArray containing maps using this prototype, |
6827 // or Smi(0) if uninitialized. | 6835 // or Smi(0) if uninitialized. |
6828 DECL_ACCESSORS(prototype_users, Object) | 6836 DECL_ACCESSORS(prototype_users, Object) |
6829 | 6837 |
6830 // [object_create_map]: A field caching the map for Object.create(prototype). | 6838 // [object_create_map]: A field caching the map for Object.create(prototype). |
6831 static inline void SetObjectCreateMap(Handle<PrototypeInfo> info, | 6839 static inline void SetObjectCreateMap(Handle<PrototypeInfo> info, |
6832 Handle<Map> map); | 6840 Handle<Map> map); |
6833 inline Map* ObjectCreateMap(); | 6841 inline Map* ObjectCreateMap(); |
6834 inline bool HasObjectCreateMap(); | 6842 inline bool HasObjectCreateMap(); |
6835 | 6843 |
(...skipping 13 matching lines...) Expand all Loading... |
6849 inline void set_bit_field(int bit_field); | 6857 inline void set_bit_field(int bit_field); |
6850 | 6858 |
6851 DECL_BOOLEAN_ACCESSORS(should_be_fast_map) | 6859 DECL_BOOLEAN_ACCESSORS(should_be_fast_map) |
6852 | 6860 |
6853 DECLARE_CAST(PrototypeInfo) | 6861 DECLARE_CAST(PrototypeInfo) |
6854 | 6862 |
6855 // Dispatched behavior. | 6863 // Dispatched behavior. |
6856 DECLARE_PRINTER(PrototypeInfo) | 6864 DECLARE_PRINTER(PrototypeInfo) |
6857 DECLARE_VERIFIER(PrototypeInfo) | 6865 DECLARE_VERIFIER(PrototypeInfo) |
6858 | 6866 |
6859 static const int kPrototypeUsersOffset = HeapObject::kHeaderSize; | 6867 static const int kWeakCellOffset = HeapObject::kHeaderSize; |
| 6868 static const int kPrototypeUsersOffset = kWeakCellOffset + kPointerSize; |
6860 static const int kRegistrySlotOffset = kPrototypeUsersOffset + kPointerSize; | 6869 static const int kRegistrySlotOffset = kPrototypeUsersOffset + kPointerSize; |
6861 static const int kValidityCellOffset = kRegistrySlotOffset + kPointerSize; | 6870 static const int kValidityCellOffset = kRegistrySlotOffset + kPointerSize; |
6862 static const int kObjectCreateMap = kValidityCellOffset + kPointerSize; | 6871 static const int kObjectCreateMap = kValidityCellOffset + kPointerSize; |
6863 static const int kBitFieldOffset = kObjectCreateMap + kPointerSize; | 6872 static const int kBitFieldOffset = kObjectCreateMap + kPointerSize; |
6864 static const int kSize = kBitFieldOffset + kPointerSize; | 6873 static const int kSize = kBitFieldOffset + kPointerSize; |
6865 | 6874 |
6866 // Bit field usage. | 6875 // Bit field usage. |
6867 static const int kShouldBeFastBit = 0; | 6876 static const int kShouldBeFastBit = 0; |
6868 | 6877 |
6869 private: | 6878 private: |
(...skipping 4733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11603 } | 11612 } |
11604 return value; | 11613 return value; |
11605 } | 11614 } |
11606 }; | 11615 }; |
11607 | 11616 |
11608 | 11617 |
11609 } // NOLINT, false-positive due to second-order macros. | 11618 } // NOLINT, false-positive due to second-order macros. |
11610 } // NOLINT, false-positive due to second-order macros. | 11619 } // NOLINT, false-positive due to second-order macros. |
11611 | 11620 |
11612 #endif // V8_OBJECTS_H_ | 11621 #endif // V8_OBJECTS_H_ |
OLD | NEW |