Index: src/transitions-inl.h |
diff --git a/src/transitions-inl.h b/src/transitions-inl.h |
index 5030616e4ea4ecc21bcf1092f80c753e0f849eb8..17c42edce2e50daf51a7a9c212cf33e4cde30807 100644 |
--- a/src/transitions-inl.h |
+++ b/src/transitions-inl.h |
@@ -69,12 +69,14 @@ void TransitionArray::ClearElementsTransition() { |
bool TransitionArray::HasElementsTransition() { |
- return get(kElementsTransitionIndex) != Smi::FromInt(0); |
+ return IsFullTransitionArray() && |
+ get(kElementsTransitionIndex) != Smi::FromInt(0); |
} |
void TransitionArray::set_elements_transition(Map* transition_map, |
WriteBarrierMode mode) { |
+ ASSERT(IsFullTransitionArray()); |
Heap* heap = GetHeap(); |
WRITE_FIELD(this, kElementsTransitionOffset, transition_map); |
CONDITIONAL_WRITE_BARRIER( |
@@ -121,12 +123,13 @@ void TransitionArray::set_back_pointer_storage(Object* back_pointer, |
bool TransitionArray::HasPrototypeTransitions() { |
- Object* prototype_transitions = get(kPrototypeTransitionsIndex); |
- return prototype_transitions != Smi::FromInt(0); |
+ return IsFullTransitionArray() && |
+ get(kPrototypeTransitionsIndex) != Smi::FromInt(0); |
} |
FixedArray* TransitionArray::GetPrototypeTransitions() { |
+ ASSERT(IsFullTransitionArray()); |
Object* prototype_transitions = get(kPrototypeTransitionsIndex); |
return FixedArray::cast(prototype_transitions); |
} |
@@ -140,7 +143,7 @@ HeapObject* TransitionArray::UncheckedPrototypeTransitions() { |
void TransitionArray::SetPrototypeTransitions(FixedArray* transitions, |
WriteBarrierMode mode) { |
- ASSERT(this != NULL); |
+ ASSERT(IsFullTransitionArray()); |
ASSERT(transitions->IsFixedArray()); |
Heap* heap = GetHeap(); |
WRITE_FIELD(this, kPrototypeTransitionsOffset, transitions); |
@@ -156,6 +159,7 @@ Object** TransitionArray::GetPrototypeTransitionsSlot() { |
Object** TransitionArray::GetKeySlot(int transition_number) { |
+ ASSERT(!IsSimpleTransition()); |
ASSERT(transition_number < number_of_transitions()); |
return HeapObject::RawField( |
reinterpret_cast<HeapObject*>(this), |
@@ -164,24 +168,39 @@ Object** TransitionArray::GetKeySlot(int transition_number) { |
String* TransitionArray::GetKey(int transition_number) { |
+ if (IsSimpleTransition()) { |
+ Map* target = GetTarget(kSimpleTransitionIndex); |
+ int descriptor = target->LastAdded(); |
+ String* key = target->instance_descriptors()->GetKey(descriptor); |
+ return key; |
+ } |
ASSERT(transition_number < number_of_transitions()); |
return String::cast(get(ToKeyIndex(transition_number))); |
} |
void TransitionArray::SetKey(int transition_number, String* key) { |
+ ASSERT(!IsSimpleTransition()); |
ASSERT(transition_number < number_of_transitions()); |
set(ToKeyIndex(transition_number), key); |
} |
Map* TransitionArray::GetTarget(int transition_number) { |
+ if (IsSimpleTransition()) { |
+ ASSERT(transition_number == kSimpleTransitionIndex); |
+ return Map::cast(get(kSimpleTransitionTarget)); |
+ } |
ASSERT(transition_number < number_of_transitions()); |
return Map::cast(get(ToTargetIndex(transition_number))); |
} |
void TransitionArray::SetTarget(int transition_number, Map* value) { |
+ if (IsSimpleTransition()) { |
+ ASSERT(transition_number == kSimpleTransitionIndex); |
+ return set(kSimpleTransitionTarget, value); |
+ } |
ASSERT(transition_number < number_of_transitions()); |
set(ToTargetIndex(transition_number), value); |
} |