Skip to content

Commit 3f66bff

Browse files
verwaestV8 LUCI CQ
authored andcommitted
[parsing] Disable scopeinfo sharing for hidden scopes
They can't be reused anyway. This also dchecks that we won't try to reuse them. Fixed: 352414639 Change-Id: I490500a7616b4dfa6be67798ce9f58a99cb00c17 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5701117 Reviewed-by: Leszek Swirski <[email protected]> Auto-Submit: Toon Verwaest <[email protected]> Commit-Queue: Toon Verwaest <[email protected]> Commit-Queue: Leszek Swirski <[email protected]> Cr-Commit-Position: refs/heads/main@{#95004}
1 parent 03dded9 commit 3f66bff

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

src/ast/scopes.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,6 +2705,7 @@ void Scope::AllocateScopeInfosRecursively(
27052705
// next outer scope that needs a context.
27062706
next_outer_scope = scope_info_;
27072707
DCHECK(!scope_info_.is_null());
2708+
DCHECK(!is_hidden());
27082709
CHECK_EQ(scope_info_->scope_type(), scope_type_);
27092710
CHECK_EQ(scope_info_->ContextLength(), num_heap_slots_);
27102711
#ifdef DEBUG
@@ -2713,8 +2714,9 @@ void Scope::AllocateScopeInfosRecursively(
27132714
#endif
27142715
} else if (NeedsScopeInfo()) {
27152716
#ifdef DEBUG
2716-
// Mark this ID as being used.
2717-
scope_infos_to_reuse[UniqueIdInScript()] = {};
2717+
// Mark this ID as being used. Skip hidden scopes because they are
2718+
// synthetic, unreusable, but hard to make unique.
2719+
if (!is_hidden()) scope_infos_to_reuse[UniqueIdInScript()] = {};
27182720
#endif
27192721
scope_info_ = ScopeInfo::Create(isolate, zone(), this, outer_scope);
27202722
DCHECK_EQ(UniqueIdInScript(), scope_info_->UniqueIdInScript());
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2024 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --fuzzing
6+
7+
const __v_2 = [{
8+
body: function () {
9+
},
10+
body: function () {
11+
}
12+
}, {
13+
body: function () {
14+
const __v_11 = {
15+
};
16+
}
17+
}];
18+
var __v_30 = [{
19+
body: function () {
20+
var __v_140 = async () => __v_147 = async () => __v_173 = 'str';
21+
}
22+
}];

0 commit comments

Comments
 (0)