Commit e5f154d1 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[scopes] Change null ScopeInfo if to DCHECK

AllocateScopeInfos should only be called for not-yet unallocated scopes,
so we can DCHECK for nullness rather than having a branch for it.

Change-Id: I65767c22d6fd7b12c4564c5ecc52f9486229affa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1981159Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65623}
parent 38e7b6b3
...@@ -2481,7 +2481,9 @@ void DeclarationScope::RecordNeedsPrivateNameContextChainRecalc() { ...@@ -2481,7 +2481,9 @@ void DeclarationScope::RecordNeedsPrivateNameContextChainRecalc() {
// static // static
void DeclarationScope::AllocateScopeInfos(ParseInfo* info, Isolate* isolate) { void DeclarationScope::AllocateScopeInfos(ParseInfo* info, Isolate* isolate) {
DeclarationScope* scope = info->literal()->scope(); DeclarationScope* scope = info->literal()->scope();
if (!scope->scope_info_.is_null()) return; // Allocated by outer function.
// No one else should have allocated a scope info for this scope yet.
DCHECK(scope->scope_info_.is_null());
MaybeHandle<ScopeInfo> outer_scope; MaybeHandle<ScopeInfo> outer_scope;
if (scope->outer_scope_ != nullptr) { if (scope->outer_scope_ != nullptr) {
......
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