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

Unified Diff: src/objects.h

Issue 1276353004: Fasterify JSObject::UnregisterPrototypeUser (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix compaction<->serialization interaction 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 8e64fe38da799f8c772a11ccda4977442703d94f..6cbdecab87acb32072e49071b4fe70782a27b66e 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1906,13 +1906,15 @@ class JSObject: public JSReceiver {
PrototypeOptimizationMode mode);
static void ReoptimizeIfPrototype(Handle<JSObject> object);
static void LazyRegisterPrototypeUser(Handle<Map> user, Isolate* isolate);
- static bool RegisterPrototypeUserIfNotRegistered(Handle<JSObject> prototype,
- Handle<HeapObject> user,
- Isolate* isolate);
- static bool UnregisterPrototypeUser(Handle<JSObject> prototype,
- Handle<HeapObject> user);
+ static bool UnregisterPrototypeUser(Handle<Map> user, Isolate* isolate);
static void InvalidatePrototypeChains(Map* map);
+ // Alternative implementation of WeakFixedArray::NullCallback.
+ class PrototypeRegistryCompactionCallback {
+ public:
+ static void Callback(Object* value, int old_index, int new_index);
+ };
+
// Retrieve interceptors.
InterceptorInfo* GetNamedInterceptor();
InterceptorInfo* GetIndexedInterceptor();
@@ -2531,17 +2533,22 @@ class FixedDoubleArray: public FixedArrayBase {
class WeakFixedArray : public FixedArray {
public:
- enum SearchForDuplicates { kAlwaysAdd, kAddIfNotFound };
-
// If |maybe_array| is not a WeakFixedArray, a fresh one will be allocated.
- static Handle<WeakFixedArray> Add(
- Handle<Object> maybe_array, Handle<HeapObject> value,
- SearchForDuplicates search_for_duplicates = kAlwaysAdd,
- bool* was_present = NULL);
+ // This function does not check if the value exists already, callers must
+ // ensure this themselves if necessary.
+ static Handle<WeakFixedArray> Add(Handle<Object> maybe_array,
+ Handle<HeapObject> value,
+ int* assigned_index = NULL);
// Returns true if an entry was found and removed.
bool Remove(Handle<HeapObject> value);
+ class NullCallback {
+ public:
+ static void Callback(Object* value, int old_index, int new_index) {}
+ };
+
+ template <class CompactionCallback>
void Compact();
inline Object* Get(int index) const;
@@ -5468,6 +5475,8 @@ class Map: public HeapObject {
// the given prototype's map).
static Handle<PrototypeInfo> GetOrCreatePrototypeInfo(
Handle<JSObject> prototype, Isolate* isolate);
+ static Handle<PrototypeInfo> GetOrCreatePrototypeInfo(
+ Handle<Map> prototype_map, Isolate* isolate);
// [prototype chain validity cell]: Associated with a prototype object,
// stored in that object's map's PrototypeInfo, indicates that prototype
@@ -6037,9 +6046,15 @@ class Box : public Struct {
// Container for metadata stored on each prototype map.
class PrototypeInfo : public Struct {
public:
+ static const int UNREGISTERED = -1;
+
// [prototype_users]: WeakFixedArray containing maps using this prototype,
// or Smi(0) if uninitialized.
DECL_ACCESSORS(prototype_users, Object)
+ // [registry_slot]: Slot in prototype's user registry where this user
+ // is stored. Returns UNREGISTERED if this prototype has not been registered.
+ inline int registry_slot() const;
+ inline void set_registry_slot(int slot);
// [validity_cell]: Cell containing the validity bit for prototype chains
// going through this object, or Smi(0) if uninitialized.
DECL_ACCESSORS(validity_cell, Object)
@@ -6053,7 +6068,8 @@ class PrototypeInfo : public Struct {
DECLARE_VERIFIER(PrototypeInfo)
static const int kPrototypeUsersOffset = HeapObject::kHeaderSize;
- static const int kValidityCellOffset = kPrototypeUsersOffset + kPointerSize;
+ static const int kRegistrySlotOffset = kPrototypeUsersOffset + kPointerSize;
+ static const int kValidityCellOffset = kRegistrySlotOffset + kPointerSize;
static const int kConstructorNameOffset = kValidityCellOffset + kPointerSize;
static const int kSize = kConstructorNameOffset + kPointerSize;
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698