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

Unified Diff: src/factory.cc

Issue 268063008: Replace NewFunctionWithPrototype(name, prototype) by NewFunction(name) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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') | src/runtime.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 a8035d8a47ad819e0ce53a4df934c52db3a59bce..0c79e6c1783f9f441b46dae216527f1edfa3c06e 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1203,11 +1203,14 @@ Handle<JSFunction> Factory::NewFunction(Handle<Map> map,
Handle<JSFunction> Factory::NewFunction(Handle<String> name,
- Handle<Code> code,
- MaybeHandle<Object> maybe_prototype) {
+ MaybeHandle<Object> maybe_prototype,
+ MaybeHandle<Code> maybe_code) {
Handle<SharedFunctionInfo> info = NewSharedFunctionInfo(name);
ASSERT(info->strict_mode() == SLOPPY);
- info->set_code(*code);
+ Handle<Code> code;
+ if (maybe_code.ToHandle(&code)) {
+ info->set_code(*code);
+ }
Handle<Context> context(isolate()->context()->native_context());
Handle<Map> map = maybe_prototype.is_null()
? isolate()->sloppy_function_without_prototype_map()
@@ -1221,15 +1224,8 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name,
}
-Handle<JSFunction> Factory::NewFunctionWithPrototype(Handle<String> name,
- Handle<Object> prototype) {
- Handle<SharedFunctionInfo> info = NewSharedFunctionInfo(name);
- ASSERT(info->strict_mode() == SLOPPY);
- Handle<Context> context(isolate()->context()->native_context());
- Handle<Map> map = isolate()->sloppy_function_map();
- Handle<JSFunction> result = NewFunction(map, info, context);
- result->set_prototype_or_initial_map(*prototype);
- return result;
+Handle<JSFunction> Factory::NewFunction(Handle<String> name) {
+ return NewFunction(name, the_hole_value(), MaybeHandle<Code>());
}
@@ -1240,7 +1236,7 @@ Handle<JSFunction> Factory::NewFunction(MaybeHandle<Object> maybe_prototype,
Handle<Code> code,
bool force_initial_map) {
// Allocate the function
- Handle<JSFunction> function = NewFunction(name, code, maybe_prototype);
+ Handle<JSFunction> function = NewFunction(name, maybe_prototype, code);
if (force_initial_map ||
type != JS_OBJECT_TYPE ||
« no previous file with comments | « src/factory.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698