[full-codegen] Fix stack depth tracking when reporting unsupported super usages

Also mark VisitSuperCallReference as unreachable, as it's handled by VisitCall.

R=mstarzinger@chromium.org
BUG=v8:4967
LOG=n

Review-Url: https://codereview.chromium.org/1929213002
Cr-Commit-Position: refs/heads/master@{#35945}
This commit is contained in:
adamk 2016-05-02 10:28:40 -07:00 committed by Commit bot
parent b027b623df
commit 567aa1be6d
2 changed files with 14 additions and 1 deletions

View File

@ -678,11 +678,15 @@ void FullCodeGenerator::SetCallPosition(Expression* expr,
void FullCodeGenerator::VisitSuperPropertyReference(
SuperPropertyReference* super) {
__ CallRuntime(Runtime::kThrowUnsupportedSuperError);
// Even though this expression doesn't produce a value, we need to simulate
// plugging of the value context to ensure stack depth tracking is in sync.
if (context()->IsStackValue()) OperandStackDepthIncrement(1);
}
void FullCodeGenerator::VisitSuperCallReference(SuperCallReference* super) {
__ CallRuntime(Runtime::kThrowUnsupportedSuperError);
// Handled by VisitCall
UNREACHABLE();
}

View File

@ -0,0 +1,9 @@
// Copyright 2016 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.
assertThrows(() => {
new class extends Object {
constructor() { (() => delete super[super()])(); }
}
}, ReferenceError);