| 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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
| (...skipping 2513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2524 // handle as the function name. Remember if we were passed a non-empty | 2524 // handle as the function name. Remember if we were passed a non-empty |
| 2525 // handle to decide whether to invoke function name inference. | 2525 // handle to decide whether to invoke function name inference. |
| 2526 bool should_infer_name = function_name == NULL; | 2526 bool should_infer_name = function_name == NULL; |
| 2527 | 2527 |
| 2528 // We want a non-null handle as the function name. | 2528 // We want a non-null handle as the function name. |
| 2529 if (should_infer_name) { | 2529 if (should_infer_name) { |
| 2530 function_name = ast_value_factory()->empty_string(); | 2530 function_name = ast_value_factory()->empty_string(); |
| 2531 } | 2531 } |
| 2532 | 2532 |
| 2533 FunctionLiteral::EagerCompileHint eager_compile_hint = | 2533 FunctionLiteral::EagerCompileHint eager_compile_hint = |
| 2534 function_state_->next_function_is_parenthesized() | 2534 function_state_->next_function_is_likely_called() |
| 2535 ? FunctionLiteral::kShouldEagerCompile | 2535 ? FunctionLiteral::kShouldEagerCompile |
| 2536 : default_eager_compile_hint(); | 2536 : default_eager_compile_hint(); |
| 2537 | 2537 |
| 2538 // Determine if the function can be parsed lazily. Lazy parsing is | 2538 // Determine if the function can be parsed lazily. Lazy parsing is |
| 2539 // different from lazy compilation; we need to parse more eagerly than we | 2539 // different from lazy compilation; we need to parse more eagerly than we |
| 2540 // compile. | 2540 // compile. |
| 2541 | 2541 |
| 2542 // We can only parse lazily if we also compile lazily. The heuristics for lazy | 2542 // We can only parse lazily if we also compile lazily. The heuristics for lazy |
| 2543 // compilation are: | 2543 // compilation are: |
| 2544 // - It must not have been prohibited by the caller to Parse (some callers | 2544 // - It must not have been prohibited by the caller to Parse (some callers |
| (...skipping 2890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5435 | 5435 |
| 5436 return final_loop; | 5436 return final_loop; |
| 5437 } | 5437 } |
| 5438 | 5438 |
| 5439 #undef CHECK_OK | 5439 #undef CHECK_OK |
| 5440 #undef CHECK_OK_VOID | 5440 #undef CHECK_OK_VOID |
| 5441 #undef CHECK_FAILED | 5441 #undef CHECK_FAILED |
| 5442 | 5442 |
| 5443 } // namespace internal | 5443 } // namespace internal |
| 5444 } // namespace v8 | 5444 } // namespace v8 |
| OLD | NEW |