v8/test/mjsunit/maglev/throw-in-cstr.js
Leszek Swirski a79dde2bce [maglev] Fix exception phi for receiver in constructors
Our previous assumption that the receiver is immutable is incorrect in
constructors. Change the current logic (which never generates an
exception phi for receivers, but instead re-uses the parameter slot)
into forcing the receiver exception phi to be allocated (and spilled) in
the receiver parameter slot.

Bug: v8:7700
Change-Id: I1ba92b2e711dc0fcd7c818526b9c199cadcdd3bf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3948586
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83684}
2022-10-13 13:46:18 +00:00

28 lines
606 B
JavaScript

// Copyright 2022 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: --maglev --allow-natives-syntax
class Base {
constructor() {
}
}
class Class extends Base {
constructor() {
try {
// Super initialises the "this" pointer.
super();
throw new Error();
} catch (e) {
// Access to "this" should be valid.
assertNotNull(this);
}
}
};
%PrepareFunctionForOptimization(Class);
new Class();
new Class();
%OptimizeMaglevOnNextCall(Class);
new Class();