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