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

Unified Diff: src/factory.cc

Issue 1481493003: Fix JSFunction's in-object properties initialization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments Created 5 years, 1 month 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') | src/heap/heap.h » ('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 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;
}
« no previous file with comments | « src/factory.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698