| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
| 10 #include "src/builtins.h" | 10 #include "src/builtins.h" |
| (...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 | 1399 |
| 1400 // Filler objects (fillers and free space objects). | 1400 // Filler objects (fillers and free space objects). |
| 1401 INLINE(bool IsFiller() const); | 1401 INLINE(bool IsFiller() const); |
| 1402 | 1402 |
| 1403 // Extract the number. | 1403 // Extract the number. |
| 1404 inline double Number(); | 1404 inline double Number(); |
| 1405 INLINE(bool IsNaN() const); | 1405 INLINE(bool IsNaN() const); |
| 1406 bool ToInt32(int32_t* value); | 1406 bool ToInt32(int32_t* value); |
| 1407 bool ToUint32(uint32_t* value); | 1407 bool ToUint32(uint32_t* value); |
| 1408 | 1408 |
| 1409 // Indicates whether OptimalRepresentation can do its work, or whether it | 1409 inline Representation OptimalRepresentation() { |
| 1410 // always has to return Representation::Tagged(). | |
| 1411 enum ValueType { | |
| 1412 OPTIMAL_REPRESENTATION, | |
| 1413 FORCE_TAGGED | |
| 1414 }; | |
| 1415 | |
| 1416 inline Representation OptimalRepresentation( | |
| 1417 ValueType type = OPTIMAL_REPRESENTATION) { | |
| 1418 if (!FLAG_track_fields) return Representation::Tagged(); | 1410 if (!FLAG_track_fields) return Representation::Tagged(); |
| 1419 if (type == FORCE_TAGGED) return Representation::Tagged(); | |
| 1420 if (IsSmi()) { | 1411 if (IsSmi()) { |
| 1421 return Representation::Smi(); | 1412 return Representation::Smi(); |
| 1422 } else if (FLAG_track_double_fields && IsHeapNumber()) { | 1413 } else if (FLAG_track_double_fields && IsHeapNumber()) { |
| 1423 return Representation::Double(); | 1414 return Representation::Double(); |
| 1424 } else if (FLAG_track_computed_fields && IsUninitialized()) { | 1415 } else if (FLAG_track_computed_fields && IsUninitialized()) { |
| 1425 return Representation::None(); | 1416 return Representation::None(); |
| 1426 } else if (FLAG_track_heap_object_fields) { | 1417 } else if (FLAG_track_heap_object_fields) { |
| 1427 ASSERT(IsHeapObject()); | 1418 ASSERT(IsHeapObject()); |
| 1428 return Representation::HeapObject(); | 1419 return Representation::HeapObject(); |
| 1429 } else { | 1420 } else { |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2160 enum ExecutableAccessorInfoHandling { | 2151 enum ExecutableAccessorInfoHandling { |
| 2161 DEFAULT_HANDLING, | 2152 DEFAULT_HANDLING, |
| 2162 DONT_FORCE_FIELD | 2153 DONT_FORCE_FIELD |
| 2163 }; | 2154 }; |
| 2164 | 2155 |
| 2165 MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes( | 2156 MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes( |
| 2166 Handle<JSObject> object, | 2157 Handle<JSObject> object, |
| 2167 Handle<Name> key, | 2158 Handle<Name> key, |
| 2168 Handle<Object> value, | 2159 Handle<Object> value, |
| 2169 PropertyAttributes attributes, | 2160 PropertyAttributes attributes, |
| 2170 ValueType value_type = OPTIMAL_REPRESENTATION, | |
| 2171 StoreMode mode = ALLOW_AS_CONSTANT, | 2161 StoreMode mode = ALLOW_AS_CONSTANT, |
| 2172 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, | 2162 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, |
| 2173 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, | 2163 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
| 2174 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); | 2164 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); |
| 2175 | 2165 |
| 2176 static void AddProperty(Handle<JSObject> object, | 2166 static void AddProperty(Handle<JSObject> object, |
| 2177 Handle<Name> key, | 2167 Handle<Name> key, |
| 2178 Handle<Object> value, | 2168 Handle<Object> value, |
| 2179 PropertyAttributes attributes, | 2169 PropertyAttributes attributes, |
| 2180 ValueType value_type = OPTIMAL_REPRESENTATION, | |
| 2181 StoreMode mode = ALLOW_AS_CONSTANT); | 2170 StoreMode mode = ALLOW_AS_CONSTANT); |
| 2182 | 2171 |
| 2183 // Extend the receiver with a single fast property appeared first in the | 2172 // Extend the receiver with a single fast property appeared first in the |
| 2184 // passed map. This also extends the property backing store if necessary. | 2173 // passed map. This also extends the property backing store if necessary. |
| 2185 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); | 2174 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); |
| 2186 | 2175 |
| 2187 // Migrates the given object to a map whose field representations are the | 2176 // Migrates the given object to a map whose field representations are the |
| 2188 // lowest upper bound of all known representations for that field. | 2177 // lowest upper bound of all known representations for that field. |
| 2189 static void MigrateInstance(Handle<JSObject> instance); | 2178 static void MigrateInstance(Handle<JSObject> instance); |
| 2190 | 2179 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2510 MUST_USE_RESULT static MaybeHandle<Object> PreventExtensions( | 2499 MUST_USE_RESULT static MaybeHandle<Object> PreventExtensions( |
| 2511 Handle<JSObject> object); | 2500 Handle<JSObject> object); |
| 2512 | 2501 |
| 2513 // ES5 Object.freeze | 2502 // ES5 Object.freeze |
| 2514 MUST_USE_RESULT static MaybeHandle<Object> Freeze(Handle<JSObject> object); | 2503 MUST_USE_RESULT static MaybeHandle<Object> Freeze(Handle<JSObject> object); |
| 2515 | 2504 |
| 2516 // Called the first time an object is observed with ES7 Object.observe. | 2505 // Called the first time an object is observed with ES7 Object.observe. |
| 2517 static void SetObserved(Handle<JSObject> object); | 2506 static void SetObserved(Handle<JSObject> object); |
| 2518 | 2507 |
| 2519 // Copy object. | 2508 // Copy object. |
| 2520 enum DeepCopyHints { | 2509 enum DeepCopyHints { kNoHints = 0, kObjectIsShallow = 1 }; |
| 2521 kNoHints = 0, | |
| 2522 kObjectIsShallowArray = 1 | |
| 2523 }; | |
| 2524 | 2510 |
| 2525 static Handle<JSObject> Copy(Handle<JSObject> object); | 2511 static Handle<JSObject> Copy(Handle<JSObject> object); |
| 2526 MUST_USE_RESULT static MaybeHandle<JSObject> DeepCopy( | 2512 MUST_USE_RESULT static MaybeHandle<JSObject> DeepCopy( |
| 2527 Handle<JSObject> object, | 2513 Handle<JSObject> object, |
| 2528 AllocationSiteUsageContext* site_context, | 2514 AllocationSiteUsageContext* site_context, |
| 2529 DeepCopyHints hints = kNoHints); | 2515 DeepCopyHints hints = kNoHints); |
| 2530 MUST_USE_RESULT static MaybeHandle<JSObject> DeepWalk( | 2516 MUST_USE_RESULT static MaybeHandle<JSObject> DeepWalk( |
| 2531 Handle<JSObject> object, | 2517 Handle<JSObject> object, |
| 2532 AllocationSiteCreationContext* site_context); | 2518 AllocationSiteCreationContext* site_context); |
| 2533 | 2519 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2778 | 2764 |
| 2779 // Add a property to an object. | 2765 // Add a property to an object. |
| 2780 MUST_USE_RESULT static MaybeHandle<Object> AddPropertyInternal( | 2766 MUST_USE_RESULT static MaybeHandle<Object> AddPropertyInternal( |
| 2781 Handle<JSObject> object, | 2767 Handle<JSObject> object, |
| 2782 Handle<Name> name, | 2768 Handle<Name> name, |
| 2783 Handle<Object> value, | 2769 Handle<Object> value, |
| 2784 PropertyAttributes attributes, | 2770 PropertyAttributes attributes, |
| 2785 StrictMode strict_mode, | 2771 StrictMode strict_mode, |
| 2786 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, | 2772 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
| 2787 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, | 2773 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, |
| 2788 ValueType value_type = OPTIMAL_REPRESENTATION, | |
| 2789 StoreMode mode = ALLOW_AS_CONSTANT, | 2774 StoreMode mode = ALLOW_AS_CONSTANT, |
| 2790 TransitionFlag flag = INSERT_TRANSITION); | 2775 TransitionFlag flag = INSERT_TRANSITION); |
| 2791 | 2776 |
| 2792 // Add a property to a fast-case object. | 2777 // Add a property to a fast-case object. |
| 2793 static void AddFastProperty(Handle<JSObject> object, | 2778 static void AddFastProperty(Handle<JSObject> object, |
| 2794 Handle<Name> name, | 2779 Handle<Name> name, |
| 2795 Handle<Object> value, | 2780 Handle<Object> value, |
| 2796 PropertyAttributes attributes, | 2781 PropertyAttributes attributes, |
| 2797 StoreFromKeyed store_mode, | 2782 StoreFromKeyed store_mode, |
| 2798 ValueType value_type, | |
| 2799 TransitionFlag flag); | 2783 TransitionFlag flag); |
| 2800 | 2784 |
| 2801 // Add a property to a slow-case object. | 2785 // Add a property to a slow-case object. |
| 2802 static void AddSlowProperty(Handle<JSObject> object, | 2786 static void AddSlowProperty(Handle<JSObject> object, |
| 2803 Handle<Name> name, | 2787 Handle<Name> name, |
| 2804 Handle<Object> value, | 2788 Handle<Object> value, |
| 2805 PropertyAttributes attributes); | 2789 PropertyAttributes attributes); |
| 2806 | 2790 |
| 2807 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty( | 2791 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty( |
| 2808 Handle<JSObject> object, | 2792 Handle<JSObject> object, |
| (...skipping 8418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11227 } else { | 11211 } else { |
| 11228 value &= ~(1 << bit_position); | 11212 value &= ~(1 << bit_position); |
| 11229 } | 11213 } |
| 11230 return value; | 11214 return value; |
| 11231 } | 11215 } |
| 11232 }; | 11216 }; |
| 11233 | 11217 |
| 11234 } } // namespace v8::internal | 11218 } } // namespace v8::internal |
| 11235 | 11219 |
| 11236 #endif // V8_OBJECTS_H_ | 11220 #endif // V8_OBJECTS_H_ |
| OLD | NEW |