Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: src/factory.cc

Issue 238773009: Set code on the SharedFunctionInfo before creating the function. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/factory.h ('k') | test/cctest/test-alloc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « src/factory.h ('k') | test/cctest/test-alloc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698