Commit ac69e74f authored by oth's avatar oth Committed by Commit bot

[stubs] Suppress shift by zero.

LOG=N
BUG=

Review-Url: https://codereview.chromium.org/2157363003
Cr-Commit-Position: refs/heads/master@{#37886}
parent d4ad10b3
......@@ -1770,7 +1770,7 @@ Node* CodeStubAssembler::StringFromCharCode(Node* code) {
Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift,
uint32_t mask) {
return Word32Shr(Word32And(word32, Int32Constant(mask)),
Int32Constant(shift));
static_cast<int>(shift));
}
void CodeStubAssembler::SetCounter(StatsCounter* counter, int value) {
......
......@@ -209,11 +209,18 @@ CODE_ASSEMBLER_BINARY_OP_LIST(DEFINE_CODE_ASSEMBLER_BINARY_OP)
#undef DEFINE_CODE_ASSEMBLER_BINARY_OP
Node* CodeAssembler::WordShl(Node* value, int shift) {
return raw_assembler_->WordShl(value, IntPtrConstant(shift));
return (shift != 0) ? raw_assembler_->WordShl(value, IntPtrConstant(shift))
: value;
}
Node* CodeAssembler::WordShr(Node* value, int shift) {
return raw_assembler_->WordShr(value, IntPtrConstant(shift));
return (shift != 0) ? raw_assembler_->WordShr(value, IntPtrConstant(shift))
: value;
}
Node* CodeAssembler::Word32Shr(Node* value, int shift) {
return (shift != 0) ? raw_assembler_->Word32Shr(value, IntPtrConstant(shift))
: value;
}
Node* CodeAssembler::ChangeUint32ToWord(Node* value) {
......
......@@ -285,6 +285,7 @@ class CodeAssembler {
Node* WordShl(Node* value, int shift);
Node* WordShr(Node* value, int shift);
Node* Word32Shr(Node* value, int shift);
// Unary
#define DECLARE_CODE_ASSEMBLER_UNARY_OP(name) Node* name(Node* a);
......
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