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 | 9 |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2163 Handle<Object> value, | 2163 Handle<Object> value, |
2164 PropertyAttributes attributes); | 2164 PropertyAttributes attributes); |
2165 static void SetDictionaryArgumentsElement(Handle<JSObject> object, | 2165 static void SetDictionaryArgumentsElement(Handle<JSObject> object, |
2166 uint32_t index, | 2166 uint32_t index, |
2167 Handle<Object> value, | 2167 Handle<Object> value, |
2168 PropertyAttributes attributes); | 2168 PropertyAttributes attributes); |
2169 | 2169 |
2170 static void OptimizeAsPrototype(Handle<JSObject> object, | 2170 static void OptimizeAsPrototype(Handle<JSObject> object, |
2171 PrototypeOptimizationMode mode); | 2171 PrototypeOptimizationMode mode); |
2172 static void ReoptimizeIfPrototype(Handle<JSObject> object); | 2172 static void ReoptimizeIfPrototype(Handle<JSObject> object); |
| 2173 static void MakePrototypesFast(Handle<Object> receiver, |
| 2174 WhereToStart where_to_start, Isolate* isolate); |
2173 static void LazyRegisterPrototypeUser(Handle<Map> user, Isolate* isolate); | 2175 static void LazyRegisterPrototypeUser(Handle<Map> user, Isolate* isolate); |
2174 static void UpdatePrototypeUserRegistration(Handle<Map> old_map, | 2176 static void UpdatePrototypeUserRegistration(Handle<Map> old_map, |
2175 Handle<Map> new_map, | 2177 Handle<Map> new_map, |
2176 Isolate* isolate); | 2178 Isolate* isolate); |
2177 static bool UnregisterPrototypeUser(Handle<Map> user, Isolate* isolate); | 2179 static bool UnregisterPrototypeUser(Handle<Map> user, Isolate* isolate); |
2178 static void InvalidatePrototypeChains(Map* map); | 2180 static void InvalidatePrototypeChains(Map* map); |
2179 | 2181 |
2180 // Alternative implementation of WeakFixedArray::NullCallback. | 2182 // Alternative implementation of WeakFixedArray::NullCallback. |
2181 class PrototypeRegistryCompactionCallback { | 2183 class PrototypeRegistryCompactionCallback { |
2182 public: | 2184 public: |
(...skipping 3557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5740 DECL_ACCESSORS(raw_transitions, Object) | 5742 DECL_ACCESSORS(raw_transitions, Object) |
5741 // [prototype_info]: Per-prototype metadata. Aliased with transitions | 5743 // [prototype_info]: Per-prototype metadata. Aliased with transitions |
5742 // (which prototype maps don't have). | 5744 // (which prototype maps don't have). |
5743 DECL_ACCESSORS(prototype_info, Object) | 5745 DECL_ACCESSORS(prototype_info, Object) |
5744 // PrototypeInfo is created lazily using this helper (which installs it on | 5746 // PrototypeInfo is created lazily using this helper (which installs it on |
5745 // the given prototype's map). | 5747 // the given prototype's map). |
5746 static Handle<PrototypeInfo> GetOrCreatePrototypeInfo( | 5748 static Handle<PrototypeInfo> GetOrCreatePrototypeInfo( |
5747 Handle<JSObject> prototype, Isolate* isolate); | 5749 Handle<JSObject> prototype, Isolate* isolate); |
5748 static Handle<PrototypeInfo> GetOrCreatePrototypeInfo( | 5750 static Handle<PrototypeInfo> GetOrCreatePrototypeInfo( |
5749 Handle<Map> prototype_map, Isolate* isolate); | 5751 Handle<Map> prototype_map, Isolate* isolate); |
| 5752 inline bool should_be_fast_prototype_map() const; |
| 5753 static void SetShouldBeFastPrototypeMap(Handle<Map> map, bool value, |
| 5754 Isolate* isolate); |
5750 | 5755 |
5751 // [prototype chain validity cell]: Associated with a prototype object, | 5756 // [prototype chain validity cell]: Associated with a prototype object, |
5752 // stored in that object's map's PrototypeInfo, indicates that prototype | 5757 // stored in that object's map's PrototypeInfo, indicates that prototype |
5753 // chains through this object are currently valid. The cell will be | 5758 // chains through this object are currently valid. The cell will be |
5754 // invalidated and replaced when the prototype chain changes. | 5759 // invalidated and replaced when the prototype chain changes. |
5755 static Handle<Cell> GetOrCreatePrototypeChainValidityCell(Handle<Map> map, | 5760 static Handle<Cell> GetOrCreatePrototypeChainValidityCell(Handle<Map> map, |
5756 Isolate* isolate); | 5761 Isolate* isolate); |
5757 static const int kPrototypeChainValid = 0; | 5762 static const int kPrototypeChainValid = 0; |
5758 static const int kPrototypeChainInvalid = 1; | 5763 static const int kPrototypeChainInvalid = 1; |
5759 | 5764 |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6307 // is stored. Returns UNREGISTERED if this prototype has not been registered. | 6312 // is stored. Returns UNREGISTERED if this prototype has not been registered. |
6308 inline int registry_slot() const; | 6313 inline int registry_slot() const; |
6309 inline void set_registry_slot(int slot); | 6314 inline void set_registry_slot(int slot); |
6310 // [validity_cell]: Cell containing the validity bit for prototype chains | 6315 // [validity_cell]: Cell containing the validity bit for prototype chains |
6311 // going through this object, or Smi(0) if uninitialized. | 6316 // going through this object, or Smi(0) if uninitialized. |
6312 // When a prototype object changes its map, then both its own validity cell | 6317 // When a prototype object changes its map, then both its own validity cell |
6313 // and those of all "downstream" prototypes are invalidated; handlers for a | 6318 // and those of all "downstream" prototypes are invalidated; handlers for a |
6314 // given receiver embed the currently valid cell for that receiver's prototype | 6319 // given receiver embed the currently valid cell for that receiver's prototype |
6315 // during their compilation and check it on execution. | 6320 // during their compilation and check it on execution. |
6316 DECL_ACCESSORS(validity_cell, Object) | 6321 DECL_ACCESSORS(validity_cell, Object) |
| 6322 // [bit_field] |
| 6323 inline int bit_field() const; |
| 6324 inline void set_bit_field(int bit_field); |
| 6325 |
| 6326 DECL_BOOLEAN_ACCESSORS(should_be_fast_map) |
6317 | 6327 |
6318 DECLARE_CAST(PrototypeInfo) | 6328 DECLARE_CAST(PrototypeInfo) |
6319 | 6329 |
6320 // Dispatched behavior. | 6330 // Dispatched behavior. |
6321 DECLARE_PRINTER(PrototypeInfo) | 6331 DECLARE_PRINTER(PrototypeInfo) |
6322 DECLARE_VERIFIER(PrototypeInfo) | 6332 DECLARE_VERIFIER(PrototypeInfo) |
6323 | 6333 |
6324 static const int kPrototypeUsersOffset = HeapObject::kHeaderSize; | 6334 static const int kPrototypeUsersOffset = HeapObject::kHeaderSize; |
6325 static const int kRegistrySlotOffset = kPrototypeUsersOffset + kPointerSize; | 6335 static const int kRegistrySlotOffset = kPrototypeUsersOffset + kPointerSize; |
6326 static const int kValidityCellOffset = kRegistrySlotOffset + kPointerSize; | 6336 static const int kValidityCellOffset = kRegistrySlotOffset + kPointerSize; |
6327 static const int kConstructorNameOffset = kValidityCellOffset + kPointerSize; | 6337 static const int kBitFieldOffset = kValidityCellOffset + kPointerSize; |
6328 static const int kSize = kConstructorNameOffset + kPointerSize; | 6338 static const int kSize = kBitFieldOffset + kPointerSize; |
| 6339 |
| 6340 // Bit field usage. |
| 6341 static const int kShouldBeFastBit = 0; |
6329 | 6342 |
6330 private: | 6343 private: |
6331 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo); | 6344 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo); |
6332 }; | 6345 }; |
6333 | 6346 |
6334 | 6347 |
6335 // Pair used to store both a ScopeInfo and an extension object in the extension | 6348 // Pair used to store both a ScopeInfo and an extension object in the extension |
6336 // slot of a block context. Needed in the rare case where a declaration block | 6349 // slot of a block context. Needed in the rare case where a declaration block |
6337 // scope (a "varblock" as used to desugar parameter destructuring) also contains | 6350 // scope (a "varblock" as used to desugar parameter destructuring) also contains |
6338 // a sloppy direct eval. (In no other case both are needed at the same time.) | 6351 // a sloppy direct eval. (In no other case both are needed at the same time.) |
(...skipping 4458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10797 } | 10810 } |
10798 return value; | 10811 return value; |
10799 } | 10812 } |
10800 }; | 10813 }; |
10801 | 10814 |
10802 | 10815 |
10803 } // NOLINT, false-positive due to second-order macros. | 10816 } // NOLINT, false-positive due to second-order macros. |
10804 } // NOLINT, false-positive due to second-order macros. | 10817 } // NOLINT, false-positive due to second-order macros. |
10805 | 10818 |
10806 #endif // V8_OBJECTS_H_ | 10819 #endif // V8_OBJECTS_H_ |
OLD | NEW |