| 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/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
| 10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 if (!isolate->has_pending_exception()) isolate->StackOverflow(); | 754 if (!isolate->has_pending_exception()) isolate->StackOverflow(); |
| 755 return false; | 755 return false; |
| 756 } | 756 } |
| 757 return true; | 757 return true; |
| 758 } | 758 } |
| 759 | 759 |
| 760 | 760 |
| 761 // TODO(rmcilroy): Remove this temporary work-around when ignition supports | 761 // TODO(rmcilroy): Remove this temporary work-around when ignition supports |
| 762 // catch and eval. | 762 // catch and eval. |
| 763 static bool IgnitionShouldFallbackToFullCodeGen(Scope* scope) { | 763 static bool IgnitionShouldFallbackToFullCodeGen(Scope* scope) { |
| 764 if (scope->is_eval_scope() || scope->is_catch_scope() || | 764 if (scope->is_catch_scope()) { |
| 765 scope->calls_eval()) { | |
| 766 return true; | 765 return true; |
| 767 } | 766 } |
| 768 for (auto inner_scope : *scope->inner_scopes()) { | 767 for (auto inner_scope : *scope->inner_scopes()) { |
| 769 if (IgnitionShouldFallbackToFullCodeGen(inner_scope)) return true; | 768 if (IgnitionShouldFallbackToFullCodeGen(inner_scope)) return true; |
| 770 } | 769 } |
| 771 return false; | 770 return false; |
| 772 } | 771 } |
| 773 | 772 |
| 774 | 773 |
| 775 static bool UseIgnition(CompilationInfo* info) { | 774 static bool UseIgnition(CompilationInfo* info) { |
| 776 // Cannot use Ignition when the {function_data} is already used. | 775 // Cannot use Ignition when the {function_data} is already used. |
| 777 if (info->has_shared_info() && info->shared_info()->HasBuiltinFunctionId()) { | 776 if (info->has_shared_info() && info->shared_info()->HasBuiltinFunctionId()) { |
| 778 return false; | 777 return false; |
| 779 } | 778 } |
| 780 | 779 |
| 781 // Checks whether the scope chain is supported. | 780 // Checks whether the scope chain is supported. |
| 782 if (FLAG_ignition_fallback_on_eval_and_catch && | 781 if (FLAG_ignition_fallback_on_catch && |
| 783 IgnitionShouldFallbackToFullCodeGen(info->scope())) { | 782 IgnitionShouldFallbackToFullCodeGen(info->scope())) { |
| 784 return false; | 783 return false; |
| 785 } | 784 } |
| 786 | 785 |
| 787 // Checks whether top level functions should be passed by the filter. | 786 // Checks whether top level functions should be passed by the filter. |
| 788 if (info->closure().is_null()) { | 787 if (info->closure().is_null()) { |
| 789 Vector<const char> filter = CStrVector(FLAG_ignition_filter); | 788 Vector<const char> filter = CStrVector(FLAG_ignition_filter); |
| 790 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*'); | 789 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*'); |
| 791 } | 790 } |
| 792 | 791 |
| (...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1844 } | 1843 } |
| 1845 | 1844 |
| 1846 #if DEBUG | 1845 #if DEBUG |
| 1847 void CompilationInfo::PrintAstForTesting() { | 1846 void CompilationInfo::PrintAstForTesting() { |
| 1848 PrintF("--- Source from AST ---\n%s\n", | 1847 PrintF("--- Source from AST ---\n%s\n", |
| 1849 PrettyPrinter(isolate()).PrintProgram(literal())); | 1848 PrettyPrinter(isolate()).PrintProgram(literal())); |
| 1850 } | 1849 } |
| 1851 #endif | 1850 #endif |
| 1852 } // namespace internal | 1851 } // namespace internal |
| 1853 } // namespace v8 | 1852 } // namespace v8 |
| OLD | NEW |