Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 18641c0ceb4e2d774884552428f21e2d97692ada..ee05b40fcaa5681769c40fbaccb9ac24119b1977 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1173,9 +1173,13 @@ DEFINE_ERROR(TypeError, type_error) |
#undef DEFINE_ERROR |
-void Factory::InitializeFunction(Handle<JSFunction> function, |
- Handle<SharedFunctionInfo> info, |
- Handle<Context> context) { |
+Handle<JSFunction> Factory::NewFunction(Handle<Map> map, |
+ Handle<SharedFunctionInfo> info, |
+ Handle<Context> context, |
+ PretenureFlag pretenure) { |
+ AllocationSpace space = pretenure == TENURED ? OLD_SPACE : NEW_SPACE; |
+ Handle<JSFunction> function = New<JSFunction>(map, space); |
+ |
function->initialize_properties(); |
function->initialize_elements(); |
function->set_shared(*info); |
@@ -1184,17 +1188,8 @@ void Factory::InitializeFunction(Handle<JSFunction> function, |
function->set_prototype_or_initial_map(*the_hole_value()); |
function->set_literals_or_bindings(*empty_fixed_array()); |
function->set_next_function_link(*undefined_value(), SKIP_WRITE_BARRIER); |
-} |
- |
- |
-Handle<JSFunction> Factory::NewFunction(Handle<Map> map, |
- Handle<SharedFunctionInfo> info, |
- Handle<Context> context, |
- PretenureFlag pretenure) { |
- AllocationSpace space = pretenure == TENURED ? OLD_SPACE : NEW_SPACE; |
- Handle<JSFunction> result = New<JSFunction>(map, space); |
- InitializeFunction(result, info, context); |
- return result; |
+ isolate()->heap()->InitializeJSObjectBody(*function, *map, JSFunction::kSize); |
+ return function; |
} |