Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index ea84ebf335f99af66765fdd5a25b3a4738305bfd..34831685b9a227fb5cef41024b547a3509426136 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -88,6 +88,7 @@ |
// - ScopeInfo |
// - TransitionArray |
// - ScriptContextTable |
+// - WeakFixedArray |
// - FixedDoubleArray |
// - ExternalArray |
// - ExternalUint8ClampedArray |
@@ -942,6 +943,7 @@ template <class C> inline bool Is(Object* obj); |
V(DependentCode) \ |
V(FixedArray) \ |
V(FixedDoubleArray) \ |
+ V(WeakFixedArray) \ |
V(ConstantPoolArray) \ |
V(Context) \ |
V(ScriptContextTable) \ |
@@ -1815,6 +1817,10 @@ class JSObject: public JSReceiver { |
static void OptimizeAsPrototype(Handle<JSObject> object, |
PrototypeOptimizationMode mode); |
static void ReoptimizeIfPrototype(Handle<JSObject> object); |
+ static void RegisterPrototypeUser(Handle<JSObject> prototype, |
+ Handle<HeapObject> user); |
+ static void UnregisterPrototypeUser(Handle<JSObject> prototype, |
+ Handle<HeapObject> user); |
// Retrieve interceptors. |
InterceptorInfo* GetNamedInterceptor(); |
@@ -2588,6 +2594,43 @@ class FixedDoubleArray: public FixedArrayBase { |
}; |
+class WeakFixedArray : public FixedArray { |
+ public: |
+ // If |maybe_array| is not a WeakFixedArray, a fresh one will be allocated. |
+ static Handle<WeakFixedArray> Add(Handle<Object> maybe_array, |
+ Handle<HeapObject> value, |
+ bool may_be_duplicate = false); |
ulan
2014/12/15 15:40:36
Please use enum with descriptive name instead of b
Jakob Kummerow
2014/12/15 16:18:49
Done.
|
+ |
+ void Remove(Handle<HeapObject> value); |
+ |
+ inline Object* get(int index) const; |
+ inline int length() const; |
ulan
2014/12/15 15:40:36
Nit: I personally don't like non-virtual overrides
Jakob Kummerow
2014/12/15 16:18:49
Done. (I don't see the need, but I'm happy to make
|
+ |
+ DECLARE_CAST(WeakFixedArray) |
+ |
+ private: |
+ static const int kLastUsedIndexIndex = 0; |
+ static const int kFirstIndex = 1; |
+ |
+ static Handle<WeakFixedArray> Allocate( |
+ Isolate* isolate, int size, Handle<WeakFixedArray> initialize_from); |
+ |
+ static void Set(Handle<WeakFixedArray> array, int index, |
+ Handle<HeapObject> value); |
+ inline void clear(int index); |
+ inline bool IsEmptySlot(int index) const; |
+ |
+ inline int last_used_index() const; |
+ inline void set_last_used_index(int index); |
+ |
+ // Disallow inherited setters. |
+ void set(int index, Smi* value); |
+ void set(int index, Object* value); |
+ void set(int index, Object* value, WriteBarrierMode mode); |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(WeakFixedArray); |
+}; |
+ |
+ |
// ConstantPoolArray describes a fixed-sized array containing constant pool |
// entries. |
// |
@@ -5883,6 +5926,11 @@ class Map: public HeapObject { |
// [prototype]: implicit prototype object. |
DECL_ACCESSORS(prototype, Object) |
+ // TODO(jkummerow): make set_prototype private. |
+ void SetPrototype(Handle<Object> prototype, |
+ PrototypeOptimizationMode proto_mode = FAST_PROTOTYPE); |
+ bool ShouldRegisterAsPrototypeUser(Handle<JSObject> prototype); |
+ bool CanUseOptimizationsBasedOnPrototypeRegistry(); |
// [constructor]: points back to the function responsible for this map. |
DECL_ACCESSORS(constructor, Object) |
@@ -6212,10 +6260,11 @@ class Map: public HeapObject { |
// the original map. That way we can transition to the same map if the same |
// prototype is set, rather than creating a new map every time. The |
// transitions are in the form of a map where the keys are prototype objects |
- // and the values are the maps the are transitioned to. |
+ // and the values are the maps they transition to. |
static const int kMaxCachedPrototypeTransitions = 256; |
static Handle<Map> TransitionToPrototype(Handle<Map> map, |
- Handle<Object> prototype); |
+ Handle<Object> prototype, |
+ PrototypeOptimizationMode mode); |
static const int kMaxPreAllocatedPropertyFields = 255; |