@@ -1206,7 +1206,8 @@ class V8_NODISCARD BytecodeGenerator::OptionalChainNullLabelScope final {
12061206 public:
12071207 explicit OptionalChainNullLabelScope (BytecodeGenerator* bytecode_generator)
12081208 : bytecode_generator_(bytecode_generator),
1209- labels_(bytecode_generator->zone ()) {
1209+ labels_(bytecode_generator->zone ()),
1210+ hole_check_scope_(bytecode_generator) {
12101211 prev_ = bytecode_generator_->optional_chaining_null_labels_ ;
12111212 bytecode_generator_->optional_chaining_null_labels_ = &labels_;
12121213 }
@@ -1221,6 +1222,9 @@ class V8_NODISCARD BytecodeGenerator::OptionalChainNullLabelScope final {
12211222 BytecodeGenerator* bytecode_generator_;
12221223 BytecodeLabels labels_;
12231224 BytecodeLabels* prev_;
1225+ // Use the same scope for the entire optional chain, as links earlier in the
1226+ // chain dominate later links, linearly.
1227+ HoleCheckElisionScope hole_check_scope_;
12241228};
12251229
12261230// LoopScope delimits the scope of {loop}, from its header to its final jump.
@@ -6338,9 +6342,6 @@ template <typename ExpressionFunc>
63386342void BytecodeGenerator::BuildOptionalChain (ExpressionFunc expression_func) {
63396343 BytecodeLabel done;
63406344 OptionalChainNullLabelScope label_scope (this );
6341- // Use the same scope for the entire optional chain, as links earlier in the
6342- // chain dominate later links, linearly.
6343- HoleCheckElisionScope elider (this );
63446345 expression_func ();
63456346 builder ()->Jump (&done);
63466347 label_scope.labels ()->Bind (builder ());
0 commit comments