| 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 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2138 Name* name, | 2138 Name* name, |
| 2139 Object* value, | 2139 Object* value, |
| 2140 bool check_prototype, | 2140 bool check_prototype, |
| 2141 StrictModeFlag strict_mode); | 2141 StrictModeFlag strict_mode); |
| 2142 MUST_USE_RESULT MaybeObject* SetPropertyWithCallback( | 2142 MUST_USE_RESULT MaybeObject* SetPropertyWithCallback( |
| 2143 Object* structure, | 2143 Object* structure, |
| 2144 Name* name, | 2144 Name* name, |
| 2145 Object* value, | 2145 Object* value, |
| 2146 JSObject* holder, | 2146 JSObject* holder, |
| 2147 StrictModeFlag strict_mode); | 2147 StrictModeFlag strict_mode); |
| 2148 static Handle<Object> SetPropertyWithInterceptor( | 2148 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor( |
| 2149 Handle<JSObject> object, | 2149 Name* name, |
| 2150 Handle<Name> name, | 2150 Object* value, |
| 2151 Handle<Object> value, | |
| 2152 PropertyAttributes attributes, | 2151 PropertyAttributes attributes, |
| 2153 StrictModeFlag strict_mode); | 2152 StrictModeFlag strict_mode); |
| 2153 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor( |
| 2154 Name* name, |
| 2155 Object* value, |
| 2156 PropertyAttributes attributes, |
| 2157 StrictModeFlag strict_mode, |
| 2158 StoreMode mode = ALLOW_AS_CONSTANT); |
| 2154 | 2159 |
| 2155 static Handle<Object> SetLocalPropertyIgnoreAttributes( | 2160 static Handle<Object> SetLocalPropertyIgnoreAttributes( |
| 2156 Handle<JSObject> object, | 2161 Handle<JSObject> object, |
| 2157 Handle<Name> key, | 2162 Handle<Name> key, |
| 2158 Handle<Object> value, | 2163 Handle<Object> value, |
| 2159 PropertyAttributes attributes, | 2164 PropertyAttributes attributes, |
| 2160 ValueType value_type = OPTIMAL_REPRESENTATION, | 2165 ValueType value_type = OPTIMAL_REPRESENTATION, |
| 2161 StoreMode mode = ALLOW_AS_CONSTANT, | 2166 StoreMode mode = ALLOW_AS_CONSTANT, |
| 2162 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); | 2167 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); |
| 2163 | 2168 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2464 int GetLocalElementKeys(FixedArray* storage, PropertyAttributes filter); | 2469 int GetLocalElementKeys(FixedArray* storage, PropertyAttributes filter); |
| 2465 // Count and fill in the enumerable elements into storage. | 2470 // Count and fill in the enumerable elements into storage. |
| 2466 // (storage->length() == NumberOfEnumElements()). | 2471 // (storage->length() == NumberOfEnumElements()). |
| 2467 // If storage is NULL, will count the elements without adding | 2472 // If storage is NULL, will count the elements without adding |
| 2468 // them to any storage. | 2473 // them to any storage. |
| 2469 // Returns the number of enumerable elements. | 2474 // Returns the number of enumerable elements. |
| 2470 int GetEnumElementKeys(FixedArray* storage); | 2475 int GetEnumElementKeys(FixedArray* storage); |
| 2471 | 2476 |
| 2472 // Add a property to a fast-case object using a map transition to | 2477 // Add a property to a fast-case object using a map transition to |
| 2473 // new_map. | 2478 // new_map. |
| 2474 // TODO(mstarzinger): Only public because of SetPropertyUsingTransition! | |
| 2475 MUST_USE_RESULT MaybeObject* AddFastPropertyUsingMap( | 2479 MUST_USE_RESULT MaybeObject* AddFastPropertyUsingMap( |
| 2476 Map* new_map, | 2480 Map* new_map, |
| 2477 Name* name, | 2481 Name* name, |
| 2478 Object* value, | 2482 Object* value, |
| 2479 int field_index, | 2483 int field_index, |
| 2480 Representation representation); | 2484 Representation representation); |
| 2481 | 2485 |
| 2486 // Add a constant function property to a fast-case object. |
| 2487 // This leaves a CONSTANT_TRANSITION in the old map, and |
| 2488 // if it is called on a second object with this map, a |
| 2489 // normal property is added instead, with a map transition. |
| 2490 // This avoids the creation of many maps with the same constant |
| 2491 // function, all orphaned. |
| 2492 MUST_USE_RESULT MaybeObject* AddConstantProperty( |
| 2493 Name* name, |
| 2494 Object* constant, |
| 2495 PropertyAttributes attributes, |
| 2496 TransitionFlag flag); |
| 2497 |
| 2482 MUST_USE_RESULT MaybeObject* ReplaceSlowProperty( | 2498 MUST_USE_RESULT MaybeObject* ReplaceSlowProperty( |
| 2483 Name* name, | 2499 Name* name, |
| 2484 Object* value, | 2500 Object* value, |
| 2485 PropertyAttributes attributes); | 2501 PropertyAttributes attributes); |
| 2486 | 2502 |
| 2487 // Returns a new map with all transitions dropped from the object's current | 2503 // Returns a new map with all transitions dropped from the object's current |
| 2488 // map and the ElementsKind set. | 2504 // map and the ElementsKind set. |
| 2489 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, | 2505 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, |
| 2490 ElementsKind to_kind); | 2506 ElementsKind to_kind); |
| 2491 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( | 2507 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( |
| 2492 Isolate* isolate, | 2508 Isolate* isolate, |
| 2493 ElementsKind elements_kind); | 2509 ElementsKind elements_kind); |
| 2494 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( | 2510 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( |
| 2495 ElementsKind elements_kind); | 2511 ElementsKind elements_kind); |
| 2496 | 2512 |
| 2497 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, | 2513 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, |
| 2498 ElementsKind to_kind); | 2514 ElementsKind to_kind); |
| 2499 | 2515 |
| 2500 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); | 2516 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); |
| 2501 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); | 2517 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); |
| 2502 | 2518 |
| 2503 MUST_USE_RESULT MaybeObject* MigrateToMap(Map* new_map); | 2519 MUST_USE_RESULT MaybeObject* MigrateToMap(Map* new_map); |
| 2504 MUST_USE_RESULT MaybeObject* GeneralizeFieldRepresentation( | 2520 MUST_USE_RESULT MaybeObject* GeneralizeFieldRepresentation( |
| 2505 int modify_index, | 2521 int modify_index, |
| 2506 Representation new_representation, | 2522 Representation new_representation, |
| 2507 StoreMode store_mode); | 2523 StoreMode store_mode); |
| 2508 | 2524 |
| 2509 // Add a property to an object. | 2525 // Add a property to a fast-case object. |
| 2510 // TODO(mstarzinger): Only public because of SetPropertyUsingTransition! | 2526 MUST_USE_RESULT MaybeObject* AddFastProperty( |
| 2511 static Handle<Object> AddProperty( | 2527 Name* name, |
| 2512 Handle<JSObject> object, | 2528 Object* value, |
| 2513 Handle<Name> name, | 2529 PropertyAttributes attributes, |
| 2514 Handle<Object> value, | 2530 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
| 2531 ValueType value_type = OPTIMAL_REPRESENTATION, |
| 2532 TransitionFlag flag = INSERT_TRANSITION); |
| 2533 |
| 2534 // Add a property to a slow-case object. |
| 2535 MUST_USE_RESULT MaybeObject* AddSlowProperty(Name* name, |
| 2536 Object* value, |
| 2537 PropertyAttributes attributes); |
| 2538 |
| 2539 // Add a property to an object. May cause GC. |
| 2540 MUST_USE_RESULT MaybeObject* AddProperty( |
| 2541 Name* name, |
| 2542 Object* value, |
| 2515 PropertyAttributes attributes, | 2543 PropertyAttributes attributes, |
| 2516 StrictModeFlag strict_mode, | 2544 StrictModeFlag strict_mode, |
| 2517 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, | 2545 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
| 2518 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, | 2546 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, |
| 2519 ValueType value_type = OPTIMAL_REPRESENTATION, | 2547 ValueType value_type = OPTIMAL_REPRESENTATION, |
| 2520 StoreMode mode = ALLOW_AS_CONSTANT, | 2548 StoreMode mode = ALLOW_AS_CONSTANT, |
| 2521 TransitionFlag flag = INSERT_TRANSITION); | 2549 TransitionFlag flag = INSERT_TRANSITION); |
| 2522 | 2550 |
| 2523 // Convert the object to use the canonical dictionary | 2551 // Convert the object to use the canonical dictionary |
| 2524 // representation. If the object is expected to have additional properties | 2552 // representation. If the object is expected to have additional properties |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2739 uint32_t index, | 2767 uint32_t index, |
| 2740 Object* value, | 2768 Object* value, |
| 2741 PropertyAttributes attributes, | 2769 PropertyAttributes attributes, |
| 2742 StrictModeFlag strict_mode, | 2770 StrictModeFlag strict_mode, |
| 2743 bool check_prototype, | 2771 bool check_prototype, |
| 2744 SetPropertyMode set_mode); | 2772 SetPropertyMode set_mode); |
| 2745 | 2773 |
| 2746 // Searches the prototype chain for property 'name'. If it is found and | 2774 // Searches the prototype chain for property 'name'. If it is found and |
| 2747 // has a setter, invoke it and set '*done' to true. If it is found and is | 2775 // has a setter, invoke it and set '*done' to true. If it is found and is |
| 2748 // read-only, reject and set '*done' to true. Otherwise, set '*done' to | 2776 // read-only, reject and set '*done' to true. Otherwise, set '*done' to |
| 2749 // false. Can throw and return an empty handle with '*done==true'. | 2777 // false. Can cause GC and can return a failure result with '*done==true'. |
| 2750 static Handle<Object> SetPropertyViaPrototypes( | 2778 MUST_USE_RESULT MaybeObject* SetPropertyViaPrototypes( |
| 2751 Handle<JSObject> object, | 2779 Name* name, |
| 2752 Handle<Name> name, | 2780 Object* value, |
| 2753 Handle<Object> value, | |
| 2754 PropertyAttributes attributes, | 2781 PropertyAttributes attributes, |
| 2755 StrictModeFlag strict_mode, | 2782 StrictModeFlag strict_mode, |
| 2756 bool* done); | 2783 bool* done); |
| 2757 static Handle<Object> SetPropertyPostInterceptor( | |
| 2758 Handle<JSObject> object, | |
| 2759 Handle<Name> name, | |
| 2760 Handle<Object> value, | |
| 2761 PropertyAttributes attributes, | |
| 2762 StrictModeFlag strict_mode); | |
| 2763 | |
| 2764 // Add a constant function property to a fast-case object. | |
| 2765 // This leaves a CONSTANT_TRANSITION in the old map, and | |
| 2766 // if it is called on a second object with this map, a | |
| 2767 // normal property is added instead, with a map transition. | |
| 2768 // This avoids the creation of many maps with the same constant | |
| 2769 // function, all orphaned. | |
| 2770 static void AddConstantProperty(Handle<JSObject> object, | |
| 2771 Handle<Name> name, | |
| 2772 Handle<Object> constant, | |
| 2773 PropertyAttributes attributes, | |
| 2774 TransitionFlag flag); | |
| 2775 MUST_USE_RESULT MaybeObject* AddConstantProperty( | |
| 2776 Name* name, | |
| 2777 Object* constant, | |
| 2778 PropertyAttributes attributes, | |
| 2779 TransitionFlag flag); | |
| 2780 | |
| 2781 // Add a property to a fast-case object. | |
| 2782 static void AddFastProperty(Handle<JSObject> object, | |
| 2783 Handle<Name> name, | |
| 2784 Handle<Object> value, | |
| 2785 PropertyAttributes attributes, | |
| 2786 StoreFromKeyed store_mode, | |
| 2787 ValueType value_type, | |
| 2788 TransitionFlag flag); | |
| 2789 MUST_USE_RESULT MaybeObject* AddFastProperty( | |
| 2790 Name* name, | |
| 2791 Object* value, | |
| 2792 PropertyAttributes attributes, | |
| 2793 StoreFromKeyed store_mode, | |
| 2794 ValueType value_type, | |
| 2795 TransitionFlag flag); | |
| 2796 | |
| 2797 // Add a property to a slow-case object. | |
| 2798 static void AddSlowProperty(Handle<JSObject> object, | |
| 2799 Handle<Name> name, | |
| 2800 Handle<Object> value, | |
| 2801 PropertyAttributes attributes); | |
| 2802 MUST_USE_RESULT MaybeObject* AddSlowProperty(Name* name, | |
| 2803 Object* value, | |
| 2804 PropertyAttributes attributes); | |
| 2805 | 2784 |
| 2806 static Handle<Object> DeleteProperty(Handle<JSObject> object, | 2785 static Handle<Object> DeleteProperty(Handle<JSObject> object, |
| 2807 Handle<Name> name, | 2786 Handle<Name> name, |
| 2808 DeleteMode mode); | 2787 DeleteMode mode); |
| 2809 static Handle<Object> DeletePropertyPostInterceptor(Handle<JSObject> object, | 2788 static Handle<Object> DeletePropertyPostInterceptor(Handle<JSObject> object, |
| 2810 Handle<Name> name, | 2789 Handle<Name> name, |
| 2811 DeleteMode mode); | 2790 DeleteMode mode); |
| 2812 static Handle<Object> DeletePropertyWithInterceptor(Handle<JSObject> object, | 2791 static Handle<Object> DeletePropertyWithInterceptor(Handle<JSObject> object, |
| 2813 Handle<Name> name); | 2792 Handle<Name> name); |
| 2814 | 2793 |
| (...skipping 7432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10247 } else { | 10226 } else { |
| 10248 value &= ~(1 << bit_position); | 10227 value &= ~(1 << bit_position); |
| 10249 } | 10228 } |
| 10250 return value; | 10229 return value; |
| 10251 } | 10230 } |
| 10252 }; | 10231 }; |
| 10253 | 10232 |
| 10254 } } // namespace v8::internal | 10233 } } // namespace v8::internal |
| 10255 | 10234 |
| 10256 #endif // V8_OBJECTS_H_ | 10235 #endif // V8_OBJECTS_H_ |
| OLD | NEW |