From 6aec28f44733d0bb0d553b3c4631ededf498b002 Mon Sep 17 00:00:00 2001 From: "antonm@chromium.org" Date: Mon, 21 Feb 2011 18:28:20 +0000 Subject: [PATCH] Minor refactoring: unify lazy function compilation for in loop and no in loop variants. Review URL: http://codereview.chromium.org/6542017 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6873 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/handles.cc | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/handles.cc b/src/handles.cc index d625d644c7..c5921c7302 100644 --- a/src/handles.cc +++ b/src/handles.cc @@ -834,14 +834,16 @@ bool CompileLazyShared(Handle shared, } -bool CompileLazy(Handle function, - ClearExceptionFlag flag) { +static bool CompileLazyFunction(Handle function, + ClearExceptionFlag flag, + InLoopFlag in_loop_flag) { bool result = true; if (function->shared()->is_compiled()) { function->ReplaceCode(function->shared()->code()); function->shared()->set_code_age(0); } else { CompilationInfo info(function); + if (in_loop_flag == IN_LOOP) info.MarkAsInLoop(); result = CompileLazyHelper(&info, flag); ASSERT(!result || function->is_compiled()); } @@ -852,22 +854,15 @@ bool CompileLazy(Handle function, } +bool CompileLazy(Handle function, + ClearExceptionFlag flag) { + return CompileLazyFunction(function, flag, NOT_IN_LOOP); +} + + bool CompileLazyInLoop(Handle function, ClearExceptionFlag flag) { - bool result = true; - if (function->shared()->is_compiled()) { - function->ReplaceCode(function->shared()->code()); - function->shared()->set_code_age(0); - } else { - CompilationInfo info(function); - info.MarkAsInLoop(); - result = CompileLazyHelper(&info, flag); - ASSERT(!result || function->is_compiled()); - } - if (result && function->is_compiled()) { - PROFILE(FunctionCreateEvent(*function)); - } - return result; + return CompileLazyFunction(function, flag, IN_LOOP); }