Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index c823f9ce111e6ede2d648a4c6057ca8d31f3d363..a6fdbd5e76b960b9fb1d3481bfb3e4052c625e54 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1251,12 +1251,7 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
Handle<Code> code, |
bool force_initial_map) { |
// Allocate the function |
- Handle<JSFunction> function = NewFunction(name, the_hole_value()); |
- |
- // Set up the code pointer in both the shared function info and in |
- // the function itself. |
- function->shared()->set_code(*code); |
- function->set_code(*code); |
+ Handle<JSFunction> function = NewFunction(name, code, the_hole_value()); |
if (force_initial_map || |
type != JS_OBJECT_TYPE || |
@@ -1282,12 +1277,7 @@ Handle<JSFunction> Factory::NewFunctionWithPrototype(Handle<String> name, |
Handle<Code> code, |
bool force_initial_map) { |
// Allocate the function. |
- Handle<JSFunction> function = NewFunction(name, prototype); |
- |
- // Set up the code pointer in both the shared function info and in |
- // the function itself. |
- function->shared()->set_code(*code); |
- function->set_code(*code); |
+ Handle<JSFunction> function = NewFunction(name, code, prototype); |
if (force_initial_map || |
type != JS_OBJECT_TYPE || |
@@ -2007,19 +1997,20 @@ Handle<JSFunction> Factory::NewFunction(Handle<SharedFunctionInfo> info, |
Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
- Handle<Object> prototype) { |
+ Handle<Code> code, |
+ MaybeHandle<Object> maybe_prototype) { |
Handle<SharedFunctionInfo> info = NewSharedFunctionInfo(name); |
+ info->set_code(*code); |
Handle<Context> context(isolate()->context()->native_context()); |
- return NewFunction(info, context, prototype); |
+ return NewFunction(info, context, maybe_prototype); |
} |
-Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name, |
- Handle<Code> code) { |
+Handle<JSFunction> Factory::NewFunctionWithPrototype(Handle<String> name, |
+ Handle<Object> prototype) { |
Handle<SharedFunctionInfo> info = NewSharedFunctionInfo(name); |
- info->set_code(*code); |
Handle<Context> context(isolate()->context()->native_context()); |
- return NewFunction(info, context, MaybeHandle<Object>()); |
+ return NewFunction(info, context, prototype); |
} |