Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: src/objects.h

Issue 133443009: A64: Synchronize with r17441. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/object-observe.js ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 V(ALLOCATION_SITE_TYPE) \ 400 V(ALLOCATION_SITE_TYPE) \
401 V(SCRIPT_TYPE) \ 401 V(SCRIPT_TYPE) \
402 V(CODE_CACHE_TYPE) \ 402 V(CODE_CACHE_TYPE) \
403 V(POLYMORPHIC_CODE_CACHE_TYPE) \ 403 V(POLYMORPHIC_CODE_CACHE_TYPE) \
404 V(TYPE_FEEDBACK_INFO_TYPE) \ 404 V(TYPE_FEEDBACK_INFO_TYPE) \
405 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ 405 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \
406 V(BOX_TYPE) \ 406 V(BOX_TYPE) \
407 \ 407 \
408 V(FIXED_ARRAY_TYPE) \ 408 V(FIXED_ARRAY_TYPE) \
409 V(FIXED_DOUBLE_ARRAY_TYPE) \ 409 V(FIXED_DOUBLE_ARRAY_TYPE) \
410 V(CONSTANT_POOL_ARRAY_TYPE) \
410 V(SHARED_FUNCTION_INFO_TYPE) \ 411 V(SHARED_FUNCTION_INFO_TYPE) \
411 \ 412 \
412 V(JS_MESSAGE_OBJECT_TYPE) \ 413 V(JS_MESSAGE_OBJECT_TYPE) \
413 \ 414 \
414 V(JS_VALUE_TYPE) \ 415 V(JS_VALUE_TYPE) \
415 V(JS_DATE_TYPE) \ 416 V(JS_DATE_TYPE) \
416 V(JS_OBJECT_TYPE) \ 417 V(JS_OBJECT_TYPE) \
417 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ 418 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
418 V(JS_GENERATOR_OBJECT_TYPE) \ 419 V(JS_GENERATOR_OBJECT_TYPE) \
419 V(JS_MODULE_TYPE) \ 420 V(JS_MODULE_TYPE) \
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE 711 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
711 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, 712 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE,
712 EXTERNAL_SHORT_ARRAY_TYPE, 713 EXTERNAL_SHORT_ARRAY_TYPE,
713 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, 714 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE,
714 EXTERNAL_INT_ARRAY_TYPE, 715 EXTERNAL_INT_ARRAY_TYPE,
715 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, 716 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE,
716 EXTERNAL_FLOAT_ARRAY_TYPE, 717 EXTERNAL_FLOAT_ARRAY_TYPE,
717 EXTERNAL_DOUBLE_ARRAY_TYPE, 718 EXTERNAL_DOUBLE_ARRAY_TYPE,
718 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE 719 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE
719 FIXED_DOUBLE_ARRAY_TYPE, 720 FIXED_DOUBLE_ARRAY_TYPE,
721 CONSTANT_POOL_ARRAY_TYPE,
720 FILLER_TYPE, // LAST_DATA_TYPE 722 FILLER_TYPE, // LAST_DATA_TYPE
721 723
722 // Structs. 724 // Structs.
723 DECLARED_ACCESSOR_DESCRIPTOR_TYPE, 725 DECLARED_ACCESSOR_DESCRIPTOR_TYPE,
724 DECLARED_ACCESSOR_INFO_TYPE, 726 DECLARED_ACCESSOR_INFO_TYPE,
725 EXECUTABLE_ACCESSOR_INFO_TYPE, 727 EXECUTABLE_ACCESSOR_INFO_TYPE,
726 ACCESSOR_PAIR_TYPE, 728 ACCESSOR_PAIR_TYPE,
727 ACCESS_CHECK_INFO_TYPE, 729 ACCESS_CHECK_INFO_TYPE,
728 INTERCEPTOR_INFO_TYPE, 730 INTERCEPTOR_INFO_TYPE,
729 CALL_HANDLER_INFO_TYPE, 731 CALL_HANDLER_INFO_TYPE,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 #define DECL_BOOLEAN_ACCESSORS(name) \ 860 #define DECL_BOOLEAN_ACCESSORS(name) \
859 inline bool name(); \ 861 inline bool name(); \
860 inline void set_##name(bool value); \ 862 inline void set_##name(bool value); \
861 863
862 864
863 #define DECL_ACCESSORS(name, type) \ 865 #define DECL_ACCESSORS(name, type) \
864 inline type* name(); \ 866 inline type* name(); \
865 inline void set_##name(type* value, \ 867 inline void set_##name(type* value, \
866 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ 868 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \
867 869
868
869 class AccessorPair; 870 class AccessorPair;
871 class AllocationSite;
872 class AllocationSiteContext;
870 class DictionaryElementsAccessor; 873 class DictionaryElementsAccessor;
871 class ElementsAccessor; 874 class ElementsAccessor;
872 class Failure; 875 class Failure;
873 class FixedArrayBase; 876 class FixedArrayBase;
874 class ObjectVisitor; 877 class ObjectVisitor;
875 class StringStream; 878 class StringStream;
876 class Type; 879 class Type;
877 880
878 struct ValueInfo : public Malloced { 881 struct ValueInfo : public Malloced {
879 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } 882 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 V(JSModule) \ 998 V(JSModule) \
996 V(Map) \ 999 V(Map) \
997 V(DescriptorArray) \ 1000 V(DescriptorArray) \
998 V(TransitionArray) \ 1001 V(TransitionArray) \
999 V(DeoptimizationInputData) \ 1002 V(DeoptimizationInputData) \
1000 V(DeoptimizationOutputData) \ 1003 V(DeoptimizationOutputData) \
1001 V(DependentCode) \ 1004 V(DependentCode) \
1002 V(TypeFeedbackCells) \ 1005 V(TypeFeedbackCells) \
1003 V(FixedArray) \ 1006 V(FixedArray) \
1004 V(FixedDoubleArray) \ 1007 V(FixedDoubleArray) \
1008 V(ConstantPoolArray) \
1005 V(Context) \ 1009 V(Context) \
1006 V(NativeContext) \ 1010 V(NativeContext) \
1007 V(ScopeInfo) \ 1011 V(ScopeInfo) \
1008 V(JSFunction) \ 1012 V(JSFunction) \
1009 V(Code) \ 1013 V(Code) \
1010 V(Oddball) \ 1014 V(Oddball) \
1011 V(SharedFunctionInfo) \ 1015 V(SharedFunctionInfo) \
1012 V(JSValue) \ 1016 V(JSValue) \
1013 V(JSDate) \ 1017 V(JSDate) \
1014 V(JSMessageObject) \ 1018 V(JSMessageObject) \
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 // Failure is returned otherwise. 1494 // Failure is returned otherwise.
1491 MUST_USE_RESULT inline MaybeObject* ToSmi(); 1495 MUST_USE_RESULT inline MaybeObject* ToSmi();
1492 1496
1493 void Lookup(Name* name, LookupResult* result); 1497 void Lookup(Name* name, LookupResult* result);
1494 1498
1495 // Property access. 1499 // Property access.
1496 MUST_USE_RESULT inline MaybeObject* GetProperty(Name* key); 1500 MUST_USE_RESULT inline MaybeObject* GetProperty(Name* key);
1497 MUST_USE_RESULT inline MaybeObject* GetProperty( 1501 MUST_USE_RESULT inline MaybeObject* GetProperty(
1498 Name* key, 1502 Name* key,
1499 PropertyAttributes* attributes); 1503 PropertyAttributes* attributes);
1504
1505 // TODO(yangguo): this should eventually replace the non-handlified version.
1506 static Handle<Object> GetPropertyWithReceiver(Handle<Object> object,
1507 Handle<Object> receiver,
1508 Handle<Name> name,
1509 PropertyAttributes* attributes);
1500 MUST_USE_RESULT MaybeObject* GetPropertyWithReceiver( 1510 MUST_USE_RESULT MaybeObject* GetPropertyWithReceiver(
1501 Object* receiver, 1511 Object* receiver,
1502 Name* key, 1512 Name* key,
1503 PropertyAttributes* attributes); 1513 PropertyAttributes* attributes);
1504 1514
1505 static Handle<Object> GetProperty(Handle<Object> object, 1515 static Handle<Object> GetProperty(Handle<Object> object,
1506 Handle<Name> key); 1516 Handle<Name> key);
1507 static Handle<Object> GetProperty(Handle<Object> object, 1517 static Handle<Object> GetProperty(Handle<Object> object,
1508 Handle<Object> receiver, 1518 Handle<Object> receiver,
1509 LookupResult* result, 1519 LookupResult* result,
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements. 2145 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements.
2136 2146
2137 inline bool ShouldTrackAllocationInfo(); 2147 inline bool ShouldTrackAllocationInfo();
2138 2148
2139 inline void set_map_and_elements( 2149 inline void set_map_and_elements(
2140 Map* map, 2150 Map* map,
2141 FixedArrayBase* value, 2151 FixedArrayBase* value,
2142 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 2152 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
2143 2153
2144 // Requires: HasFastElements(). 2154 // Requires: HasFastElements().
2155 static Handle<FixedArray> EnsureWritableFastElements(
2156 Handle<JSObject> object);
2145 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); 2157 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements();
2146 2158
2147 // Collects elements starting at index 0. 2159 // Collects elements starting at index 0.
2148 // Undefined values are placed after non-undefined values. 2160 // Undefined values are placed after non-undefined values.
2149 // Returns the number of non-undefined values. 2161 // Returns the number of non-undefined values.
2150 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); 2162 static Handle<Object> PrepareElementsForSort(Handle<JSObject> object,
2163 uint32_t limit);
2151 // As PrepareElementsForSort, but only on objects where elements is 2164 // As PrepareElementsForSort, but only on objects where elements is
2152 // a dictionary, and it will stay a dictionary. 2165 // a dictionary, and it will stay a dictionary.
2166 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object,
2167 uint32_t limit);
2153 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); 2168 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit);
2154 2169
2155 MUST_USE_RESULT MaybeObject* GetPropertyWithCallback(Object* receiver, 2170 static Handle<Object> GetPropertyWithCallback(Handle<JSObject> object,
2156 Object* structure, 2171 Handle<Object> receiver,
2157 Name* name); 2172 Handle<Object> structure,
2173 Handle<Name> name);
2158 2174
2159 static Handle<Object> SetPropertyWithCallback( 2175 static Handle<Object> SetPropertyWithCallback(
2160 Handle<JSObject> object, 2176 Handle<JSObject> object,
2161 Handle<Object> structure, 2177 Handle<Object> structure,
2162 Handle<Name> name, 2178 Handle<Name> name,
2163 Handle<Object> value, 2179 Handle<Object> value,
2164 Handle<JSObject> holder, 2180 Handle<JSObject> holder,
2165 StrictModeFlag strict_mode); 2181 StrictModeFlag strict_mode);
2166 2182
2167 static Handle<Object> SetPropertyWithInterceptor( 2183 static Handle<Object> SetPropertyWithInterceptor(
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 Handle<Name> name, 2286 Handle<Name> name,
2271 Handle<Object> getter, 2287 Handle<Object> getter,
2272 Handle<Object> setter, 2288 Handle<Object> setter,
2273 PropertyAttributes attributes, 2289 PropertyAttributes attributes,
2274 v8::AccessControl access_control = v8::DEFAULT); 2290 v8::AccessControl access_control = v8::DEFAULT);
2275 2291
2276 // Defines an AccessorInfo property on the given object. 2292 // Defines an AccessorInfo property on the given object.
2277 static Handle<Object> SetAccessor(Handle<JSObject> object, 2293 static Handle<Object> SetAccessor(Handle<JSObject> object,
2278 Handle<AccessorInfo> info); 2294 Handle<AccessorInfo> info);
2279 2295
2280 // Used from Object::GetProperty(). 2296 static Handle<Object> GetPropertyWithInterceptor(
2281 MUST_USE_RESULT MaybeObject* GetPropertyWithFailedAccessCheck( 2297 Handle<JSObject> object,
2282 Object* receiver, 2298 Handle<Object> receiver,
2283 LookupResult* result, 2299 Handle<Name> name,
2284 Name* name,
2285 PropertyAttributes* attributes); 2300 PropertyAttributes* attributes);
2286 MUST_USE_RESULT MaybeObject* GetPropertyWithInterceptor( 2301 static Handle<Object> GetPropertyPostInterceptor(
2287 Object* receiver, 2302 Handle<JSObject> object,
2288 Name* name, 2303 Handle<Object> receiver,
2289 PropertyAttributes* attributes); 2304 Handle<Name> name,
2290 MUST_USE_RESULT MaybeObject* GetPropertyPostInterceptor(
2291 Object* receiver,
2292 Name* name,
2293 PropertyAttributes* attributes); 2305 PropertyAttributes* attributes);
2294 MUST_USE_RESULT MaybeObject* GetLocalPropertyPostInterceptor( 2306 MUST_USE_RESULT MaybeObject* GetLocalPropertyPostInterceptor(
2295 Object* receiver, 2307 Object* receiver,
2296 Name* name, 2308 Name* name,
2297 PropertyAttributes* attributes); 2309 PropertyAttributes* attributes);
2298 2310
2299 // Returns true if this is an instance of an api function and has 2311 // Returns true if this is an instance of an api function and has
2300 // been modified since it was created. May give false positives. 2312 // been modified since it was created. May give false positives.
2301 bool IsDirty(); 2313 bool IsDirty();
2302 2314
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( 2452 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength(
2441 int capacity, 2453 int capacity,
2442 int length); 2454 int length);
2443 2455
2444 // Lookup interceptors are used for handling properties controlled by host 2456 // Lookup interceptors are used for handling properties controlled by host
2445 // objects. 2457 // objects.
2446 inline bool HasNamedInterceptor(); 2458 inline bool HasNamedInterceptor();
2447 inline bool HasIndexedInterceptor(); 2459 inline bool HasIndexedInterceptor();
2448 2460
2449 // Support functions for v8 api (needed for correct interceptor behavior). 2461 // Support functions for v8 api (needed for correct interceptor behavior).
2450 bool HasRealNamedProperty(Isolate* isolate, Name* key); 2462 static bool HasRealNamedProperty(Handle<JSObject> object,
2451 bool HasRealElementProperty(Isolate* isolate, uint32_t index); 2463 Handle<Name> key);
2452 bool HasRealNamedCallbackProperty(Isolate* isolate, Name* key); 2464 static bool HasRealElementProperty(Handle<JSObject> object, uint32_t index);
2465 static bool HasRealNamedCallbackProperty(Handle<JSObject> object,
2466 Handle<Name> key);
2453 2467
2454 // Get the header size for a JSObject. Used to compute the index of 2468 // Get the header size for a JSObject. Used to compute the index of
2455 // internal fields as well as the number of internal fields. 2469 // internal fields as well as the number of internal fields.
2456 inline int GetHeaderSize(); 2470 inline int GetHeaderSize();
2457 2471
2458 inline int GetInternalFieldCount(); 2472 inline int GetInternalFieldCount();
2459 inline int GetInternalFieldOffset(int index); 2473 inline int GetInternalFieldOffset(int index);
2460 inline Object* GetInternalField(int index); 2474 inline Object* GetInternalField(int index);
2461 inline void SetInternalField(int index, Object* value); 2475 inline void SetInternalField(int index, Object* value);
2462 inline void SetInternalField(int index, Smi* value); 2476 inline void SetInternalField(int index, Smi* value);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2564 // Check whether this object references another object 2578 // Check whether this object references another object
2565 bool ReferencesObject(Object* obj); 2579 bool ReferencesObject(Object* obj);
2566 2580
2567 // Disalow further properties to be added to the object. 2581 // Disalow further properties to be added to the object.
2568 static Handle<Object> PreventExtensions(Handle<JSObject> object); 2582 static Handle<Object> PreventExtensions(Handle<JSObject> object);
2569 2583
2570 // ES5 Object.freeze 2584 // ES5 Object.freeze
2571 static Handle<Object> Freeze(Handle<JSObject> object); 2585 static Handle<Object> Freeze(Handle<JSObject> object);
2572 2586
2573 // Called the first time an object is observed with ES7 Object.observe. 2587 // Called the first time an object is observed with ES7 Object.observe.
2574 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); 2588 static void SetObserved(Handle<JSObject> object);
2575 2589
2576 // Copy object. 2590 // Copy object.
2591 static Handle<JSObject> Copy(Handle<JSObject> object,
2592 Handle<AllocationSite> site);
2577 static Handle<JSObject> Copy(Handle<JSObject> object); 2593 static Handle<JSObject> Copy(Handle<JSObject> object);
2578 static Handle<JSObject> DeepCopy(Handle<JSObject> object); 2594 static Handle<JSObject> DeepCopy(Handle<JSObject> object,
2595 AllocationSiteContext* site_context);
2596 static Handle<JSObject> DeepWalk(Handle<JSObject> object,
2597 AllocationSiteContext* site_context);
2579 2598
2580 // Casting. 2599 // Casting.
2581 static inline JSObject* cast(Object* obj); 2600 static inline JSObject* cast(Object* obj);
2582 2601
2583 // Dispatched behavior. 2602 // Dispatched behavior.
2584 void JSObjectShortPrint(StringStream* accumulator); 2603 void JSObjectShortPrint(StringStream* accumulator);
2585 DECLARE_PRINTER(JSObject) 2604 DECLARE_PRINTER(JSObject)
2586 DECLARE_VERIFIER(JSObject) 2605 DECLARE_VERIFIER(JSObject)
2587 #ifdef OBJECT_PRINT 2606 #ifdef OBJECT_PRINT
2588 void PrintProperties(FILE* out = stdout); 2607 void PrintProperties(FILE* out = stdout);
(...skipping 21 matching lines...) Expand all
2610 int number_of_slow_used_properties_; 2629 int number_of_slow_used_properties_;
2611 int number_of_slow_unused_properties_; 2630 int number_of_slow_unused_properties_;
2612 int number_of_fast_used_elements_; 2631 int number_of_fast_used_elements_;
2613 int number_of_fast_unused_elements_; 2632 int number_of_fast_unused_elements_;
2614 int number_of_slow_used_elements_; 2633 int number_of_slow_used_elements_;
2615 int number_of_slow_unused_elements_; 2634 int number_of_slow_unused_elements_;
2616 }; 2635 };
2617 2636
2618 void IncrementSpillStatistics(SpillInformation* info); 2637 void IncrementSpillStatistics(SpillInformation* info);
2619 #endif 2638 #endif
2639
2640 #ifdef VERIFY_HEAP
2641 // If a GC was caused while constructing this object, the elements pointer
2642 // may point to a one pointer filler map. The object won't be rooted, but
2643 // our heap verification code could stumble across it.
2644 bool ElementsAreSafeToExamine();
2645 #endif
2646
2620 Object* SlowReverseLookup(Object* value); 2647 Object* SlowReverseLookup(Object* value);
2621 2648
2622 // Maximal number of fast properties for the JSObject. Used to 2649 // Maximal number of fast properties for the JSObject. Used to
2623 // restrict the number of map transitions to avoid an explosion in 2650 // restrict the number of map transitions to avoid an explosion in
2624 // the number of maps for objects used as dictionaries. 2651 // the number of maps for objects used as dictionaries.
2625 inline bool TooManyFastProperties( 2652 inline bool TooManyFastProperties(
2626 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); 2653 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
2627 2654
2628 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). 2655 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1).
2629 // Also maximal value of JSArray's length property. 2656 // Also maximal value of JSArray's length property.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 const char* type, 2700 const char* type,
2674 Handle<Name> name, 2701 Handle<Name> name,
2675 Handle<Object> old_value); 2702 Handle<Object> old_value);
2676 2703
2677 // Deliver change records to observers. May cause GC. 2704 // Deliver change records to observers. May cause GC.
2678 static void DeliverChangeRecords(Isolate* isolate); 2705 static void DeliverChangeRecords(Isolate* isolate);
2679 2706
2680 private: 2707 private:
2681 friend class DictionaryElementsAccessor; 2708 friend class DictionaryElementsAccessor;
2682 friend class JSReceiver; 2709 friend class JSReceiver;
2710 friend class Object;
2711
2712 // Used from Object::GetProperty().
2713 static Handle<Object> GetPropertyWithFailedAccessCheck(
2714 Handle<JSObject> object,
2715 Handle<Object> receiver,
2716 LookupResult* result,
2717 Handle<Name> name,
2718 PropertyAttributes* attributes);
2683 2719
2684 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, 2720 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver,
2685 Object* structure, 2721 Object* structure,
2686 uint32_t index, 2722 uint32_t index,
2687 Object* holder); 2723 Object* holder);
2688 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( 2724 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor(
2689 JSReceiver* receiver, 2725 JSReceiver* receiver,
2690 uint32_t index, 2726 uint32_t index,
2691 bool continue_search); 2727 bool continue_search);
2692 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( 2728 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor(
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
3049 3085
3050 // Dispatched behavior. 3086 // Dispatched behavior.
3051 DECLARE_PRINTER(FixedDoubleArray) 3087 DECLARE_PRINTER(FixedDoubleArray)
3052 DECLARE_VERIFIER(FixedDoubleArray) 3088 DECLARE_VERIFIER(FixedDoubleArray)
3053 3089
3054 private: 3090 private:
3055 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); 3091 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray);
3056 }; 3092 };
3057 3093
3058 3094
3095 // ConstantPoolArray describes a fixed-sized array containing constant pool
3096 // entires.
3097 // The format of the pool is:
3098 // [0]: Field holding the first index which is a pointer entry
3099 // [1]: Field holding the first index which is a int32 entry
3100 // [2] ... [first_ptr_index() - 1]: 64 bit entries
3101 // [first_ptr_index()] ... [first_int32_index() - 1]: pointer entries
3102 // [first_int32_index()] ... [length - 1]: 32 bit entries
3103 class ConstantPoolArray: public FixedArrayBase {
3104 public:
3105 // Getters for the field storing the first index for different type entries.
3106 inline int first_ptr_index();
3107 inline int first_int64_index();
3108 inline int first_int32_index();
3109
3110 // Getters for counts of different type entries.
3111 inline int count_of_ptr_entries();
3112 inline int count_of_int64_entries();
3113 inline int count_of_int32_entries();
3114
3115 // Setter and getter for pool elements.
3116 inline Object* get_ptr_entry(int index);
3117 inline int64_t get_int64_entry(int index);
3118 inline int32_t get_int32_entry(int index);
3119 inline double get_int64_entry_as_double(int index);
3120
3121 inline void set(int index, Object* value);
3122 inline void set(int index, int64_t value);
3123 inline void set(int index, double value);
3124 inline void set(int index, int32_t value);
3125
3126 // Set up initial state.
3127 inline void SetEntryCounts(int number_of_int64_entries,
3128 int number_of_ptr_entries,
3129 int number_of_int32_entries);
3130
3131 // Copy operations
3132 MUST_USE_RESULT inline MaybeObject* Copy();
3133
3134 // Garbage collection support.
3135 inline static int SizeFor(int number_of_int64_entries,
3136 int number_of_ptr_entries,
3137 int number_of_int32_entries) {
3138 return RoundUp(OffsetAt(number_of_int64_entries,
3139 number_of_ptr_entries,
3140 number_of_int32_entries),
3141 kPointerSize);
3142 }
3143
3144 // Code Generation support.
3145 inline int OffsetOfElementAt(int index) {
3146 ASSERT(index < length());
3147 if (index >= first_int32_index()) {
3148 return OffsetAt(count_of_int64_entries(), count_of_ptr_entries(),
3149 index - first_int32_index());
3150 } else if (index >= first_ptr_index()) {
3151 return OffsetAt(count_of_int64_entries(), index - first_ptr_index(), 0);
3152 } else {
3153 return OffsetAt(index, 0, 0);
3154 }
3155 }
3156
3157 // Casting.
3158 static inline ConstantPoolArray* cast(Object* obj);
3159
3160 // Layout description.
3161 static const int kFirstPointerIndexOffset = FixedArray::kHeaderSize;
3162 static const int kFirstInt32IndexOffset =
3163 kFirstPointerIndexOffset + kPointerSize;
3164 static const int kFirstOffset = kFirstInt32IndexOffset + kPointerSize;
3165
3166 // Dispatched behavior.
3167 void ConstantPoolIterateBody(ObjectVisitor* v);
3168
3169 DECLARE_PRINTER(ConstantPoolArray)
3170 DECLARE_VERIFIER(ConstantPoolArray)
3171
3172 private:
3173 inline void set_first_ptr_index(int value);
3174 inline void set_first_int32_index(int value);
3175
3176 inline static int OffsetAt(int number_of_int64_entries,
3177 int number_of_ptr_entries,
3178 int number_of_int32_entries) {
3179 return kFirstOffset
3180 + (number_of_int64_entries * kInt64Size)
3181 + (number_of_ptr_entries * kPointerSize)
3182 + (number_of_int32_entries * kInt32Size);
3183 }
3184
3185 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolArray);
3186 };
3187
3188
3059 // DescriptorArrays are fixed arrays used to hold instance descriptors. 3189 // DescriptorArrays are fixed arrays used to hold instance descriptors.
3060 // The format of the these objects is: 3190 // The format of the these objects is:
3061 // [0]: Number of descriptors 3191 // [0]: Number of descriptors
3062 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: 3192 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array:
3063 // [0]: pointer to fixed array with enum cache 3193 // [0]: pointer to fixed array with enum cache
3064 // [1]: either Smi(0) or pointer to fixed array with indices 3194 // [1]: either Smi(0) or pointer to fixed array with indices
3065 // [2]: first key 3195 // [2]: first key
3066 // [2 + number of descriptors * kDescriptorSize]: start of slack 3196 // [2 + number of descriptors * kDescriptorSize]: start of slack
3067 class DescriptorArray: public FixedArray { 3197 class DescriptorArray: public FixedArray {
3068 public: 3198 public:
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
4034 } 4164 }
4035 4165
4036 // Looks up the value associated with the given key. The hole value is 4166 // Looks up the value associated with the given key. The hole value is
4037 // returned in case the key is not present. 4167 // returned in case the key is not present.
4038 Object* Lookup(Object* key); 4168 Object* Lookup(Object* key);
4039 4169
4040 // Adds (or overwrites) the value associated with the given key. Mapping a 4170 // Adds (or overwrites) the value associated with the given key. Mapping a
4041 // key to the hole value causes removal of the whole entry. 4171 // key to the hole value causes removal of the whole entry.
4042 MUST_USE_RESULT MaybeObject* Put(Object* key, Object* value); 4172 MUST_USE_RESULT MaybeObject* Put(Object* key, Object* value);
4043 4173
4174 // This function is called when heap verification is turned on.
4175 void Zap(Object* value) {
4176 int capacity = Capacity();
4177 for (int i = 0; i < capacity; i++) {
4178 set(EntryToIndex(i), value);
4179 set(EntryToValueIndex(i), value);
4180 }
4181 }
4182
4044 private: 4183 private:
4045 friend class MarkCompactCollector; 4184 friend class MarkCompactCollector;
4046 4185
4047 void AddEntry(int entry, Object* key, Object* value); 4186 void AddEntry(int entry, Object* key, Object* value);
4048 4187
4049 // Returns the index to the value of an entry. 4188 // Returns the index to the value of an entry.
4050 static inline int EntryToValueIndex(int entry) { 4189 static inline int EntryToValueIndex(int entry) {
4051 return EntryToIndex(entry) + 1; 4190 return EntryToIndex(entry) + 1;
4052 } 4191 }
4053 }; 4192 };
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
4885 CALLBACKS, 5024 CALLBACKS,
4886 INTERCEPTOR, 5025 INTERCEPTOR,
4887 TRANSITION, 5026 TRANSITION,
4888 NONEXISTENT 5027 NONEXISTENT
4889 }; 5028 };
4890 5029
4891 typedef int ExtraICState; 5030 typedef int ExtraICState;
4892 5031
4893 static const ExtraICState kNoExtraICState = 0; 5032 static const ExtraICState kNoExtraICState = 0;
4894 5033
5034 static const int kPrologueOffsetNotSet = -1;
5035
4895 #ifdef ENABLE_DISASSEMBLER 5036 #ifdef ENABLE_DISASSEMBLER
4896 // Printing 5037 // Printing
4897 static const char* ICState2String(InlineCacheState state); 5038 static const char* ICState2String(InlineCacheState state);
4898 static const char* StubType2String(StubType type); 5039 static const char* StubType2String(StubType type);
4899 static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra); 5040 static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra);
4900 void Disassemble(const char* name, FILE* out = stdout); 5041 void Disassemble(const char* name, FILE* out = stdout);
4901 #endif // ENABLE_DISASSEMBLER 5042 #endif // ENABLE_DISASSEMBLER
4902 5043
4903 // [instruction_size]: Size of the native instructions 5044 // [instruction_size]: Size of the native instructions
4904 inline int instruction_size(); 5045 inline int instruction_size();
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
5081 // Find the first map in an IC stub. 5222 // Find the first map in an IC stub.
5082 Map* FindFirstMap(); 5223 Map* FindFirstMap();
5083 void FindAllMaps(MapHandleList* maps); 5224 void FindAllMaps(MapHandleList* maps);
5084 void ReplaceFirstMap(Map* replace); 5225 void ReplaceFirstMap(Map* replace);
5085 5226
5086 // Find the first handler in an IC stub. 5227 // Find the first handler in an IC stub.
5087 Code* FindFirstHandler(); 5228 Code* FindFirstHandler();
5088 5229
5089 // Find |length| handlers and put them into |code_list|. Returns false if not 5230 // Find |length| handlers and put them into |code_list|. Returns false if not
5090 // enough handlers can be found. 5231 // enough handlers can be found.
5091 MUST_USE_RESULT bool FindHandlers(CodeHandleList* code_list, int length); 5232 bool FindHandlers(CodeHandleList* code_list, int length = -1);
5092 5233
5093 // Find the first name in an IC stub. 5234 // Find the first name in an IC stub.
5094 Name* FindFirstName(); 5235 Name* FindFirstName();
5095 5236
5096 void ReplaceNthCell(int n, Cell* replace_with); 5237 void ReplaceNthCell(int n, Cell* replace_with);
5097 5238
5098 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {}; 5239 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {};
5099 class ExtraICStateKeyedAccessStoreMode: 5240 class ExtraICStateKeyedAccessStoreMode:
5100 public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT 5241 public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT
5101 5242
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
5204 DECLARE_PRINTER(Code) 5345 DECLARE_PRINTER(Code)
5205 DECLARE_VERIFIER(Code) 5346 DECLARE_VERIFIER(Code)
5206 5347
5207 void ClearInlineCaches(); 5348 void ClearInlineCaches();
5208 void ClearTypeFeedbackCells(Heap* heap); 5349 void ClearTypeFeedbackCells(Heap* heap);
5209 5350
5210 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); 5351 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset);
5211 5352
5212 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, 5353 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge,
5213 enum Age { 5354 enum Age {
5214 kNoAge = 0, 5355 kNotExecutedCodeAge = -2,
5356 kExecutedOnceCodeAge = -1,
5357 kNoAgeCodeAge = 0,
5215 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) 5358 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM)
5216 kAfterLastCodeAge, 5359 kAfterLastCodeAge,
5217 kLastCodeAge = kAfterLastCodeAge - 1, 5360 kLastCodeAge = kAfterLastCodeAge - 1,
5218 kCodeAgeCount = kAfterLastCodeAge - 1 5361 kCodeAgeCount = kAfterLastCodeAge - 1,
5362 kIsOldCodeAge = kSexagenarianCodeAge,
5363 kPreAgedCodeAge = kIsOldCodeAge - 1
5219 }; 5364 };
5220 #undef DECLARE_CODE_AGE_ENUM 5365 #undef DECLARE_CODE_AGE_ENUM
5221 5366
5222 // Code aging. Indicates how many full GCs this code has survived without 5367 // Code aging. Indicates how many full GCs this code has survived without
5223 // being entered through the prologue. Used to determine when it is 5368 // being entered through the prologue. Used to determine when it is
5224 // relatively safe to flush this code object and replace it with the lazy 5369 // relatively safe to flush this code object and replace it with the lazy
5225 // compilation stub. 5370 // compilation stub.
5226 static void MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate); 5371 static void MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate);
5372 static void MarkCodeAsExecuted(byte* sequence, Isolate* isolate);
5227 void MakeOlder(MarkingParity); 5373 void MakeOlder(MarkingParity);
5228 static bool IsYoungSequence(byte* sequence); 5374 static bool IsYoungSequence(byte* sequence);
5229 bool IsOld(); 5375 bool IsOld();
5230 int GetAge(); 5376 Age GetAge();
5377 static inline Code* GetPreAgedCodeAgeStub(Isolate* isolate) {
5378 return GetCodeAgeStub(isolate, kNotExecutedCodeAge, NO_MARKING_PARITY);
5379 }
5231 5380
5232 void PrintDeoptLocation(int bailout_id); 5381 void PrintDeoptLocation(int bailout_id);
5233 bool CanDeoptAt(Address pc); 5382 bool CanDeoptAt(Address pc);
5234 5383
5235 #ifdef VERIFY_HEAP 5384 #ifdef VERIFY_HEAP
5236 void VerifyEmbeddedObjectsDependency(); 5385 void VerifyEmbeddedObjectsDependency();
5237 #endif 5386 #endif
5238 5387
5239 static bool IsWeakEmbeddedObject(Kind kind, Object* object); 5388 static bool IsWeakEmbeddedObject(Kind kind, Object* object);
5240 5389
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
5656 static bool IsValidElementsTransition(ElementsKind from_kind, 5805 static bool IsValidElementsTransition(ElementsKind from_kind,
5657 ElementsKind to_kind); 5806 ElementsKind to_kind);
5658 5807
5659 inline bool HasTransitionArray(); 5808 inline bool HasTransitionArray();
5660 inline bool HasElementsTransition(); 5809 inline bool HasElementsTransition();
5661 inline Map* elements_transition_map(); 5810 inline Map* elements_transition_map();
5662 MUST_USE_RESULT inline MaybeObject* set_elements_transition_map( 5811 MUST_USE_RESULT inline MaybeObject* set_elements_transition_map(
5663 Map* transitioned_map); 5812 Map* transitioned_map);
5664 inline void SetTransition(int transition_index, Map* target); 5813 inline void SetTransition(int transition_index, Map* target);
5665 inline Map* GetTransition(int transition_index); 5814 inline Map* GetTransition(int transition_index);
5815
5816 static Handle<TransitionArray> AddTransition(Handle<Map> map,
5817 Handle<Name> key,
5818 Handle<Map> target,
5819 SimpleTransitionFlag flag);
5820
5666 MUST_USE_RESULT inline MaybeObject* AddTransition(Name* key, 5821 MUST_USE_RESULT inline MaybeObject* AddTransition(Name* key,
5667 Map* target, 5822 Map* target,
5668 SimpleTransitionFlag flag); 5823 SimpleTransitionFlag flag);
5669 DECL_ACCESSORS(transitions, TransitionArray) 5824 DECL_ACCESSORS(transitions, TransitionArray)
5670 inline void ClearTransitions(Heap* heap, 5825 inline void ClearTransitions(Heap* heap,
5671 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 5826 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
5672 5827
5673 void DeprecateTransitionTree(); 5828 void DeprecateTransitionTree();
5674 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); 5829 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors);
5675 5830
5676 Map* FindRootMap(); 5831 Map* FindRootMap();
5677 Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors); 5832 Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors);
5678 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); 5833 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors);
5679 5834
5680 int NumberOfFields(); 5835 int NumberOfFields();
5681 5836
5682 bool InstancesNeedRewriting(Map* target, 5837 bool InstancesNeedRewriting(Map* target,
5683 int target_number_of_fields, 5838 int target_number_of_fields,
5684 int target_inobject, 5839 int target_inobject,
5685 int target_unused); 5840 int target_unused);
5841 static Handle<Map> GeneralizeAllFieldRepresentations(
5842 Handle<Map> map,
5843 Representation new_representation);
5686 static Handle<Map> GeneralizeRepresentation( 5844 static Handle<Map> GeneralizeRepresentation(
5687 Handle<Map> map, 5845 Handle<Map> map,
5688 int modify_index, 5846 int modify_index,
5689 Representation new_representation, 5847 Representation new_representation,
5690 StoreMode store_mode); 5848 StoreMode store_mode);
5691 static Handle<Map> CopyGeneralizeAllRepresentations( 5849 static Handle<Map> CopyGeneralizeAllRepresentations(
5692 Handle<Map> map, 5850 Handle<Map> map,
5693 int modify_index, 5851 int modify_index,
5694 StoreMode store_mode, 5852 StoreMode store_mode,
5695 PropertyAttributes attributes, 5853 PropertyAttributes attributes,
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
5853 inline bool is_migration_target(); 6011 inline bool is_migration_target();
5854 inline void deprecate(); 6012 inline void deprecate();
5855 inline bool is_deprecated(); 6013 inline bool is_deprecated();
5856 inline bool CanBeDeprecated(); 6014 inline bool CanBeDeprecated();
5857 // Returns a non-deprecated version of the input. If the input was not 6015 // Returns a non-deprecated version of the input. If the input was not
5858 // deprecated, it is directly returned. Otherwise, the non-deprecated version 6016 // deprecated, it is directly returned. Otherwise, the non-deprecated version
5859 // is found by re-transitioning from the root of the transition tree using the 6017 // is found by re-transitioning from the root of the transition tree using the
5860 // descriptor array of the map. Returns NULL if no updated map is found. 6018 // descriptor array of the map. Returns NULL if no updated map is found.
5861 Map* CurrentMapForDeprecated(); 6019 Map* CurrentMapForDeprecated();
5862 6020
6021 static Handle<Map> RawCopy(Handle<Map> map, int instance_size);
5863 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); 6022 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size);
5864 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); 6023 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors();
5865 static Handle<Map> CopyDropDescriptors(Handle<Map> map); 6024 static Handle<Map> CopyDropDescriptors(Handle<Map> map);
5866 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); 6025 MUST_USE_RESULT MaybeObject* CopyDropDescriptors();
5867 static Handle<Map> CopyReplaceDescriptors(Handle<Map> map, 6026 static Handle<Map> CopyReplaceDescriptors(Handle<Map> map,
5868 Handle<DescriptorArray> descriptors, 6027 Handle<DescriptorArray> descriptors,
5869 TransitionFlag flag, 6028 TransitionFlag flag,
5870 Handle<Name> name); 6029 Handle<Name> name);
5871 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors( 6030 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors(
5872 DescriptorArray* descriptors, 6031 DescriptorArray* descriptors,
5873 TransitionFlag flag, 6032 TransitionFlag flag,
5874 Name* name = NULL, 6033 Name* name = NULL,
5875 SimpleTransitionFlag simple_flag = FULL_TRANSITION); 6034 SimpleTransitionFlag simple_flag = FULL_TRANSITION);
5876 static Handle<Map> CopyInstallDescriptors( 6035 static Handle<Map> CopyInstallDescriptors(
5877 Handle<Map> map, 6036 Handle<Map> map,
5878 int new_descriptor, 6037 int new_descriptor,
5879 Handle<DescriptorArray> descriptors); 6038 Handle<DescriptorArray> descriptors);
5880 MUST_USE_RESULT MaybeObject* CopyInstallDescriptors(
5881 int new_descriptor,
5882 DescriptorArray* descriptors);
5883 MUST_USE_RESULT MaybeObject* ShareDescriptor(DescriptorArray* descriptors, 6039 MUST_USE_RESULT MaybeObject* ShareDescriptor(DescriptorArray* descriptors,
5884 Descriptor* descriptor); 6040 Descriptor* descriptor);
5885 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor, 6041 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor,
5886 TransitionFlag flag); 6042 TransitionFlag flag);
5887 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, 6043 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor,
5888 TransitionFlag flag); 6044 TransitionFlag flag);
5889 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor( 6045 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor(
5890 DescriptorArray* descriptors, 6046 DescriptorArray* descriptors,
5891 Descriptor* descriptor, 6047 Descriptor* descriptor,
5892 int index, 6048 int index,
5893 TransitionFlag flag); 6049 TransitionFlag flag);
5894 MUST_USE_RESULT MaybeObject* AsElementsKind(ElementsKind kind); 6050 MUST_USE_RESULT MaybeObject* AsElementsKind(ElementsKind kind);
5895 6051
5896 MUST_USE_RESULT MaybeObject* CopyAsElementsKind(ElementsKind kind, 6052 MUST_USE_RESULT MaybeObject* CopyAsElementsKind(ElementsKind kind,
5897 TransitionFlag flag); 6053 TransitionFlag flag);
5898 MUST_USE_RESULT MaybeObject* CopyForObserved(); 6054
6055 static Handle<Map> CopyForObserved(Handle<Map> map);
5899 6056
5900 static Handle<Map> CopyNormalized(Handle<Map> map, 6057 static Handle<Map> CopyNormalized(Handle<Map> map,
5901 PropertyNormalizationMode mode, 6058 PropertyNormalizationMode mode,
5902 NormalizedMapSharingMode sharing); 6059 NormalizedMapSharingMode sharing);
5903 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode,
5904 NormalizedMapSharingMode sharing);
5905 6060
5906 inline void AppendDescriptor(Descriptor* desc, 6061 inline void AppendDescriptor(Descriptor* desc,
5907 const DescriptorArray::WhitenessWitness&); 6062 const DescriptorArray::WhitenessWitness&);
5908 6063
5909 // Returns a copy of the map, with all transitions dropped from the 6064 // Returns a copy of the map, with all transitions dropped from the
5910 // instance descriptors. 6065 // instance descriptors.
5911 static Handle<Map> Copy(Handle<Map> map); 6066 static Handle<Map> Copy(Handle<Map> map);
5912 MUST_USE_RESULT MaybeObject* Copy(); 6067 MUST_USE_RESULT MaybeObject* Copy();
5913 6068
5914 // Returns the next free property index (only valid for FAST MODE). 6069 // Returns the next free property index (only valid for FAST MODE).
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after
7916 DECL_ACCESSORS(transition_info, Object) 8071 DECL_ACCESSORS(transition_info, Object)
7917 // nested_site threads a list of sites that represent nested literals 8072 // nested_site threads a list of sites that represent nested literals
7918 // walked in a particular order. So [[1, 2], 1, 2] will have one 8073 // walked in a particular order. So [[1, 2], 1, 2] will have one
7919 // nested_site, but [[1, 2], 3, [4]] will have a list of two. 8074 // nested_site, but [[1, 2], 3, [4]] will have a list of two.
7920 DECL_ACCESSORS(nested_site, Object) 8075 DECL_ACCESSORS(nested_site, Object)
7921 DECL_ACCESSORS(dependent_code, DependentCode) 8076 DECL_ACCESSORS(dependent_code, DependentCode)
7922 DECL_ACCESSORS(weak_next, Object) 8077 DECL_ACCESSORS(weak_next, Object)
7923 8078
7924 inline void Initialize(); 8079 inline void Initialize();
7925 8080
8081 bool HasNestedSites() {
8082 return nested_site()->IsAllocationSite();
8083 }
8084
8085 // This method is expensive, it should only be called for reporting.
8086 bool IsNestedSite();
8087
7926 ElementsKind GetElementsKind() { 8088 ElementsKind GetElementsKind() {
7927 ASSERT(!IsLiteralSite()); 8089 ASSERT(!SitePointsToLiteral());
7928 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); 8090 return static_cast<ElementsKind>(Smi::cast(transition_info())->value());
7929 } 8091 }
7930 8092
7931 void SetElementsKind(ElementsKind kind) { 8093 void SetElementsKind(ElementsKind kind) {
7932 set_transition_info(Smi::FromInt(static_cast<int>(kind))); 8094 set_transition_info(Smi::FromInt(static_cast<int>(kind)));
7933 } 8095 }
7934 8096
7935 bool IsLiteralSite() { 8097 bool SitePointsToLiteral() {
7936 // If transition_info is a smi, then it represents an ElementsKind 8098 // If transition_info is a smi, then it represents an ElementsKind
7937 // for a constructed array. Otherwise, it must be a boilerplate 8099 // for a constructed array. Otherwise, it must be a boilerplate
7938 // for an array literal 8100 // for an object or array literal.
7939 return transition_info()->IsJSArray(); 8101 return transition_info()->IsJSArray() || transition_info()->IsJSObject();
7940 } 8102 }
7941 8103
7942 DECLARE_PRINTER(AllocationSite) 8104 DECLARE_PRINTER(AllocationSite)
7943 DECLARE_VERIFIER(AllocationSite) 8105 DECLARE_VERIFIER(AllocationSite)
7944 8106
7945 static inline AllocationSite* cast(Object* obj); 8107 static inline AllocationSite* cast(Object* obj);
7946 static inline AllocationSiteMode GetMode( 8108 static inline AllocationSiteMode GetMode(
7947 ElementsKind boilerplate_elements_kind); 8109 ElementsKind boilerplate_elements_kind);
7948 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); 8110 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to);
7949 static inline bool CanTrack(InstanceType type); 8111 static inline bool CanTrack(InstanceType type);
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after
9091 9253
9092 // [dependent_code]: dependent code that depends on the type of the global 9254 // [dependent_code]: dependent code that depends on the type of the global
9093 // property. 9255 // property.
9094 DECL_ACCESSORS(dependent_code, DependentCode) 9256 DECL_ACCESSORS(dependent_code, DependentCode)
9095 9257
9096 // Sets the value of the cell and updates the type field to be the union 9258 // Sets the value of the cell and updates the type field to be the union
9097 // of the cell's current type and the value's type. If the change causes 9259 // of the cell's current type and the value's type. If the change causes
9098 // a change of the type of the cell's contents, code dependent on the cell 9260 // a change of the type of the cell's contents, code dependent on the cell
9099 // will be deoptimized. 9261 // will be deoptimized.
9100 static void SetValueInferType(Handle<PropertyCell> cell, 9262 static void SetValueInferType(Handle<PropertyCell> cell,
9101 Handle<Object> value, 9263 Handle<Object> value);
9102 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 9264
9103 MUST_USE_RESULT MaybeObject* SetValueInferType( 9265 // Computes the new type of the cell's contents for the given value, but
9104 Object* value, 9266 // without actually modifying the 'type' field.
9105 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 9267 static Handle<Type> UpdatedType(Handle<PropertyCell> cell,
9268 Handle<Object> value);
9269
9270 void AddDependentCompilationInfo(CompilationInfo* info);
9271
9272 void AddDependentCode(Handle<Code> code);
9106 9273
9107 // Casting. 9274 // Casting.
9108 static inline PropertyCell* cast(Object* obj); 9275 static inline PropertyCell* cast(Object* obj);
9109 9276
9110 inline Address TypeAddress() { 9277 inline Address TypeAddress() {
9111 return address() + kTypeOffset; 9278 return address() + kTypeOffset;
9112 } 9279 }
9113 9280
9114 // Dispatched behavior. 9281 // Dispatched behavior.
9115 DECLARE_PRINTER(PropertyCell) 9282 DECLARE_PRINTER(PropertyCell)
9116 DECLARE_VERIFIER(PropertyCell) 9283 DECLARE_VERIFIER(PropertyCell)
9117 9284
9118 // Layout description. 9285 // Layout description.
9119 static const int kTypeOffset = kValueOffset + kPointerSize; 9286 static const int kTypeOffset = kValueOffset + kPointerSize;
9120 static const int kDependentCodeOffset = kTypeOffset + kPointerSize; 9287 static const int kDependentCodeOffset = kTypeOffset + kPointerSize;
9121 static const int kSize = kDependentCodeOffset + kPointerSize; 9288 static const int kSize = kDependentCodeOffset + kPointerSize;
9122 9289
9123 static const int kPointerFieldsBeginOffset = kValueOffset; 9290 static const int kPointerFieldsBeginOffset = kValueOffset;
9124 static const int kPointerFieldsEndOffset = kDependentCodeOffset; 9291 static const int kPointerFieldsEndOffset = kDependentCodeOffset;
9125 9292
9126 typedef FixedBodyDescriptor<kValueOffset, 9293 typedef FixedBodyDescriptor<kValueOffset,
9127 kSize, 9294 kSize,
9128 kSize> BodyDescriptor; 9295 kSize> BodyDescriptor;
9129 9296
9130 void AddDependentCompilationInfo(CompilationInfo* info);
9131
9132 void AddDependentCode(Handle<Code> code);
9133
9134 static Type* UpdateType(Handle<PropertyCell> cell,
9135 Handle<Object> value);
9136
9137 private: 9297 private:
9138 DECL_ACCESSORS(type_raw, Object) 9298 DECL_ACCESSORS(type_raw, Object)
9139 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); 9299 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell);
9140 }; 9300 };
9141 9301
9142 9302
9143 // The JSProxy describes EcmaScript Harmony proxies 9303 // The JSProxy describes EcmaScript Harmony proxies
9144 class JSProxy: public JSReceiver { 9304 class JSProxy: public JSReceiver {
9145 public: 9305 public:
9146 // [handler]: The handler property. 9306 // [handler]: The handler property.
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
10232 // Abstract base class for visiting, and optionally modifying, the 10392 // Abstract base class for visiting, and optionally modifying, the
10233 // pointers contained in Objects. Used in GC and serialization/deserialization. 10393 // pointers contained in Objects. Used in GC and serialization/deserialization.
10234 class ObjectVisitor BASE_EMBEDDED { 10394 class ObjectVisitor BASE_EMBEDDED {
10235 public: 10395 public:
10236 virtual ~ObjectVisitor() {} 10396 virtual ~ObjectVisitor() {}
10237 10397
10238 // Visits a contiguous arrays of pointers in the half-open range 10398 // Visits a contiguous arrays of pointers in the half-open range
10239 // [start, end). Any or all of the values may be modified on return. 10399 // [start, end). Any or all of the values may be modified on return.
10240 virtual void VisitPointers(Object** start, Object** end) = 0; 10400 virtual void VisitPointers(Object** start, Object** end) = 0;
10241 10401
10402 // Handy shorthand for visiting a single pointer.
10403 virtual void VisitPointer(Object** p) { VisitPointers(p, p + 1); }
10404
10242 // To allow lazy clearing of inline caches the visitor has 10405 // To allow lazy clearing of inline caches the visitor has
10243 // a rich interface for iterating over Code objects.. 10406 // a rich interface for iterating over Code objects..
10244 10407
10245 // Visits a code target in the instruction stream. 10408 // Visits a code target in the instruction stream.
10246 virtual void VisitCodeTarget(RelocInfo* rinfo); 10409 virtual void VisitCodeTarget(RelocInfo* rinfo);
10247 10410
10248 // Visits a code entry in a JS function. 10411 // Visits a code entry in a JS function.
10249 virtual void VisitCodeEntry(Address entry_address); 10412 virtual void VisitCodeEntry(Address entry_address);
10250 10413
10251 // Visits a global property cell reference in the instruction stream. 10414 // Visits a global property cell reference in the instruction stream.
10252 virtual void VisitCell(RelocInfo* rinfo); 10415 virtual void VisitCell(RelocInfo* rinfo);
10253 10416
10254 // Visits a runtime entry in the instruction stream. 10417 // Visits a runtime entry in the instruction stream.
10255 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {} 10418 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {}
10256 10419
10257 // Visits the resource of an ASCII or two-byte string. 10420 // Visits the resource of an ASCII or two-byte string.
10258 virtual void VisitExternalAsciiString( 10421 virtual void VisitExternalAsciiString(
10259 v8::String::ExternalAsciiStringResource** resource) {} 10422 v8::String::ExternalAsciiStringResource** resource) {}
10260 virtual void VisitExternalTwoByteString( 10423 virtual void VisitExternalTwoByteString(
10261 v8::String::ExternalStringResource** resource) {} 10424 v8::String::ExternalStringResource** resource) {}
10262 10425
10263 // Visits a debug call target in the instruction stream. 10426 // Visits a debug call target in the instruction stream.
10264 virtual void VisitDebugTarget(RelocInfo* rinfo); 10427 virtual void VisitDebugTarget(RelocInfo* rinfo);
10265 10428
10266 // Visits the byte sequence in a function's prologue that contains information 10429 // Visits the byte sequence in a function's prologue that contains information
10267 // about the code's age. 10430 // about the code's age.
10268 virtual void VisitCodeAgeSequence(RelocInfo* rinfo); 10431 virtual void VisitCodeAgeSequence(RelocInfo* rinfo);
10269 10432
10270 // Handy shorthand for visiting a single pointer.
10271 virtual void VisitPointer(Object** p) { VisitPointers(p, p + 1); }
10272
10273 // Visit pointer embedded into a code object. 10433 // Visit pointer embedded into a code object.
10274 virtual void VisitEmbeddedPointer(RelocInfo* rinfo); 10434 virtual void VisitEmbeddedPointer(RelocInfo* rinfo);
10275 10435
10276 // Visits a contiguous arrays of external references (references to the C++ 10436 // Visits an external reference embedded into a code object.
10277 // heap) in the half-open range [start, end). Any or all of the values
10278 // may be modified on return.
10279 virtual void VisitExternalReferences(Address* start, Address* end) {}
10280
10281 virtual void VisitExternalReference(RelocInfo* rinfo); 10437 virtual void VisitExternalReference(RelocInfo* rinfo);
10282 10438
10283 inline void VisitExternalReference(Address* p) { 10439 // Visits an external reference. The value may be modified on return.
10284 VisitExternalReferences(p, p + 1); 10440 virtual void VisitExternalReference(Address* p) {}
10285 }
10286 10441
10287 // Visits a handle that has an embedder-assigned class ID. 10442 // Visits a handle that has an embedder-assigned class ID.
10288 virtual void VisitEmbedderReference(Object** p, uint16_t class_id) {} 10443 virtual void VisitEmbedderReference(Object** p, uint16_t class_id) {}
10289 10444
10290 // Intended for serialization/deserialization checking: insert, or 10445 // Intended for serialization/deserialization checking: insert, or
10291 // check for the presence of, a tag at this position in the stream. 10446 // check for the presence of, a tag at this position in the stream.
10292 // Also used for marking up GC roots in heap snapshots. 10447 // Also used for marking up GC roots in heap snapshots.
10293 virtual void Synchronize(VisitorSynchronization::SyncTag tag) {} 10448 virtual void Synchronize(VisitorSynchronization::SyncTag tag) {}
10294 }; 10449 };
10295 10450
(...skipping 29 matching lines...) Expand all
10325 } else { 10480 } else {
10326 value &= ~(1 << bit_position); 10481 value &= ~(1 << bit_position);
10327 } 10482 }
10328 return value; 10483 return value;
10329 } 10484 }
10330 }; 10485 };
10331 10486
10332 } } // namespace v8::internal 10487 } } // namespace v8::internal
10333 10488
10334 #endif // V8_OBJECTS_H_ 10489 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/object-observe.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698