Commit 23644ddf authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[parser] Load outer ScopeInfo from SharedFunctionInfo.

This switches the {ParseInfo} constructor to always determine the outer
scope info from the shared function info instead of a concrete closure.
It is a precursor to deprecate the constructor taking closures entirely
and hence make the fact that we can parse without a closure explicit.

R=jochen@chromium.org
BUG=v8:2206

Review-Url: https://codereview.chromium.org/2397053003
Cr-Commit-Position: refs/heads/master@{#40031}
parent a03ac68c
......@@ -32,11 +32,7 @@ ParseInfo::ParseInfo(Zone* zone)
literal_(nullptr) {}
ParseInfo::ParseInfo(Zone* zone, Handle<JSFunction> function)
: ParseInfo(zone, Handle<SharedFunctionInfo>(function->shared())) {
if (!function->context()->IsNativeContext()) {
set_outer_scope_info(handle(function->context()->scope_info()));
}
}
: ParseInfo(zone, Handle<SharedFunctionInfo>(function->shared())) {}
ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared)
: ParseInfo(zone) {
......@@ -59,6 +55,12 @@ ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared)
if (!script.is_null() && script->type() == Script::TYPE_NATIVE) {
set_native();
}
Handle<HeapObject> scope_info(shared->outer_scope_info());
if (!scope_info->IsTheHole(isolate()) &&
Handle<ScopeInfo>::cast(scope_info)->length() > 0) {
set_outer_scope_info(Handle<ScopeInfo>::cast(scope_info));
}
}
ParseInfo::ParseInfo(Zone* zone, Handle<Script> script) : ParseInfo(zone) {
......
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