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

Side by Side Diff: src/objects.h

Issue 263663002: Map::Normalize() introduced as single entry point for map normalization and Map::NotifyLeafMapLayou… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing review comments Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/bootstrapper.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 "allocation.h" 8 #include "allocation.h"
9 #include "assert-scope.h" 9 #include "assert-scope.h"
10 #include "builtins.h" 10 #include "builtins.h"
(...skipping 4599 matching lines...) Expand 10 before | Expand all | Expand 10 after
4610 class ContextLocalMode: public BitField<VariableMode, 0, 3> {}; 4610 class ContextLocalMode: public BitField<VariableMode, 0, 3> {};
4611 class ContextLocalInitFlag: public BitField<InitializationFlag, 3, 1> {}; 4611 class ContextLocalInitFlag: public BitField<InitializationFlag, 3, 1> {};
4612 }; 4612 };
4613 4613
4614 4614
4615 // The cache for maps used by normalized (dictionary mode) objects. 4615 // The cache for maps used by normalized (dictionary mode) objects.
4616 // Such maps do not have property descriptors, so a typical program 4616 // Such maps do not have property descriptors, so a typical program
4617 // needs very limited number of distinct normalized maps. 4617 // needs very limited number of distinct normalized maps.
4618 class NormalizedMapCache: public FixedArray { 4618 class NormalizedMapCache: public FixedArray {
4619 public: 4619 public:
4620 static const int kEntries = 64; 4620 static Handle<NormalizedMapCache> New(Isolate* isolate);
4621 4621
4622 static Handle<Map> Get(Handle<NormalizedMapCache> cache, 4622 MUST_USE_RESULT MaybeHandle<Map> Get(Handle<Map> fast_map,
4623 Handle<Map> fast_map, 4623 PropertyNormalizationMode mode);
4624 PropertyNormalizationMode mode); 4624 void Set(Handle<Map> fast_map, Handle<Map> normalized_map);
4625 4625
4626 void Clear(); 4626 void Clear();
4627 4627
4628 // Casting 4628 // Casting
4629 static inline NormalizedMapCache* cast(Object* obj); 4629 static inline NormalizedMapCache* cast(Object* obj);
4630 static inline bool IsNormalizedMapCache(Object* obj);
4630 4631
4631 DECLARE_VERIFIER(NormalizedMapCache) 4632 DECLARE_VERIFIER(NormalizedMapCache)
4633 private:
4634 static const int kEntries = 64;
4635
4636 static inline int GetIndex(Handle<Map> map);
4637
4638 // The following declarations hide base class methods.
4639 Object* get(int index);
4640 void set(int index, Object* value);
4632 }; 4641 };
4633 4642
4634 4643
4635 // ByteArray represents fixed sized byte arrays. Used for the relocation info 4644 // ByteArray represents fixed sized byte arrays. Used for the relocation info
4636 // that is attached to code objects. 4645 // that is attached to code objects.
4637 class ByteArray: public FixedArrayBase { 4646 class ByteArray: public FixedArrayBase {
4638 public: 4647 public:
4639 inline int Size() { return RoundUp(length() + kHeaderSize, kPointerSize); } 4648 inline int Size() { return RoundUp(length() + kHeaderSize, kPointerSize); }
4640 4649
4641 // Setter and getter. 4650 // Setter and getter.
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after
6114 Representation new_representation, 6123 Representation new_representation,
6115 Handle<HeapType> new_field_type, 6124 Handle<HeapType> new_field_type,
6116 StoreMode store_mode); 6125 StoreMode store_mode);
6117 static Handle<Map> CopyGeneralizeAllRepresentations( 6126 static Handle<Map> CopyGeneralizeAllRepresentations(
6118 Handle<Map> map, 6127 Handle<Map> map,
6119 int modify_index, 6128 int modify_index,
6120 StoreMode store_mode, 6129 StoreMode store_mode,
6121 PropertyAttributes attributes, 6130 PropertyAttributes attributes,
6122 const char* reason); 6131 const char* reason);
6123 6132
6133 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode);
6134
6124 // Returns the constructor name (the name (possibly, inferred name) of the 6135 // Returns the constructor name (the name (possibly, inferred name) of the
6125 // function that was used to instantiate the object). 6136 // function that was used to instantiate the object).
6126 String* constructor_name(); 6137 String* constructor_name();
6127 6138
6128 // Tells whether the map is attached to SharedFunctionInfo 6139 // Tells whether the map is attached to SharedFunctionInfo
6129 // (for inobject slack tracking). 6140 // (for inobject slack tracking).
6130 inline void set_attached_to_shared_function_info(bool value); 6141 inline void set_attached_to_shared_function_info(bool value);
6131 6142
6132 inline bool attached_to_shared_function_info(); 6143 inline bool attached_to_shared_function_info();
6133 6144
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
6307 static Handle<Map> AsElementsKind(Handle<Map> map, ElementsKind kind); 6318 static Handle<Map> AsElementsKind(Handle<Map> map, ElementsKind kind);
6308 6319
6309 static Handle<Map> CopyAsElementsKind(Handle<Map> map, 6320 static Handle<Map> CopyAsElementsKind(Handle<Map> map,
6310 ElementsKind kind, 6321 ElementsKind kind,
6311 TransitionFlag flag); 6322 TransitionFlag flag);
6312 6323
6313 static Handle<Map> CopyForObserved(Handle<Map> map); 6324 static Handle<Map> CopyForObserved(Handle<Map> map);
6314 6325
6315 static Handle<Map> CopyForFreeze(Handle<Map> map); 6326 static Handle<Map> CopyForFreeze(Handle<Map> map);
6316 6327
6317 static Handle<Map> CopyNormalized(Handle<Map> map,
6318 PropertyNormalizationMode mode,
6319 NormalizedMapSharingMode sharing);
6320
6321 inline void AppendDescriptor(Descriptor* desc); 6328 inline void AppendDescriptor(Descriptor* desc);
6322 6329
6323 // Returns a copy of the map, with all transitions dropped from the 6330 // Returns a copy of the map, with all transitions dropped from the
6324 // instance descriptors. 6331 // instance descriptors.
6325 static Handle<Map> Copy(Handle<Map> map); 6332 static Handle<Map> Copy(Handle<Map> map);
6326 static Handle<Map> Create(Handle<JSFunction> constructor, 6333 static Handle<Map> Create(Handle<JSFunction> constructor,
6327 int extra_inobject_properties); 6334 int extra_inobject_properties);
6328 6335
6329 // Returns the next free property index (only valid for FAST MODE). 6336 // Returns the next free property index (only valid for FAST MODE).
6330 int NextFreePropertyIndex(); 6337 int NextFreePropertyIndex();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
6404 return instance_type() == JS_GLOBAL_PROXY_TYPE; 6411 return instance_type() == JS_GLOBAL_PROXY_TYPE;
6405 } 6412 }
6406 bool IsJSGlobalObjectMap() { 6413 bool IsJSGlobalObjectMap() {
6407 return instance_type() == JS_GLOBAL_OBJECT_TYPE; 6414 return instance_type() == JS_GLOBAL_OBJECT_TYPE;
6408 } 6415 }
6409 bool IsGlobalObjectMap() { 6416 bool IsGlobalObjectMap() {
6410 const InstanceType type = instance_type(); 6417 const InstanceType type = instance_type();
6411 return type == JS_GLOBAL_OBJECT_TYPE || type == JS_BUILTINS_OBJECT_TYPE; 6418 return type == JS_GLOBAL_OBJECT_TYPE || type == JS_BUILTINS_OBJECT_TYPE;
6412 } 6419 }
6413 6420
6414 // Fires when the layout of an object with a leaf map changes.
6415 // This includes adding transitions to the leaf map or changing
6416 // the descriptor array.
6417 inline void NotifyLeafMapLayoutChange();
6418
6419 inline bool CanOmitMapChecks(); 6421 inline bool CanOmitMapChecks();
6420 6422
6421 static void AddDependentCompilationInfo(Handle<Map> map, 6423 static void AddDependentCompilationInfo(Handle<Map> map,
6422 DependentCode::DependencyGroup group, 6424 DependentCode::DependencyGroup group,
6423 CompilationInfo* info); 6425 CompilationInfo* info);
6424 6426
6425 static void AddDependentCode(Handle<Map> map, 6427 static void AddDependentCode(Handle<Map> map,
6426 DependentCode::DependencyGroup group, 6428 DependentCode::DependencyGroup group,
6427 Handle<Code> code); 6429 Handle<Code> code);
6428 static void AddDependentIC(Handle<Map> map, 6430 static void AddDependentIC(Handle<Map> map,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
6558 static Handle<Map> CopyAddDescriptor(Handle<Map> map, 6560 static Handle<Map> CopyAddDescriptor(Handle<Map> map,
6559 Descriptor* descriptor, 6561 Descriptor* descriptor,
6560 TransitionFlag flag); 6562 TransitionFlag flag);
6561 static Handle<Map> CopyReplaceDescriptors( 6563 static Handle<Map> CopyReplaceDescriptors(
6562 Handle<Map> map, 6564 Handle<Map> map,
6563 Handle<DescriptorArray> descriptors, 6565 Handle<DescriptorArray> descriptors,
6564 TransitionFlag flag, 6566 TransitionFlag flag,
6565 MaybeHandle<Name> maybe_name, 6567 MaybeHandle<Name> maybe_name,
6566 SimpleTransitionFlag simple_flag = FULL_TRANSITION); 6568 SimpleTransitionFlag simple_flag = FULL_TRANSITION);
6567 6569
6570 static Handle<Map> CopyNormalized(Handle<Map> map,
6571 PropertyNormalizationMode mode,
6572 NormalizedMapSharingMode sharing);
6573
6574 // Fires when the layout of an object with a leaf map changes.
6575 // This includes adding transitions to the leaf map or changing
6576 // the descriptor array.
6577 inline void NotifyLeafMapLayoutChange();
6578
6568 // Zaps the contents of backing data structures. Note that the 6579 // Zaps the contents of backing data structures. Note that the
6569 // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects 6580 // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects
6570 // holding weak references when incremental marking is used, because it also 6581 // holding weak references when incremental marking is used, because it also
6571 // iterates over objects that are otherwise unreachable. 6582 // iterates over objects that are otherwise unreachable.
6572 // In general we only want to call these functions in release mode when 6583 // In general we only want to call these functions in release mode when
6573 // heap verification is turned on. 6584 // heap verification is turned on.
6574 void ZapPrototypeTransitions(); 6585 void ZapPrototypeTransitions();
6575 void ZapTransitions(); 6586 void ZapTransitions();
6576 6587
6577 void DeprecateTransitionTree(); 6588 void DeprecateTransitionTree();
(...skipping 4505 matching lines...) Expand 10 before | Expand all | Expand 10 after
11083 } else { 11094 } else {
11084 value &= ~(1 << bit_position); 11095 value &= ~(1 << bit_position);
11085 } 11096 }
11086 return value; 11097 return value;
11087 } 11098 }
11088 }; 11099 };
11089 11100
11090 } } // namespace v8::internal 11101 } } // namespace v8::internal
11091 11102
11092 #endif // V8_OBJECTS_H_ 11103 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698