OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 static inline bool IsGrowStoreMode(KeyedAccessStoreMode store_mode) { | 225 static inline bool IsGrowStoreMode(KeyedAccessStoreMode store_mode) { |
226 return store_mode >= STORE_AND_GROW_NO_TRANSITION && | 226 return store_mode >= STORE_AND_GROW_NO_TRANSITION && |
227 store_mode <= STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT; | 227 store_mode <= STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT; |
228 } | 228 } |
229 | 229 |
230 | 230 |
231 // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER. | 231 // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER. |
232 enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER }; | 232 enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER }; |
233 | 233 |
234 | 234 |
| 235 // Indicates whether a value can be loaded as a constant. |
| 236 enum StoreMode { |
| 237 ALLOW_AS_CONSTANT, |
| 238 FORCE_FIELD |
| 239 }; |
| 240 |
| 241 |
235 // PropertyNormalizationMode is used to specify whether to keep | 242 // PropertyNormalizationMode is used to specify whether to keep |
236 // inobject properties when normalizing properties of a JSObject. | 243 // inobject properties when normalizing properties of a JSObject. |
237 enum PropertyNormalizationMode { | 244 enum PropertyNormalizationMode { |
238 CLEAR_INOBJECT_PROPERTIES, | 245 CLEAR_INOBJECT_PROPERTIES, |
239 KEEP_INOBJECT_PROPERTIES | 246 KEEP_INOBJECT_PROPERTIES |
240 }; | 247 }; |
241 | 248 |
242 | 249 |
243 // NormalizedMapSharingMode is used to specify whether a map may be shared | 250 // NormalizedMapSharingMode is used to specify whether a map may be shared |
244 // by different objects with normalized properties. | 251 // by different objects with normalized properties. |
245 enum NormalizedMapSharingMode { | 252 enum NormalizedMapSharingMode { |
246 UNIQUE_NORMALIZED_MAP, | 253 UNIQUE_NORMALIZED_MAP, |
247 SHARED_NORMALIZED_MAP | 254 SHARED_NORMALIZED_MAP |
248 }; | 255 }; |
249 | 256 |
250 | 257 |
251 // Indicates whether a get method should implicitly create the object looked up. | 258 // Indicates whether a get method should implicitly create the object looked up. |
252 enum CreationFlag { | 259 enum CreationFlag { |
253 ALLOW_CREATION, | 260 ALLOW_CREATION, |
254 OMIT_CREATION | 261 OMIT_CREATION |
255 }; | 262 }; |
256 | 263 |
257 | 264 |
258 // Indicates whether transitions can be added to a source map or not. | 265 // Indicates whether transitions can be added to a source map or not. |
259 enum TransitionFlag { | 266 enum TransitionFlag { |
260 INSERT_TRANSITION, | 267 INSERT_TRANSITION, |
261 OMIT_TRANSITION_KEEP_REPRESENTATIONS, | |
262 OMIT_TRANSITION | 268 OMIT_TRANSITION |
263 }; | 269 }; |
264 | 270 |
265 | 271 |
266 enum DebugExtraICState { | 272 enum DebugExtraICState { |
267 DEBUG_BREAK, | 273 DEBUG_BREAK, |
268 DEBUG_PREPARE_STEP_IN | 274 DEBUG_PREPARE_STEP_IN |
269 }; | 275 }; |
270 | 276 |
271 | 277 |
(...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1919 FORCE_DELETION | 1925 FORCE_DELETION |
1920 }; | 1926 }; |
1921 | 1927 |
1922 // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas | 1928 // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas |
1923 // a keyed store is of the form a[expression] = foo. | 1929 // a keyed store is of the form a[expression] = foo. |
1924 enum StoreFromKeyed { | 1930 enum StoreFromKeyed { |
1925 MAY_BE_STORE_FROM_KEYED, | 1931 MAY_BE_STORE_FROM_KEYED, |
1926 CERTAINLY_NOT_STORE_FROM_KEYED | 1932 CERTAINLY_NOT_STORE_FROM_KEYED |
1927 }; | 1933 }; |
1928 | 1934 |
1929 // Indicates whether a value can be loaded as a constant. | |
1930 enum StoreMode { | |
1931 ALLOW_AS_CONSTANT, | |
1932 FORCE_FIELD | |
1933 }; | |
1934 | |
1935 // Internal properties (e.g. the hidden properties dictionary) might | 1935 // Internal properties (e.g. the hidden properties dictionary) might |
1936 // be added even though the receiver is non-extensible. | 1936 // be added even though the receiver is non-extensible. |
1937 enum ExtensibilityCheck { | 1937 enum ExtensibilityCheck { |
1938 PERFORM_EXTENSIBILITY_CHECK, | 1938 PERFORM_EXTENSIBILITY_CHECK, |
1939 OMIT_EXTENSIBILITY_CHECK | 1939 OMIT_EXTENSIBILITY_CHECK |
1940 }; | 1940 }; |
1941 | 1941 |
1942 // Casting. | 1942 // Casting. |
1943 static inline JSReceiver* cast(Object* obj); | 1943 static inline JSReceiver* cast(Object* obj); |
1944 | 1944 |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2515 ElementsKind elements_kind); | 2515 ElementsKind elements_kind); |
2516 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( | 2516 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( |
2517 ElementsKind elements_kind); | 2517 ElementsKind elements_kind); |
2518 | 2518 |
2519 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, | 2519 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, |
2520 ElementsKind to_kind); | 2520 ElementsKind to_kind); |
2521 | 2521 |
2522 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); | 2522 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); |
2523 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); | 2523 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); |
2524 | 2524 |
2525 // Replaces an existing transition with a transition to a map with a FIELD. | |
2526 MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition( | |
2527 int transition_index, | |
2528 Name* name, | |
2529 Object* new_value, | |
2530 PropertyAttributes attributes); | |
2531 | |
2532 // Converts a descriptor of any other type to a real field, backed by the | 2525 // Converts a descriptor of any other type to a real field, backed by the |
2533 // properties array. | 2526 // properties array. |
2534 MUST_USE_RESULT MaybeObject* ConvertDescriptorToField( | 2527 MUST_USE_RESULT MaybeObject* ConvertDescriptorToField( |
2535 Name* name, | 2528 Name* name, |
2536 Object* new_value, | 2529 Object* new_value, |
2537 PropertyAttributes attributes, | 2530 PropertyAttributes attributes, |
2538 TransitionFlag flag = OMIT_TRANSITION); | 2531 TransitionFlag flag = OMIT_TRANSITION); |
2539 | 2532 |
2540 MUST_USE_RESULT MaybeObject* MigrateToMap(Map* new_map); | 2533 MUST_USE_RESULT MaybeObject* MigrateToMap(Map* new_map); |
2541 MUST_USE_RESULT MaybeObject* GeneralizeFieldRepresentation( | 2534 MUST_USE_RESULT MaybeObject* GeneralizeFieldRepresentation( |
2542 int modify_index, | 2535 int modify_index, |
2543 Representation new_representation); | 2536 Representation new_representation, |
| 2537 StoreMode store_mode); |
2544 | 2538 |
2545 // Add a property to a fast-case object. | 2539 // Add a property to a fast-case object. |
2546 MUST_USE_RESULT MaybeObject* AddFastProperty( | 2540 MUST_USE_RESULT MaybeObject* AddFastProperty( |
2547 Name* name, | 2541 Name* name, |
2548 Object* value, | 2542 Object* value, |
2549 PropertyAttributes attributes, | 2543 PropertyAttributes attributes, |
2550 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, | 2544 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
2551 ValueType value_type = OPTIMAL_REPRESENTATION); | 2545 ValueType value_type = OPTIMAL_REPRESENTATION); |
2552 | 2546 |
2553 // Add a property to a slow-case object. | 2547 // Add a property to a slow-case object. |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 | 3177 |
3184 // Transfer a complete descriptor from the src descriptor array to this | 3178 // Transfer a complete descriptor from the src descriptor array to this |
3185 // descriptor array. | 3179 // descriptor array. |
3186 void CopyFrom(int dst_index, | 3180 void CopyFrom(int dst_index, |
3187 DescriptorArray* src, | 3181 DescriptorArray* src, |
3188 int src_index, | 3182 int src_index, |
3189 const WhitenessWitness&); | 3183 const WhitenessWitness&); |
3190 MUST_USE_RESULT MaybeObject* Merge(int verbatim, | 3184 MUST_USE_RESULT MaybeObject* Merge(int verbatim, |
3191 int valid, | 3185 int valid, |
3192 int new_size, | 3186 int new_size, |
| 3187 int modify_index, |
| 3188 StoreMode store_mode, |
3193 DescriptorArray* other); | 3189 DescriptorArray* other); |
3194 | 3190 |
3195 bool IsMoreGeneralThan(int verbatim, | 3191 bool IsMoreGeneralThan(int verbatim, |
3196 int valid, | 3192 int valid, |
3197 int new_size, | 3193 int new_size, |
3198 DescriptorArray* other); | 3194 DescriptorArray* other); |
3199 | 3195 |
3200 MUST_USE_RESULT MaybeObject* CopyUpTo(int enumeration_index) { | 3196 MUST_USE_RESULT MaybeObject* CopyUpTo(int enumeration_index) { |
3201 return CopyUpToAddAttributes(enumeration_index, NONE); | 3197 return CopyUpToAddAttributes(enumeration_index, NONE); |
3202 } | 3198 } |
(...skipping 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5612 | 5608 |
5613 int NumberOfFields(); | 5609 int NumberOfFields(); |
5614 | 5610 |
5615 bool InstancesNeedRewriting(Map* target, | 5611 bool InstancesNeedRewriting(Map* target, |
5616 int target_number_of_fields, | 5612 int target_number_of_fields, |
5617 int target_inobject, | 5613 int target_inobject, |
5618 int target_unused); | 5614 int target_unused); |
5619 static Handle<Map> GeneralizeRepresentation( | 5615 static Handle<Map> GeneralizeRepresentation( |
5620 Handle<Map> map, | 5616 Handle<Map> map, |
5621 int modify_index, | 5617 int modify_index, |
5622 Representation new_representation); | 5618 Representation new_representation, |
| 5619 StoreMode store_mode); |
5623 MUST_USE_RESULT MaybeObject* GeneralizeRepresentation( | 5620 MUST_USE_RESULT MaybeObject* GeneralizeRepresentation( |
5624 int modify_index, | 5621 int modify_index, |
5625 Representation representation); | 5622 Representation representation, |
5626 MUST_USE_RESULT MaybeObject* CopyGeneralizeAllRepresentations(); | 5623 StoreMode store_mode); |
| 5624 MUST_USE_RESULT MaybeObject* CopyGeneralizeAllRepresentations( |
| 5625 int modify_index, |
| 5626 StoreMode store_mode, |
| 5627 const char* reason); |
5627 | 5628 |
5628 void PrintGeneralization(FILE* file, | 5629 void PrintGeneralization(FILE* file, |
| 5630 const char* reason, |
5629 int modify_index, | 5631 int modify_index, |
5630 int split, | 5632 int split, |
5631 int descriptors, | 5633 int descriptors, |
| 5634 bool constant_to_field, |
5632 Representation old_representation, | 5635 Representation old_representation, |
5633 Representation new_representation); | 5636 Representation new_representation); |
5634 | 5637 |
5635 // Returns the constructor name (the name (possibly, inferred name) of the | 5638 // Returns the constructor name (the name (possibly, inferred name) of the |
5636 // function that was used to instantiate the object). | 5639 // function that was used to instantiate the object). |
5637 String* constructor_name(); | 5640 String* constructor_name(); |
5638 | 5641 |
5639 // Tells whether the map is attached to SharedFunctionInfo | 5642 // Tells whether the map is attached to SharedFunctionInfo |
5640 // (for inobject slack tracking). | 5643 // (for inobject slack tracking). |
5641 inline void set_attached_to_shared_function_info(bool value); | 5644 inline void set_attached_to_shared_function_info(bool value); |
(...skipping 4542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10184 } else { | 10187 } else { |
10185 value &= ~(1 << bit_position); | 10188 value &= ~(1 << bit_position); |
10186 } | 10189 } |
10187 return value; | 10190 return value; |
10188 } | 10191 } |
10189 }; | 10192 }; |
10190 | 10193 |
10191 } } // namespace v8::internal | 10194 } } // namespace v8::internal |
10192 | 10195 |
10193 #endif // V8_OBJECTS_H_ | 10196 #endif // V8_OBJECTS_H_ |
OLD | NEW |