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

Side by Side Diff: src/objects.h

Issue 958023002: Store weak cell cache for map in the map itself. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix verification of normalized map Created 5 years, 9 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/heap/heap.cc ('k') | src/objects.cc » ('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 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 5973 matching lines...) Expand 10 before | Expand all | Expand 10 after
5984 LayoutDescriptor* layout_descriptor); 5984 LayoutDescriptor* layout_descriptor);
5985 inline void InitializeDescriptors(DescriptorArray* descriptors, 5985 inline void InitializeDescriptors(DescriptorArray* descriptors,
5986 LayoutDescriptor* layout_descriptor); 5986 LayoutDescriptor* layout_descriptor);
5987 5987
5988 // [stub cache]: contains stubs compiled for this map. 5988 // [stub cache]: contains stubs compiled for this map.
5989 DECL_ACCESSORS(code_cache, Object) 5989 DECL_ACCESSORS(code_cache, Object)
5990 5990
5991 // [dependent code]: list of optimized codes that weakly embed this map. 5991 // [dependent code]: list of optimized codes that weakly embed this map.
5992 DECL_ACCESSORS(dependent_code, DependentCode) 5992 DECL_ACCESSORS(dependent_code, DependentCode)
5993 5993
5994 // [weak cell cache]: cache that stores a weak cell pointing to this map.
5995 DECL_ACCESSORS(weak_cell_cache, Object)
5996
5994 // [prototype transitions]: cache of prototype transitions. 5997 // [prototype transitions]: cache of prototype transitions.
5995 // Prototype transition is a transition that happens 5998 // Prototype transition is a transition that happens
5996 // when we change object's prototype to a new one. 5999 // when we change object's prototype to a new one.
5997 // Cache format: 6000 // Cache format:
5998 // 0: finger - index of the first free cell in the cache 6001 // 0: finger - index of the first free cell in the cache
5999 // 1 + i: target map 6002 // 1 + i: target map
6000 inline FixedArray* GetPrototypeTransitions(); 6003 inline FixedArray* GetPrototypeTransitions();
6001 inline bool HasPrototypeTransitions(); 6004 inline bool HasPrototypeTransitions();
6002 6005
6003 static const int kProtoTransitionNumberOfEntriesOffset = 0; 6006 static const int kProtoTransitionNumberOfEntriesOffset = 0;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
6289 kConstructorOrBackPointerOffset + kPointerSize; 6292 kConstructorOrBackPointerOffset + kPointerSize;
6290 static const int kDescriptorsOffset = kTransitionsOffset + kPointerSize; 6293 static const int kDescriptorsOffset = kTransitionsOffset + kPointerSize;
6291 #if V8_DOUBLE_FIELDS_UNBOXING 6294 #if V8_DOUBLE_FIELDS_UNBOXING
6292 static const int kLayoutDecriptorOffset = kDescriptorsOffset + kPointerSize; 6295 static const int kLayoutDecriptorOffset = kDescriptorsOffset + kPointerSize;
6293 static const int kCodeCacheOffset = kLayoutDecriptorOffset + kPointerSize; 6296 static const int kCodeCacheOffset = kLayoutDecriptorOffset + kPointerSize;
6294 #else 6297 #else
6295 static const int kLayoutDecriptorOffset = 1; // Must not be ever accessed. 6298 static const int kLayoutDecriptorOffset = 1; // Must not be ever accessed.
6296 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize; 6299 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize;
6297 #endif 6300 #endif
6298 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize; 6301 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize;
6299 static const int kSize = kDependentCodeOffset + kPointerSize; 6302 static const int kWeakCellCacheOffset = kDependentCodeOffset + kPointerSize;
6303 static const int kSize = kWeakCellCacheOffset + kPointerSize;
6300 6304
6301 // Layout of pointer fields. Heap iteration code relies on them 6305 // Layout of pointer fields. Heap iteration code relies on them
6302 // being continuously allocated. 6306 // being continuously allocated.
6303 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; 6307 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset;
6304 static const int kPointerFieldsEndOffset = kSize; 6308 static const int kPointerFieldsEndOffset = kSize;
6305 6309
6306 // Byte offsets within kInstanceSizesOffset. 6310 // Byte offsets within kInstanceSizesOffset.
6307 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; 6311 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0;
6308 static const int kInObjectPropertiesByte = 1; 6312 static const int kInObjectPropertiesByte = 1;
6309 static const int kInObjectPropertiesOffset = 6313 static const int kInObjectPropertiesOffset =
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after
8101 8105
8102 private: 8106 private:
8103 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); 8107 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable);
8104 }; 8108 };
8105 8109
8106 8110
8107 class CodeCache: public Struct { 8111 class CodeCache: public Struct {
8108 public: 8112 public:
8109 DECL_ACCESSORS(default_cache, FixedArray) 8113 DECL_ACCESSORS(default_cache, FixedArray)
8110 DECL_ACCESSORS(normal_type_cache, Object) 8114 DECL_ACCESSORS(normal_type_cache, Object)
8111 DECL_ACCESSORS(weak_cell_cache, Object)
8112 8115
8113 // Add the code object to the cache. 8116 // Add the code object to the cache.
8114 static void Update( 8117 static void Update(
8115 Handle<CodeCache> cache, Handle<Name> name, Handle<Code> code); 8118 Handle<CodeCache> cache, Handle<Name> name, Handle<Code> code);
8116 8119
8117 // Lookup code object in the cache. Returns code object if found and undefined 8120 // Lookup code object in the cache. Returns code object if found and undefined
8118 // if not. 8121 // if not.
8119 Object* Lookup(Name* name, Code::Flags flags); 8122 Object* Lookup(Name* name, Code::Flags flags);
8120 8123
8121 // Get the internal index of a code object in the cache. Returns -1 if the 8124 // Get the internal index of a code object in the cache. Returns -1 if the
8122 // code object is not in that cache. This index can be used to later call 8125 // code object is not in that cache. This index can be used to later call
8123 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and 8126 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and
8124 // RemoveByIndex. 8127 // RemoveByIndex.
8125 int GetIndex(Object* name, Code* code); 8128 int GetIndex(Object* name, Code* code);
8126 8129
8127 // Remove an object from the cache with the provided internal index. 8130 // Remove an object from the cache with the provided internal index.
8128 void RemoveByIndex(Object* name, Code* code, int index); 8131 void RemoveByIndex(Object* name, Code* code, int index);
8129 8132
8130 DECLARE_CAST(CodeCache) 8133 DECLARE_CAST(CodeCache)
8131 8134
8132 // Dispatched behavior. 8135 // Dispatched behavior.
8133 DECLARE_PRINTER(CodeCache) 8136 DECLARE_PRINTER(CodeCache)
8134 DECLARE_VERIFIER(CodeCache) 8137 DECLARE_VERIFIER(CodeCache)
8135 8138
8136 static const int kDefaultCacheOffset = HeapObject::kHeaderSize; 8139 static const int kDefaultCacheOffset = HeapObject::kHeaderSize;
8137 static const int kNormalTypeCacheOffset = 8140 static const int kNormalTypeCacheOffset =
8138 kDefaultCacheOffset + kPointerSize; 8141 kDefaultCacheOffset + kPointerSize;
8139 static const int kWeakCellCacheOffset = kNormalTypeCacheOffset + kPointerSize; 8142 static const int kSize = kNormalTypeCacheOffset + kPointerSize;
8140 static const int kSize = kWeakCellCacheOffset + kPointerSize;
8141 8143
8142 private: 8144 private:
8143 static void UpdateDefaultCache( 8145 static void UpdateDefaultCache(
8144 Handle<CodeCache> code_cache, Handle<Name> name, Handle<Code> code); 8146 Handle<CodeCache> code_cache, Handle<Name> name, Handle<Code> code);
8145 static void UpdateNormalTypeCache( 8147 static void UpdateNormalTypeCache(
8146 Handle<CodeCache> code_cache, Handle<Name> name, Handle<Code> code); 8148 Handle<CodeCache> code_cache, Handle<Name> name, Handle<Code> code);
8147 Object* LookupDefaultCache(Name* name, Code::Flags flags); 8149 Object* LookupDefaultCache(Name* name, Code::Flags flags);
8148 Object* LookupNormalTypeCache(Name* name, Code::Flags flags); 8150 Object* LookupNormalTypeCache(Name* name, Code::Flags flags);
8149 8151
8150 // Code cache layout of the default cache. Elements are alternating name and 8152 // Code cache layout of the default cache. Elements are alternating name and
(...skipping 2827 matching lines...) Expand 10 before | Expand all | Expand 10 after
10978 } else { 10980 } else {
10979 value &= ~(1 << bit_position); 10981 value &= ~(1 << bit_position);
10980 } 10982 }
10981 return value; 10983 return value;
10982 } 10984 }
10983 }; 10985 };
10984 10986
10985 } } // namespace v8::internal 10987 } } // namespace v8::internal
10986 10988
10987 #endif // V8_OBJECTS_H_ 10989 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698