From 1a80bc33a2a7018ee9dac3d8d41d9739ca3238c4 Mon Sep 17 00:00:00 2001 From: "ulan@chromium.org" Date: Tue, 5 Jun 2012 13:15:35 +0000 Subject: [PATCH] Replace SharedFunctionInfo::EnsureCompiled with JSFunction::CompileLazy where possible. After we get rid of all SharedFunctionInfo::EnsureCompiled calls, it will be possible to remove the HasTrivialOuterContext() condition in Scope::AllowsLazyCompilation. R=mstarzinger@chromium.org Review URL: https://chromiumcodereview.appspot.com/10542002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11715 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/bootstrapper.cc | 8 ++------ src/runtime.cc | 10 ++++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index a20f87b..3805a30 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -2092,14 +2092,10 @@ bool Genesis::InstallJSBuiltins(Handle builtins) { Handle function = Handle(JSFunction::cast(function_object)); builtins->set_javascript_builtin(id, *function); - Handle shared - = Handle(function->shared()); - if (!SharedFunctionInfo::EnsureCompiled(shared, CLEAR_EXCEPTION)) { + if (!JSFunction::CompileLazy(function, CLEAR_EXCEPTION)) { return false; } - // Set the code object on the function object. - function->ReplaceCode(function->shared()->code()); - builtins->set_javascript_builtin_code(id, shared->code()); + builtins->set_javascript_builtin_code(id, function->shared()->code()); } return true; } diff --git a/src/runtime.cc b/src/runtime.cc index c8ad030..331d2d4 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -2182,7 +2182,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetCode) { Handle fun = Handle::cast(code); Handle shared(fun->shared()); - if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) { + if (!JSFunction::CompileLazy(fun, KEEP_EXCEPTION)) { return Failure::Exception(); } // Since we don't store the source for this we should never @@ -12503,8 +12503,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleFunction) { ASSERT(args.length() == 1); // Get the function and make sure it is compiled. CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); - Handle shared(func->shared()); - if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) { + if (!JSFunction::CompileLazy(func, KEEP_EXCEPTION)) { return Failure::Exception(); } func->code()->PrintLn(); @@ -12519,11 +12518,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleConstructor) { ASSERT(args.length() == 1); // Get the function and make sure it is compiled. CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); - Handle shared(func->shared()); - if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) { + if (!JSFunction::CompileLazy(func, KEEP_EXCEPTION)) { return Failure::Exception(); } - shared->construct_stub()->PrintLn(); + func->shared()->construct_stub()->PrintLn(); #endif // DEBUG return isolate->heap()->undefined_value(); } -- 2.7.4