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 14 matching lines...) Expand all Loading... |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_OBJECTS_H_ | 28 #ifndef V8_OBJECTS_H_ |
29 #define V8_OBJECTS_H_ | 29 #define V8_OBJECTS_H_ |
30 | 30 |
31 #include "allocation.h" | 31 #include "allocation.h" |
32 #include "assert-scope.h" | 32 #include "assert-scope.h" |
33 #include "builtins.h" | 33 #include "builtins.h" |
34 #include "elements-kind.h" | 34 #include "elements-kind.h" |
| 35 #include "flags.h" |
35 #include "list.h" | 36 #include "list.h" |
36 #include "property-details.h" | 37 #include "property-details.h" |
37 #include "smart-pointers.h" | 38 #include "smart-pointers.h" |
38 #include "unicode-inl.h" | 39 #include "unicode-inl.h" |
39 #if V8_TARGET_ARCH_A64 | 40 #if V8_TARGET_ARCH_A64 |
40 #include "a64/constants-a64.h" | 41 #include "a64/constants-a64.h" |
41 #elif V8_TARGET_ARCH_ARM | 42 #elif V8_TARGET_ARCH_ARM |
42 #include "arm/constants-arm.h" | 43 #include "arm/constants-arm.h" |
43 #elif V8_TARGET_ARCH_MIPS | 44 #elif V8_TARGET_ARCH_MIPS |
44 #include "mips/constants-mips.h" | 45 #include "mips/constants-mips.h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \ | 382 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \ |
382 V(ACCESSOR_PAIR_TYPE) \ | 383 V(ACCESSOR_PAIR_TYPE) \ |
383 V(ACCESS_CHECK_INFO_TYPE) \ | 384 V(ACCESS_CHECK_INFO_TYPE) \ |
384 V(INTERCEPTOR_INFO_TYPE) \ | 385 V(INTERCEPTOR_INFO_TYPE) \ |
385 V(CALL_HANDLER_INFO_TYPE) \ | 386 V(CALL_HANDLER_INFO_TYPE) \ |
386 V(FUNCTION_TEMPLATE_INFO_TYPE) \ | 387 V(FUNCTION_TEMPLATE_INFO_TYPE) \ |
387 V(OBJECT_TEMPLATE_INFO_TYPE) \ | 388 V(OBJECT_TEMPLATE_INFO_TYPE) \ |
388 V(SIGNATURE_INFO_TYPE) \ | 389 V(SIGNATURE_INFO_TYPE) \ |
389 V(TYPE_SWITCH_INFO_TYPE) \ | 390 V(TYPE_SWITCH_INFO_TYPE) \ |
390 V(ALLOCATION_SITE_INFO_TYPE) \ | 391 V(ALLOCATION_SITE_INFO_TYPE) \ |
| 392 V(ALLOCATION_SITE_TYPE) \ |
391 V(SCRIPT_TYPE) \ | 393 V(SCRIPT_TYPE) \ |
392 V(CODE_CACHE_TYPE) \ | 394 V(CODE_CACHE_TYPE) \ |
393 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | 395 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
394 V(TYPE_FEEDBACK_INFO_TYPE) \ | 396 V(TYPE_FEEDBACK_INFO_TYPE) \ |
395 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 397 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
396 \ | 398 \ |
397 V(FIXED_ARRAY_TYPE) \ | 399 V(FIXED_ARRAY_TYPE) \ |
398 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 400 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
399 V(SHARED_FUNCTION_INFO_TYPE) \ | 401 V(SHARED_FUNCTION_INFO_TYPE) \ |
400 \ | 402 \ |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, executable_accessor_info)\ | 546 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, executable_accessor_info)\ |
545 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ | 547 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ |
546 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ | 548 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ |
547 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ | 549 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ |
548 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ | 550 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ |
549 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 551 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
550 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 552 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
551 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ | 553 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ |
552 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ | 554 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ |
553 V(SCRIPT, Script, script) \ | 555 V(SCRIPT, Script, script) \ |
| 556 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ |
554 V(ALLOCATION_SITE_INFO, AllocationSiteInfo, allocation_site_info) \ | 557 V(ALLOCATION_SITE_INFO, AllocationSiteInfo, allocation_site_info) \ |
555 V(CODE_CACHE, CodeCache, code_cache) \ | 558 V(CODE_CACHE, CodeCache, code_cache) \ |
556 V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \ | 559 V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \ |
557 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ | 560 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ |
558 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) | 561 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) |
559 | 562 |
560 #ifdef ENABLE_DEBUGGER_SUPPORT | 563 #ifdef ENABLE_DEBUGGER_SUPPORT |
561 #define STRUCT_LIST_DEBUGGER(V) \ | 564 #define STRUCT_LIST_DEBUGGER(V) \ |
562 V(DEBUG_INFO, DebugInfo, debug_info) \ | 565 V(DEBUG_INFO, DebugInfo, debug_info) \ |
563 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) | 566 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 DECLARED_ACCESSOR_INFO_TYPE, | 706 DECLARED_ACCESSOR_INFO_TYPE, |
704 EXECUTABLE_ACCESSOR_INFO_TYPE, | 707 EXECUTABLE_ACCESSOR_INFO_TYPE, |
705 ACCESSOR_PAIR_TYPE, | 708 ACCESSOR_PAIR_TYPE, |
706 ACCESS_CHECK_INFO_TYPE, | 709 ACCESS_CHECK_INFO_TYPE, |
707 INTERCEPTOR_INFO_TYPE, | 710 INTERCEPTOR_INFO_TYPE, |
708 CALL_HANDLER_INFO_TYPE, | 711 CALL_HANDLER_INFO_TYPE, |
709 FUNCTION_TEMPLATE_INFO_TYPE, | 712 FUNCTION_TEMPLATE_INFO_TYPE, |
710 OBJECT_TEMPLATE_INFO_TYPE, | 713 OBJECT_TEMPLATE_INFO_TYPE, |
711 SIGNATURE_INFO_TYPE, | 714 SIGNATURE_INFO_TYPE, |
712 TYPE_SWITCH_INFO_TYPE, | 715 TYPE_SWITCH_INFO_TYPE, |
| 716 ALLOCATION_SITE_TYPE, |
713 ALLOCATION_SITE_INFO_TYPE, | 717 ALLOCATION_SITE_INFO_TYPE, |
714 SCRIPT_TYPE, | 718 SCRIPT_TYPE, |
715 CODE_CACHE_TYPE, | 719 CODE_CACHE_TYPE, |
716 POLYMORPHIC_CODE_CACHE_TYPE, | 720 POLYMORPHIC_CODE_CACHE_TYPE, |
717 TYPE_FEEDBACK_INFO_TYPE, | 721 TYPE_FEEDBACK_INFO_TYPE, |
718 ALIASED_ARGUMENTS_ENTRY_TYPE, | 722 ALIASED_ARGUMENTS_ENTRY_TYPE, |
719 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT | 723 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT |
720 // is defined. However as include/v8.h contain some of the instance type | 724 // is defined. However as include/v8.h contain some of the instance type |
721 // constants always having them avoids them getting different numbers | 725 // constants always having them avoids them getting different numbers |
722 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. | 726 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 inline bool HasLocalProperty(Name* name); | 1702 inline bool HasLocalProperty(Name* name); |
1699 inline bool HasElement(uint32_t index); | 1703 inline bool HasElement(uint32_t index); |
1700 inline bool HasLocalElement(uint32_t index); | 1704 inline bool HasLocalElement(uint32_t index); |
1701 | 1705 |
1702 // Return the object's prototype (might be Heap::null_value()). | 1706 // Return the object's prototype (might be Heap::null_value()). |
1703 inline Object* GetPrototype(); | 1707 inline Object* GetPrototype(); |
1704 | 1708 |
1705 // Return the constructor function (may be Heap::null_value()). | 1709 // Return the constructor function (may be Heap::null_value()). |
1706 inline Object* GetConstructor(); | 1710 inline Object* GetConstructor(); |
1707 | 1711 |
1708 // Set the object's prototype (only JSReceiver and null are allowed). | |
1709 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value, | |
1710 bool skip_hidden_prototypes); | |
1711 | |
1712 // Retrieves a permanent object identity hash code. The undefined value might | 1712 // Retrieves a permanent object identity hash code. The undefined value might |
1713 // be returned in case no hash was created yet and OMIT_CREATION was used. | 1713 // be returned in case no hash was created yet and OMIT_CREATION was used. |
1714 inline MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 1714 inline MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); |
1715 | 1715 |
1716 // Lookup a property. If found, the result is valid and has | 1716 // Lookup a property. If found, the result is valid and has |
1717 // detailed information. | 1717 // detailed information. |
1718 void LocalLookup(Name* name, LookupResult* result, | 1718 void LocalLookup(Name* name, LookupResult* result, |
1719 bool search_hidden_prototypes = false); | 1719 bool search_hidden_prototypes = false); |
1720 void Lookup(Name* name, LookupResult* result); | 1720 void Lookup(Name* name, LookupResult* result); |
1721 | 1721 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1884 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( | 1884 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( |
1885 Name* key, | 1885 Name* key, |
1886 Object* value, | 1886 Object* value, |
1887 PropertyAttributes attributes, | 1887 PropertyAttributes attributes, |
1888 ValueType value_type = OPTIMAL_REPRESENTATION); | 1888 ValueType value_type = OPTIMAL_REPRESENTATION); |
1889 | 1889 |
1890 // Retrieve a value in a normalized object given a lookup result. | 1890 // Retrieve a value in a normalized object given a lookup result. |
1891 // Handles the special representation of JS global objects. | 1891 // Handles the special representation of JS global objects. |
1892 Object* GetNormalizedProperty(LookupResult* result); | 1892 Object* GetNormalizedProperty(LookupResult* result); |
1893 | 1893 |
| 1894 // Sets the property value in a normalized object given (key, value). |
| 1895 // Handles the special representation of JS global objects. |
| 1896 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object, |
| 1897 LookupResult* result, |
| 1898 Handle<Object> value); |
| 1899 |
1894 // Sets the property value in a normalized object given a lookup result. | 1900 // Sets the property value in a normalized object given a lookup result. |
1895 // Handles the special representation of JS global objects. | 1901 // Handles the special representation of JS global objects. |
1896 Object* SetNormalizedProperty(LookupResult* result, Object* value); | 1902 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(LookupResult* result, |
| 1903 Object* value); |
1897 | 1904 |
1898 // Sets the property value in a normalized object given (key, value, details). | 1905 // Sets the property value in a normalized object given (key, value, details). |
1899 // Handles the special representation of JS global objects. | 1906 // Handles the special representation of JS global objects. |
1900 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object, | 1907 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object, |
1901 Handle<Name> key, | 1908 Handle<Name> key, |
1902 Handle<Object> value, | 1909 Handle<Object> value, |
1903 PropertyDetails details); | 1910 PropertyDetails details); |
1904 | 1911 |
1905 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(Name* name, | 1912 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(Name* name, |
1906 Object* value, | 1913 Object* value, |
1907 PropertyDetails details); | 1914 PropertyDetails details); |
1908 | 1915 |
1909 // Deletes the named property in a normalized object. | 1916 // Deletes the named property in a normalized object. |
1910 MUST_USE_RESULT MaybeObject* DeleteNormalizedProperty(Name* name, | 1917 MUST_USE_RESULT MaybeObject* DeleteNormalizedProperty(Name* name, |
1911 DeleteMode mode); | 1918 DeleteMode mode); |
1912 | 1919 |
| 1920 static void OptimizeAsPrototype(Handle<JSObject> object); |
1913 MUST_USE_RESULT MaybeObject* OptimizeAsPrototype(); | 1921 MUST_USE_RESULT MaybeObject* OptimizeAsPrototype(); |
1914 | 1922 |
1915 // Retrieve interceptors. | 1923 // Retrieve interceptors. |
1916 InterceptorInfo* GetNamedInterceptor(); | 1924 InterceptorInfo* GetNamedInterceptor(); |
1917 InterceptorInfo* GetIndexedInterceptor(); | 1925 InterceptorInfo* GetIndexedInterceptor(); |
1918 | 1926 |
1919 // Used from JSReceiver. | 1927 // Used from JSReceiver. |
1920 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, | 1928 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, |
1921 Name* name, | 1929 Name* name, |
1922 bool continue_search); | 1930 bool continue_search); |
1923 PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject* receiver, | 1931 PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject* receiver, |
1924 Name* name, | 1932 Name* name, |
1925 bool continue_search); | 1933 bool continue_search); |
1926 PropertyAttributes GetPropertyAttributeWithFailedAccessCheck( | 1934 PropertyAttributes GetPropertyAttributeWithFailedAccessCheck( |
1927 Object* receiver, | 1935 Object* receiver, |
1928 LookupResult* result, | 1936 LookupResult* result, |
1929 Name* name, | 1937 Name* name, |
1930 bool continue_search); | 1938 bool continue_search); |
1931 PropertyAttributes GetElementAttributeWithReceiver(JSReceiver* receiver, | 1939 PropertyAttributes GetElementAttributeWithReceiver(JSReceiver* receiver, |
1932 uint32_t index, | 1940 uint32_t index, |
1933 bool continue_search); | 1941 bool continue_search); |
1934 | 1942 |
1935 static void DefineAccessor(Handle<JSObject> object, | 1943 static void DefineAccessor(Handle<JSObject> object, |
1936 Handle<Name> name, | 1944 Handle<Name> name, |
1937 Handle<Object> getter, | 1945 Handle<Object> getter, |
1938 Handle<Object> setter, | 1946 Handle<Object> setter, |
1939 PropertyAttributes attributes); | 1947 PropertyAttributes attributes); |
1940 // Can cause GC. | 1948 |
1941 MUST_USE_RESULT MaybeObject* DefineAccessor(Name* name, | |
1942 Object* getter, | |
1943 Object* setter, | |
1944 PropertyAttributes attributes); | |
1945 // Try to define a single accessor paying attention to map transitions. | |
1946 // Returns a JavaScript null if this was not possible and we have to use the | |
1947 // slow case. Note that we can fail due to allocations, too. | |
1948 MUST_USE_RESULT MaybeObject* DefineFastAccessor( | |
1949 Name* name, | |
1950 AccessorComponent component, | |
1951 Object* accessor, | |
1952 PropertyAttributes attributes); | |
1953 Object* LookupAccessor(Name* name, AccessorComponent component); | 1949 Object* LookupAccessor(Name* name, AccessorComponent component); |
1954 | 1950 |
1955 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); | 1951 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); |
1956 | 1952 |
1957 // Used from Object::GetProperty(). | 1953 // Used from Object::GetProperty(). |
1958 MUST_USE_RESULT MaybeObject* GetPropertyWithFailedAccessCheck( | 1954 MUST_USE_RESULT MaybeObject* GetPropertyWithFailedAccessCheck( |
1959 Object* receiver, | 1955 Object* receiver, |
1960 LookupResult* result, | 1956 LookupResult* result, |
1961 Name* name, | 1957 Name* name, |
1962 PropertyAttributes* attributes); | 1958 PropertyAttributes* attributes); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2212 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( | 2208 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( |
2213 Isolate* isolate, | 2209 Isolate* isolate, |
2214 ElementsKind elements_kind); | 2210 ElementsKind elements_kind); |
2215 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( | 2211 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( |
2216 ElementsKind elements_kind); | 2212 ElementsKind elements_kind); |
2217 | 2213 |
2218 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, | 2214 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, |
2219 ElementsKind to_kind); | 2215 ElementsKind to_kind); |
2220 | 2216 |
2221 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); | 2217 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); |
2222 MUST_USE_RESULT MaybeObject* UpdateAllocationSiteInfo( | 2218 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); |
2223 ElementsKind to_kind); | |
2224 | 2219 |
2225 // Replaces an existing transition with a transition to a map with a FIELD. | 2220 // Replaces an existing transition with a transition to a map with a FIELD. |
2226 MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition( | 2221 MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition( |
2227 int transition_index, | 2222 int transition_index, |
2228 Name* name, | 2223 Name* name, |
2229 Object* new_value, | 2224 Object* new_value, |
2230 PropertyAttributes attributes); | 2225 PropertyAttributes attributes); |
2231 | 2226 |
2232 // Converts a descriptor of any other type to a real field, backed by the | 2227 // Converts a descriptor of any other type to a real field, backed by the |
2233 // properties array. | 2228 // properties array. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2306 inline void FastPropertyAtPut(int index, Object* value); | 2301 inline void FastPropertyAtPut(int index, Object* value); |
2307 | 2302 |
2308 // Access to in object properties. | 2303 // Access to in object properties. |
2309 inline int GetInObjectPropertyOffset(int index); | 2304 inline int GetInObjectPropertyOffset(int index); |
2310 inline Object* InObjectPropertyAt(int index); | 2305 inline Object* InObjectPropertyAt(int index); |
2311 inline Object* InObjectPropertyAtPut(int index, | 2306 inline Object* InObjectPropertyAtPut(int index, |
2312 Object* value, | 2307 Object* value, |
2313 WriteBarrierMode mode | 2308 WriteBarrierMode mode |
2314 = UPDATE_WRITE_BARRIER); | 2309 = UPDATE_WRITE_BARRIER); |
2315 | 2310 |
| 2311 // Set the object's prototype (only JSReceiver and null are allowed values). |
| 2312 static Handle<Object> SetPrototype(Handle<JSObject> object, |
| 2313 Handle<Object> value, |
| 2314 bool skip_hidden_prototypes = false); |
| 2315 |
2316 // Initializes the body after properties slot, properties slot is | 2316 // Initializes the body after properties slot, properties slot is |
2317 // initialized by set_properties. Fill the pre-allocated fields with | 2317 // initialized by set_properties. Fill the pre-allocated fields with |
2318 // pre_allocated_value and the rest with filler_value. | 2318 // pre_allocated_value and the rest with filler_value. |
2319 // Note: this call does not update write barrier, the caller is responsible | 2319 // Note: this call does not update write barrier, the caller is responsible |
2320 // to ensure that |filler_value| can be collected without WB here. | 2320 // to ensure that |filler_value| can be collected without WB here. |
2321 inline void InitializeBody(Map* map, | 2321 inline void InitializeBody(Map* map, |
2322 Object* pre_allocated_value, | 2322 Object* pre_allocated_value, |
2323 Object* filler_value); | 2323 Object* filler_value); |
2324 | 2324 |
2325 // Check whether this object references another object | 2325 // Check whether this object references another object |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2508 | 2508 |
2509 bool CanSetCallback(Name* name); | 2509 bool CanSetCallback(Name* name); |
2510 MUST_USE_RESULT MaybeObject* SetElementCallback( | 2510 MUST_USE_RESULT MaybeObject* SetElementCallback( |
2511 uint32_t index, | 2511 uint32_t index, |
2512 Object* structure, | 2512 Object* structure, |
2513 PropertyAttributes attributes); | 2513 PropertyAttributes attributes); |
2514 MUST_USE_RESULT MaybeObject* SetPropertyCallback( | 2514 MUST_USE_RESULT MaybeObject* SetPropertyCallback( |
2515 Name* name, | 2515 Name* name, |
2516 Object* structure, | 2516 Object* structure, |
2517 PropertyAttributes attributes); | 2517 PropertyAttributes attributes); |
2518 MUST_USE_RESULT MaybeObject* DefineElementAccessor( | 2518 static void DefineElementAccessor(Handle<JSObject> object, |
2519 uint32_t index, | 2519 uint32_t index, |
2520 Object* getter, | 2520 Handle<Object> getter, |
2521 Object* setter, | 2521 Handle<Object> setter, |
2522 PropertyAttributes attributes); | 2522 PropertyAttributes attributes); |
2523 MUST_USE_RESULT MaybeObject* CreateAccessorPairFor(Name* name); | 2523 static Handle<AccessorPair> CreateAccessorPairFor(Handle<JSObject> object, |
2524 MUST_USE_RESULT MaybeObject* DefinePropertyAccessor( | 2524 Handle<Name> name); |
2525 Name* name, | 2525 static void DefinePropertyAccessor(Handle<JSObject> object, |
2526 Object* getter, | 2526 Handle<Name> name, |
2527 Object* setter, | 2527 Handle<Object> getter, |
2528 PropertyAttributes attributes); | 2528 Handle<Object> setter, |
| 2529 PropertyAttributes attributes); |
2529 | 2530 |
| 2531 // Try to define a single accessor paying attention to map transitions. |
| 2532 // Returns false if this was not possible and we have to use the slow case. |
| 2533 static bool DefineFastAccessor(Handle<JSObject> object, |
| 2534 Handle<Name> name, |
| 2535 AccessorComponent component, |
| 2536 Handle<Object> accessor, |
| 2537 PropertyAttributes attributes); |
2530 | 2538 |
2531 enum InitializeHiddenProperties { | 2539 enum InitializeHiddenProperties { |
2532 CREATE_NEW_IF_ABSENT, | 2540 CREATE_NEW_IF_ABSENT, |
2533 ONLY_RETURN_INLINE_VALUE | 2541 ONLY_RETURN_INLINE_VALUE |
2534 }; | 2542 }; |
2535 | 2543 |
2536 // If create_if_absent is true, return the hash table backing store | 2544 // If create_if_absent is true, return the hash table backing store |
2537 // for hidden properties. If there is no backing store, allocate one. | 2545 // for hidden properties. If there is no backing store, allocate one. |
2538 // If create_if_absent is false, return the hash table backing store | 2546 // If create_if_absent is false, return the hash table backing store |
2539 // or the inline stored identity hash, whatever is found. | 2547 // or the inline stored identity hash, whatever is found. |
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4563 inline Kind kind(); | 4571 inline Kind kind(); |
4564 inline InlineCacheState ic_state(); // Only valid for IC stubs. | 4572 inline InlineCacheState ic_state(); // Only valid for IC stubs. |
4565 inline ExtraICState extra_ic_state(); // Only valid for IC stubs. | 4573 inline ExtraICState extra_ic_state(); // Only valid for IC stubs. |
4566 | 4574 |
4567 inline ExtraICState extended_extra_ic_state(); // Only valid for | 4575 inline ExtraICState extended_extra_ic_state(); // Only valid for |
4568 // non-call IC stubs. | 4576 // non-call IC stubs. |
4569 static bool needs_extended_extra_ic_state(Kind kind) { | 4577 static bool needs_extended_extra_ic_state(Kind kind) { |
4570 // TODO(danno): This is a bit of a hack right now since there are still | 4578 // TODO(danno): This is a bit of a hack right now since there are still |
4571 // clients of this API that pass "extra" values in for argc. These clients | 4579 // clients of this API that pass "extra" values in for argc. These clients |
4572 // should be retrofitted to used ExtendedExtraICState. | 4580 // should be retrofitted to used ExtendedExtraICState. |
4573 return kind == COMPARE_NIL_IC || kind == TO_BOOLEAN_IC; | 4581 return kind == COMPARE_NIL_IC || kind == TO_BOOLEAN_IC || |
| 4582 kind == UNARY_OP_IC; |
4574 } | 4583 } |
4575 | 4584 |
4576 inline StubType type(); // Only valid for monomorphic IC stubs. | 4585 inline StubType type(); // Only valid for monomorphic IC stubs. |
4577 inline int arguments_count(); // Only valid for call IC stubs. | 4586 inline int arguments_count(); // Only valid for call IC stubs. |
4578 | 4587 |
4579 // Testers for IC stub kinds. | 4588 // Testers for IC stub kinds. |
4580 inline bool is_inline_cache_stub(); | 4589 inline bool is_inline_cache_stub(); |
4581 inline bool is_debug_break(); | 4590 inline bool is_debug_break(); |
4582 inline bool is_load_stub() { return kind() == LOAD_IC; } | 4591 inline bool is_load_stub() { return kind() == LOAD_IC; } |
4583 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } | 4592 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4836 // being entered through the prologue. Used to determine when it is | 4845 // being entered through the prologue. Used to determine when it is |
4837 // relatively safe to flush this code object and replace it with the lazy | 4846 // relatively safe to flush this code object and replace it with the lazy |
4838 // compilation stub. | 4847 // compilation stub. |
4839 static void MakeCodeAgeSequenceYoung(byte* sequence); | 4848 static void MakeCodeAgeSequenceYoung(byte* sequence); |
4840 void MakeOlder(MarkingParity); | 4849 void MakeOlder(MarkingParity); |
4841 static bool IsYoungSequence(byte* sequence); | 4850 static bool IsYoungSequence(byte* sequence); |
4842 bool IsOld(); | 4851 bool IsOld(); |
4843 int GetAge(); | 4852 int GetAge(); |
4844 | 4853 |
4845 void PrintDeoptLocation(int bailout_id); | 4854 void PrintDeoptLocation(int bailout_id); |
| 4855 bool CanDeoptAt(Address pc); |
4846 | 4856 |
4847 #ifdef VERIFY_HEAP | 4857 #ifdef VERIFY_HEAP |
4848 void VerifyEmbeddedMapsDependency(); | 4858 void VerifyEmbeddedMapsDependency(); |
4849 #endif | 4859 #endif |
4850 | 4860 |
4851 // Max loop nesting marker used to postpose OSR. We don't take loop | 4861 // Max loop nesting marker used to postpose OSR. We don't take loop |
4852 // nesting that is deeper than 5 levels into account. | 4862 // nesting that is deeper than 5 levels into account. |
4853 static const int kMaxLoopNestingMarker = 6; | 4863 static const int kMaxLoopNestingMarker = 6; |
4854 | 4864 |
4855 // Layout description. | 4865 // Layout description. |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5477 TransitionFlag flag); | 5487 TransitionFlag flag); |
5478 | 5488 |
5479 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, | 5489 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, |
5480 NormalizedMapSharingMode sharing); | 5490 NormalizedMapSharingMode sharing); |
5481 | 5491 |
5482 inline void AppendDescriptor(Descriptor* desc, | 5492 inline void AppendDescriptor(Descriptor* desc, |
5483 const DescriptorArray::WhitenessWitness&); | 5493 const DescriptorArray::WhitenessWitness&); |
5484 | 5494 |
5485 // Returns a copy of the map, with all transitions dropped from the | 5495 // Returns a copy of the map, with all transitions dropped from the |
5486 // instance descriptors. | 5496 // instance descriptors. |
| 5497 static Handle<Map> Copy(Handle<Map> map); |
5487 MUST_USE_RESULT MaybeObject* Copy(); | 5498 MUST_USE_RESULT MaybeObject* Copy(); |
5488 | 5499 |
5489 // Returns the next free property index (only valid for FAST MODE). | 5500 // Returns the next free property index (only valid for FAST MODE). |
5490 int NextFreePropertyIndex(); | 5501 int NextFreePropertyIndex(); |
5491 | 5502 |
5492 // Returns the number of properties described in instance_descriptors | 5503 // Returns the number of properties described in instance_descriptors |
5493 // filtering out properties with the specified attributes. | 5504 // filtering out properties with the specified attributes. |
5494 int NumberOfDescribedProperties(DescriptorFlag which = OWN_DESCRIPTORS, | 5505 int NumberOfDescribedProperties(DescriptorFlag which = OWN_DESCRIPTORS, |
5495 PropertyAttributes filter = NONE); | 5506 PropertyAttributes filter = NONE); |
5496 | 5507 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5603 void TraverseTransitionTree(TraverseCallback callback, void* data); | 5614 void TraverseTransitionTree(TraverseCallback callback, void* data); |
5604 | 5615 |
5605 // When you set the prototype of an object using the __proto__ accessor you | 5616 // When you set the prototype of an object using the __proto__ accessor you |
5606 // need a new map for the object (the prototype is stored in the map). In | 5617 // need a new map for the object (the prototype is stored in the map). In |
5607 // order not to multiply maps unnecessarily we store these as transitions in | 5618 // order not to multiply maps unnecessarily we store these as transitions in |
5608 // the original map. That way we can transition to the same map if the same | 5619 // the original map. That way we can transition to the same map if the same |
5609 // prototype is set, rather than creating a new map every time. The | 5620 // prototype is set, rather than creating a new map every time. The |
5610 // transitions are in the form of a map where the keys are prototype objects | 5621 // transitions are in the form of a map where the keys are prototype objects |
5611 // and the values are the maps the are transitioned to. | 5622 // and the values are the maps the are transitioned to. |
5612 static const int kMaxCachedPrototypeTransitions = 256; | 5623 static const int kMaxCachedPrototypeTransitions = 256; |
5613 | 5624 static Handle<Map> GetPrototypeTransition(Handle<Map> map, |
5614 Map* GetPrototypeTransition(Object* prototype); | 5625 Handle<Object> prototype); |
5615 | 5626 static Handle<Map> PutPrototypeTransition(Handle<Map> map, |
5616 MUST_USE_RESULT MaybeObject* PutPrototypeTransition(Object* prototype, | 5627 Handle<Object> prototype, |
5617 Map* map); | 5628 Handle<Map> target_map); |
5618 | 5629 |
5619 static const int kMaxPreAllocatedPropertyFields = 255; | 5630 static const int kMaxPreAllocatedPropertyFields = 255; |
5620 | 5631 |
5621 // Constant for denoting that the enum cache is not yet initialized. | 5632 // Constant for denoting that the enum cache is not yet initialized. |
5622 static const int kInvalidEnumCache = EnumLengthBits::kMax; | 5633 static const int kInvalidEnumCache = EnumLengthBits::kMax; |
5623 | 5634 |
5624 // Layout description. | 5635 // Layout description. |
5625 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; | 5636 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; |
5626 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; | 5637 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; |
5627 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; | 5638 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6813 // This is like GetProperty, but is used when you know the lookup won't fail | 6824 // This is like GetProperty, but is used when you know the lookup won't fail |
6814 // by throwing an exception. This is for the debug and builtins global | 6825 // by throwing an exception. This is for the debug and builtins global |
6815 // objects, where it is known which properties can be expected to be present | 6826 // objects, where it is known which properties can be expected to be present |
6816 // on the object. | 6827 // on the object. |
6817 Object* GetPropertyNoExceptionThrown(Name* key) { | 6828 Object* GetPropertyNoExceptionThrown(Name* key) { |
6818 Object* answer = GetProperty(key)->ToObjectUnchecked(); | 6829 Object* answer = GetProperty(key)->ToObjectUnchecked(); |
6819 return answer; | 6830 return answer; |
6820 } | 6831 } |
6821 | 6832 |
6822 // Ensure that the global object has a cell for the given property name. | 6833 // Ensure that the global object has a cell for the given property name. |
6823 static Handle<PropertyCell> EnsurePropertyCell( | 6834 static Handle<PropertyCell> EnsurePropertyCell(Handle<GlobalObject> global, |
6824 Handle<GlobalObject> global, | 6835 Handle<Name> name); |
6825 Handle<Name> name); | |
6826 // TODO(kmillikin): This function can be eliminated once the stub cache is | |
6827 // fully handlified (and the static helper can be written directly). | |
6828 MUST_USE_RESULT MaybeObject* EnsurePropertyCell(Name* name); | |
6829 | 6836 |
6830 // Casting. | 6837 // Casting. |
6831 static inline GlobalObject* cast(Object* obj); | 6838 static inline GlobalObject* cast(Object* obj); |
6832 | 6839 |
6833 // Layout description. | 6840 // Layout description. |
6834 static const int kBuiltinsOffset = JSObject::kHeaderSize; | 6841 static const int kBuiltinsOffset = JSObject::kHeaderSize; |
6835 static const int kNativeContextOffset = kBuiltinsOffset + kPointerSize; | 6842 static const int kNativeContextOffset = kBuiltinsOffset + kPointerSize; |
6836 static const int kGlobalContextOffset = kNativeContextOffset + kPointerSize; | 6843 static const int kGlobalContextOffset = kNativeContextOffset + kPointerSize; |
6837 static const int kGlobalReceiverOffset = kGlobalContextOffset + kPointerSize; | 6844 static const int kGlobalReceiverOffset = kGlobalContextOffset + kPointerSize; |
6838 static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize; | 6845 static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize; |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7451 }; | 7458 }; |
7452 | 7459 |
7453 | 7460 |
7454 enum AllocationSiteMode { | 7461 enum AllocationSiteMode { |
7455 DONT_TRACK_ALLOCATION_SITE, | 7462 DONT_TRACK_ALLOCATION_SITE, |
7456 TRACK_ALLOCATION_SITE, | 7463 TRACK_ALLOCATION_SITE, |
7457 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE | 7464 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE |
7458 }; | 7465 }; |
7459 | 7466 |
7460 | 7467 |
| 7468 class AllocationSite: public Struct { |
| 7469 public: |
| 7470 static const int kPayloadOffset = HeapObject::kHeaderSize; |
| 7471 static const int kSize = kPayloadOffset + kPointerSize; |
| 7472 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; |
| 7473 |
| 7474 // TODO(mvstanton): rename payload to transition_info. |
| 7475 DECL_ACCESSORS(payload, Object) |
| 7476 |
| 7477 void Initialize() { |
| 7478 SetElementsKindPayload(GetInitialFastElementsKind()); |
| 7479 } |
| 7480 |
| 7481 ElementsKind GetElementsKindPayload() { |
| 7482 ASSERT(!IsLiteralSite()); |
| 7483 return static_cast<ElementsKind>(Smi::cast(payload())->value()); |
| 7484 } |
| 7485 |
| 7486 void SetElementsKindPayload(ElementsKind kind) { |
| 7487 set_payload(Smi::FromInt(static_cast<int>(kind))); |
| 7488 } |
| 7489 |
| 7490 bool IsLiteralSite() { |
| 7491 // If the payload is a smi, then it represents an ElementsKind |
| 7492 // for a constructed array. Otherwise, it must be a boilerplate |
| 7493 // for an array literal |
| 7494 return payload()->IsJSArray(); |
| 7495 } |
| 7496 |
| 7497 DECLARE_PRINTER(AllocationSite) |
| 7498 DECLARE_VERIFIER(AllocationSite) |
| 7499 |
| 7500 static inline AllocationSite* cast(Object* obj); |
| 7501 static inline AllocationSiteMode GetMode( |
| 7502 ElementsKind boilerplate_elements_kind); |
| 7503 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
| 7504 |
| 7505 private: |
| 7506 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); |
| 7507 }; |
| 7508 |
| 7509 |
7461 class AllocationSiteInfo: public Struct { | 7510 class AllocationSiteInfo: public Struct { |
7462 public: | 7511 public: |
7463 DECL_ACCESSORS(payload, Object) | 7512 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; |
| 7513 static const int kSize = kAllocationSiteOffset + kPointerSize; |
7464 | 7514 |
7465 static inline AllocationSiteInfo* cast(Object* obj); | 7515 DECL_ACCESSORS(allocation_site, Object) |
| 7516 |
| 7517 bool IsValid() { return allocation_site()->IsAllocationSite(); } |
| 7518 AllocationSite* GetAllocationSite() { |
| 7519 ASSERT(IsValid()); |
| 7520 return AllocationSite::cast(allocation_site()); |
| 7521 } |
7466 | 7522 |
7467 DECLARE_PRINTER(AllocationSiteInfo) | 7523 DECLARE_PRINTER(AllocationSiteInfo) |
7468 DECLARE_VERIFIER(AllocationSiteInfo) | 7524 DECLARE_VERIFIER(AllocationSiteInfo) |
7469 | 7525 |
7470 // Returns NULL if no AllocationSiteInfo is available for object. | 7526 // Returns NULL if no AllocationSiteInfo is available for object. |
7471 static AllocationSiteInfo* FindForJSObject(JSObject* object); | 7527 static AllocationSiteInfo* FindForJSObject(JSObject* object); |
7472 static inline AllocationSiteMode GetMode( | 7528 static inline AllocationSiteInfo* cast(Object* obj); |
7473 ElementsKind boilerplate_elements_kind); | |
7474 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | |
7475 | 7529 |
7476 static const int kPayloadOffset = HeapObject::kHeaderSize; | |
7477 static const int kSize = kPayloadOffset + kPointerSize; | |
7478 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; | |
7479 | |
7480 bool GetElementsKindPayload(ElementsKind* kind); | |
7481 private: | 7530 private: |
7482 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSiteInfo); | 7531 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSiteInfo); |
7483 }; | 7532 }; |
7484 | 7533 |
7485 | 7534 |
7486 // Representation of a slow alias as part of a non-strict arguments objects. | 7535 // Representation of a slow alias as part of a non-strict arguments objects. |
7487 // For fast aliases (if HasNonStrictArgumentsElements()): | 7536 // For fast aliases (if HasNonStrictArgumentsElements()): |
7488 // - the parameter map contains an index into the context | 7537 // - the parameter map contains an index into the context |
7489 // - all attributes of the element have default values | 7538 // - all attributes of the element have default values |
7490 // For slow aliases (if HasDictionaryArgumentsElements()): | 7539 // For slow aliases (if HasDictionaryArgumentsElements()): |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8580 class PropertyCell: public Cell { | 8629 class PropertyCell: public Cell { |
8581 public: | 8630 public: |
8582 // [type]: type of the global property. | 8631 // [type]: type of the global property. |
8583 Type* type(); | 8632 Type* type(); |
8584 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 8633 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
8585 | 8634 |
8586 // [dependent_code]: dependent code that depends on the type of the global | 8635 // [dependent_code]: dependent code that depends on the type of the global |
8587 // property. | 8636 // property. |
8588 DECL_ACCESSORS(dependent_code, DependentCode) | 8637 DECL_ACCESSORS(dependent_code, DependentCode) |
8589 | 8638 |
| 8639 // Sets the value of the cell and updates the type field to be the union |
| 8640 // of the cell's current type and the value's type. If the change causes |
| 8641 // a change of the type of the cell's contents, code dependent on the cell |
| 8642 // will be deoptimized. |
| 8643 MUST_USE_RESULT MaybeObject* SetValueInferType( |
| 8644 Object* value, |
| 8645 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
| 8646 |
8590 // Casting. | 8647 // Casting. |
8591 static inline PropertyCell* cast(Object* obj); | 8648 static inline PropertyCell* cast(Object* obj); |
8592 | 8649 |
8593 inline Address TypeAddress() { | 8650 inline Address TypeAddress() { |
8594 return address() + kTypeOffset; | 8651 return address() + kTypeOffset; |
8595 } | 8652 } |
8596 | 8653 |
8597 // Dispatched behavior. | 8654 // Dispatched behavior. |
8598 DECLARE_PRINTER(PropertyCell) | 8655 DECLARE_PRINTER(PropertyCell) |
8599 DECLARE_VERIFIER(PropertyCell) | 8656 DECLARE_VERIFIER(PropertyCell) |
8600 | 8657 |
8601 // Layout description. | 8658 // Layout description. |
8602 static const int kTypeOffset = kValueOffset + kPointerSize; | 8659 static const int kTypeOffset = kValueOffset + kPointerSize; |
8603 static const int kDependentCodeOffset = kTypeOffset + kPointerSize; | 8660 static const int kDependentCodeOffset = kTypeOffset + kPointerSize; |
8604 static const int kSize = kDependentCodeOffset + kPointerSize; | 8661 static const int kSize = kDependentCodeOffset + kPointerSize; |
8605 | 8662 |
8606 static const int kPointerFieldsBeginOffset = kValueOffset; | 8663 static const int kPointerFieldsBeginOffset = kValueOffset; |
8607 static const int kPointerFieldsEndOffset = kDependentCodeOffset; | 8664 static const int kPointerFieldsEndOffset = kDependentCodeOffset; |
8608 | 8665 |
8609 typedef FixedBodyDescriptor<kValueOffset, | 8666 typedef FixedBodyDescriptor<kValueOffset, |
8610 kSize, | 8667 kSize, |
8611 kSize> BodyDescriptor; | 8668 kSize> BodyDescriptor; |
8612 | 8669 |
8613 void AddDependentCompilationInfo(CompilationInfo* info); | 8670 void AddDependentCompilationInfo(CompilationInfo* info); |
8614 | 8671 |
8615 void AddDependentCode(Handle<Code> code); | 8672 void AddDependentCode(Handle<Code> code); |
8616 | 8673 |
| 8674 static Type* UpdateType(Handle<PropertyCell> cell, |
| 8675 Handle<Object> value); |
| 8676 |
8617 private: | 8677 private: |
8618 DECL_ACCESSORS(type_raw, Object) | 8678 DECL_ACCESSORS(type_raw, Object) |
8619 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); | 8679 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); |
8620 }; | 8680 }; |
8621 | 8681 |
8622 | 8682 |
8623 // The JSProxy describes EcmaScript Harmony proxies | 8683 // The JSProxy describes EcmaScript Harmony proxies |
8624 class JSProxy: public JSReceiver { | 8684 class JSProxy: public JSReceiver { |
8625 public: | 8685 public: |
8626 // [handler]: The handler property. | 8686 // [handler]: The handler property. |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8915 ExternalArrayType type(); | 8975 ExternalArrayType type(); |
8916 size_t element_size(); | 8976 size_t element_size(); |
8917 | 8977 |
8918 // Dispatched behavior. | 8978 // Dispatched behavior. |
8919 DECLARE_PRINTER(JSTypedArray) | 8979 DECLARE_PRINTER(JSTypedArray) |
8920 DECLARE_VERIFIER(JSTypedArray) | 8980 DECLARE_VERIFIER(JSTypedArray) |
8921 | 8981 |
8922 static const int kLengthOffset = kViewSize + kPointerSize; | 8982 static const int kLengthOffset = kViewSize + kPointerSize; |
8923 static const int kSize = kLengthOffset + kPointerSize; | 8983 static const int kSize = kLengthOffset + kPointerSize; |
8924 | 8984 |
| 8985 static const int kSizeWithInternalFields = |
| 8986 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; |
| 8987 |
8925 private: | 8988 private: |
8926 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); | 8989 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); |
8927 }; | 8990 }; |
8928 | 8991 |
8929 | 8992 |
8930 class JSDataView: public JSArrayBufferView { | 8993 class JSDataView: public JSArrayBufferView { |
8931 public: | 8994 public: |
8932 // Only neuters this DataView | 8995 // Only neuters this DataView |
8933 void Neuter(); | 8996 void Neuter(); |
8934 | 8997 |
8935 // Casting. | 8998 // Casting. |
8936 static inline JSDataView* cast(Object* obj); | 8999 static inline JSDataView* cast(Object* obj); |
8937 | 9000 |
8938 // Dispatched behavior. | 9001 // Dispatched behavior. |
8939 DECLARE_PRINTER(JSDataView) | 9002 DECLARE_PRINTER(JSDataView) |
8940 DECLARE_VERIFIER(JSDataView) | 9003 DECLARE_VERIFIER(JSDataView) |
8941 | 9004 |
8942 static const int kSize = kViewSize; | 9005 static const int kSize = kViewSize; |
8943 | 9006 |
| 9007 static const int kSizeWithInternalFields = |
| 9008 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; |
| 9009 |
8944 private: | 9010 private: |
8945 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView); | 9011 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView); |
8946 }; | 9012 }; |
8947 | 9013 |
8948 | 9014 |
8949 // Foreign describes objects pointing from JavaScript to C structures. | 9015 // Foreign describes objects pointing from JavaScript to C structures. |
8950 // Since they cannot contain references to JS HeapObjects they can be | 9016 // Since they cannot contain references to JS HeapObjects they can be |
8951 // placed in old_data_space. | 9017 // placed in old_data_space. |
8952 class Foreign: public HeapObject { | 9018 class Foreign: public HeapObject { |
8953 public: | 9019 public: |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9250 // * undefined: considered an accessor by the spec, too, strangely enough | 9316 // * undefined: considered an accessor by the spec, too, strangely enough |
9251 // * the hole: an accessor which has not been set | 9317 // * the hole: an accessor which has not been set |
9252 // * a pointer to a map: a transition used to ensure map sharing | 9318 // * a pointer to a map: a transition used to ensure map sharing |
9253 class AccessorPair: public Struct { | 9319 class AccessorPair: public Struct { |
9254 public: | 9320 public: |
9255 DECL_ACCESSORS(getter, Object) | 9321 DECL_ACCESSORS(getter, Object) |
9256 DECL_ACCESSORS(setter, Object) | 9322 DECL_ACCESSORS(setter, Object) |
9257 | 9323 |
9258 static inline AccessorPair* cast(Object* obj); | 9324 static inline AccessorPair* cast(Object* obj); |
9259 | 9325 |
9260 MUST_USE_RESULT MaybeObject* Copy(); | 9326 static Handle<AccessorPair> Copy(Handle<AccessorPair> pair); |
9261 | 9327 |
9262 Object* get(AccessorComponent component) { | 9328 Object* get(AccessorComponent component) { |
9263 return component == ACCESSOR_GETTER ? getter() : setter(); | 9329 return component == ACCESSOR_GETTER ? getter() : setter(); |
9264 } | 9330 } |
9265 | 9331 |
9266 void set(AccessorComponent component, Object* value) { | 9332 void set(AccessorComponent component, Object* value) { |
9267 if (component == ACCESSOR_GETTER) { | 9333 if (component == ACCESSOR_GETTER) { |
9268 set_getter(value); | 9334 set_getter(value); |
9269 } else { | 9335 } else { |
9270 set_setter(value); | 9336 set_setter(value); |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9747 } else { | 9813 } else { |
9748 value &= ~(1 << bit_position); | 9814 value &= ~(1 << bit_position); |
9749 } | 9815 } |
9750 return value; | 9816 return value; |
9751 } | 9817 } |
9752 }; | 9818 }; |
9753 | 9819 |
9754 } } // namespace v8::internal | 9820 } } // namespace v8::internal |
9755 | 9821 |
9756 #endif // V8_OBJECTS_H_ | 9822 #endif // V8_OBJECTS_H_ |
OLD | NEW |