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 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1720 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo( | 1720 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo( |
1721 FunctionLiteral* literal, Handle<Script> script, | 1721 FunctionLiteral* literal, Handle<Script> script, |
1722 CompilationInfo* outer_info) { | 1722 CompilationInfo* outer_info) { |
1723 // Precondition: code has been parsed and scopes have been analyzed. | 1723 // Precondition: code has been parsed and scopes have been analyzed. |
1724 Isolate* isolate = outer_info->isolate(); | 1724 Isolate* isolate = outer_info->isolate(); |
1725 MaybeHandle<SharedFunctionInfo> maybe_existing; | 1725 MaybeHandle<SharedFunctionInfo> maybe_existing; |
1726 if (outer_info->is_first_compile()) { | 1726 if (outer_info->is_first_compile()) { |
1727 // On the first compile, there are no existing shared function info for | 1727 // On the first compile, there are no existing shared function info for |
1728 // inner functions yet, so do not try to find them. All bets are off for | 1728 // inner functions yet, so do not try to find them. All bets are off for |
1729 // live edit though. | 1729 // live edit though. |
1730 DCHECK(script->FindSharedFunctionInfo(literal).is_null() || | 1730 SLOW_DCHECK(script->FindSharedFunctionInfo(literal).is_null() || |
1731 isolate->debug()->live_edit_enabled()); | 1731 isolate->debug()->live_edit_enabled()); |
1732 } else { | 1732 } else { |
1733 maybe_existing = script->FindSharedFunctionInfo(literal); | 1733 maybe_existing = script->FindSharedFunctionInfo(literal); |
1734 } | 1734 } |
1735 // We found an existing shared function info. If it's already compiled, | 1735 // We found an existing shared function info. If it's already compiled, |
1736 // don't worry about compiling it, and simply return it. If it's not yet | 1736 // don't worry about compiling it, and simply return it. If it's not yet |
1737 // compiled, continue to decide whether to eagerly compile. | 1737 // compiled, continue to decide whether to eagerly compile. |
1738 // Carry on if we are compiling eager to obtain code for debugging, | 1738 // Carry on if we are compiling eager to obtain code for debugging, |
1739 // unless we already have code with debut break slots. | 1739 // unless we already have code with debut break slots. |
1740 Handle<SharedFunctionInfo> existing; | 1740 Handle<SharedFunctionInfo> existing; |
1741 if (maybe_existing.ToHandle(&existing) && existing->is_compiled()) { | 1741 if (maybe_existing.ToHandle(&existing) && existing->is_compiled()) { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 | 1972 |
1973 #if DEBUG | 1973 #if DEBUG |
1974 void CompilationInfo::PrintAstForTesting() { | 1974 void CompilationInfo::PrintAstForTesting() { |
1975 PrintF("--- Source from AST ---\n%s\n", | 1975 PrintF("--- Source from AST ---\n%s\n", |
1976 PrettyPrinter(isolate()).PrintProgram(literal())); | 1976 PrettyPrinter(isolate()).PrintProgram(literal())); |
1977 } | 1977 } |
1978 #endif | 1978 #endif |
1979 | 1979 |
1980 } // namespace internal | 1980 } // namespace internal |
1981 } // namespace v8 | 1981 } // namespace v8 |
OLD | NEW |