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 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 maybe_existing = script->FindSharedFunctionInfo(literal); | 1563 maybe_existing = script->FindSharedFunctionInfo(literal); |
1564 } | 1564 } |
1565 | 1565 |
1566 // We found an existing shared function info. If it's already compiled, | 1566 // We found an existing shared function info. If it's already compiled, |
1567 // don't worry about compiling it, and simply return it. If it's not yet | 1567 // don't worry about compiling it, and simply return it. If it's not yet |
1568 // compiled, continue to decide whether to eagerly compile. | 1568 // compiled, continue to decide whether to eagerly compile. |
1569 // Carry on if we are compiling eager to obtain code for debugging, | 1569 // Carry on if we are compiling eager to obtain code for debugging, |
1570 // unless we already have code with debut break slots. | 1570 // unless we already have code with debut break slots. |
1571 Handle<SharedFunctionInfo> existing; | 1571 Handle<SharedFunctionInfo> existing; |
1572 if (maybe_existing.ToHandle(&existing) && existing->is_compiled()) { | 1572 if (maybe_existing.ToHandle(&existing) && existing->is_compiled()) { |
| 1573 DCHECK(!existing->is_toplevel()); |
1573 if (!outer_info->is_debug() || existing->HasDebugCode()) { | 1574 if (!outer_info->is_debug() || existing->HasDebugCode()) { |
1574 return existing; | 1575 return existing; |
1575 } | 1576 } |
1576 } | 1577 } |
1577 | 1578 |
1578 // Allocate a shared function info object. | 1579 // Allocate a shared function info object. |
1579 Handle<SharedFunctionInfo> result; | 1580 Handle<SharedFunctionInfo> result; |
1580 if (!maybe_existing.ToHandle(&result)) { | 1581 if (!maybe_existing.ToHandle(&result)) { |
1581 result = NewSharedFunctionInfoForLiteral(isolate, literal, script); | 1582 result = NewSharedFunctionInfoForLiteral(isolate, literal, script); |
1582 result->set_is_toplevel(false); | 1583 result->set_is_toplevel(false); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1768 MaybeHandle<Code> code; | 1769 MaybeHandle<Code> code; |
1769 if (cached.code != nullptr) code = handle(cached.code); | 1770 if (cached.code != nullptr) code = handle(cached.code); |
1770 Handle<Context> native_context(function->context()->native_context()); | 1771 Handle<Context> native_context(function->context()->native_context()); |
1771 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 1772 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
1772 literals, BailoutId::None()); | 1773 literals, BailoutId::None()); |
1773 } | 1774 } |
1774 } | 1775 } |
1775 | 1776 |
1776 } // namespace internal | 1777 } // namespace internal |
1777 } // namespace v8 | 1778 } // namespace v8 |
OLD | NEW |