Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 7a2d46c4b4315a96ad86ef7cb8c79458fef66b9b..556069cbec1b4a07360a0ee831774d913d42d1fd 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -14329,14 +14329,19 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyContextDisposed) { |
} |
-RUNTIME_FUNCTION(MaybeObject*, Runtime_MigrateInstance) { |
+RUNTIME_FUNCTION(MaybeObject*, Runtime_TryMigrateInstance) { |
HandleScope scope(isolate); |
ASSERT(args.length() == 1); |
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
if (!object->IsJSObject()) return Smi::FromInt(0); |
Handle<JSObject> js_object = Handle<JSObject>::cast(object); |
if (!js_object->map()->is_deprecated()) return Smi::FromInt(0); |
- JSObject::MigrateInstance(js_object); |
+ // This call must not cause lazy deopts, because it's called from deferred |
+ // code where we can't handle lazy deopts for lack of a suitable bailout |
+ // ID. So we just try migration and signal failure if necessary, |
+ // which will also trigger a deopt. |
+ Handle<Object> result = JSObject::TryMigrateInstance(js_object); |
+ if (result.is_null()) return Smi::FromInt(0); |
return *object; |
} |