Commit 66218e4e authored by Mythri's avatar Mythri Committed by Commit Bot

[Turbofan] Fix to not leak holes on any edges.

This cl: https://chromium-review.googlesource.com/509613 changed
CheckNotTaggedHole to not produce any value output. This would mean that
in some cases, we could leak hole on value edges. This violates the
assumption that we cannot see a hole on several operators. Fixing this
back to the original state.

Bug: chromium:730254
Change-Id: I3512930e88dbe15e9d9b4b0d276868f354cc2ae2
Reviewed-on: https://chromium-review.googlesource.com/527033Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45757}
parent fdfb8c9e
......@@ -2183,8 +2183,8 @@ JSNativeContextSpecialization::BuildElementAccess(
value);
} else {
// Bailout if we see the hole.
effect = graph()->NewNode(simplified()->CheckNotTaggedHole(), value,
effect, control);
value = effect = graph()->NewNode(simplified()->CheckNotTaggedHole(),
value, effect, control);
}
} else if (elements_kind == FAST_HOLEY_DOUBLE_ELEMENTS) {
// Perform the hole check on the result.
......
......@@ -225,8 +225,7 @@
V(CheckedTaggedToFloat64) \
V(CheckedTaggedToTaggedSigned) \
V(CheckedTaggedToTaggedPointer) \
V(CheckTaggedHole) \
V(CheckNotTaggedHole)
V(CheckTaggedHole)
#define SIMPLIFIED_COMPARE_BINOP_LIST(V) \
V(NumberEqual) \
......@@ -331,6 +330,7 @@
V(CheckSmi) \
V(CheckHeapObject) \
V(CheckFloat64Hole) \
V(CheckNotTaggedHole) \
V(ConvertTaggedHoleToUndefined) \
V(Allocate) \
V(LoadField) \
......
......@@ -527,7 +527,7 @@ UnicodeEncoding UnicodeEncodingOf(const Operator* op) {
V(CheckSeqString, 1, 1) \
V(CheckSymbol, 1, 1) \
V(CheckTaggedHole, 1, 0) \
V(CheckNotTaggedHole, 1, 0) \
V(CheckNotTaggedHole, 1, 1) \
V(CheckedInt32Add, 2, 1) \
V(CheckedInt32Sub, 2, 1) \
V(CheckedInt32Div, 2, 1) \
......
......@@ -1871,6 +1871,12 @@ Type* Typer::Visitor::TypeCheckFloat64Hole(Node* node) {
return typer_->operation_typer_.CheckFloat64Hole(Operand(node, 0));
}
Type* Typer::Visitor::TypeCheckNotTaggedHole(Node* node) {
Type* type = Operand(node, 0);
type = Type::Intersect(type, Type::NonInternal(), zone());
return type;
}
Type* Typer::Visitor::TypeConvertTaggedHoleToUndefined(Node* node) {
Type* type = Operand(node, 0);
if (type->Maybe(Type::Hole())) {
......
......@@ -1231,6 +1231,7 @@ void Verifier::Visitor::Check(Node* node) {
break;
case IrOpcode::kCheckNotTaggedHole:
CheckValueInputIs(node, 0, Type::Any());
CheckTypeIs(node, Type::NonInternal());
break;
case IrOpcode::kConvertTaggedHoleToUndefined:
CheckValueInputIs(node, 0, Type::Any());
......
// Copyright 2010 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --opt --turbo --no-always-opt
var __v_0 = {};
__v_0 = new Map();
function __f_0() {
__v_0[0] --;
}
__f_0();
%OptimizeFunctionOnNextCall(__f_0);
__f_0();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment