Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 6f38bdc5872084c4bdeb673b954804fdbf2893ab..120d8edfe8704cc1143887a2283ac86427663f4f 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -3326,6 +3326,15 @@ void JSObject::MigrateToMap(Handle<JSObject> object, Handle<Map> new_map, |
// When adding code here, add a DisallowHeapAllocation too. |
} |
+void JSObject::ForceSetPrototype(Handle<JSObject> object, |
+ Handle<Object> proto) { |
+ // object.__proto__ = proto; |
+ Handle<Map> old_map = Handle<Map>(object->map()); |
+ Handle<Map> new_map = Map::Copy(old_map, "ForceSetPrototype"); |
+ Map::SetPrototype(new_map, proto, FAST_PROTOTYPE); |
+ JSObject::MigrateToMap(object, new_map); |
+} |
+ |
int Map::NumberOfFields() { |
DescriptorArray* descriptors = instance_descriptors(); |
int result = 0; |