Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index a14fccb073fb7936f1efe9f83bf9d33ddad1646a..88f45067f23be6192fa64b0619e85793f5c3c2cd 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; |
+ 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 |
+ // GeneralizeFieldStorage algorithm to create the most general existing |
+ // transition that matches the object. This achieves what is needed. |
+ return GeneralizeFieldStorage(0, SMI); |
+} |
+ |
+ |
Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) { |
AssertNoAllocation no_gc; |
if (!map->HasTransitionArray()) return Handle<String>::null(); |
@@ -2239,6 +2233,21 @@ void DescriptorArray::SetSortedKey(int descriptor_index, int pointer) { |
} |
+void DescriptorArray::SetStorageType(int descriptor_index, StorageType type) { |
+ PropertyDetails details = GetDetails(descriptor_index); |
+ set(ToDetailsIndex(descriptor_index), details.set_storage_type(type).AsSmi()); |
+} |
+ |
+ |
+void DescriptorArray::InitializeStorageTypes(StorageType storage_type) { |
+ int length = number_of_descriptors(); |
+ for (int i = 0; i < length; i++) { |
+ PropertyDetails details = GetDetails(i); |
+ set(ToDetailsIndex(i), details.set_storage_type(storage_type).AsSmi()); |
+ } |
+} |
+ |
+ |
Object** DescriptorArray::GetValueSlot(int descriptor_number) { |
ASSERT(descriptor_number < number_of_descriptors()); |
return HeapObject::RawField( |
@@ -3535,6 +3544,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() { |
+ if (!FLAG_track_fields) return false; |
+ int descriptor = LastAdded(); |
+ for (int i = 0; i <= descriptor; i++) { |
+ PropertyDetails details = instance_descriptors()->GetDetails(i); |
+ if (details.storage_type() != TAGGED) return true; |
+ } |
+ return false; |
+} |
+ |
+ |
void Map::NotifyLeafMapLayoutChange() { |
dependent_code()->DeoptimizeDependentCodeGroup( |
GetIsolate(), |