Add Int32 matching to CodeAssembler::ToInt32Constant

Prior to this, ToInt32Constant only matched Int64Constant nodes within
the int32_t range, but did not match actual Int32Constant nodes.

Change-Id: I4e67ea57f53f3b1d4b1f2b27f11ebdeffb2bf357
Reviewed-on: https://chromium-review.googlesource.com/1012022
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52590}
This commit is contained in:
jgruber 2018-04-13 11:11:42 +02:00 committed by Commit Bot
parent 2c7c8da127
commit 7c36eff8d5

View File

@ -371,12 +371,21 @@ TNode<HeapNumber> CodeAssembler::NaNConstant() {
}
bool CodeAssembler::ToInt32Constant(Node* node, int32_t& out_value) {
Int64Matcher m(node);
if (m.HasValue() &&
m.IsInRange(std::numeric_limits<int32_t>::min(),
std::numeric_limits<int32_t>::max())) {
out_value = static_cast<int32_t>(m.Value());
return true;
{
Int64Matcher m(node);
if (m.HasValue() && m.IsInRange(std::numeric_limits<int32_t>::min(),
std::numeric_limits<int32_t>::max())) {
out_value = static_cast<int32_t>(m.Value());
return true;
}
}
{
Int32Matcher m(node);
if (m.HasValue()) {
out_value = m.Value();
return true;
}
}
return false;