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 2482 matching lines...) Loading... |
2493 | 2493 |
2494 // Add a constant function property to a fast-case object. | 2494 // Add a constant function property to a fast-case object. |
2495 // This leaves a CONSTANT_TRANSITION in the old map, and | 2495 // This leaves a CONSTANT_TRANSITION in the old map, and |
2496 // if it is called on a second object with this map, a | 2496 // if it is called on a second object with this map, a |
2497 // normal property is added instead, with a map transition. | 2497 // normal property is added instead, with a map transition. |
2498 // This avoids the creation of many maps with the same constant | 2498 // This avoids the creation of many maps with the same constant |
2499 // function, all orphaned. | 2499 // function, all orphaned. |
2500 MUST_USE_RESULT MaybeObject* AddConstantProperty( | 2500 MUST_USE_RESULT MaybeObject* AddConstantProperty( |
2501 Name* name, | 2501 Name* name, |
2502 Object* constant, | 2502 Object* constant, |
2503 PropertyAttributes attributes); | 2503 PropertyAttributes attributes, |
| 2504 TransitionFlag flag); |
2504 | 2505 |
2505 MUST_USE_RESULT MaybeObject* ReplaceSlowProperty( | 2506 MUST_USE_RESULT MaybeObject* ReplaceSlowProperty( |
2506 Name* name, | 2507 Name* name, |
2507 Object* value, | 2508 Object* value, |
2508 PropertyAttributes attributes); | 2509 PropertyAttributes attributes); |
2509 | 2510 |
2510 // Returns a new map with all transitions dropped from the object's current | 2511 // Returns a new map with all transitions dropped from the object's current |
2511 // map and the ElementsKind set. | 2512 // map and the ElementsKind set. |
2512 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, | 2513 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, |
2513 ElementsKind to_kind); | 2514 ElementsKind to_kind); |
2514 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( | 2515 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( |
2515 Isolate* isolate, | 2516 Isolate* isolate, |
2516 ElementsKind elements_kind); | 2517 ElementsKind elements_kind); |
2517 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( | 2518 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( |
2518 ElementsKind elements_kind); | 2519 ElementsKind elements_kind); |
2519 | 2520 |
2520 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, | 2521 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, |
2521 ElementsKind to_kind); | 2522 ElementsKind to_kind); |
2522 | 2523 |
2523 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); | 2524 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); |
2524 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); | 2525 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); |
2525 | 2526 |
2526 // Converts a descriptor of any other type to a real field, backed by the | |
2527 // properties array. | |
2528 MUST_USE_RESULT MaybeObject* ConvertDescriptorToField( | |
2529 Name* name, | |
2530 Object* new_value, | |
2531 PropertyAttributes attributes, | |
2532 TransitionFlag flag = OMIT_TRANSITION); | |
2533 | |
2534 MUST_USE_RESULT MaybeObject* MigrateToMap(Map* new_map); | 2527 MUST_USE_RESULT MaybeObject* MigrateToMap(Map* new_map); |
2535 MUST_USE_RESULT MaybeObject* GeneralizeFieldRepresentation( | 2528 MUST_USE_RESULT MaybeObject* GeneralizeFieldRepresentation( |
2536 int modify_index, | 2529 int modify_index, |
2537 Representation new_representation, | 2530 Representation new_representation, |
2538 StoreMode store_mode); | 2531 StoreMode store_mode); |
2539 | 2532 |
2540 // Add a property to a fast-case object. | 2533 // Add a property to a fast-case object. |
2541 MUST_USE_RESULT MaybeObject* AddFastProperty( | 2534 MUST_USE_RESULT MaybeObject* AddFastProperty( |
2542 Name* name, | 2535 Name* name, |
2543 Object* value, | 2536 Object* value, |
2544 PropertyAttributes attributes, | 2537 PropertyAttributes attributes, |
2545 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, | 2538 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
2546 ValueType value_type = OPTIMAL_REPRESENTATION); | 2539 ValueType value_type = OPTIMAL_REPRESENTATION, |
| 2540 TransitionFlag flag = INSERT_TRANSITION); |
2547 | 2541 |
2548 // Add a property to a slow-case object. | 2542 // Add a property to a slow-case object. |
2549 MUST_USE_RESULT MaybeObject* AddSlowProperty(Name* name, | 2543 MUST_USE_RESULT MaybeObject* AddSlowProperty(Name* name, |
2550 Object* value, | 2544 Object* value, |
2551 PropertyAttributes attributes); | 2545 PropertyAttributes attributes); |
2552 | 2546 |
2553 // Add a property to an object. May cause GC. | 2547 // Add a property to an object. May cause GC. |
2554 MUST_USE_RESULT MaybeObject* AddProperty( | 2548 MUST_USE_RESULT MaybeObject* AddProperty( |
2555 Name* name, | 2549 Name* name, |
2556 Object* value, | 2550 Object* value, |
2557 PropertyAttributes attributes, | 2551 PropertyAttributes attributes, |
2558 StrictModeFlag strict_mode, | 2552 StrictModeFlag strict_mode, |
2559 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, | 2553 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
2560 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, | 2554 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, |
2561 ValueType value_type = OPTIMAL_REPRESENTATION, | 2555 ValueType value_type = OPTIMAL_REPRESENTATION, |
2562 StoreMode mode = ALLOW_AS_CONSTANT); | 2556 StoreMode mode = ALLOW_AS_CONSTANT, |
| 2557 TransitionFlag flag = INSERT_TRANSITION); |
2563 | 2558 |
2564 // Convert the object to use the canonical dictionary | 2559 // Convert the object to use the canonical dictionary |
2565 // representation. If the object is expected to have additional properties | 2560 // representation. If the object is expected to have additional properties |
2566 // added this number can be indicated to have the backing store allocated to | 2561 // added this number can be indicated to have the backing store allocated to |
2567 // an initial capacity for holding these properties. | 2562 // an initial capacity for holding these properties. |
2568 static void NormalizeProperties(Handle<JSObject> object, | 2563 static void NormalizeProperties(Handle<JSObject> object, |
2569 PropertyNormalizationMode mode, | 2564 PropertyNormalizationMode mode, |
2570 int expected_additional_properties); | 2565 int expected_additional_properties); |
2571 | 2566 |
2572 MUST_USE_RESULT MaybeObject* NormalizeProperties( | 2567 MUST_USE_RESULT MaybeObject* NormalizeProperties( |
(...skipping 115 matching lines...) Loading... |
2688 int number_of_slow_unused_elements_; | 2683 int number_of_slow_unused_elements_; |
2689 }; | 2684 }; |
2690 | 2685 |
2691 void IncrementSpillStatistics(SpillInformation* info); | 2686 void IncrementSpillStatistics(SpillInformation* info); |
2692 #endif | 2687 #endif |
2693 Object* SlowReverseLookup(Object* value); | 2688 Object* SlowReverseLookup(Object* value); |
2694 | 2689 |
2695 // Maximal number of fast properties for the JSObject. Used to | 2690 // Maximal number of fast properties for the JSObject. Used to |
2696 // restrict the number of map transitions to avoid an explosion in | 2691 // restrict the number of map transitions to avoid an explosion in |
2697 // the number of maps for objects used as dictionaries. | 2692 // the number of maps for objects used as dictionaries. |
2698 inline bool TooManyFastProperties(int properties, StoreFromKeyed store_mode); | 2693 inline bool TooManyFastProperties( |
| 2694 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); |
2699 | 2695 |
2700 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). | 2696 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). |
2701 // Also maximal value of JSArray's length property. | 2697 // Also maximal value of JSArray's length property. |
2702 static const uint32_t kMaxElementCount = 0xffffffffu; | 2698 static const uint32_t kMaxElementCount = 0xffffffffu; |
2703 | 2699 |
2704 // Constants for heuristics controlling conversion of fast elements | 2700 // Constants for heuristics controlling conversion of fast elements |
2705 // to slow elements. | 2701 // to slow elements. |
2706 | 2702 |
2707 // Maximal gap that can be introduced by adding an element beyond | 2703 // Maximal gap that can be introduced by adding an element beyond |
2708 // the current elements length. | 2704 // the current elements length. |
(...skipping 2911 matching lines...) Loading... |
5620 int modify_index, | 5616 int modify_index, |
5621 Representation new_representation, | 5617 Representation new_representation, |
5622 StoreMode store_mode); | 5618 StoreMode store_mode); |
5623 MUST_USE_RESULT MaybeObject* GeneralizeRepresentation( | 5619 MUST_USE_RESULT MaybeObject* GeneralizeRepresentation( |
5624 int modify_index, | 5620 int modify_index, |
5625 Representation representation, | 5621 Representation representation, |
5626 StoreMode store_mode); | 5622 StoreMode store_mode); |
5627 MUST_USE_RESULT MaybeObject* CopyGeneralizeAllRepresentations( | 5623 MUST_USE_RESULT MaybeObject* CopyGeneralizeAllRepresentations( |
5628 int modify_index, | 5624 int modify_index, |
5629 StoreMode store_mode, | 5625 StoreMode store_mode, |
| 5626 PropertyAttributes attributes, |
5630 const char* reason); | 5627 const char* reason); |
5631 | 5628 |
5632 void PrintGeneralization(FILE* file, | 5629 void PrintGeneralization(FILE* file, |
5633 const char* reason, | 5630 const char* reason, |
5634 int modify_index, | 5631 int modify_index, |
5635 int split, | 5632 int split, |
5636 int descriptors, | 5633 int descriptors, |
5637 bool constant_to_field, | 5634 bool constant_to_field, |
5638 Representation old_representation, | 5635 Representation old_representation, |
5639 Representation new_representation); | 5636 Representation new_representation); |
(...skipping 4563 matching lines...) Loading... |
10203 } else { | 10200 } else { |
10204 value &= ~(1 << bit_position); | 10201 value &= ~(1 << bit_position); |
10205 } | 10202 } |
10206 return value; | 10203 return value; |
10207 } | 10204 } |
10208 }; | 10205 }; |
10209 | 10206 |
10210 } } // namespace v8::internal | 10207 } } // namespace v8::internal |
10211 | 10208 |
10212 #endif // V8_OBJECTS_H_ | 10209 #endif // V8_OBJECTS_H_ |
OLD | NEW |