Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index a14fccb073fb7936f1efe9f83bf9d33ddad1646a..9b17cc4cf1808dfba69108db3d3b5dead98627d2 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -58,7 +58,8 @@ PropertyDetails::PropertyDetails(Smi* smi) { |
Smi* PropertyDetails::AsSmi() { |
- return Smi::FromInt(value_); |
+ int value = value_ << 1; |
danno
2013/04/24 15:23:00
Comment why this is needed?
Toon Verwaest
2013/04/25 10:59:38
Done.
|
+ return Smi::FromInt(value >> 1); |
} |
@@ -1475,21 +1476,6 @@ MaybeObject* JSObject::ResetElements() { |
} |
-MaybeObject* JSObject::AddFastPropertyUsingMap(Map* map) { |
- ASSERT(this->map()->NumberOfOwnDescriptors() + 1 == |
- map->NumberOfOwnDescriptors()); |
- if (this->map()->unused_property_fields() == 0) { |
- int new_size = properties()->length() + map->unused_property_fields() + 1; |
- FixedArray* new_properties; |
- MaybeObject* maybe_properties = properties()->CopySize(new_size); |
- if (!maybe_properties->To(&new_properties)) return maybe_properties; |
- set_properties(new_properties); |
- } |
- set_map(map); |
- return this; |
-} |
- |
- |
MaybeObject* JSObject::TransitionToMap(Map* map) { |
ASSERT(this->map()->inobject_properties() == map->inobject_properties()); |
ElementsKind expected_kind = this->map()->elements_kind(); |
@@ -1511,6 +1497,14 @@ MaybeObject* JSObject::TransitionToMap(Map* map) { |
} |
+MaybeObject* JSObject::MigrateInstance() { |
+ // Converting any field to the most specific type will cause the |
+ // GeneralizeFieldRepresentation algorithm to create the most general existing |
+ // transition that matches the object. This achieves what is needed. |
+ return GeneralizeFieldRepresentation(0, Representation::Smi()); |
+} |
+ |
+ |
Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) { |
AssertNoAllocation no_gc; |
if (!map->HasTransitionArray()) return Handle<String>::null(); |
@@ -2239,6 +2233,24 @@ void DescriptorArray::SetSortedKey(int descriptor_index, int pointer) { |
} |
+void DescriptorArray::SetRepresentation(int descriptor_index, |
+ Representation representation) { |
+ ASSERT(!representation.IsNone()); |
+ PropertyDetails details = GetDetails(descriptor_index); |
+ set(ToDetailsIndex(descriptor_index), |
+ details.set_representation(representation).AsSmi()); |
+} |
+ |
+ |
+void DescriptorArray::InitializeRepresentations(Representation representation) { |
+ int length = number_of_descriptors(); |
+ for (int i = 0; i < length; i++) { |
+ PropertyDetails details = GetDetails(i); |
+ set(ToDetailsIndex(i), details.set_representation(representation).AsSmi()); |
+ } |
+} |
+ |
+ |
Object** DescriptorArray::GetValueSlot(int descriptor_number) { |
ASSERT(descriptor_number < number_of_descriptors()); |
return HeapObject::RawField( |
@@ -2304,6 +2316,7 @@ void DescriptorArray::Set(int descriptor_number, |
number_of_descriptors()); |
ASSERT(desc->GetDetails().descriptor_index() > 0); |
+ ASSERT(!desc->GetDetails().representation().IsNone()); |
NoIncrementalWriteBarrierSet(this, |
ToKeyIndex(descriptor_number), |
desc->GetKey()); |
@@ -2322,6 +2335,7 @@ void DescriptorArray::Set(int descriptor_number, Descriptor* desc) { |
ASSERT(desc->GetDetails().descriptor_index() <= |
number_of_descriptors()); |
ASSERT(desc->GetDetails().descriptor_index() > 0); |
+ ASSERT(!desc->GetDetails().representation().IsNone()); |
set(ToKeyIndex(descriptor_number), desc->GetKey()); |
set(ToValueIndex(descriptor_number), desc->GetValue()); |
@@ -3535,6 +3549,28 @@ bool Map::is_observed() { |
} |
+void Map::invalidate_transition() { |
+ set_bit_field3(InvalidTransition::update(bit_field3(), true)); |
+} |
+ |
+ |
+bool Map::is_invalid_transition() { |
+ if (!FLAG_track_fields) return false; |
+ return InvalidTransition::decode(bit_field3()); |
+} |
+ |
+ |
+bool Map::CanTransitionBeInvalidated() { |
danno
2013/04/24 15:23:00
CanBeDeprecated
Toon Verwaest
2013/04/25 10:59:38
Done.
|
+ if (!FLAG_track_fields) return false; |
+ int descriptor = LastAdded(); |
+ for (int i = 0; i <= descriptor; i++) { |
+ PropertyDetails details = instance_descriptors()->GetDetails(i); |
+ if (!details.representation().IsTagged()) return true; |
+ } |
+ return false; |
+} |
+ |
+ |
void Map::NotifyLeafMapLayoutChange() { |
dependent_code()->DeoptimizeDependentCodeGroup( |
GetIsolate(), |