Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index e3a19a1e4ba988a0b19b00219e8ed50d83cb3a23..a52b95719db05276362f7325ec32be751b37d87a 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1268,11 +1268,6 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
? isolate()->sloppy_function_with_readonly_prototype_map() |
: isolate()->sloppy_function_map(); |
Handle<JSFunction> result = NewFunction(map, name, code); |
- if (!prototype->IsTheHole()) { |
- Handle<JSObject> js_proto = Handle<JSObject>::cast(prototype); |
- Handle<Map> new_map = Map::CopyAsPrototypeMap(handle(js_proto->map())); |
- JSObject::MigrateToMap(js_proto, new_map); |
- } |
result->set_prototype_or_initial_map(*prototype); |
return result; |
} |
@@ -1293,9 +1288,9 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
if (prototype->IsTheHole() && !function->shared()->is_generator()) { |
prototype = NewFunctionPrototype(function); |
} |
+ |
initial_map->set_prototype(*prototype); |
- function->set_initial_map(*initial_map); |
- initial_map->set_constructor(*function); |
+ JSFunction::SetInitialMap(function, initial_map); |
return function; |
} |
@@ -1323,7 +1318,7 @@ Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) { |
// maps between prototypes of different constructors. |
Handle<JSFunction> object_function(native_context->object_function()); |
DCHECK(object_function->has_initial_map()); |
- new_map = Map::CopyAsPrototypeMap(handle(object_function->initial_map())); |
+ new_map = handle(object_function->initial_map()); |
} |
Handle<JSObject> prototype = NewJSObjectFromMap(new_map); |