Commit b87bdd17 authored by jgruber's avatar jgruber Committed by Commit bot

Allow Script::FindSharedFunctionInfo to return toplevel functions

We will use this function to find toplevel function infos in an upcoming
commit.

R=yangguo@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/1970153002
Cr-Commit-Position: refs/heads/master@{#36204}
parent 9c9708ac
...@@ -1546,6 +1546,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo( ...@@ -1546,6 +1546,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
// unless we already have code with debut break slots. // unless we already have code with debut break slots.
Handle<SharedFunctionInfo> existing; Handle<SharedFunctionInfo> existing;
if (maybe_existing.ToHandle(&existing) && existing->is_compiled()) { if (maybe_existing.ToHandle(&existing) && existing->is_compiled()) {
DCHECK(!existing->is_toplevel());
if (!outer_info->is_debug() || existing->HasDebugCode()) { if (!outer_info->is_debug() || existing->HasDebugCode()) {
return existing; return existing;
} }
......
...@@ -12408,9 +12408,6 @@ MaybeHandle<SharedFunctionInfo> Script::FindSharedFunctionInfo( ...@@ -12408,9 +12408,6 @@ MaybeHandle<SharedFunctionInfo> Script::FindSharedFunctionInfo(
if (fun->function_token_position() == shared->function_token_position() && if (fun->function_token_position() == shared->function_token_position() &&
fun->start_position() == shared->start_position() && fun->start_position() == shared->start_position() &&
fun->end_position() == shared->end_position()) { fun->end_position() == shared->end_position()) {
// This method is not used to find top-level SharedFunctionInfo objects,
// verify that above checks are sufficient to distinguish top-level code.
DCHECK(!shared->is_toplevel());
return Handle<SharedFunctionInfo>(shared); return Handle<SharedFunctionInfo>(shared);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment