Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 96ad7927f861f80bda6379eeee00da4b1a72bfe9..b47a27ecc75213a905b52c6af21060d9420896fd 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -3408,14 +3408,67 @@ void Map::set_bit_field3(int value) { |
} |
-FixedArray* Map::unchecked_prototype_transitions() { |
- return reinterpret_cast<FixedArray*>( |
- READ_FIELD(this, kPrototypeTransitionsOffset)); |
+Object* Map::GetBackPointer() { |
+ Object* object = READ_FIELD(this, kPrototypeTransitionsOrBackPointerOffset); |
+ if (object->IsFixedArray()) { |
+ return FixedArray::cast(object)->get(kProtoTransitionBackPointerOffset); |
+ } else { |
+ return object; |
+ } |
+} |
+ |
+ |
+void Map::SetBackPointer(Object* value, WriteBarrierMode mode) { |
+ Heap* heap = GetHeap(); |
+ ASSERT(instance_type() >= FIRST_JS_RECEIVER_TYPE); |
+ ASSERT((value->IsUndefined() && GetBackPointer()->IsMap()) || |
+ (value->IsMap() && GetBackPointer()->IsUndefined())); |
+ Object* object = READ_FIELD(this, kPrototypeTransitionsOrBackPointerOffset); |
+ if (object->IsFixedArray()) { |
+ FixedArray::cast(object)->set( |
+ kProtoTransitionBackPointerOffset, value, mode); |
+ } else { |
+ WRITE_FIELD(this, kPrototypeTransitionsOrBackPointerOffset, value); |
+ CONDITIONAL_WRITE_BARRIER( |
+ heap, this, kPrototypeTransitionsOrBackPointerOffset, value, mode); |
+ } |
+} |
+ |
+ |
+FixedArray* Map::prototype_transitions() { |
+ Object* object = READ_FIELD(this, kPrototypeTransitionsOrBackPointerOffset); |
+ if (object->IsFixedArray()) { |
+ return FixedArray::cast(object); |
+ } else { |
+ return GetHeap()->empty_fixed_array(); |
+ } |
+} |
+ |
+ |
+void Map::set_prototype_transitions(FixedArray* value, WriteBarrierMode mode) { |
+ Heap* heap = GetHeap(); |
+ ASSERT(value != heap->empty_fixed_array()); |
+ value->set(kProtoTransitionBackPointerOffset, GetBackPointer()); |
+ WRITE_FIELD(this, kPrototypeTransitionsOrBackPointerOffset, value); |
+ CONDITIONAL_WRITE_BARRIER( |
+ heap, this, kPrototypeTransitionsOrBackPointerOffset, value, mode); |
+ |
+} |
+ |
+ |
+void Map::init_prototype_transitions(Object* undefined) { |
+ ASSERT(undefined->IsUndefined()); |
+ WRITE_FIELD(this, kPrototypeTransitionsOrBackPointerOffset, undefined); |
+} |
+ |
+ |
+HeapObject* Map::unchecked_prototype_transitions() { |
+ Object* object = READ_FIELD(this, kPrototypeTransitionsOrBackPointerOffset); |
+ return reinterpret_cast<HeapObject*>(object); |
} |
ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) |
-ACCESSORS(Map, prototype_transitions, FixedArray, kPrototypeTransitionsOffset) |
ACCESSORS(Map, constructor, Object, kConstructorOffset) |
ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) |