Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: src/objects.h

Issue 2083353002: Cache Object.create maps on the passed prototype's PrototypeInfo (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: properly set prototype Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/contexts.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6286 matching lines...) Expand 10 before | Expand all | Expand 10 after
6297 6297
6298 6298
6299 // Container for metadata stored on each prototype map. 6299 // Container for metadata stored on each prototype map.
6300 class PrototypeInfo : public Struct { 6300 class PrototypeInfo : public Struct {
6301 public: 6301 public:
6302 static const int UNREGISTERED = -1; 6302 static const int UNREGISTERED = -1;
6303 6303
6304 // [prototype_users]: WeakFixedArray containing maps using this prototype, 6304 // [prototype_users]: WeakFixedArray containing maps using this prototype,
6305 // or Smi(0) if uninitialized. 6305 // or Smi(0) if uninitialized.
6306 DECL_ACCESSORS(prototype_users, Object) 6306 DECL_ACCESSORS(prototype_users, Object)
6307
6308 // [object_create_map]: A field caching the map for Object.create(prototype).
6309 static inline void SetObjectCreateMap(Handle<PrototypeInfo> info,
6310 Handle<Map> map);
6311 inline Map* ObjectCreateMap();
6312 inline bool HasObjectCreateMap();
6313
6307 // [registry_slot]: Slot in prototype's user registry where this user 6314 // [registry_slot]: Slot in prototype's user registry where this user
6308 // is stored. Returns UNREGISTERED if this prototype has not been registered. 6315 // is stored. Returns UNREGISTERED if this prototype has not been registered.
6309 inline int registry_slot() const; 6316 inline int registry_slot() const;
6310 inline void set_registry_slot(int slot); 6317 inline void set_registry_slot(int slot);
6311 // [validity_cell]: Cell containing the validity bit for prototype chains 6318 // [validity_cell]: Cell containing the validity bit for prototype chains
6312 // going through this object, or Smi(0) if uninitialized. 6319 // going through this object, or Smi(0) if uninitialized.
6313 // When a prototype object changes its map, then both its own validity cell 6320 // When a prototype object changes its map, then both its own validity cell
6314 // and those of all "downstream" prototypes are invalidated; handlers for a 6321 // and those of all "downstream" prototypes are invalidated; handlers for a
6315 // given receiver embed the currently valid cell for that receiver's prototype 6322 // given receiver embed the currently valid cell for that receiver's prototype
6316 // during their compilation and check it on execution. 6323 // during their compilation and check it on execution.
6317 DECL_ACCESSORS(validity_cell, Object) 6324 DECL_ACCESSORS(validity_cell, Object)
6318 // [bit_field] 6325 // [bit_field]
6319 inline int bit_field() const; 6326 inline int bit_field() const;
6320 inline void set_bit_field(int bit_field); 6327 inline void set_bit_field(int bit_field);
6321 6328
6322 DECL_BOOLEAN_ACCESSORS(should_be_fast_map) 6329 DECL_BOOLEAN_ACCESSORS(should_be_fast_map)
6323 6330
6324 DECLARE_CAST(PrototypeInfo) 6331 DECLARE_CAST(PrototypeInfo)
6325 6332
6326 // Dispatched behavior. 6333 // Dispatched behavior.
6327 DECLARE_PRINTER(PrototypeInfo) 6334 DECLARE_PRINTER(PrototypeInfo)
6328 DECLARE_VERIFIER(PrototypeInfo) 6335 DECLARE_VERIFIER(PrototypeInfo)
6329 6336
6330 static const int kPrototypeUsersOffset = HeapObject::kHeaderSize; 6337 static const int kPrototypeUsersOffset = HeapObject::kHeaderSize;
6331 static const int kRegistrySlotOffset = kPrototypeUsersOffset + kPointerSize; 6338 static const int kRegistrySlotOffset = kPrototypeUsersOffset + kPointerSize;
6332 static const int kValidityCellOffset = kRegistrySlotOffset + kPointerSize; 6339 static const int kValidityCellOffset = kRegistrySlotOffset + kPointerSize;
6333 static const int kBitFieldOffset = kValidityCellOffset + kPointerSize; 6340 static const int kObjectCreateMap = kValidityCellOffset + kPointerSize;
6341 static const int kBitFieldOffset = kObjectCreateMap + kPointerSize;
6334 static const int kSize = kBitFieldOffset + kPointerSize; 6342 static const int kSize = kBitFieldOffset + kPointerSize;
6335 6343
6336 // Bit field usage. 6344 // Bit field usage.
6337 static const int kShouldBeFastBit = 0; 6345 static const int kShouldBeFastBit = 0;
6338 6346
6339 private: 6347 private:
6348 DECL_ACCESSORS(object_create_map, Object)
6349
6340 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo); 6350 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo);
6341 }; 6351 };
6342 6352
6343 6353
6344 // Pair used to store both a ScopeInfo and an extension object in the extension 6354 // Pair used to store both a ScopeInfo and an extension object in the extension
6345 // slot of a block context. Needed in the rare case where a declaration block 6355 // slot of a block context. Needed in the rare case where a declaration block
6346 // scope (a "varblock" as used to desugar parameter destructuring) also contains 6356 // scope (a "varblock" as used to desugar parameter destructuring) also contains
6347 // a sloppy direct eval. (In no other case both are needed at the same time.) 6357 // a sloppy direct eval. (In no other case both are needed at the same time.)
6348 class SloppyBlockWithEvalContextExtension : public Struct { 6358 class SloppyBlockWithEvalContextExtension : public Struct {
6349 public: 6359 public:
(...skipping 4465 matching lines...) Expand 10 before | Expand all | Expand 10 after
10815 } 10825 }
10816 return value; 10826 return value;
10817 } 10827 }
10818 }; 10828 };
10819 10829
10820 10830
10821 } // NOLINT, false-positive due to second-order macros. 10831 } // NOLINT, false-positive due to second-order macros.
10822 } // NOLINT, false-positive due to second-order macros. 10832 } // NOLINT, false-positive due to second-order macros.
10823 10833
10824 #endif // V8_OBJECTS_H_ 10834 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698