Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 56fde30433158490204a50da96438175c046862b..89abe5043358c14642512f8d677104151b72a2d5 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -1566,6 +1566,21 @@ MaybeObject* JSObject::AllocateStorageForMap(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. |
+ Map* original_map = map(); |
+ MaybeObject* maybe_result = GeneralizeFieldRepresentation( |
+ 0, Representation::None(), ALLOW_AS_CONSTANT); |
+ JSObject* result; |
+ if (FLAG_trace_migration && maybe_result->To(&result)) { |
+ PrintInstanceMigration(stdout, original_map, result->map()); |
+ } |
+ return maybe_result; |
+} |
+ |
+ |
MaybeObject* JSObject::TryMigrateInstance() { |
Map* new_map = map()->CurrentMapForDeprecated(); |
if (new_map == NULL) return Smi::FromInt(0); |
@@ -5714,23 +5729,19 @@ Object* JSReceiver::GetConstructor() { |
} |
-bool JSReceiver::HasProperty(Handle<JSReceiver> object, |
- Handle<Name> name) { |
- if (object->IsJSProxy()) { |
- Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
- return JSProxy::HasPropertyWithHandler(proxy, name); |
+bool JSReceiver::HasProperty(Name* name) { |
+ if (IsJSProxy()) { |
+ return JSProxy::cast(this)->HasPropertyWithHandler(name); |
} |
- return object->GetPropertyAttribute(*name) != ABSENT; |
+ return GetPropertyAttribute(name) != ABSENT; |
} |
-bool JSReceiver::HasLocalProperty(Handle<JSReceiver> object, |
- Handle<Name> name) { |
- if (object->IsJSProxy()) { |
- Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
- return JSProxy::HasPropertyWithHandler(proxy, name); |
+bool JSReceiver::HasLocalProperty(Name* name) { |
+ if (IsJSProxy()) { |
+ return JSProxy::cast(this)->HasPropertyWithHandler(name); |
} |
- return object->GetLocalPropertyAttribute(*name) != ABSENT; |
+ return GetLocalPropertyAttribute(name) != ABSENT; |
} |
@@ -5772,23 +5783,21 @@ MaybeObject* JSReceiver::GetIdentityHash(CreationFlag flag) { |
} |
-bool JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { |
- if (object->IsJSProxy()) { |
- Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
- return JSProxy::HasElementWithHandler(proxy, index); |
+bool JSReceiver::HasElement(uint32_t index) { |
+ if (IsJSProxy()) { |
+ return JSProxy::cast(this)->HasElementWithHandler(index); |
} |
- return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver( |
- *object, index, true) != ABSENT; |
+ return JSObject::cast(this)->GetElementAttributeWithReceiver( |
+ this, index, true) != ABSENT; |
} |
-bool JSReceiver::HasLocalElement(Handle<JSReceiver> object, uint32_t index) { |
- if (object->IsJSProxy()) { |
- Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
- return JSProxy::HasElementWithHandler(proxy, index); |
+bool JSReceiver::HasLocalElement(uint32_t index) { |
+ if (IsJSProxy()) { |
+ return JSProxy::cast(this)->HasElementWithHandler(index); |
} |
- return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver( |
- *object, index, false) != ABSENT; |
+ return JSObject::cast(this)->GetElementAttributeWithReceiver( |
+ this, index, false) != ABSENT; |
} |