Chromium Code Reviews| 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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 778 DCHECK(AllowCompilation::IsAllowed(info->isolate())); | 778 DCHECK(AllowCompilation::IsAllowed(info->isolate())); |
| 779 if (!Compiler::Analyze(info->parse_info()) || | 779 if (!Compiler::Analyze(info->parse_info()) || |
| 780 !FullCodeGenerator::MakeCode(info)) { | 780 !FullCodeGenerator::MakeCode(info)) { |
| 781 Isolate* isolate = info->isolate(); | 781 Isolate* isolate = info->isolate(); |
| 782 if (!isolate->has_pending_exception()) isolate->StackOverflow(); | 782 if (!isolate->has_pending_exception()) isolate->StackOverflow(); |
| 783 return false; | 783 return false; |
| 784 } | 784 } |
| 785 return true; | 785 return true; |
| 786 } | 786 } |
| 787 | 787 |
| 788 static bool IsGeneratorFunctionOrBuiltin(CompilationInfo* info) { | |
| 789 if (info->has_shared_info()) { | |
| 790 Handle<SharedFunctionInfo> shared = info->shared_info(); | |
| 791 if (shared->is_generator()) { | |
| 792 return true; | |
| 793 } else if (shared->HasBuiltinFunctionId()) { | |
| 794 BuiltinFunctionId id = shared->builtin_function_id(); | |
| 795 return id == kGeneratorObjectNext || id == kGeneratorObjectReturn || | |
| 796 id == kGeneratorObjectThrow; | |
| 797 } | |
| 798 } | |
| 799 return info->has_literal() && IsGeneratorFunction(info->literal()->kind()); | |
| 800 } | |
| 788 | 801 |
| 789 static bool UseIgnition(CompilationInfo* info) { | 802 static bool UseIgnition(CompilationInfo* info) { |
| 790 // Cannot use Ignition when the {function_data} is already used. | 803 // TODO(4681): Generators are not yet supported. |
| 791 if (info->has_shared_info() && info->shared_info()->HasBuiltinFunctionId()) { | 804 if (IsGeneratorFunctionOrBuiltin(info)) { |
|
Michael Starzinger
2016/03/15 17:39:41
nit: I am not sure combining these two flags into
rmcilroy
2016/03/16 13:24:24
Sure thing - I was trying to reuse the SharedFunct
| |
| 792 return false; | 805 return false; |
| 793 } | 806 } |
| 794 | 807 |
| 795 // TODO(4681): Generators are not yet supported. | |
| 796 if ((info->has_shared_info() && info->shared_info()->is_generator()) || | |
| 797 (info->has_literal() && IsGeneratorFunction(info->literal()->kind()))) { | |
| 798 return false; | |
| 799 } | |
| 800 | |
| 801 // Checks whether top level functions should be passed by the filter. | 808 // Checks whether top level functions should be passed by the filter. |
| 802 if (info->closure().is_null()) { | 809 if (info->closure().is_null()) { |
| 803 Vector<const char> filter = CStrVector(FLAG_ignition_filter); | 810 Vector<const char> filter = CStrVector(FLAG_ignition_filter); |
| 804 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*'); | 811 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*'); |
| 805 } | 812 } |
| 806 | 813 |
| 807 // Finally respect the filter. | 814 // Finally respect the filter. |
| 808 return info->closure()->PassesFilter(FLAG_ignition_filter); | 815 return info->closure()->PassesFilter(FLAG_ignition_filter); |
| 809 } | 816 } |
| 810 | 817 |
| (...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1966 | 1973 |
| 1967 #if DEBUG | 1974 #if DEBUG |
| 1968 void CompilationInfo::PrintAstForTesting() { | 1975 void CompilationInfo::PrintAstForTesting() { |
| 1969 PrintF("--- Source from AST ---\n%s\n", | 1976 PrintF("--- Source from AST ---\n%s\n", |
| 1970 PrettyPrinter(isolate()).PrintProgram(literal())); | 1977 PrettyPrinter(isolate()).PrintProgram(literal())); |
| 1971 } | 1978 } |
| 1972 #endif | 1979 #endif |
| 1973 | 1980 |
| 1974 } // namespace internal | 1981 } // namespace internal |
| 1975 } // namespace v8 | 1982 } // namespace v8 |
| OLD | NEW |