| 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 V(ALLOCATION_SITE_TYPE) \ | 398 V(ALLOCATION_SITE_TYPE) \ |
| 399 V(SCRIPT_TYPE) \ | 399 V(SCRIPT_TYPE) \ |
| 400 V(CODE_CACHE_TYPE) \ | 400 V(CODE_CACHE_TYPE) \ |
| 401 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | 401 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
| 402 V(TYPE_FEEDBACK_INFO_TYPE) \ | 402 V(TYPE_FEEDBACK_INFO_TYPE) \ |
| 403 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 403 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
| 404 V(BOX_TYPE) \ | 404 V(BOX_TYPE) \ |
| 405 \ | 405 \ |
| 406 V(FIXED_ARRAY_TYPE) \ | 406 V(FIXED_ARRAY_TYPE) \ |
| 407 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 407 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
| 408 V(CONSTANT_POOL_ARRAY_TYPE) \ |
| 408 V(SHARED_FUNCTION_INFO_TYPE) \ | 409 V(SHARED_FUNCTION_INFO_TYPE) \ |
| 409 \ | 410 \ |
| 410 V(JS_MESSAGE_OBJECT_TYPE) \ | 411 V(JS_MESSAGE_OBJECT_TYPE) \ |
| 411 \ | 412 \ |
| 412 V(JS_VALUE_TYPE) \ | 413 V(JS_VALUE_TYPE) \ |
| 413 V(JS_DATE_TYPE) \ | 414 V(JS_DATE_TYPE) \ |
| 414 V(JS_OBJECT_TYPE) \ | 415 V(JS_OBJECT_TYPE) \ |
| 415 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 416 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
| 416 V(JS_GENERATOR_OBJECT_TYPE) \ | 417 V(JS_GENERATOR_OBJECT_TYPE) \ |
| 417 V(JS_MODULE_TYPE) \ | 418 V(JS_MODULE_TYPE) \ |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE | 709 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE |
| 709 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, | 710 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, |
| 710 EXTERNAL_SHORT_ARRAY_TYPE, | 711 EXTERNAL_SHORT_ARRAY_TYPE, |
| 711 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, | 712 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, |
| 712 EXTERNAL_INT_ARRAY_TYPE, | 713 EXTERNAL_INT_ARRAY_TYPE, |
| 713 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, | 714 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, |
| 714 EXTERNAL_FLOAT_ARRAY_TYPE, | 715 EXTERNAL_FLOAT_ARRAY_TYPE, |
| 715 EXTERNAL_DOUBLE_ARRAY_TYPE, | 716 EXTERNAL_DOUBLE_ARRAY_TYPE, |
| 716 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE | 717 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE |
| 717 FIXED_DOUBLE_ARRAY_TYPE, | 718 FIXED_DOUBLE_ARRAY_TYPE, |
| 719 CONSTANT_POOL_ARRAY_TYPE, |
| 718 FILLER_TYPE, // LAST_DATA_TYPE | 720 FILLER_TYPE, // LAST_DATA_TYPE |
| 719 | 721 |
| 720 // Structs. | 722 // Structs. |
| 721 DECLARED_ACCESSOR_DESCRIPTOR_TYPE, | 723 DECLARED_ACCESSOR_DESCRIPTOR_TYPE, |
| 722 DECLARED_ACCESSOR_INFO_TYPE, | 724 DECLARED_ACCESSOR_INFO_TYPE, |
| 723 EXECUTABLE_ACCESSOR_INFO_TYPE, | 725 EXECUTABLE_ACCESSOR_INFO_TYPE, |
| 724 ACCESSOR_PAIR_TYPE, | 726 ACCESSOR_PAIR_TYPE, |
| 725 ACCESS_CHECK_INFO_TYPE, | 727 ACCESS_CHECK_INFO_TYPE, |
| 726 INTERCEPTOR_INFO_TYPE, | 728 INTERCEPTOR_INFO_TYPE, |
| 727 CALL_HANDLER_INFO_TYPE, | 729 CALL_HANDLER_INFO_TYPE, |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 #define DECL_BOOLEAN_ACCESSORS(name) \ | 858 #define DECL_BOOLEAN_ACCESSORS(name) \ |
| 857 inline bool name(); \ | 859 inline bool name(); \ |
| 858 inline void set_##name(bool value); \ | 860 inline void set_##name(bool value); \ |
| 859 | 861 |
| 860 | 862 |
| 861 #define DECL_ACCESSORS(name, type) \ | 863 #define DECL_ACCESSORS(name, type) \ |
| 862 inline type* name(); \ | 864 inline type* name(); \ |
| 863 inline void set_##name(type* value, \ | 865 inline void set_##name(type* value, \ |
| 864 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ | 866 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ |
| 865 | 867 |
| 866 | |
| 867 class AccessorPair; | 868 class AccessorPair; |
| 869 class AllocationSite; |
| 870 class AllocationSiteContext; |
| 868 class DictionaryElementsAccessor; | 871 class DictionaryElementsAccessor; |
| 869 class ElementsAccessor; | 872 class ElementsAccessor; |
| 870 class Failure; | 873 class Failure; |
| 871 class FixedArrayBase; | 874 class FixedArrayBase; |
| 872 class ObjectVisitor; | 875 class ObjectVisitor; |
| 873 class StringStream; | 876 class StringStream; |
| 874 class Type; | 877 class Type; |
| 875 | 878 |
| 876 struct ValueInfo : public Malloced { | 879 struct ValueInfo : public Malloced { |
| 877 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } | 880 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 V(JSModule) \ | 996 V(JSModule) \ |
| 994 V(Map) \ | 997 V(Map) \ |
| 995 V(DescriptorArray) \ | 998 V(DescriptorArray) \ |
| 996 V(TransitionArray) \ | 999 V(TransitionArray) \ |
| 997 V(DeoptimizationInputData) \ | 1000 V(DeoptimizationInputData) \ |
| 998 V(DeoptimizationOutputData) \ | 1001 V(DeoptimizationOutputData) \ |
| 999 V(DependentCode) \ | 1002 V(DependentCode) \ |
| 1000 V(TypeFeedbackCells) \ | 1003 V(TypeFeedbackCells) \ |
| 1001 V(FixedArray) \ | 1004 V(FixedArray) \ |
| 1002 V(FixedDoubleArray) \ | 1005 V(FixedDoubleArray) \ |
| 1006 V(ConstantPoolArray) \ |
| 1003 V(Context) \ | 1007 V(Context) \ |
| 1004 V(NativeContext) \ | 1008 V(NativeContext) \ |
| 1005 V(ScopeInfo) \ | 1009 V(ScopeInfo) \ |
| 1006 V(JSFunction) \ | 1010 V(JSFunction) \ |
| 1007 V(Code) \ | 1011 V(Code) \ |
| 1008 V(Oddball) \ | 1012 V(Oddball) \ |
| 1009 V(SharedFunctionInfo) \ | 1013 V(SharedFunctionInfo) \ |
| 1010 V(JSValue) \ | 1014 V(JSValue) \ |
| 1011 V(JSDate) \ | 1015 V(JSDate) \ |
| 1012 V(JSMessageObject) \ | 1016 V(JSMessageObject) \ |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 // Failure is returned otherwise. | 1454 // Failure is returned otherwise. |
| 1451 MUST_USE_RESULT inline MaybeObject* ToSmi(); | 1455 MUST_USE_RESULT inline MaybeObject* ToSmi(); |
| 1452 | 1456 |
| 1453 void Lookup(Name* name, LookupResult* result); | 1457 void Lookup(Name* name, LookupResult* result); |
| 1454 | 1458 |
| 1455 // Property access. | 1459 // Property access. |
| 1456 MUST_USE_RESULT inline MaybeObject* GetProperty(Name* key); | 1460 MUST_USE_RESULT inline MaybeObject* GetProperty(Name* key); |
| 1457 MUST_USE_RESULT inline MaybeObject* GetProperty( | 1461 MUST_USE_RESULT inline MaybeObject* GetProperty( |
| 1458 Name* key, | 1462 Name* key, |
| 1459 PropertyAttributes* attributes); | 1463 PropertyAttributes* attributes); |
| 1464 |
| 1465 // TODO(yangguo): this should eventually replace the non-handlified version. |
| 1466 static Handle<Object> GetPropertyWithReceiver(Handle<Object> object, |
| 1467 Handle<Object> receiver, |
| 1468 Handle<Name> name, |
| 1469 PropertyAttributes* attributes); |
| 1460 MUST_USE_RESULT MaybeObject* GetPropertyWithReceiver( | 1470 MUST_USE_RESULT MaybeObject* GetPropertyWithReceiver( |
| 1461 Object* receiver, | 1471 Object* receiver, |
| 1462 Name* key, | 1472 Name* key, |
| 1463 PropertyAttributes* attributes); | 1473 PropertyAttributes* attributes); |
| 1464 | 1474 |
| 1465 static Handle<Object> GetProperty(Handle<Object> object, | 1475 static Handle<Object> GetProperty(Handle<Object> object, |
| 1466 Handle<Name> key); | 1476 Handle<Name> key); |
| 1467 static Handle<Object> GetProperty(Handle<Object> object, | 1477 static Handle<Object> GetProperty(Handle<Object> object, |
| 1468 Handle<Object> receiver, | 1478 Handle<Object> receiver, |
| 1469 LookupResult* result, | 1479 LookupResult* result, |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); | 2115 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); |
| 2106 | 2116 |
| 2107 // Collects elements starting at index 0. | 2117 // Collects elements starting at index 0. |
| 2108 // Undefined values are placed after non-undefined values. | 2118 // Undefined values are placed after non-undefined values. |
| 2109 // Returns the number of non-undefined values. | 2119 // Returns the number of non-undefined values. |
| 2110 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); | 2120 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); |
| 2111 // As PrepareElementsForSort, but only on objects where elements is | 2121 // As PrepareElementsForSort, but only on objects where elements is |
| 2112 // a dictionary, and it will stay a dictionary. | 2122 // a dictionary, and it will stay a dictionary. |
| 2113 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); | 2123 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); |
| 2114 | 2124 |
| 2115 MUST_USE_RESULT MaybeObject* GetPropertyWithCallback(Object* receiver, | 2125 static Handle<Object> GetPropertyWithCallback(Handle<JSObject> object, |
| 2116 Object* structure, | 2126 Handle<Object> receiver, |
| 2117 Name* name); | 2127 Handle<Object> structure, |
| 2128 Handle<Name> name); |
| 2118 | 2129 |
| 2119 static Handle<Object> SetPropertyWithCallback( | 2130 static Handle<Object> SetPropertyWithCallback( |
| 2120 Handle<JSObject> object, | 2131 Handle<JSObject> object, |
| 2121 Handle<Object> structure, | 2132 Handle<Object> structure, |
| 2122 Handle<Name> name, | 2133 Handle<Name> name, |
| 2123 Handle<Object> value, | 2134 Handle<Object> value, |
| 2124 Handle<JSObject> holder, | 2135 Handle<JSObject> holder, |
| 2125 StrictModeFlag strict_mode); | 2136 StrictModeFlag strict_mode); |
| 2126 | 2137 |
| 2127 static Handle<Object> SetPropertyWithInterceptor( | 2138 static Handle<Object> SetPropertyWithInterceptor( |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2230 Handle<Name> name, | 2241 Handle<Name> name, |
| 2231 Handle<Object> getter, | 2242 Handle<Object> getter, |
| 2232 Handle<Object> setter, | 2243 Handle<Object> setter, |
| 2233 PropertyAttributes attributes, | 2244 PropertyAttributes attributes, |
| 2234 v8::AccessControl access_control = v8::DEFAULT); | 2245 v8::AccessControl access_control = v8::DEFAULT); |
| 2235 | 2246 |
| 2236 // Defines an AccessorInfo property on the given object. | 2247 // Defines an AccessorInfo property on the given object. |
| 2237 static Handle<Object> SetAccessor(Handle<JSObject> object, | 2248 static Handle<Object> SetAccessor(Handle<JSObject> object, |
| 2238 Handle<AccessorInfo> info); | 2249 Handle<AccessorInfo> info); |
| 2239 | 2250 |
| 2240 // Used from Object::GetProperty(). | 2251 static Handle<Object> GetPropertyWithInterceptor( |
| 2241 MUST_USE_RESULT MaybeObject* GetPropertyWithFailedAccessCheck( | 2252 Handle<JSObject> object, |
| 2242 Object* receiver, | 2253 Handle<Object> receiver, |
| 2243 LookupResult* result, | 2254 Handle<Name> name, |
| 2244 Name* name, | |
| 2245 PropertyAttributes* attributes); | 2255 PropertyAttributes* attributes); |
| 2246 MUST_USE_RESULT MaybeObject* GetPropertyWithInterceptor( | 2256 static Handle<Object> GetPropertyPostInterceptor( |
| 2247 Object* receiver, | 2257 Handle<JSObject> object, |
| 2248 Name* name, | 2258 Handle<Object> receiver, |
| 2249 PropertyAttributes* attributes); | 2259 Handle<Name> name, |
| 2250 MUST_USE_RESULT MaybeObject* GetPropertyPostInterceptor( | |
| 2251 Object* receiver, | |
| 2252 Name* name, | |
| 2253 PropertyAttributes* attributes); | 2260 PropertyAttributes* attributes); |
| 2254 MUST_USE_RESULT MaybeObject* GetLocalPropertyPostInterceptor( | 2261 MUST_USE_RESULT MaybeObject* GetLocalPropertyPostInterceptor( |
| 2255 Object* receiver, | 2262 Object* receiver, |
| 2256 Name* name, | 2263 Name* name, |
| 2257 PropertyAttributes* attributes); | 2264 PropertyAttributes* attributes); |
| 2258 | 2265 |
| 2259 // Returns true if this is an instance of an api function and has | 2266 // Returns true if this is an instance of an api function and has |
| 2260 // been modified since it was created. May give false positives. | 2267 // been modified since it was created. May give false positives. |
| 2261 bool IsDirty(); | 2268 bool IsDirty(); |
| 2262 | 2269 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2400 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( | 2407 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( |
| 2401 int capacity, | 2408 int capacity, |
| 2402 int length); | 2409 int length); |
| 2403 | 2410 |
| 2404 // Lookup interceptors are used for handling properties controlled by host | 2411 // Lookup interceptors are used for handling properties controlled by host |
| 2405 // objects. | 2412 // objects. |
| 2406 inline bool HasNamedInterceptor(); | 2413 inline bool HasNamedInterceptor(); |
| 2407 inline bool HasIndexedInterceptor(); | 2414 inline bool HasIndexedInterceptor(); |
| 2408 | 2415 |
| 2409 // Support functions for v8 api (needed for correct interceptor behavior). | 2416 // Support functions for v8 api (needed for correct interceptor behavior). |
| 2410 bool HasRealNamedProperty(Isolate* isolate, Name* key); | 2417 static bool HasRealNamedProperty(Handle<JSObject> object, |
| 2411 bool HasRealElementProperty(Isolate* isolate, uint32_t index); | 2418 Handle<Name> key); |
| 2412 bool HasRealNamedCallbackProperty(Isolate* isolate, Name* key); | 2419 static bool HasRealElementProperty(Handle<JSObject> object, uint32_t index); |
| 2420 static bool HasRealNamedCallbackProperty(Handle<JSObject> object, |
| 2421 Handle<Name> key); |
| 2413 | 2422 |
| 2414 // Get the header size for a JSObject. Used to compute the index of | 2423 // Get the header size for a JSObject. Used to compute the index of |
| 2415 // internal fields as well as the number of internal fields. | 2424 // internal fields as well as the number of internal fields. |
| 2416 inline int GetHeaderSize(); | 2425 inline int GetHeaderSize(); |
| 2417 | 2426 |
| 2418 inline int GetInternalFieldCount(); | 2427 inline int GetInternalFieldCount(); |
| 2419 inline int GetInternalFieldOffset(int index); | 2428 inline int GetInternalFieldOffset(int index); |
| 2420 inline Object* GetInternalField(int index); | 2429 inline Object* GetInternalField(int index); |
| 2421 inline void SetInternalField(int index, Object* value); | 2430 inline void SetInternalField(int index, Object* value); |
| 2422 inline void SetInternalField(int index, Smi* value); | 2431 inline void SetInternalField(int index, Smi* value); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2524 // Check whether this object references another object | 2533 // Check whether this object references another object |
| 2525 bool ReferencesObject(Object* obj); | 2534 bool ReferencesObject(Object* obj); |
| 2526 | 2535 |
| 2527 // Disalow further properties to be added to the object. | 2536 // Disalow further properties to be added to the object. |
| 2528 static Handle<Object> PreventExtensions(Handle<JSObject> object); | 2537 static Handle<Object> PreventExtensions(Handle<JSObject> object); |
| 2529 | 2538 |
| 2530 // ES5 Object.freeze | 2539 // ES5 Object.freeze |
| 2531 static Handle<Object> Freeze(Handle<JSObject> object); | 2540 static Handle<Object> Freeze(Handle<JSObject> object); |
| 2532 | 2541 |
| 2533 // Called the first time an object is observed with ES7 Object.observe. | 2542 // Called the first time an object is observed with ES7 Object.observe. |
| 2534 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); | 2543 static void SetObserved(Handle<JSObject> object); |
| 2535 | 2544 |
| 2536 // Copy object. | 2545 // Copy object. |
| 2546 static Handle<JSObject> Copy(Handle<JSObject> object, |
| 2547 Handle<AllocationSite> site); |
| 2537 static Handle<JSObject> Copy(Handle<JSObject> object); | 2548 static Handle<JSObject> Copy(Handle<JSObject> object); |
| 2538 static Handle<JSObject> DeepCopy(Handle<JSObject> object); | 2549 static Handle<JSObject> DeepCopy(Handle<JSObject> object, |
| 2550 AllocationSiteContext* site_context); |
| 2551 static Handle<JSObject> DeepWalk(Handle<JSObject> object, |
| 2552 AllocationSiteContext* site_context); |
| 2539 | 2553 |
| 2540 // Casting. | 2554 // Casting. |
| 2541 static inline JSObject* cast(Object* obj); | 2555 static inline JSObject* cast(Object* obj); |
| 2542 | 2556 |
| 2543 // Dispatched behavior. | 2557 // Dispatched behavior. |
| 2544 void JSObjectShortPrint(StringStream* accumulator); | 2558 void JSObjectShortPrint(StringStream* accumulator); |
| 2545 DECLARE_PRINTER(JSObject) | 2559 DECLARE_PRINTER(JSObject) |
| 2546 DECLARE_VERIFIER(JSObject) | 2560 DECLARE_VERIFIER(JSObject) |
| 2547 #ifdef OBJECT_PRINT | 2561 #ifdef OBJECT_PRINT |
| 2548 void PrintProperties(FILE* out = stdout); | 2562 void PrintProperties(FILE* out = stdout); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2633 const char* type, | 2647 const char* type, |
| 2634 Handle<Name> name, | 2648 Handle<Name> name, |
| 2635 Handle<Object> old_value); | 2649 Handle<Object> old_value); |
| 2636 | 2650 |
| 2637 // Deliver change records to observers. May cause GC. | 2651 // Deliver change records to observers. May cause GC. |
| 2638 static void DeliverChangeRecords(Isolate* isolate); | 2652 static void DeliverChangeRecords(Isolate* isolate); |
| 2639 | 2653 |
| 2640 private: | 2654 private: |
| 2641 friend class DictionaryElementsAccessor; | 2655 friend class DictionaryElementsAccessor; |
| 2642 friend class JSReceiver; | 2656 friend class JSReceiver; |
| 2657 friend class Object; |
| 2658 |
| 2659 // Used from Object::GetProperty(). |
| 2660 static Handle<Object> GetPropertyWithFailedAccessCheck( |
| 2661 Handle<JSObject> object, |
| 2662 Handle<Object> receiver, |
| 2663 LookupResult* result, |
| 2664 Handle<Name> name, |
| 2665 PropertyAttributes* attributes); |
| 2643 | 2666 |
| 2644 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, | 2667 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, |
| 2645 Object* structure, | 2668 Object* structure, |
| 2646 uint32_t index, | 2669 uint32_t index, |
| 2647 Object* holder); | 2670 Object* holder); |
| 2648 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( | 2671 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( |
| 2649 JSReceiver* receiver, | 2672 JSReceiver* receiver, |
| 2650 uint32_t index, | 2673 uint32_t index, |
| 2651 bool continue_search); | 2674 bool continue_search); |
| 2652 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( | 2675 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3009 | 3032 |
| 3010 // Dispatched behavior. | 3033 // Dispatched behavior. |
| 3011 DECLARE_PRINTER(FixedDoubleArray) | 3034 DECLARE_PRINTER(FixedDoubleArray) |
| 3012 DECLARE_VERIFIER(FixedDoubleArray) | 3035 DECLARE_VERIFIER(FixedDoubleArray) |
| 3013 | 3036 |
| 3014 private: | 3037 private: |
| 3015 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); | 3038 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); |
| 3016 }; | 3039 }; |
| 3017 | 3040 |
| 3018 | 3041 |
| 3042 // ConstantPoolArray describes a fixed-sized array containing constant pool |
| 3043 // entires. |
| 3044 // The format of the pool is: |
| 3045 // [0]: Field holding the first index which is a pointer entry |
| 3046 // [1]: Field holding the first index which is a int32 entry |
| 3047 // [2] ... [first_ptr_index() - 1]: 64 bit entries |
| 3048 // [first_ptr_index()] ... [first_int32_index() - 1]: pointer entries |
| 3049 // [first_int32_index()] ... [length - 1]: 32 bit entries |
| 3050 class ConstantPoolArray: public FixedArrayBase { |
| 3051 public: |
| 3052 // Getters for the field storing the first index for different type entries. |
| 3053 inline int first_ptr_index(); |
| 3054 inline int first_int64_index(); |
| 3055 inline int first_int32_index(); |
| 3056 |
| 3057 // Getters for counts of different type entries. |
| 3058 inline int count_of_ptr_entries(); |
| 3059 inline int count_of_int64_entries(); |
| 3060 inline int count_of_int32_entries(); |
| 3061 |
| 3062 // Setter and getter for pool elements. |
| 3063 inline Object* get_ptr_entry(int index); |
| 3064 inline int64_t get_int64_entry(int index); |
| 3065 inline int32_t get_int32_entry(int index); |
| 3066 inline double get_int64_entry_as_double(int index); |
| 3067 |
| 3068 inline void set(int index, Object* value); |
| 3069 inline void set(int index, int64_t value); |
| 3070 inline void set(int index, double value); |
| 3071 inline void set(int index, int32_t value); |
| 3072 |
| 3073 // Set up initial state. |
| 3074 inline void SetEntryCounts(int number_of_int64_entries, |
| 3075 int number_of_ptr_entries, |
| 3076 int number_of_int32_entries); |
| 3077 |
| 3078 // Copy operations |
| 3079 MUST_USE_RESULT inline MaybeObject* Copy(); |
| 3080 |
| 3081 // Garbage collection support. |
| 3082 inline static int SizeFor(int number_of_int64_entries, |
| 3083 int number_of_ptr_entries, |
| 3084 int number_of_int32_entries) { |
| 3085 return RoundUp(OffsetAt(number_of_int64_entries, |
| 3086 number_of_ptr_entries, |
| 3087 number_of_int32_entries), |
| 3088 kPointerSize); |
| 3089 } |
| 3090 |
| 3091 // Code Generation support. |
| 3092 inline int OffsetOfElementAt(int index) { |
| 3093 ASSERT(index < length()); |
| 3094 if (index >= first_int32_index()) { |
| 3095 return OffsetAt(count_of_int64_entries(), count_of_ptr_entries(), |
| 3096 index - first_int32_index()); |
| 3097 } else if (index >= first_ptr_index()) { |
| 3098 return OffsetAt(count_of_int64_entries(), index - first_ptr_index(), 0); |
| 3099 } else { |
| 3100 return OffsetAt(index, 0, 0); |
| 3101 } |
| 3102 } |
| 3103 |
| 3104 // Casting. |
| 3105 static inline ConstantPoolArray* cast(Object* obj); |
| 3106 |
| 3107 // Layout description. |
| 3108 static const int kFirstPointerIndexOffset = FixedArray::kHeaderSize; |
| 3109 static const int kFirstInt32IndexOffset = |
| 3110 kFirstPointerIndexOffset + kPointerSize; |
| 3111 static const int kFirstOffset = kFirstInt32IndexOffset + kPointerSize; |
| 3112 |
| 3113 // Dispatched behavior. |
| 3114 void ConstantPoolIterateBody(ObjectVisitor* v); |
| 3115 |
| 3116 DECLARE_PRINTER(ConstantPoolArray) |
| 3117 DECLARE_VERIFIER(ConstantPoolArray) |
| 3118 |
| 3119 private: |
| 3120 inline void set_first_ptr_index(int value); |
| 3121 inline void set_first_int32_index(int value); |
| 3122 |
| 3123 inline static int OffsetAt(int number_of_int64_entries, |
| 3124 int number_of_ptr_entries, |
| 3125 int number_of_int32_entries) { |
| 3126 return kFirstOffset |
| 3127 + (number_of_int64_entries * kInt64Size) |
| 3128 + (number_of_ptr_entries * kPointerSize) |
| 3129 + (number_of_int32_entries * kInt32Size); |
| 3130 } |
| 3131 |
| 3132 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolArray); |
| 3133 }; |
| 3134 |
| 3135 |
| 3019 // DescriptorArrays are fixed arrays used to hold instance descriptors. | 3136 // DescriptorArrays are fixed arrays used to hold instance descriptors. |
| 3020 // The format of the these objects is: | 3137 // The format of the these objects is: |
| 3021 // [0]: Number of descriptors | 3138 // [0]: Number of descriptors |
| 3022 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: | 3139 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: |
| 3023 // [0]: pointer to fixed array with enum cache | 3140 // [0]: pointer to fixed array with enum cache |
| 3024 // [1]: either Smi(0) or pointer to fixed array with indices | 3141 // [1]: either Smi(0) or pointer to fixed array with indices |
| 3025 // [2]: first key | 3142 // [2]: first key |
| 3026 // [2 + number of descriptors * kDescriptorSize]: start of slack | 3143 // [2 + number of descriptors * kDescriptorSize]: start of slack |
| 3027 class DescriptorArray: public FixedArray { | 3144 class DescriptorArray: public FixedArray { |
| 3028 public: | 3145 public: |
| (...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3994 } | 4111 } |
| 3995 | 4112 |
| 3996 // Looks up the value associated with the given key. The hole value is | 4113 // Looks up the value associated with the given key. The hole value is |
| 3997 // returned in case the key is not present. | 4114 // returned in case the key is not present. |
| 3998 Object* Lookup(Object* key); | 4115 Object* Lookup(Object* key); |
| 3999 | 4116 |
| 4000 // Adds (or overwrites) the value associated with the given key. Mapping a | 4117 // Adds (or overwrites) the value associated with the given key. Mapping a |
| 4001 // key to the hole value causes removal of the whole entry. | 4118 // key to the hole value causes removal of the whole entry. |
| 4002 MUST_USE_RESULT MaybeObject* Put(Object* key, Object* value); | 4119 MUST_USE_RESULT MaybeObject* Put(Object* key, Object* value); |
| 4003 | 4120 |
| 4121 // This function is called when heap verification is turned on. |
| 4122 void Zap(Object* value) { |
| 4123 int capacity = Capacity(); |
| 4124 for (int i = 0; i < capacity; i++) { |
| 4125 set(EntryToIndex(i), value); |
| 4126 set(EntryToValueIndex(i), value); |
| 4127 } |
| 4128 } |
| 4129 |
| 4004 private: | 4130 private: |
| 4005 friend class MarkCompactCollector; | 4131 friend class MarkCompactCollector; |
| 4006 | 4132 |
| 4007 void AddEntry(int entry, Object* key, Object* value); | 4133 void AddEntry(int entry, Object* key, Object* value); |
| 4008 | 4134 |
| 4009 // Returns the index to the value of an entry. | 4135 // Returns the index to the value of an entry. |
| 4010 static inline int EntryToValueIndex(int entry) { | 4136 static inline int EntryToValueIndex(int entry) { |
| 4011 return EntryToIndex(entry) + 1; | 4137 return EntryToIndex(entry) + 1; |
| 4012 } | 4138 } |
| 4013 }; | 4139 }; |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4845 CALLBACKS, | 4971 CALLBACKS, |
| 4846 INTERCEPTOR, | 4972 INTERCEPTOR, |
| 4847 TRANSITION, | 4973 TRANSITION, |
| 4848 NONEXISTENT | 4974 NONEXISTENT |
| 4849 }; | 4975 }; |
| 4850 | 4976 |
| 4851 typedef int ExtraICState; | 4977 typedef int ExtraICState; |
| 4852 | 4978 |
| 4853 static const ExtraICState kNoExtraICState = 0; | 4979 static const ExtraICState kNoExtraICState = 0; |
| 4854 | 4980 |
| 4981 static const int kPrologueOffsetNotSet = -1; |
| 4982 |
| 4855 #ifdef ENABLE_DISASSEMBLER | 4983 #ifdef ENABLE_DISASSEMBLER |
| 4856 // Printing | 4984 // Printing |
| 4857 static const char* ICState2String(InlineCacheState state); | 4985 static const char* ICState2String(InlineCacheState state); |
| 4858 static const char* StubType2String(StubType type); | 4986 static const char* StubType2String(StubType type); |
| 4859 static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra); | 4987 static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra); |
| 4860 void Disassemble(const char* name, FILE* out = stdout); | 4988 void Disassemble(const char* name, FILE* out = stdout); |
| 4861 #endif // ENABLE_DISASSEMBLER | 4989 #endif // ENABLE_DISASSEMBLER |
| 4862 | 4990 |
| 4863 // [instruction_size]: Size of the native instructions | 4991 // [instruction_size]: Size of the native instructions |
| 4864 inline int instruction_size(); | 4992 inline int instruction_size(); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5041 // Find the first map in an IC stub. | 5169 // Find the first map in an IC stub. |
| 5042 Map* FindFirstMap(); | 5170 Map* FindFirstMap(); |
| 5043 void FindAllMaps(MapHandleList* maps); | 5171 void FindAllMaps(MapHandleList* maps); |
| 5044 void ReplaceFirstMap(Map* replace); | 5172 void ReplaceFirstMap(Map* replace); |
| 5045 | 5173 |
| 5046 // Find the first handler in an IC stub. | 5174 // Find the first handler in an IC stub. |
| 5047 Code* FindFirstHandler(); | 5175 Code* FindFirstHandler(); |
| 5048 | 5176 |
| 5049 // Find |length| handlers and put them into |code_list|. Returns false if not | 5177 // Find |length| handlers and put them into |code_list|. Returns false if not |
| 5050 // enough handlers can be found. | 5178 // enough handlers can be found. |
| 5051 MUST_USE_RESULT bool FindHandlers(CodeHandleList* code_list, int length); | 5179 bool FindHandlers(CodeHandleList* code_list, int length = -1); |
| 5052 | 5180 |
| 5053 // Find the first name in an IC stub. | 5181 // Find the first name in an IC stub. |
| 5054 Name* FindFirstName(); | 5182 Name* FindFirstName(); |
| 5055 | 5183 |
| 5056 void ReplaceNthCell(int n, Cell* replace_with); | 5184 void ReplaceNthCell(int n, Cell* replace_with); |
| 5057 | 5185 |
| 5058 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {}; | 5186 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {}; |
| 5059 class ExtraICStateKeyedAccessStoreMode: | 5187 class ExtraICStateKeyedAccessStoreMode: |
| 5060 public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT | 5188 public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT |
| 5061 | 5189 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5164 DECLARE_PRINTER(Code) | 5292 DECLARE_PRINTER(Code) |
| 5165 DECLARE_VERIFIER(Code) | 5293 DECLARE_VERIFIER(Code) |
| 5166 | 5294 |
| 5167 void ClearInlineCaches(); | 5295 void ClearInlineCaches(); |
| 5168 void ClearTypeFeedbackCells(Heap* heap); | 5296 void ClearTypeFeedbackCells(Heap* heap); |
| 5169 | 5297 |
| 5170 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); | 5298 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); |
| 5171 | 5299 |
| 5172 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, | 5300 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, |
| 5173 enum Age { | 5301 enum Age { |
| 5174 kNoAge = 0, | 5302 kNotExecutedCodeAge = -2, |
| 5303 kExecutedOnceCodeAge = -1, |
| 5304 kNoAgeCodeAge = 0, |
| 5175 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) | 5305 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) |
| 5176 kAfterLastCodeAge, | 5306 kAfterLastCodeAge, |
| 5177 kLastCodeAge = kAfterLastCodeAge - 1, | 5307 kLastCodeAge = kAfterLastCodeAge - 1, |
| 5178 kCodeAgeCount = kAfterLastCodeAge - 1 | 5308 kCodeAgeCount = kAfterLastCodeAge - 1, |
| 5309 kIsOldCodeAge = kSexagenarianCodeAge, |
| 5310 kPreAgedCodeAge = kIsOldCodeAge - 1 |
| 5179 }; | 5311 }; |
| 5180 #undef DECLARE_CODE_AGE_ENUM | 5312 #undef DECLARE_CODE_AGE_ENUM |
| 5181 | 5313 |
| 5182 // Code aging. Indicates how many full GCs this code has survived without | 5314 // Code aging. Indicates how many full GCs this code has survived without |
| 5183 // being entered through the prologue. Used to determine when it is | 5315 // being entered through the prologue. Used to determine when it is |
| 5184 // relatively safe to flush this code object and replace it with the lazy | 5316 // relatively safe to flush this code object and replace it with the lazy |
| 5185 // compilation stub. | 5317 // compilation stub. |
| 5186 static void MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate); | 5318 static void MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate); |
| 5319 static void MarkCodeAsExecuted(byte* sequence, Isolate* isolate); |
| 5187 void MakeOlder(MarkingParity); | 5320 void MakeOlder(MarkingParity); |
| 5188 static bool IsYoungSequence(byte* sequence); | 5321 static bool IsYoungSequence(byte* sequence); |
| 5189 bool IsOld(); | 5322 bool IsOld(); |
| 5190 int GetAge(); | 5323 Age GetAge(); |
| 5324 static inline Code* GetPreAgedCodeAgeStub(Isolate* isolate) { |
| 5325 return GetCodeAgeStub(isolate, kNotExecutedCodeAge, NO_MARKING_PARITY); |
| 5326 } |
| 5191 | 5327 |
| 5192 void PrintDeoptLocation(int bailout_id); | 5328 void PrintDeoptLocation(int bailout_id); |
| 5193 bool CanDeoptAt(Address pc); | 5329 bool CanDeoptAt(Address pc); |
| 5194 | 5330 |
| 5195 #ifdef VERIFY_HEAP | 5331 #ifdef VERIFY_HEAP |
| 5196 void VerifyEmbeddedObjectsDependency(); | 5332 void VerifyEmbeddedObjectsDependency(); |
| 5197 #endif | 5333 #endif |
| 5198 | 5334 |
| 5199 static bool IsWeakEmbeddedObject(Kind kind, Object* object); | 5335 static bool IsWeakEmbeddedObject(Kind kind, Object* object); |
| 5200 | 5336 |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5616 static bool IsValidElementsTransition(ElementsKind from_kind, | 5752 static bool IsValidElementsTransition(ElementsKind from_kind, |
| 5617 ElementsKind to_kind); | 5753 ElementsKind to_kind); |
| 5618 | 5754 |
| 5619 inline bool HasTransitionArray(); | 5755 inline bool HasTransitionArray(); |
| 5620 inline bool HasElementsTransition(); | 5756 inline bool HasElementsTransition(); |
| 5621 inline Map* elements_transition_map(); | 5757 inline Map* elements_transition_map(); |
| 5622 MUST_USE_RESULT inline MaybeObject* set_elements_transition_map( | 5758 MUST_USE_RESULT inline MaybeObject* set_elements_transition_map( |
| 5623 Map* transitioned_map); | 5759 Map* transitioned_map); |
| 5624 inline void SetTransition(int transition_index, Map* target); | 5760 inline void SetTransition(int transition_index, Map* target); |
| 5625 inline Map* GetTransition(int transition_index); | 5761 inline Map* GetTransition(int transition_index); |
| 5762 |
| 5763 static Handle<TransitionArray> AddTransition(Handle<Map> map, |
| 5764 Handle<Name> key, |
| 5765 Handle<Map> target, |
| 5766 SimpleTransitionFlag flag); |
| 5767 |
| 5626 MUST_USE_RESULT inline MaybeObject* AddTransition(Name* key, | 5768 MUST_USE_RESULT inline MaybeObject* AddTransition(Name* key, |
| 5627 Map* target, | 5769 Map* target, |
| 5628 SimpleTransitionFlag flag); | 5770 SimpleTransitionFlag flag); |
| 5629 DECL_ACCESSORS(transitions, TransitionArray) | 5771 DECL_ACCESSORS(transitions, TransitionArray) |
| 5630 inline void ClearTransitions(Heap* heap, | 5772 inline void ClearTransitions(Heap* heap, |
| 5631 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 5773 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
| 5632 | 5774 |
| 5633 void DeprecateTransitionTree(); | 5775 void DeprecateTransitionTree(); |
| 5634 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); | 5776 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); |
| 5635 | 5777 |
| 5636 Map* FindRootMap(); | 5778 Map* FindRootMap(); |
| 5637 Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors); | 5779 Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors); |
| 5638 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); | 5780 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); |
| 5639 | 5781 |
| 5640 int NumberOfFields(); | 5782 int NumberOfFields(); |
| 5641 | 5783 |
| 5642 bool InstancesNeedRewriting(Map* target, | 5784 bool InstancesNeedRewriting(Map* target, |
| 5643 int target_number_of_fields, | 5785 int target_number_of_fields, |
| 5644 int target_inobject, | 5786 int target_inobject, |
| 5645 int target_unused); | 5787 int target_unused); |
| 5788 static Handle<Map> GeneralizeAllFieldRepresentations( |
| 5789 Handle<Map> map, |
| 5790 Representation new_representation); |
| 5646 static Handle<Map> GeneralizeRepresentation( | 5791 static Handle<Map> GeneralizeRepresentation( |
| 5647 Handle<Map> map, | 5792 Handle<Map> map, |
| 5648 int modify_index, | 5793 int modify_index, |
| 5649 Representation new_representation, | 5794 Representation new_representation, |
| 5650 StoreMode store_mode); | 5795 StoreMode store_mode); |
| 5651 static Handle<Map> CopyGeneralizeAllRepresentations( | 5796 static Handle<Map> CopyGeneralizeAllRepresentations( |
| 5652 Handle<Map> map, | 5797 Handle<Map> map, |
| 5653 int modify_index, | 5798 int modify_index, |
| 5654 StoreMode store_mode, | 5799 StoreMode store_mode, |
| 5655 PropertyAttributes attributes, | 5800 PropertyAttributes attributes, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5813 inline bool is_migration_target(); | 5958 inline bool is_migration_target(); |
| 5814 inline void deprecate(); | 5959 inline void deprecate(); |
| 5815 inline bool is_deprecated(); | 5960 inline bool is_deprecated(); |
| 5816 inline bool CanBeDeprecated(); | 5961 inline bool CanBeDeprecated(); |
| 5817 // Returns a non-deprecated version of the input. If the input was not | 5962 // Returns a non-deprecated version of the input. If the input was not |
| 5818 // deprecated, it is directly returned. Otherwise, the non-deprecated version | 5963 // deprecated, it is directly returned. Otherwise, the non-deprecated version |
| 5819 // is found by re-transitioning from the root of the transition tree using the | 5964 // is found by re-transitioning from the root of the transition tree using the |
| 5820 // descriptor array of the map. Returns NULL if no updated map is found. | 5965 // descriptor array of the map. Returns NULL if no updated map is found. |
| 5821 Map* CurrentMapForDeprecated(); | 5966 Map* CurrentMapForDeprecated(); |
| 5822 | 5967 |
| 5968 static Handle<Map> RawCopy(Handle<Map> map, int instance_size); |
| 5823 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); | 5969 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); |
| 5824 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); | 5970 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); |
| 5825 static Handle<Map> CopyDropDescriptors(Handle<Map> map); | 5971 static Handle<Map> CopyDropDescriptors(Handle<Map> map); |
| 5826 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); | 5972 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); |
| 5827 static Handle<Map> CopyReplaceDescriptors(Handle<Map> map, | 5973 static Handle<Map> CopyReplaceDescriptors(Handle<Map> map, |
| 5828 Handle<DescriptorArray> descriptors, | 5974 Handle<DescriptorArray> descriptors, |
| 5829 TransitionFlag flag, | 5975 TransitionFlag flag, |
| 5830 Handle<Name> name); | 5976 Handle<Name> name); |
| 5831 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors( | 5977 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors( |
| 5832 DescriptorArray* descriptors, | 5978 DescriptorArray* descriptors, |
| 5833 TransitionFlag flag, | 5979 TransitionFlag flag, |
| 5834 Name* name = NULL, | 5980 Name* name = NULL, |
| 5835 SimpleTransitionFlag simple_flag = FULL_TRANSITION); | 5981 SimpleTransitionFlag simple_flag = FULL_TRANSITION); |
| 5836 static Handle<Map> CopyInstallDescriptors( | 5982 static Handle<Map> CopyInstallDescriptors( |
| 5837 Handle<Map> map, | 5983 Handle<Map> map, |
| 5838 int new_descriptor, | 5984 int new_descriptor, |
| 5839 Handle<DescriptorArray> descriptors); | 5985 Handle<DescriptorArray> descriptors); |
| 5840 MUST_USE_RESULT MaybeObject* CopyInstallDescriptors( | |
| 5841 int new_descriptor, | |
| 5842 DescriptorArray* descriptors); | |
| 5843 MUST_USE_RESULT MaybeObject* ShareDescriptor(DescriptorArray* descriptors, | 5986 MUST_USE_RESULT MaybeObject* ShareDescriptor(DescriptorArray* descriptors, |
| 5844 Descriptor* descriptor); | 5987 Descriptor* descriptor); |
| 5845 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor, | 5988 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor, |
| 5846 TransitionFlag flag); | 5989 TransitionFlag flag); |
| 5847 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, | 5990 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, |
| 5848 TransitionFlag flag); | 5991 TransitionFlag flag); |
| 5849 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor( | 5992 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor( |
| 5850 DescriptorArray* descriptors, | 5993 DescriptorArray* descriptors, |
| 5851 Descriptor* descriptor, | 5994 Descriptor* descriptor, |
| 5852 int index, | 5995 int index, |
| 5853 TransitionFlag flag); | 5996 TransitionFlag flag); |
| 5854 MUST_USE_RESULT MaybeObject* AsElementsKind(ElementsKind kind); | 5997 MUST_USE_RESULT MaybeObject* AsElementsKind(ElementsKind kind); |
| 5855 | 5998 |
| 5856 MUST_USE_RESULT MaybeObject* CopyAsElementsKind(ElementsKind kind, | 5999 MUST_USE_RESULT MaybeObject* CopyAsElementsKind(ElementsKind kind, |
| 5857 TransitionFlag flag); | 6000 TransitionFlag flag); |
| 5858 MUST_USE_RESULT MaybeObject* CopyForObserved(); | 6001 |
| 6002 static Handle<Map> CopyForObserved(Handle<Map> map); |
| 5859 | 6003 |
| 5860 static Handle<Map> CopyNormalized(Handle<Map> map, | 6004 static Handle<Map> CopyNormalized(Handle<Map> map, |
| 5861 PropertyNormalizationMode mode, | 6005 PropertyNormalizationMode mode, |
| 5862 NormalizedMapSharingMode sharing); | 6006 NormalizedMapSharingMode sharing); |
| 5863 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, | |
| 5864 NormalizedMapSharingMode sharing); | |
| 5865 | 6007 |
| 5866 inline void AppendDescriptor(Descriptor* desc, | 6008 inline void AppendDescriptor(Descriptor* desc, |
| 5867 const DescriptorArray::WhitenessWitness&); | 6009 const DescriptorArray::WhitenessWitness&); |
| 5868 | 6010 |
| 5869 // Returns a copy of the map, with all transitions dropped from the | 6011 // Returns a copy of the map, with all transitions dropped from the |
| 5870 // instance descriptors. | 6012 // instance descriptors. |
| 5871 static Handle<Map> Copy(Handle<Map> map); | 6013 static Handle<Map> Copy(Handle<Map> map); |
| 5872 MUST_USE_RESULT MaybeObject* Copy(); | 6014 MUST_USE_RESULT MaybeObject* Copy(); |
| 5873 | 6015 |
| 5874 // Returns the next free property index (only valid for FAST MODE). | 6016 // Returns the next free property index (only valid for FAST MODE). |
| (...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7876 DECL_ACCESSORS(transition_info, Object) | 8018 DECL_ACCESSORS(transition_info, Object) |
| 7877 // nested_site threads a list of sites that represent nested literals | 8019 // nested_site threads a list of sites that represent nested literals |
| 7878 // walked in a particular order. So [[1, 2], 1, 2] will have one | 8020 // walked in a particular order. So [[1, 2], 1, 2] will have one |
| 7879 // nested_site, but [[1, 2], 3, [4]] will have a list of two. | 8021 // nested_site, but [[1, 2], 3, [4]] will have a list of two. |
| 7880 DECL_ACCESSORS(nested_site, Object) | 8022 DECL_ACCESSORS(nested_site, Object) |
| 7881 DECL_ACCESSORS(dependent_code, DependentCode) | 8023 DECL_ACCESSORS(dependent_code, DependentCode) |
| 7882 DECL_ACCESSORS(weak_next, Object) | 8024 DECL_ACCESSORS(weak_next, Object) |
| 7883 | 8025 |
| 7884 inline void Initialize(); | 8026 inline void Initialize(); |
| 7885 | 8027 |
| 8028 bool HasNestedSites() { |
| 8029 return nested_site()->IsAllocationSite(); |
| 8030 } |
| 8031 |
| 8032 // This method is expensive, it should only be called for reporting. |
| 8033 bool IsNestedSite(); |
| 8034 |
| 7886 ElementsKind GetElementsKind() { | 8035 ElementsKind GetElementsKind() { |
| 7887 ASSERT(!IsLiteralSite()); | 8036 ASSERT(!SitePointsToLiteral()); |
| 7888 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); | 8037 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); |
| 7889 } | 8038 } |
| 7890 | 8039 |
| 7891 void SetElementsKind(ElementsKind kind) { | 8040 void SetElementsKind(ElementsKind kind) { |
| 7892 set_transition_info(Smi::FromInt(static_cast<int>(kind))); | 8041 set_transition_info(Smi::FromInt(static_cast<int>(kind))); |
| 7893 } | 8042 } |
| 7894 | 8043 |
| 7895 bool IsLiteralSite() { | 8044 bool SitePointsToLiteral() { |
| 7896 // If transition_info is a smi, then it represents an ElementsKind | 8045 // If transition_info is a smi, then it represents an ElementsKind |
| 7897 // for a constructed array. Otherwise, it must be a boilerplate | 8046 // for a constructed array. Otherwise, it must be a boilerplate |
| 7898 // for an array literal | 8047 // for an object or array literal. |
| 7899 return transition_info()->IsJSArray(); | 8048 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); |
| 7900 } | 8049 } |
| 7901 | 8050 |
| 7902 DECLARE_PRINTER(AllocationSite) | 8051 DECLARE_PRINTER(AllocationSite) |
| 7903 DECLARE_VERIFIER(AllocationSite) | 8052 DECLARE_VERIFIER(AllocationSite) |
| 7904 | 8053 |
| 7905 static inline AllocationSite* cast(Object* obj); | 8054 static inline AllocationSite* cast(Object* obj); |
| 7906 static inline AllocationSiteMode GetMode( | 8055 static inline AllocationSiteMode GetMode( |
| 7907 ElementsKind boilerplate_elements_kind); | 8056 ElementsKind boilerplate_elements_kind); |
| 7908 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 8057 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
| 7909 static inline bool CanTrack(InstanceType type); | 8058 static inline bool CanTrack(InstanceType type); |
| (...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9051 | 9200 |
| 9052 // [dependent_code]: dependent code that depends on the type of the global | 9201 // [dependent_code]: dependent code that depends on the type of the global |
| 9053 // property. | 9202 // property. |
| 9054 DECL_ACCESSORS(dependent_code, DependentCode) | 9203 DECL_ACCESSORS(dependent_code, DependentCode) |
| 9055 | 9204 |
| 9056 // Sets the value of the cell and updates the type field to be the union | 9205 // Sets the value of the cell and updates the type field to be the union |
| 9057 // of the cell's current type and the value's type. If the change causes | 9206 // of the cell's current type and the value's type. If the change causes |
| 9058 // a change of the type of the cell's contents, code dependent on the cell | 9207 // a change of the type of the cell's contents, code dependent on the cell |
| 9059 // will be deoptimized. | 9208 // will be deoptimized. |
| 9060 static void SetValueInferType(Handle<PropertyCell> cell, | 9209 static void SetValueInferType(Handle<PropertyCell> cell, |
| 9061 Handle<Object> value, | 9210 Handle<Object> value); |
| 9062 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 9211 |
| 9063 MUST_USE_RESULT MaybeObject* SetValueInferType( | 9212 // Computes the new type of the cell's contents for the given value, but |
| 9064 Object* value, | 9213 // without actually modifying the 'type' field. |
| 9065 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 9214 static Handle<Type> UpdatedType(Handle<PropertyCell> cell, |
| 9215 Handle<Object> value); |
| 9216 |
| 9217 void AddDependentCompilationInfo(CompilationInfo* info); |
| 9218 |
| 9219 void AddDependentCode(Handle<Code> code); |
| 9066 | 9220 |
| 9067 // Casting. | 9221 // Casting. |
| 9068 static inline PropertyCell* cast(Object* obj); | 9222 static inline PropertyCell* cast(Object* obj); |
| 9069 | 9223 |
| 9070 inline Address TypeAddress() { | 9224 inline Address TypeAddress() { |
| 9071 return address() + kTypeOffset; | 9225 return address() + kTypeOffset; |
| 9072 } | 9226 } |
| 9073 | 9227 |
| 9074 // Dispatched behavior. | 9228 // Dispatched behavior. |
| 9075 DECLARE_PRINTER(PropertyCell) | 9229 DECLARE_PRINTER(PropertyCell) |
| 9076 DECLARE_VERIFIER(PropertyCell) | 9230 DECLARE_VERIFIER(PropertyCell) |
| 9077 | 9231 |
| 9078 // Layout description. | 9232 // Layout description. |
| 9079 static const int kTypeOffset = kValueOffset + kPointerSize; | 9233 static const int kTypeOffset = kValueOffset + kPointerSize; |
| 9080 static const int kDependentCodeOffset = kTypeOffset + kPointerSize; | 9234 static const int kDependentCodeOffset = kTypeOffset + kPointerSize; |
| 9081 static const int kSize = kDependentCodeOffset + kPointerSize; | 9235 static const int kSize = kDependentCodeOffset + kPointerSize; |
| 9082 | 9236 |
| 9083 static const int kPointerFieldsBeginOffset = kValueOffset; | 9237 static const int kPointerFieldsBeginOffset = kValueOffset; |
| 9084 static const int kPointerFieldsEndOffset = kDependentCodeOffset; | 9238 static const int kPointerFieldsEndOffset = kDependentCodeOffset; |
| 9085 | 9239 |
| 9086 typedef FixedBodyDescriptor<kValueOffset, | 9240 typedef FixedBodyDescriptor<kValueOffset, |
| 9087 kSize, | 9241 kSize, |
| 9088 kSize> BodyDescriptor; | 9242 kSize> BodyDescriptor; |
| 9089 | 9243 |
| 9090 void AddDependentCompilationInfo(CompilationInfo* info); | |
| 9091 | |
| 9092 void AddDependentCode(Handle<Code> code); | |
| 9093 | |
| 9094 static Type* UpdateType(Handle<PropertyCell> cell, | |
| 9095 Handle<Object> value); | |
| 9096 | |
| 9097 private: | 9244 private: |
| 9098 DECL_ACCESSORS(type_raw, Object) | 9245 DECL_ACCESSORS(type_raw, Object) |
| 9099 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); | 9246 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); |
| 9100 }; | 9247 }; |
| 9101 | 9248 |
| 9102 | 9249 |
| 9103 // The JSProxy describes EcmaScript Harmony proxies | 9250 // The JSProxy describes EcmaScript Harmony proxies |
| 9104 class JSProxy: public JSReceiver { | 9251 class JSProxy: public JSReceiver { |
| 9105 public: | 9252 public: |
| 9106 // [handler]: The handler property. | 9253 // [handler]: The handler property. |
| (...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10192 // Abstract base class for visiting, and optionally modifying, the | 10339 // Abstract base class for visiting, and optionally modifying, the |
| 10193 // pointers contained in Objects. Used in GC and serialization/deserialization. | 10340 // pointers contained in Objects. Used in GC and serialization/deserialization. |
| 10194 class ObjectVisitor BASE_EMBEDDED { | 10341 class ObjectVisitor BASE_EMBEDDED { |
| 10195 public: | 10342 public: |
| 10196 virtual ~ObjectVisitor() {} | 10343 virtual ~ObjectVisitor() {} |
| 10197 | 10344 |
| 10198 // Visits a contiguous arrays of pointers in the half-open range | 10345 // Visits a contiguous arrays of pointers in the half-open range |
| 10199 // [start, end). Any or all of the values may be modified on return. | 10346 // [start, end). Any or all of the values may be modified on return. |
| 10200 virtual void VisitPointers(Object** start, Object** end) = 0; | 10347 virtual void VisitPointers(Object** start, Object** end) = 0; |
| 10201 | 10348 |
| 10349 // Handy shorthand for visiting a single pointer. |
| 10350 virtual void VisitPointer(Object** p) { VisitPointers(p, p + 1); } |
| 10351 |
| 10202 // To allow lazy clearing of inline caches the visitor has | 10352 // To allow lazy clearing of inline caches the visitor has |
| 10203 // a rich interface for iterating over Code objects.. | 10353 // a rich interface for iterating over Code objects.. |
| 10204 | 10354 |
| 10205 // Visits a code target in the instruction stream. | 10355 // Visits a code target in the instruction stream. |
| 10206 virtual void VisitCodeTarget(RelocInfo* rinfo); | 10356 virtual void VisitCodeTarget(RelocInfo* rinfo); |
| 10207 | 10357 |
| 10208 // Visits a code entry in a JS function. | 10358 // Visits a code entry in a JS function. |
| 10209 virtual void VisitCodeEntry(Address entry_address); | 10359 virtual void VisitCodeEntry(Address entry_address); |
| 10210 | 10360 |
| 10211 // Visits a global property cell reference in the instruction stream. | 10361 // Visits a global property cell reference in the instruction stream. |
| 10212 virtual void VisitCell(RelocInfo* rinfo); | 10362 virtual void VisitCell(RelocInfo* rinfo); |
| 10213 | 10363 |
| 10214 // Visits a runtime entry in the instruction stream. | 10364 // Visits a runtime entry in the instruction stream. |
| 10215 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {} | 10365 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {} |
| 10216 | 10366 |
| 10217 // Visits the resource of an ASCII or two-byte string. | 10367 // Visits the resource of an ASCII or two-byte string. |
| 10218 virtual void VisitExternalAsciiString( | 10368 virtual void VisitExternalAsciiString( |
| 10219 v8::String::ExternalAsciiStringResource** resource) {} | 10369 v8::String::ExternalAsciiStringResource** resource) {} |
| 10220 virtual void VisitExternalTwoByteString( | 10370 virtual void VisitExternalTwoByteString( |
| 10221 v8::String::ExternalStringResource** resource) {} | 10371 v8::String::ExternalStringResource** resource) {} |
| 10222 | 10372 |
| 10223 // Visits a debug call target in the instruction stream. | 10373 // Visits a debug call target in the instruction stream. |
| 10224 virtual void VisitDebugTarget(RelocInfo* rinfo); | 10374 virtual void VisitDebugTarget(RelocInfo* rinfo); |
| 10225 | 10375 |
| 10226 // Visits the byte sequence in a function's prologue that contains information | 10376 // Visits the byte sequence in a function's prologue that contains information |
| 10227 // about the code's age. | 10377 // about the code's age. |
| 10228 virtual void VisitCodeAgeSequence(RelocInfo* rinfo); | 10378 virtual void VisitCodeAgeSequence(RelocInfo* rinfo); |
| 10229 | 10379 |
| 10230 // Handy shorthand for visiting a single pointer. | |
| 10231 virtual void VisitPointer(Object** p) { VisitPointers(p, p + 1); } | |
| 10232 | |
| 10233 // Visit pointer embedded into a code object. | 10380 // Visit pointer embedded into a code object. |
| 10234 virtual void VisitEmbeddedPointer(RelocInfo* rinfo); | 10381 virtual void VisitEmbeddedPointer(RelocInfo* rinfo); |
| 10235 | 10382 |
| 10236 // Visits a contiguous arrays of external references (references to the C++ | 10383 // Visits an external reference embedded into a code object. |
| 10237 // heap) in the half-open range [start, end). Any or all of the values | |
| 10238 // may be modified on return. | |
| 10239 virtual void VisitExternalReferences(Address* start, Address* end) {} | |
| 10240 | |
| 10241 virtual void VisitExternalReference(RelocInfo* rinfo); | 10384 virtual void VisitExternalReference(RelocInfo* rinfo); |
| 10242 | 10385 |
| 10243 inline void VisitExternalReference(Address* p) { | 10386 // Visits an external reference. The value may be modified on return. |
| 10244 VisitExternalReferences(p, p + 1); | 10387 virtual void VisitExternalReference(Address* p) {} |
| 10245 } | |
| 10246 | 10388 |
| 10247 // Visits a handle that has an embedder-assigned class ID. | 10389 // Visits a handle that has an embedder-assigned class ID. |
| 10248 virtual void VisitEmbedderReference(Object** p, uint16_t class_id) {} | 10390 virtual void VisitEmbedderReference(Object** p, uint16_t class_id) {} |
| 10249 | 10391 |
| 10250 // Intended for serialization/deserialization checking: insert, or | 10392 // Intended for serialization/deserialization checking: insert, or |
| 10251 // check for the presence of, a tag at this position in the stream. | 10393 // check for the presence of, a tag at this position in the stream. |
| 10252 // Also used for marking up GC roots in heap snapshots. | 10394 // Also used for marking up GC roots in heap snapshots. |
| 10253 virtual void Synchronize(VisitorSynchronization::SyncTag tag) {} | 10395 virtual void Synchronize(VisitorSynchronization::SyncTag tag) {} |
| 10254 }; | 10396 }; |
| 10255 | 10397 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 10285 } else { | 10427 } else { |
| 10286 value &= ~(1 << bit_position); | 10428 value &= ~(1 << bit_position); |
| 10287 } | 10429 } |
| 10288 return value; | 10430 return value; |
| 10289 } | 10431 } |
| 10290 }; | 10432 }; |
| 10291 | 10433 |
| 10292 } } // namespace v8::internal | 10434 } } // namespace v8::internal |
| 10293 | 10435 |
| 10294 #endif // V8_OBJECTS_H_ | 10436 #endif // V8_OBJECTS_H_ |
| OLD | NEW |