v8/test/mjsunit/regress/regress-crbug-1038178.js
Mythri A df98901c19 [interpreter] Store accumulator to callee after optional chain checks
Optional chain checks check if the object is null or undefined and
if it is we don't perform the load but just load accumulator with
undefined. For calls the value of the accumulator needs to be stored
in the callee register. We were doing this only when the object
isn't null or undefined. This cl fixes it by storing it to callee
always.

Bug: chromium:1171954
Change-Id: I391af18e783486fed70be561027bd8aba97b93cc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2665466
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72475}
2021-02-02 11:27:13 +00:00

22 lines
573 B
JavaScript

// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
function opt(){
(new (function(){
try{
r.c>new class extends(W.y.h){}
l.g.e._
function _(){}[]=({[l](){}}),c()
}catch(x){}
}));
(((function(){})())?.v)()
}
%PrepareFunctionForOptimization(opt)
assertThrows(() => opt());
assertThrows(() => opt());
%OptimizeFunctionOnNextCall(opt)
assertThrows(() => opt());