Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index 18cc25d43ace406da094b393662e0ad0704cbb7a..0bd973045a1aaf3dc1c476c910cbd9e97cb22930 100755 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -92,6 +92,25 @@ 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); |
+} |
+ |
+ |
// Determine whether to use the full compiler for all code. If the flag |
// --always-full-compiler is specified this is the case. For the virtual frame |
// based compiler the full compiler is also used if a debugger is connected, as |