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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 if (!Compiler::Analyze(info->parse_info()) || | 733 if (!Compiler::Analyze(info->parse_info()) || |
734 !FullCodeGenerator::MakeCode(info)) { | 734 !FullCodeGenerator::MakeCode(info)) { |
735 Isolate* isolate = info->isolate(); | 735 Isolate* isolate = info->isolate(); |
736 if (!isolate->has_pending_exception()) isolate->StackOverflow(); | 736 if (!isolate->has_pending_exception()) isolate->StackOverflow(); |
737 return false; | 737 return false; |
738 } | 738 } |
739 return true; | 739 return true; |
740 } | 740 } |
741 | 741 |
742 | 742 |
743 // TODO(rmcilroy): Remove this temporary work-around when ignition supports | |
744 // catch and eval. | |
745 static bool IgnitionShouldFallbackToFullCodeGen(Scope* scope) { | |
746 if (scope->is_catch_scope()) { | |
747 return true; | |
748 } | |
749 for (auto inner_scope : *scope->inner_scopes()) { | |
750 if (IgnitionShouldFallbackToFullCodeGen(inner_scope)) return true; | |
751 } | |
752 return false; | |
753 } | |
754 | |
755 | |
756 static bool UseIgnition(CompilationInfo* info) { | 743 static bool UseIgnition(CompilationInfo* info) { |
757 // Cannot use Ignition when the {function_data} is already used. | 744 // Cannot use Ignition when the {function_data} is already used. |
758 if (info->has_shared_info() && info->shared_info()->HasBuiltinFunctionId()) { | 745 if (info->has_shared_info() && info->shared_info()->HasBuiltinFunctionId()) { |
759 return false; | 746 return false; |
760 } | 747 } |
761 | 748 |
762 // Checks whether the scope chain is supported. | |
763 if (FLAG_ignition_fallback_on_catch && | |
764 IgnitionShouldFallbackToFullCodeGen(info->scope())) { | |
765 return false; | |
766 } | |
767 | |
768 // Checks whether top level functions should be passed by the filter. | 749 // Checks whether top level functions should be passed by the filter. |
769 if (info->closure().is_null()) { | 750 if (info->closure().is_null()) { |
770 Vector<const char> filter = CStrVector(FLAG_ignition_filter); | 751 Vector<const char> filter = CStrVector(FLAG_ignition_filter); |
771 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*'); | 752 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*'); |
772 } | 753 } |
773 | 754 |
774 // Finally respect the filter. | 755 // Finally respect the filter. |
775 return info->closure()->PassesFilter(FLAG_ignition_filter); | 756 return info->closure()->PassesFilter(FLAG_ignition_filter); |
776 } | 757 } |
777 | 758 |
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 } | 1806 } |
1826 | 1807 |
1827 #if DEBUG | 1808 #if DEBUG |
1828 void CompilationInfo::PrintAstForTesting() { | 1809 void CompilationInfo::PrintAstForTesting() { |
1829 PrintF("--- Source from AST ---\n%s\n", | 1810 PrintF("--- Source from AST ---\n%s\n", |
1830 PrettyPrinter(isolate()).PrintProgram(literal())); | 1811 PrettyPrinter(isolate()).PrintProgram(literal())); |
1831 } | 1812 } |
1832 #endif | 1813 #endif |
1833 } // namespace internal | 1814 } // namespace internal |
1834 } // namespace v8 | 1815 } // namespace v8 |
OLD | NEW |