Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: src/compiler.cc

Issue 1970153002: Allow Script::FindSharedFunctionInfo to return toplevel functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698