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

Side by Side Diff: src/objects.h

Issue 1276353004: Fasterify JSObject::UnregisterPrototypeUser (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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 | « src/factory.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')
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 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 PropertyAttributes attributes); 1899 PropertyAttributes attributes);
1900 static void SetDictionaryArgumentsElement(Handle<JSObject> object, 1900 static void SetDictionaryArgumentsElement(Handle<JSObject> object,
1901 uint32_t index, 1901 uint32_t index,
1902 Handle<Object> value, 1902 Handle<Object> value,
1903 PropertyAttributes attributes); 1903 PropertyAttributes attributes);
1904 1904
1905 static void OptimizeAsPrototype(Handle<JSObject> object, 1905 static void OptimizeAsPrototype(Handle<JSObject> object,
1906 PrototypeOptimizationMode mode); 1906 PrototypeOptimizationMode mode);
1907 static void ReoptimizeIfPrototype(Handle<JSObject> object); 1907 static void ReoptimizeIfPrototype(Handle<JSObject> object);
1908 static void LazyRegisterPrototypeUser(Handle<Map> user, Isolate* isolate); 1908 static void LazyRegisterPrototypeUser(Handle<Map> user, Isolate* isolate);
1909 static bool RegisterPrototypeUserIfNotRegistered(Handle<JSObject> prototype, 1909 static bool UnregisterPrototypeUser(Handle<Map> user, Isolate* isolate);
1910 Handle<HeapObject> user,
1911 Isolate* isolate);
1912 static bool UnregisterPrototypeUser(Handle<JSObject> prototype,
1913 Handle<HeapObject> user);
1914 static void InvalidatePrototypeChains(Map* map); 1910 static void InvalidatePrototypeChains(Map* map);
1915 1911
1916 // Retrieve interceptors. 1912 // Retrieve interceptors.
1917 InterceptorInfo* GetNamedInterceptor(); 1913 InterceptorInfo* GetNamedInterceptor();
1918 InterceptorInfo* GetIndexedInterceptor(); 1914 InterceptorInfo* GetIndexedInterceptor();
1919 1915
1920 // Used from JSReceiver. 1916 // Used from JSReceiver.
1921 MUST_USE_RESULT static Maybe<PropertyAttributes> 1917 MUST_USE_RESULT static Maybe<PropertyAttributes>
1922 GetPropertyAttributesWithInterceptor(LookupIterator* it); 1918 GetPropertyAttributesWithInterceptor(LookupIterator* it);
1923 MUST_USE_RESULT static Maybe<PropertyAttributes> 1919 MUST_USE_RESULT static Maybe<PropertyAttributes>
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
2524 DECLARE_PRINTER(FixedDoubleArray) 2520 DECLARE_PRINTER(FixedDoubleArray)
2525 DECLARE_VERIFIER(FixedDoubleArray) 2521 DECLARE_VERIFIER(FixedDoubleArray)
2526 2522
2527 private: 2523 private:
2528 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); 2524 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray);
2529 }; 2525 };
2530 2526
2531 2527
2532 class WeakFixedArray : public FixedArray { 2528 class WeakFixedArray : public FixedArray {
2533 public: 2529 public:
2534 enum SearchForDuplicates { kAlwaysAdd, kAddIfNotFound };
2535
2536 // If |maybe_array| is not a WeakFixedArray, a fresh one will be allocated. 2530 // If |maybe_array| is not a WeakFixedArray, a fresh one will be allocated.
2537 static Handle<WeakFixedArray> Add( 2531 // This function does not check if the value exists already, callers must
2538 Handle<Object> maybe_array, Handle<HeapObject> value, 2532 // ensure this themselves if necessary.
2539 SearchForDuplicates search_for_duplicates = kAlwaysAdd, 2533 static Handle<WeakFixedArray> Add(Handle<Object> maybe_array,
2540 bool* was_present = NULL); 2534 Handle<HeapObject> value,
2535 int* assigned_index = NULL);
2541 2536
2542 // Returns true if an entry was found and removed. 2537 // Returns true if an entry was found and removed.
2543 bool Remove(Handle<HeapObject> value); 2538 bool Remove(Handle<HeapObject> value);
2544 2539
2545 void Compact(); 2540 void Compact();
2541 // Special version of Compact() for WeakFixedArrays that are used as
2542 // prototype user registries. Updates the contained maps' remembered index.
2543 void CompactPrototypeUserList();
Yang 2015/08/07 21:37:24 Not sure if this should live on Map instead.
Jakob Kummerow 2015/08/08 12:39:32 Moved it to JSObject where all the other prototype
2546 2544
2547 inline Object* Get(int index) const; 2545 inline Object* Get(int index) const;
2548 inline void Clear(int index); 2546 inline void Clear(int index);
2549 inline int Length() const; 2547 inline int Length() const;
2550 2548
2551 inline bool IsEmptySlot(int index) const; 2549 inline bool IsEmptySlot(int index) const;
2552 static Object* Empty() { return Smi::FromInt(0); } 2550 static Object* Empty() { return Smi::FromInt(0); }
2553 2551
2554 DECLARE_CAST(WeakFixedArray) 2552 DECLARE_CAST(WeakFixedArray)
2555 2553
(...skipping 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after
5461 // Don't call set_raw_transitions() directly to overwrite transitions, use 5459 // Don't call set_raw_transitions() directly to overwrite transitions, use
5462 // the TransitionArray::ReplaceTransitions() wrapper instead! 5460 // the TransitionArray::ReplaceTransitions() wrapper instead!
5463 DECL_ACCESSORS(raw_transitions, Object) 5461 DECL_ACCESSORS(raw_transitions, Object)
5464 // [prototype_info]: Per-prototype metadata. Aliased with transitions 5462 // [prototype_info]: Per-prototype metadata. Aliased with transitions
5465 // (which prototype maps don't have). 5463 // (which prototype maps don't have).
5466 DECL_ACCESSORS(prototype_info, Object) 5464 DECL_ACCESSORS(prototype_info, Object)
5467 // PrototypeInfo is created lazily using this helper (which installs it on 5465 // PrototypeInfo is created lazily using this helper (which installs it on
5468 // the given prototype's map). 5466 // the given prototype's map).
5469 static Handle<PrototypeInfo> GetOrCreatePrototypeInfo( 5467 static Handle<PrototypeInfo> GetOrCreatePrototypeInfo(
5470 Handle<JSObject> prototype, Isolate* isolate); 5468 Handle<JSObject> prototype, Isolate* isolate);
5469 static Handle<PrototypeInfo> GetOrCreatePrototypeInfo(
5470 Handle<Map> prototype_map, Isolate* isolate);
5471 5471
5472 // [prototype chain validity cell]: Associated with a prototype object, 5472 // [prototype chain validity cell]: Associated with a prototype object,
5473 // stored in that object's map's PrototypeInfo, indicates that prototype 5473 // stored in that object's map's PrototypeInfo, indicates that prototype
5474 // chains through this object are currently valid. The cell will be 5474 // chains through this object are currently valid. The cell will be
5475 // invalidated and replaced when the prototype chain changes. 5475 // invalidated and replaced when the prototype chain changes.
5476 static Handle<Cell> GetOrCreatePrototypeChainValidityCell(Handle<Map> map, 5476 static Handle<Cell> GetOrCreatePrototypeChainValidityCell(Handle<Map> map,
5477 Isolate* isolate); 5477 Isolate* isolate);
5478 static const int kPrototypeChainValid = 0; 5478 static const int kPrototypeChainValid = 0;
5479 static const int kPrototypeChainInvalid = 1; 5479 static const int kPrototypeChainInvalid = 1;
5480 5480
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
6030 static const int kSize = kValueOffset + kPointerSize; 6030 static const int kSize = kValueOffset + kPointerSize;
6031 6031
6032 private: 6032 private:
6033 DISALLOW_IMPLICIT_CONSTRUCTORS(Box); 6033 DISALLOW_IMPLICIT_CONSTRUCTORS(Box);
6034 }; 6034 };
6035 6035
6036 6036
6037 // Container for metadata stored on each prototype map. 6037 // Container for metadata stored on each prototype map.
6038 class PrototypeInfo : public Struct { 6038 class PrototypeInfo : public Struct {
6039 public: 6039 public:
6040 static const int UNREGISTERED = -1;
6041
6040 // [prototype_users]: WeakFixedArray containing maps using this prototype, 6042 // [prototype_users]: WeakFixedArray containing maps using this prototype,
6041 // or Smi(0) if uninitialized. 6043 // or Smi(0) if uninitialized.
6042 DECL_ACCESSORS(prototype_users, Object) 6044 DECL_ACCESSORS(prototype_users, Object)
6045 // [registry_slot]: Slot in prototype's user registry where this user
6046 // is stored. Returns UNREGISTERED if this prototype has not been registered.
6047 inline int registry_slot() const;
6048 inline void set_registry_slot(int slot);
6043 // [validity_cell]: Cell containing the validity bit for prototype chains 6049 // [validity_cell]: Cell containing the validity bit for prototype chains
6044 // going through this object, or Smi(0) if uninitialized. 6050 // going through this object, or Smi(0) if uninitialized.
6045 DECL_ACCESSORS(validity_cell, Object) 6051 DECL_ACCESSORS(validity_cell, Object)
6046 // [constructor_name]: User-friendly name of the original constructor. 6052 // [constructor_name]: User-friendly name of the original constructor.
6047 DECL_ACCESSORS(constructor_name, Object) 6053 DECL_ACCESSORS(constructor_name, Object)
6048 6054
6049 DECLARE_CAST(PrototypeInfo) 6055 DECLARE_CAST(PrototypeInfo)
6050 6056
6051 // Dispatched behavior. 6057 // Dispatched behavior.
6052 DECLARE_PRINTER(PrototypeInfo) 6058 DECLARE_PRINTER(PrototypeInfo)
6053 DECLARE_VERIFIER(PrototypeInfo) 6059 DECLARE_VERIFIER(PrototypeInfo)
6054 6060
6055 static const int kPrototypeUsersOffset = HeapObject::kHeaderSize; 6061 static const int kPrototypeUsersOffset = HeapObject::kHeaderSize;
6056 static const int kValidityCellOffset = kPrototypeUsersOffset + kPointerSize; 6062 static const int kRegistrySlotOffset = kPrototypeUsersOffset + kPointerSize;
6063 static const int kValidityCellOffset = kRegistrySlotOffset + kPointerSize;
6057 static const int kConstructorNameOffset = kValidityCellOffset + kPointerSize; 6064 static const int kConstructorNameOffset = kValidityCellOffset + kPointerSize;
6058 static const int kSize = kConstructorNameOffset + kPointerSize; 6065 static const int kSize = kConstructorNameOffset + kPointerSize;
6059 6066
6060 private: 6067 private:
6061 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo); 6068 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo);
6062 }; 6069 };
6063 6070
6064 6071
6065 // Script describes a script which has been added to the VM. 6072 // Script describes a script which has been added to the VM.
6066 class Script: public Struct { 6073 class Script: public Struct {
(...skipping 4478 matching lines...) Expand 10 before | Expand all | Expand 10 after
10545 } else { 10552 } else {
10546 value &= ~(1 << bit_position); 10553 value &= ~(1 << bit_position);
10547 } 10554 }
10548 return value; 10555 return value;
10549 } 10556 }
10550 }; 10557 };
10551 10558
10552 } } // namespace v8::internal 10559 } } // namespace v8::internal
10553 10560
10554 #endif // V8_OBJECTS_H_ 10561 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698