Commit 50a6e301 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[turbofan] Don't insert {Int32Constant}s in JSCallReducer

Bug: chromium:814336, v8:7250, v8:7340
Change-Id: I9345778cabf24f1278ca7364ef7e223038c5aeee
Reviewed-on: https://chromium-review.googlesource.com/929121
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51468}
parent ccbbdb93
......@@ -115,7 +115,7 @@ Reduction JSCallReducer::ReduceMathClz32(Node* node) {
return NoChange();
}
if (node->op()->ValueInputCount() < 3) {
Node* value = jsgraph()->Int32Constant(32);
Node* value = jsgraph()->Constant(32);
ReplaceWithValue(node, value);
return Replace(value);
}
......
......@@ -251,8 +251,24 @@ TEST_F(JSCallReducerTest, MathClz32WithUnsigned32) {
Reduction r = Reduce(call);
ASSERT_TRUE(r.Changed());
EXPECT_THAT(std::string(IrOpcode::Mnemonic(r.replacement()->opcode())),
op_name_for("clz32"));
EXPECT_THAT(r.replacement(),
IsNumberClz32(IsNumberToUint32(IsSpeculativeToNumber(p0))));
}
TEST_F(JSCallReducerTest, MathClz32WithUnsigned32NoArg) {
Node* jsfunction = MathFunction("clz32");
Node* effect = graph()->start();
Node* control = graph()->start();
Node* context = UndefinedConstant();
Node* frame_state = graph()->start();
Node* call =
graph()->NewNode(javascript()->Call(2), jsfunction, UndefinedConstant(),
context, frame_state, effect, control);
Reduction r = Reduce(call);
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsNumberConstant(32));
}
// -----------------------------------------------------------------------------
......
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