OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler.h" | 5 #include "src/compiler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 | 1341 |
1342 if (outer_info->parse_info()->is_toplevel() && outer_info->will_serialize()) { | 1342 if (outer_info->parse_info()->is_toplevel() && outer_info->will_serialize()) { |
1343 // Make sure that if the toplevel code (possibly to be serialized), | 1343 // Make sure that if the toplevel code (possibly to be serialized), |
1344 // the inner function must be allowed to be compiled lazily. | 1344 // the inner function must be allowed to be compiled lazily. |
1345 // This is necessary to serialize toplevel code without inner functions. | 1345 // This is necessary to serialize toplevel code without inner functions. |
1346 DCHECK(allow_lazy); | 1346 DCHECK(allow_lazy); |
1347 } | 1347 } |
1348 | 1348 |
1349 // Generate code | 1349 // Generate code |
1350 Handle<ScopeInfo> scope_info; | 1350 Handle<ScopeInfo> scope_info; |
1351 if (FLAG_lazy && allow_lazy && !literal->is_parenthesized()) { | 1351 if (FLAG_lazy && allow_lazy && !literal->should_eager_compile()) { |
1352 Handle<Code> code = isolate->builtins()->CompileLazy(); | 1352 Handle<Code> code = isolate->builtins()->CompileLazy(); |
1353 info.SetCode(code); | 1353 info.SetCode(code); |
1354 // There's no need in theory for a lazy-compiled function to have a type | 1354 // There's no need in theory for a lazy-compiled function to have a type |
1355 // feedback vector, but some parts of the system expect all | 1355 // feedback vector, but some parts of the system expect all |
1356 // SharedFunctionInfo instances to have one. The size of the vector depends | 1356 // SharedFunctionInfo instances to have one. The size of the vector depends |
1357 // on how many feedback-needing nodes are in the tree, and when lazily | 1357 // on how many feedback-needing nodes are in the tree, and when lazily |
1358 // parsing we might not know that, if this function was never parsed before. | 1358 // parsing we might not know that, if this function was never parsed before. |
1359 // In that case the vector will be replaced the next time MakeCode is | 1359 // In that case the vector will be replaced the next time MakeCode is |
1360 // called. | 1360 // called. |
1361 info.EnsureFeedbackVector(); | 1361 info.EnsureFeedbackVector(); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1541 } | 1541 } |
1542 | 1542 |
1543 | 1543 |
1544 #if DEBUG | 1544 #if DEBUG |
1545 void CompilationInfo::PrintAstForTesting() { | 1545 void CompilationInfo::PrintAstForTesting() { |
1546 PrintF("--- Source from AST ---\n%s\n", | 1546 PrintF("--- Source from AST ---\n%s\n", |
1547 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1547 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1548 } | 1548 } |
1549 #endif | 1549 #endif |
1550 } } // namespace v8::internal | 1550 } } // namespace v8::internal |
OLD | NEW |