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

Side by Side Diff: src/objects.h

Issue 1108583002: Revert of Lazily register prototype users (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 // Sets the property value in a normalized object given (key, value, details). 1834 // Sets the property value in a normalized object given (key, value, details).
1835 // Handles the special representation of JS global objects. 1835 // Handles the special representation of JS global objects.
1836 static void SetNormalizedProperty(Handle<JSObject> object, 1836 static void SetNormalizedProperty(Handle<JSObject> object,
1837 Handle<Name> key, 1837 Handle<Name> key,
1838 Handle<Object> value, 1838 Handle<Object> value,
1839 PropertyDetails details); 1839 PropertyDetails details);
1840 1840
1841 static void OptimizeAsPrototype(Handle<JSObject> object, 1841 static void OptimizeAsPrototype(Handle<JSObject> object,
1842 PrototypeOptimizationMode mode); 1842 PrototypeOptimizationMode mode);
1843 static void ReoptimizeIfPrototype(Handle<JSObject> object); 1843 static void ReoptimizeIfPrototype(Handle<JSObject> object);
1844 static void LazyRegisterPrototypeUser(Handle<Map> user, Isolate* isolate); 1844 static void RegisterPrototypeUser(Handle<JSObject> prototype,
1845 static bool RegisterPrototypeUserIfNotRegistered(Handle<JSObject> prototype, 1845 Handle<HeapObject> user);
1846 Handle<HeapObject> user, 1846 static void UnregisterPrototypeUser(Handle<JSObject> prototype,
1847 Isolate* isolate);
1848 static bool UnregisterPrototypeUser(Handle<JSObject> prototype,
1849 Handle<HeapObject> user); 1847 Handle<HeapObject> user);
1850 static void InvalidatePrototypeChains(Map* map); 1848 static void InvalidatePrototypeChains(Map* map);
1851 1849
1852 // Retrieve interceptors. 1850 // Retrieve interceptors.
1853 InterceptorInfo* GetNamedInterceptor(); 1851 InterceptorInfo* GetNamedInterceptor();
1854 InterceptorInfo* GetIndexedInterceptor(); 1852 InterceptorInfo* GetIndexedInterceptor();
1855 1853
1856 // Used from JSReceiver. 1854 // Used from JSReceiver.
1857 MUST_USE_RESULT static Maybe<PropertyAttributes> 1855 MUST_USE_RESULT static Maybe<PropertyAttributes>
1858 GetPropertyAttributesWithInterceptor(Handle<JSObject> holder, 1856 GetPropertyAttributesWithInterceptor(Handle<JSObject> holder,
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
2616 }; 2614 };
2617 2615
2618 2616
2619 class WeakFixedArray : public FixedArray { 2617 class WeakFixedArray : public FixedArray {
2620 public: 2618 public:
2621 enum SearchForDuplicates { kAlwaysAdd, kAddIfNotFound }; 2619 enum SearchForDuplicates { kAlwaysAdd, kAddIfNotFound };
2622 2620
2623 // If |maybe_array| is not a WeakFixedArray, a fresh one will be allocated. 2621 // If |maybe_array| is not a WeakFixedArray, a fresh one will be allocated.
2624 static Handle<WeakFixedArray> Add( 2622 static Handle<WeakFixedArray> Add(
2625 Handle<Object> maybe_array, Handle<HeapObject> value, 2623 Handle<Object> maybe_array, Handle<HeapObject> value,
2626 SearchForDuplicates search_for_duplicates = kAlwaysAdd, 2624 SearchForDuplicates search_for_duplicates = kAlwaysAdd);
2627 bool* was_present = NULL);
2628 2625
2629 // Returns true if an entry was found and removed. 2626 void Remove(Handle<HeapObject> value);
2630 bool Remove(Handle<HeapObject> value);
2631 2627
2632 void Compact(); 2628 void Compact();
2633 2629
2634 inline Object* Get(int index) const; 2630 inline Object* Get(int index) const;
2635 inline int Length() const; 2631 inline int Length() const;
2636 2632
2637 static Object* Empty() { return Smi::FromInt(0); } 2633 static Object* Empty() { return Smi::FromInt(0); }
2638 2634
2639 DECLARE_CAST(WeakFixedArray) 2635 DECLARE_CAST(WeakFixedArray)
2640 2636
(...skipping 3200 matching lines...) Expand 10 before | Expand all | Expand 10 after
5841 // any cleared weak cell. 5837 // any cleared weak cell.
5842 bool Compact(); 5838 bool Compact();
5843 static int Grow(int number_of_entries) { 5839 static int Grow(int number_of_entries) {
5844 if (number_of_entries < 5) return number_of_entries + 1; 5840 if (number_of_entries < 5) return number_of_entries + 1;
5845 return number_of_entries * 5 / 4; 5841 return number_of_entries * 5 / 4;
5846 } 5842 }
5847 static const int kCodesStartIndex = kGroupCount; 5843 static const int kCodesStartIndex = kGroupCount;
5848 }; 5844 };
5849 5845
5850 5846
5851 class PrototypeInfo;
5852
5853
5854 // All heap objects have a Map that describes their structure. 5847 // All heap objects have a Map that describes their structure.
5855 // A Map contains information about: 5848 // A Map contains information about:
5856 // - Size information about the object 5849 // - Size information about the object
5857 // - How to iterate over an object (for garbage collection) 5850 // - How to iterate over an object (for garbage collection)
5858 class Map: public HeapObject { 5851 class Map: public HeapObject {
5859 public: 5852 public:
5860 // Instance size. 5853 // Instance size.
5861 // Size in bytes or kVariableSizeSentinel if instances do not have 5854 // Size in bytes or kVariableSizeSentinel if instances do not have
5862 // a fixed size. 5855 // a fixed size.
5863 inline int instance_size(); 5856 inline int instance_size();
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
6051 6044
6052 inline FixedArrayBase* GetInitialElements(); 6045 inline FixedArrayBase* GetInitialElements();
6053 6046
6054 // [raw_transitions]: Provides access to the transitions storage field. 6047 // [raw_transitions]: Provides access to the transitions storage field.
6055 // Don't call set_raw_transitions() directly to overwrite transitions, use 6048 // Don't call set_raw_transitions() directly to overwrite transitions, use
6056 // the TransitionArray::ReplaceTransitions() wrapper instead! 6049 // the TransitionArray::ReplaceTransitions() wrapper instead!
6057 DECL_ACCESSORS(raw_transitions, Object) 6050 DECL_ACCESSORS(raw_transitions, Object)
6058 // [prototype_info]: Per-prototype metadata. Aliased with transitions 6051 // [prototype_info]: Per-prototype metadata. Aliased with transitions
6059 // (which prototype maps don't have). 6052 // (which prototype maps don't have).
6060 DECL_ACCESSORS(prototype_info, Object) 6053 DECL_ACCESSORS(prototype_info, Object)
6061 // PrototypeInfo is created lazily using this helper (which installs it on
6062 // the given prototype's map).
6063 static Handle<PrototypeInfo> GetOrCreatePrototypeInfo(
6064 Handle<JSObject> prototype, Isolate* isolate);
6065 6054
6066 // [prototype chain validity cell]: Associated with a prototype object, 6055 // [prototype chain validity cell]: Associated with a prototype object,
6067 // stored in that object's map's PrototypeInfo, indicates that prototype 6056 // stored in that object's map's PrototypeInfo, indicates that prototype
6068 // chains through this object are currently valid. The cell will be 6057 // chains through this object are currently valid. The cell will be
6069 // invalidated and replaced when the prototype chain changes. 6058 // invalidated and replaced when the prototype chain changes.
6070 static Handle<Cell> GetOrCreatePrototypeChainValidityCell(Handle<Map> map, 6059 static Handle<Cell> GetOrCreatePrototypeChainValidityCell(Handle<Map> map,
6071 Isolate* isolate); 6060 Isolate* isolate);
6072 static const int kPrototypeChainValid = 0; 6061 static const int kPrototypeChainValid = 0;
6073 static const int kPrototypeChainInvalid = 1; 6062 static const int kPrototypeChainInvalid = 1;
6074 6063
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
6127 6116
6128 // Returns true if map has a non-empty stub code cache. 6117 // Returns true if map has a non-empty stub code cache.
6129 inline bool has_code_cache(); 6118 inline bool has_code_cache();
6130 6119
6131 // [prototype]: implicit prototype object. 6120 // [prototype]: implicit prototype object.
6132 DECL_ACCESSORS(prototype, Object) 6121 DECL_ACCESSORS(prototype, Object)
6133 // TODO(jkummerow): make set_prototype private. 6122 // TODO(jkummerow): make set_prototype private.
6134 static void SetPrototype( 6123 static void SetPrototype(
6135 Handle<Map> map, Handle<Object> prototype, 6124 Handle<Map> map, Handle<Object> prototype,
6136 PrototypeOptimizationMode proto_mode = FAST_PROTOTYPE); 6125 PrototypeOptimizationMode proto_mode = FAST_PROTOTYPE);
6126 static bool ShouldRegisterAsPrototypeUser(Handle<Map> map,
6127 Handle<JSObject> prototype);
6128 bool CanUseOptimizationsBasedOnPrototypeRegistry();
6137 6129
6138 // [constructor]: points back to the function responsible for this map. 6130 // [constructor]: points back to the function responsible for this map.
6139 // The field overlaps with the back pointer. All maps in a transition tree 6131 // The field overlaps with the back pointer. All maps in a transition tree
6140 // have the same constructor, so maps with back pointers can walk the 6132 // have the same constructor, so maps with back pointers can walk the
6141 // back pointer chain until they find the map holding their constructor. 6133 // back pointer chain until they find the map holding their constructor.
6142 DECL_ACCESSORS(constructor_or_backpointer, Object) 6134 DECL_ACCESSORS(constructor_or_backpointer, Object)
6143 inline Object* GetConstructor() const; 6135 inline Object* GetConstructor() const;
6144 inline void SetConstructor(Object* constructor, 6136 inline void SetConstructor(Object* constructor,
6145 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 6137 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
6146 // [back pointer]: points back to the parent map from which a transition 6138 // [back pointer]: points back to the parent map from which a transition
(...skipping 4958 matching lines...) Expand 10 before | Expand all | Expand 10 after
11105 } else { 11097 } else {
11106 value &= ~(1 << bit_position); 11098 value &= ~(1 << bit_position);
11107 } 11099 }
11108 return value; 11100 return value;
11109 } 11101 }
11110 }; 11102 };
11111 11103
11112 } } // namespace v8::internal 11104 } } // namespace v8::internal
11113 11105
11114 #endif // V8_OBJECTS_H_ 11106 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698