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

Unified Diff: src/handles.cc

Issue 6542017: Minor refactoring: unify lazy function compilation for in loop and no in loop variants. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Switching to enum Created 9 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/handles.cc
diff --git a/src/handles.cc b/src/handles.cc
index d625d644c776e744251d69bfc7f582b77751c1b2..c5921c7302da26f9d95493d33dfa90e229bb3cf0 100644
--- a/src/handles.cc
+++ b/src/handles.cc
@@ -834,14 +834,16 @@ bool CompileLazyShared(Handle<SharedFunctionInfo> shared,
}
-bool CompileLazy(Handle<JSFunction> function,
- ClearExceptionFlag flag) {
+static bool CompileLazyFunction(Handle<JSFunction> 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<JSFunction> function,
}
+bool CompileLazy(Handle<JSFunction> function,
+ ClearExceptionFlag flag) {
+ return CompileLazyFunction(function, flag, NOT_IN_LOOP);
+}
+
+
bool CompileLazyInLoop(Handle<JSFunction> 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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698