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

Unified Diff: src/compiler.cc

Issue 6960009: Version 3.3.5 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 9 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/compiler.h ('k') | src/cpu.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index e9b48cb070e8ecc744b281da8cc6597740091584..985a95124628b5ba02f119a143d8d822106f625a 100755
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -95,21 +95,13 @@ CompilationInfo::CompilationInfo(Handle<JSFunction> closure)
void CompilationInfo::DisableOptimization() {
- if (FLAG_optimize_closures) {
- // If we allow closures optimizations and it's an optimizable closure
- // mark it correspondingly.
- bool is_closure = closure_.is_null() && !scope_->HasTrivialOuterContext();
- if (is_closure) {
- bool is_optimizable_closure =
- !scope_->outer_scope_calls_eval() && !scope_->inside_with();
- if (is_optimizable_closure) {
- SetMode(BASE);
- return;
- }
- }
- }
-
- SetMode(NONOPT);
+ bool is_optimizable_closure =
+ FLAG_optimize_closures &&
+ closure_.is_null() &&
+ !scope_->HasTrivialOuterContext() &&
+ !scope_->outer_scope_calls_eval() &&
+ !scope_->inside_with();
+ SetMode(is_optimizable_closure ? BASE : NONOPT);
}
@@ -121,20 +113,23 @@ void CompilationInfo::DisableOptimization() {
// all. However crankshaft support recompilation of functions, so in this case
// the full compiler need not be be used if a debugger is attached, but only if
// break points has actually been set.
-static bool AlwaysFullCompiler() {
+static bool is_debugging_active() {
#ifdef ENABLE_DEBUGGER_SUPPORT
Isolate* isolate = Isolate::Current();
- if (V8::UseCrankshaft()) {
- return FLAG_always_full_compiler || isolate->debug()->has_break_points();
- } else {
- return FLAG_always_full_compiler || isolate->debugger()->IsDebuggerActive();
- }
+ return V8::UseCrankshaft() ?
+ isolate->debug()->has_break_points() :
+ isolate->debugger()->IsDebuggerActive();
#else
- return FLAG_always_full_compiler;
+ return false;
#endif
}
+static bool AlwaysFullCompiler() {
+ return FLAG_always_full_compiler || is_debugging_active();
+}
+
+
static void FinishOptimization(Handle<JSFunction> function, int64_t start) {
int opt_count = function->shared()->opt_count();
function->shared()->set_opt_count(opt_count + 1);
@@ -318,19 +313,18 @@ static bool MakeCrankshaftCode(CompilationInfo* info) {
}
+static bool GenerateCode(CompilationInfo* info) {
+ return V8::UseCrankshaft() ?
+ MakeCrankshaftCode(info) :
+ FullCodeGenerator::MakeCode(info);
+}
+
+
static bool MakeCode(CompilationInfo* info) {
// Precondition: code has been parsed. Postcondition: the code field in
// the compilation info is set if compilation succeeded.
ASSERT(info->function() != NULL);
-
- if (Rewriter::Rewrite(info) && Scope::Analyze(info)) {
- if (V8::UseCrankshaft()) return MakeCrankshaftCode(info);
- // If crankshaft is not supported fall back to full code generator
- // for all compilation.
- return FullCodeGenerator::MakeCode(info);
- }
-
- return false;
+ return Rewriter::Rewrite(info) && Scope::Analyze(info) && GenerateCode(info);
}
« no previous file with comments | « src/compiler.h ('k') | src/cpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698