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

Side by Side Diff: src/objects.h

Issue 2601643002: [runtime] Add MapUpdater class that manages all kinds of map updates. (Closed)
Patch Set: Addressing comments Created 3 years, 11 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/map-updater.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 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 6036 matching lines...) Expand 10 before | Expand all | Expand 10 after
6047 // TODO(ishell): candidate with JSObject::MigrateToMap(). 6047 // TODO(ishell): candidate with JSObject::MigrateToMap().
6048 bool InstancesNeedRewriting(Map* target); 6048 bool InstancesNeedRewriting(Map* target);
6049 bool InstancesNeedRewriting(Map* target, int target_number_of_fields, 6049 bool InstancesNeedRewriting(Map* target, int target_number_of_fields,
6050 int target_inobject, int target_unused, 6050 int target_inobject, int target_unused,
6051 int* old_number_of_fields); 6051 int* old_number_of_fields);
6052 // TODO(ishell): moveit! 6052 // TODO(ishell): moveit!
6053 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map); 6053 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map);
6054 MUST_USE_RESULT static Handle<FieldType> GeneralizeFieldType( 6054 MUST_USE_RESULT static Handle<FieldType> GeneralizeFieldType(
6055 Representation rep1, Handle<FieldType> type1, Representation rep2, 6055 Representation rep1, Handle<FieldType> type1, Representation rep2,
6056 Handle<FieldType> type2, Isolate* isolate); 6056 Handle<FieldType> type2, Isolate* isolate);
6057 static void GeneralizeFieldType(Handle<Map> map, int modify_index, 6057 static void GeneralizeField(Handle<Map> map, int modify_index,
6058 Representation new_representation, 6058 Representation new_representation,
6059 Handle<FieldType> new_field_type); 6059 Handle<FieldType> new_field_type);
6060 6060
6061 static inline Handle<Map> ReconfigureProperty( 6061 static Handle<Map> ReconfigureProperty(Handle<Map> map, int modify_index,
6062 Handle<Map> map, int modify_index, PropertyKind new_kind, 6062 PropertyKind new_kind,
6063 PropertyAttributes new_attributes, Representation new_representation, 6063 PropertyAttributes new_attributes,
6064 Handle<FieldType> new_field_type, StoreMode store_mode); 6064 Representation new_representation,
6065 Handle<FieldType> new_field_type,
6066 StoreMode store_mode);
6065 6067
6066 static inline Handle<Map> ReconfigureElementsKind( 6068 static Handle<Map> ReconfigureElementsKind(Handle<Map> map,
6067 Handle<Map> map, ElementsKind new_elements_kind); 6069 ElementsKind new_elements_kind);
6068 6070
6069 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, 6071 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map,
6070 int descriptor_number, 6072 int descriptor_number,
6071 Handle<Object> value); 6073 Handle<Object> value);
6072 6074
6073 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, 6075 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode,
6074 const char* reason); 6076 const char* reason);
6075 6077
6076 // Tells whether the map is used for JSObjects in dictionary mode (ie 6078 // Tells whether the map is used for JSObjects in dictionary mode (ie
6077 // normalized objects, ie objects for which HasFastProperties returns false). 6079 // normalized objects, ie objects for which HasFastProperties returns false).
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
6180 6182
6181 static inline Handle<Map> CopyInitialMap(Handle<Map> map); 6183 static inline Handle<Map> CopyInitialMap(Handle<Map> map);
6182 static Handle<Map> CopyInitialMap(Handle<Map> map, int instance_size, 6184 static Handle<Map> CopyInitialMap(Handle<Map> map, int instance_size,
6183 int in_object_properties, 6185 int in_object_properties,
6184 int unused_property_fields); 6186 int unused_property_fields);
6185 static Handle<Map> CopyDropDescriptors(Handle<Map> map); 6187 static Handle<Map> CopyDropDescriptors(Handle<Map> map);
6186 static Handle<Map> CopyInsertDescriptor(Handle<Map> map, 6188 static Handle<Map> CopyInsertDescriptor(Handle<Map> map,
6187 Descriptor* descriptor, 6189 Descriptor* descriptor,
6188 TransitionFlag flag); 6190 TransitionFlag flag);
6189 6191
6192 static Handle<Object> WrapType(Handle<FieldType> type);
6193
6190 MUST_USE_RESULT static MaybeHandle<Map> CopyWithField( 6194 MUST_USE_RESULT static MaybeHandle<Map> CopyWithField(
6191 Handle<Map> map, Handle<Name> name, Handle<FieldType> type, 6195 Handle<Map> map, Handle<Name> name, Handle<FieldType> type,
6192 PropertyAttributes attributes, Representation representation, 6196 PropertyAttributes attributes, Representation representation,
6193 TransitionFlag flag); 6197 TransitionFlag flag);
6194 6198
6195 MUST_USE_RESULT static MaybeHandle<Map> CopyWithConstant( 6199 MUST_USE_RESULT static MaybeHandle<Map> CopyWithConstant(
6196 Handle<Map> map, 6200 Handle<Map> map,
6197 Handle<Name> name, 6201 Handle<Name> name,
6198 Handle<Object> constant, 6202 Handle<Object> constant,
6199 PropertyAttributes attributes, 6203 PropertyAttributes attributes,
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
6492 Descriptor* descriptor, 6496 Descriptor* descriptor,
6493 int index, 6497 int index,
6494 TransitionFlag flag); 6498 TransitionFlag flag);
6495 static MUST_USE_RESULT MaybeHandle<Map> TryReconfigureExistingProperty( 6499 static MUST_USE_RESULT MaybeHandle<Map> TryReconfigureExistingProperty(
6496 Handle<Map> map, int descriptor, PropertyKind kind, 6500 Handle<Map> map, int descriptor, PropertyKind kind,
6497 PropertyAttributes attributes, const char** reason); 6501 PropertyAttributes attributes, const char** reason);
6498 6502
6499 static Handle<Map> CopyNormalized(Handle<Map> map, 6503 static Handle<Map> CopyNormalized(Handle<Map> map,
6500 PropertyNormalizationMode mode); 6504 PropertyNormalizationMode mode);
6501 6505
6502 static Handle<Map> Reconfigure(Handle<Map> map, 6506 // TODO(ishell): Move to MapUpdater.
6503 ElementsKind new_elements_kind,
6504 int modify_index, PropertyKind new_kind,
6505 PropertyAttributes new_attributes,
6506 Representation new_representation,
6507 Handle<FieldType> new_field_type,
6508 StoreMode store_mode);
6509
6510 static Handle<Map> CopyGeneralizeAllRepresentations( 6507 static Handle<Map> CopyGeneralizeAllRepresentations(
6511 Handle<Map> map, ElementsKind elements_kind, int modify_index, 6508 Handle<Map> map, ElementsKind elements_kind, int modify_index,
6512 StoreMode store_mode, PropertyKind kind, PropertyAttributes attributes, 6509 StoreMode store_mode, PropertyKind kind, PropertyAttributes attributes,
6513 const char* reason); 6510 const char* reason);
6514 6511
6515 // Fires when the layout of an object with a leaf map changes. 6512 // Fires when the layout of an object with a leaf map changes.
6516 // This includes adding transitions to the leaf map or changing 6513 // This includes adding transitions to the leaf map or changing
6517 // the descriptor array. 6514 // the descriptor array.
6518 inline void NotifyLeafMapLayoutChange(); 6515 inline void NotifyLeafMapLayoutChange();
6519 6516
6520 void DeprecateTransitionTree(); 6517 void DeprecateTransitionTree();
6521 6518
6522 void ReplaceDescriptors(DescriptorArray* new_descriptors, 6519 void ReplaceDescriptors(DescriptorArray* new_descriptors,
6523 LayoutDescriptor* new_layout_descriptor); 6520 LayoutDescriptor* new_layout_descriptor);
6524 6521
6525 6522
6526 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors);
6527
6528 // Update field type of the given descriptor to new representation and new 6523 // Update field type of the given descriptor to new representation and new
6529 // type. The type must be prepared for storing in descriptor array: 6524 // type. The type must be prepared for storing in descriptor array:
6530 // it must be either a simple type or a map wrapped in a weak cell. 6525 // it must be either a simple type or a map wrapped in a weak cell.
6531 void UpdateFieldType(int descriptor_number, Handle<Name> name, 6526 void UpdateFieldType(int descriptor_number, Handle<Name> name,
6532 Representation new_representation, 6527 Representation new_representation,
6533 Handle<Object> new_wrapped_type); 6528 Handle<Object> new_wrapped_type);
6534 6529
6530 // TODO(ishell): Move to MapUpdater.
6535 void PrintReconfiguration(FILE* file, int modify_index, PropertyKind kind, 6531 void PrintReconfiguration(FILE* file, int modify_index, PropertyKind kind,
6536 PropertyAttributes attributes); 6532 PropertyAttributes attributes);
6533 // TODO(ishell): Move to MapUpdater.
6537 void PrintGeneralization(FILE* file, const char* reason, int modify_index, 6534 void PrintGeneralization(FILE* file, const char* reason, int modify_index,
6538 int split, int descriptors, bool constant_to_field, 6535 int split, int descriptors, bool constant_to_field,
6539 Representation old_representation, 6536 Representation old_representation,
6540 Representation new_representation, 6537 Representation new_representation,
6541 MaybeHandle<FieldType> old_field_type, 6538 MaybeHandle<FieldType> old_field_type,
6542 MaybeHandle<Object> old_value, 6539 MaybeHandle<Object> old_value,
6543 MaybeHandle<FieldType> new_field_type, 6540 MaybeHandle<FieldType> new_field_type,
6544 MaybeHandle<Object> new_value); 6541 MaybeHandle<Object> new_value);
6545
6546 static const int kFastPropertiesSoftLimit = 12; 6542 static const int kFastPropertiesSoftLimit = 12;
6547 static const int kMaxFastProperties = 128; 6543 static const int kMaxFastProperties = 128;
6548 6544
6545 friend class MapUpdater;
6546
6549 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); 6547 DISALLOW_IMPLICIT_CONSTRUCTORS(Map);
6550 }; 6548 };
6551 6549
6552 6550
6553 // An abstract superclass, a marker class really, for simple structure classes. 6551 // An abstract superclass, a marker class really, for simple structure classes.
6554 // It doesn't carry much functionality but allows struct classes to be 6552 // It doesn't carry much functionality but allows struct classes to be
6555 // identified in the type system. 6553 // identified in the type system.
6556 class Struct: public HeapObject { 6554 class Struct: public HeapObject {
6557 public: 6555 public:
6558 inline void InitializeBody(int object_size); 6556 inline void InitializeBody(int object_size);
(...skipping 5192 matching lines...) Expand 10 before | Expand all | Expand 10 after
11751 } 11749 }
11752 }; 11750 };
11753 11751
11754 11752
11755 } // NOLINT, false-positive due to second-order macros. 11753 } // NOLINT, false-positive due to second-order macros.
11756 } // NOLINT, false-positive due to second-order macros. 11754 } // NOLINT, false-positive due to second-order macros.
11757 11755
11758 #include "src/objects/object-macros-undef.h" 11756 #include "src/objects/object-macros-undef.h"
11759 11757
11760 #endif // V8_OBJECTS_H_ 11758 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/map-updater.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698