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
This commit is contained in:
ulan@chromium.org 2012-06-05 13:15:35 +00:00
parent c13dd2ece6
commit 1a80bc33a2
2 changed files with 6 additions and 12 deletions

View File

@ -2092,14 +2092,10 @@ bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
Handle<JSFunction> function
= Handle<JSFunction>(JSFunction::cast(function_object));
builtins->set_javascript_builtin(id, *function);
Handle<SharedFunctionInfo> shared
= Handle<SharedFunctionInfo>(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;
}

View File

@ -2182,7 +2182,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetCode) {
Handle<JSFunction> fun = Handle<JSFunction>::cast(code);
Handle<SharedFunctionInfo> 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<SharedFunctionInfo> 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<SharedFunctionInfo> 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();
}