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

Side by Side Diff: src/objects.h

Issue 2062783002: Version 5.2.361.22 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5.2
Patch Set: 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/ic/ic-compiler.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 9
10 #include "src/assert-scope.h" 10 #include "src/assert-scope.h"
(...skipping 5725 matching lines...) Expand 10 before | Expand all | Expand 10 after
5736 static const int kPrototypeChainInvalid = 1; 5736 static const int kPrototypeChainInvalid = 1;
5737 5737
5738 Map* FindRootMap(); 5738 Map* FindRootMap();
5739 Map* FindFieldOwner(int descriptor); 5739 Map* FindFieldOwner(int descriptor);
5740 5740
5741 inline int GetInObjectPropertyOffset(int index); 5741 inline int GetInObjectPropertyOffset(int index);
5742 5742
5743 int NumberOfFields(); 5743 int NumberOfFields();
5744 5744
5745 // TODO(ishell): candidate with JSObject::MigrateToMap(). 5745 // TODO(ishell): candidate with JSObject::MigrateToMap().
5746 bool InstancesNeedRewriting(Map* target);
5746 bool InstancesNeedRewriting(Map* target, int target_number_of_fields, 5747 bool InstancesNeedRewriting(Map* target, int target_number_of_fields,
5747 int target_inobject, int target_unused, 5748 int target_inobject, int target_unused,
5748 int* old_number_of_fields); 5749 int* old_number_of_fields);
5749 // TODO(ishell): moveit! 5750 // TODO(ishell): moveit!
5750 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map); 5751 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map);
5751 MUST_USE_RESULT static Handle<FieldType> GeneralizeFieldType( 5752 MUST_USE_RESULT static Handle<FieldType> GeneralizeFieldType(
5752 Representation rep1, Handle<FieldType> type1, Representation rep2, 5753 Representation rep1, Handle<FieldType> type1, Representation rep2,
5753 Handle<FieldType> type2, Isolate* isolate); 5754 Handle<FieldType> type2, Isolate* isolate);
5754 static void GeneralizeFieldType(Handle<Map> map, int modify_index, 5755 static void GeneralizeFieldType(Handle<Map> map, int modify_index,
5755 Representation new_representation, 5756 Representation new_representation,
5756 Handle<FieldType> new_field_type); 5757 Handle<FieldType> new_field_type);
5757 static Handle<Map> ReconfigureProperty(Handle<Map> map, int modify_index, 5758
5758 PropertyKind new_kind, 5759 static inline Handle<Map> ReconfigureProperty(
5759 PropertyAttributes new_attributes, 5760 Handle<Map> map, int modify_index, PropertyKind new_kind,
5760 Representation new_representation, 5761 PropertyAttributes new_attributes, Representation new_representation,
5761 Handle<FieldType> new_field_type, 5762 Handle<FieldType> new_field_type, StoreMode store_mode);
5762 StoreMode store_mode); 5763
5763 static Handle<Map> CopyGeneralizeAllRepresentations( 5764 static inline Handle<Map> ReconfigureElementsKind(
5764 Handle<Map> map, int modify_index, StoreMode store_mode, 5765 Handle<Map> map, ElementsKind new_elements_kind);
5765 PropertyKind kind, PropertyAttributes attributes, const char* reason);
5766 5766
5767 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, 5767 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map,
5768 int descriptor_number, 5768 int descriptor_number,
5769 Handle<Object> value); 5769 Handle<Object> value);
5770 5770
5771 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, 5771 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode,
5772 const char* reason); 5772 const char* reason);
5773 5773
5774 // Tells whether the map is used for JSObjects in dictionary mode (ie 5774 // Tells whether the map is used for JSObjects in dictionary mode (ie
5775 // normalized objects, ie objects for which HasFastProperties returns false). 5775 // normalized objects, ie objects for which HasFastProperties returns false).
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
5976 5976
5977 static inline int SlackForArraySize(int old_size, int size_limit); 5977 static inline int SlackForArraySize(int old_size, int size_limit);
5978 5978
5979 static void EnsureDescriptorSlack(Handle<Map> map, int slack); 5979 static void EnsureDescriptorSlack(Handle<Map> map, int slack);
5980 5980
5981 Code* LookupInCodeCache(Name* name, Code::Flags code); 5981 Code* LookupInCodeCache(Name* name, Code::Flags code);
5982 5982
5983 // Computes a hash value for this map, to be used in HashTables and such. 5983 // Computes a hash value for this map, to be used in HashTables and such.
5984 int Hash(); 5984 int Hash();
5985 5985
5986 // Returns the map that this map transitions to if its elements_kind
5987 // is changed to |elements_kind|, or NULL if no such map is cached yet.
5988 // |safe_to_add_transitions| is set to false if adding transitions is not
5989 // allowed.
5990 Map* LookupElementsTransitionMap(ElementsKind elements_kind);
5991
5992 // Returns the transitioned map for this map with the most generic 5986 // Returns the transitioned map for this map with the most generic
5993 // elements_kind that's found in |candidates|, or null handle if no match is 5987 // elements_kind that's found in |candidates|, or |nullptr| if no match is
5994 // found at all. 5988 // found at all.
5995 static Handle<Map> FindTransitionedMap(Handle<Map> map, 5989 Map* FindElementsKindTransitionedMap(MapHandleList* candidates);
5996 MapHandleList* candidates);
5997 5990
5998 inline bool CanTransition(); 5991 inline bool CanTransition();
5999 5992
6000 inline bool IsBooleanMap(); 5993 inline bool IsBooleanMap();
6001 inline bool IsPrimitiveMap(); 5994 inline bool IsPrimitiveMap();
6002 inline bool IsJSReceiverMap(); 5995 inline bool IsJSReceiverMap();
6003 inline bool IsJSObjectMap(); 5996 inline bool IsJSObjectMap();
6004 inline bool IsJSArrayMap(); 5997 inline bool IsJSArrayMap();
6005 inline bool IsJSFunctionMap(); 5998 inline bool IsJSFunctionMap();
6006 inline bool IsStringMap(); 5999 inline bool IsStringMap();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
6145 #if TRACE_MAPS 6138 #if TRACE_MAPS
6146 static void TraceTransition(const char* what, Map* from, Map* to, Name* name); 6139 static void TraceTransition(const char* what, Map* from, Map* to, Name* name);
6147 static void TraceAllTransitions(Map* map); 6140 static void TraceAllTransitions(Map* map);
6148 #endif 6141 #endif
6149 6142
6150 static inline Handle<Map> AddMissingTransitionsForTesting( 6143 static inline Handle<Map> AddMissingTransitionsForTesting(
6151 Handle<Map> split_map, Handle<DescriptorArray> descriptors, 6144 Handle<Map> split_map, Handle<DescriptorArray> descriptors,
6152 Handle<LayoutDescriptor> full_layout_descriptor); 6145 Handle<LayoutDescriptor> full_layout_descriptor);
6153 6146
6154 private: 6147 private:
6148 // Returns the map that this (root) map transitions to if its elements_kind
6149 // is changed to |elements_kind|, or |nullptr| if no such map is cached yet.
6150 Map* LookupElementsTransitionMap(ElementsKind elements_kind);
6151
6152 // Tries to replay property transitions starting from this (root) map using
6153 // the descriptor array of the |map|. The |root_map| is expected to have
6154 // proper elements kind and therefore elements kinds transitions are not
6155 // taken by this function. Returns |nullptr| if matching transition map is
6156 // not found.
6157 Map* TryReplayPropertyTransitions(Map* map);
6158
6155 static void ConnectTransition(Handle<Map> parent, Handle<Map> child, 6159 static void ConnectTransition(Handle<Map> parent, Handle<Map> child,
6156 Handle<Name> name, SimpleTransitionFlag flag); 6160 Handle<Name> name, SimpleTransitionFlag flag);
6157 6161
6158 bool EquivalentToForTransition(Map* other); 6162 bool EquivalentToForTransition(Map* other);
6159 static Handle<Map> RawCopy(Handle<Map> map, int instance_size); 6163 static Handle<Map> RawCopy(Handle<Map> map, int instance_size);
6160 static Handle<Map> ShareDescriptor(Handle<Map> map, 6164 static Handle<Map> ShareDescriptor(Handle<Map> map,
6161 Handle<DescriptorArray> descriptors, 6165 Handle<DescriptorArray> descriptors,
6162 Descriptor* descriptor); 6166 Descriptor* descriptor);
6163 static Handle<Map> AddMissingTransitions( 6167 static Handle<Map> AddMissingTransitions(
6164 Handle<Map> map, Handle<DescriptorArray> descriptors, 6168 Handle<Map> map, Handle<DescriptorArray> descriptors,
(...skipping 16 matching lines...) Expand all
6181 Descriptor* descriptor, 6185 Descriptor* descriptor,
6182 int index, 6186 int index,
6183 TransitionFlag flag); 6187 TransitionFlag flag);
6184 static MUST_USE_RESULT MaybeHandle<Map> TryReconfigureExistingProperty( 6188 static MUST_USE_RESULT MaybeHandle<Map> TryReconfigureExistingProperty(
6185 Handle<Map> map, int descriptor, PropertyKind kind, 6189 Handle<Map> map, int descriptor, PropertyKind kind,
6186 PropertyAttributes attributes, const char** reason); 6190 PropertyAttributes attributes, const char** reason);
6187 6191
6188 static Handle<Map> CopyNormalized(Handle<Map> map, 6192 static Handle<Map> CopyNormalized(Handle<Map> map,
6189 PropertyNormalizationMode mode); 6193 PropertyNormalizationMode mode);
6190 6194
6195 static Handle<Map> Reconfigure(Handle<Map> map,
6196 ElementsKind new_elements_kind,
6197 int modify_index, PropertyKind new_kind,
6198 PropertyAttributes new_attributes,
6199 Representation new_representation,
6200 Handle<FieldType> new_field_type,
6201 StoreMode store_mode);
6202
6203 static Handle<Map> CopyGeneralizeAllRepresentations(
6204 Handle<Map> map, ElementsKind elements_kind, int modify_index,
6205 StoreMode store_mode, PropertyKind kind, PropertyAttributes attributes,
6206 const char* reason);
6207
6191 // Fires when the layout of an object with a leaf map changes. 6208 // Fires when the layout of an object with a leaf map changes.
6192 // This includes adding transitions to the leaf map or changing 6209 // This includes adding transitions to the leaf map or changing
6193 // the descriptor array. 6210 // the descriptor array.
6194 inline void NotifyLeafMapLayoutChange(); 6211 inline void NotifyLeafMapLayoutChange();
6195 6212
6196 void DeprecateTransitionTree(); 6213 void DeprecateTransitionTree();
6197 6214
6198 void ReplaceDescriptors(DescriptorArray* new_descriptors, 6215 void ReplaceDescriptors(DescriptorArray* new_descriptors,
6199 LayoutDescriptor* new_layout_descriptor); 6216 LayoutDescriptor* new_layout_descriptor);
6200 6217
(...skipping 4548 matching lines...) Expand 10 before | Expand all | Expand 10 after
10749 } 10766 }
10750 return value; 10767 return value;
10751 } 10768 }
10752 }; 10769 };
10753 10770
10754 10771
10755 } // NOLINT, false-positive due to second-order macros. 10772 } // NOLINT, false-positive due to second-order macros.
10756 } // NOLINT, false-positive due to second-order macros. 10773 } // NOLINT, false-positive due to second-order macros.
10757 10774
10758 #endif // V8_OBJECTS_H_ 10775 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/ic/ic-compiler.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698