Commit 8c6ace98 authored by sampsong's avatar sampsong Committed by Commit bot

Use TM instead of TMLL in case of memory operand.

R=jyan@ca.ibm.com, joransiu@ca.ibm.com, bjaideep@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=

Review-Url: https://codereview.chromium.org/2582973002
Cr-Commit-Position: refs/heads/master@{#41824}
parent 35bf403f
......@@ -4870,14 +4870,42 @@ void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
LOperand* input = instr->value();
__ TestIfSmi(ToRegister(input));
if (input->IsRegister()) {
__ TestIfSmi(ToRegister(input));
} else if (input->IsStackSlot()) {
MemOperand value = ToMemOperand(input);
#if !V8_TARGET_LITTLE_ENDIAN
#if V8_TARGET_ARCH_S390X
__ TestIfSmi(MemOperand(value.rb(), value.offset() + 7));
#else
__ TestIfSmi(MemOperand(value.rb(), value.offset() + 3));
#endif
#else
__ TestIfSmi(value);
#endif
}
DeoptimizeIf(ne, instr, DeoptimizeReason::kNotASmi, cr0);
}
void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
if (!instr->hydrogen()->value()->type().IsHeapObject()) {
LOperand* input = instr->value();
__ TestIfSmi(ToRegister(input));
if (input->IsRegister()) {
__ TestIfSmi(ToRegister(input));
} else if (input->IsStackSlot()) {
MemOperand value = ToMemOperand(input);
#if !V8_TARGET_LITTLE_ENDIAN
#if V8_TARGET_ARCH_S390X
__ TestIfSmi(MemOperand(value.rb(), value.offset() + 7));
#else
__ TestIfSmi(MemOperand(value.rb(), value.offset() + 3));
#endif
#else
__ TestIfSmi(value);
#endif
} else {
UNIMPLEMENTED();
}
DeoptimizeIf(eq, instr, DeoptimizeReason::kSmi, cr0);
}
}
......
......@@ -1678,7 +1678,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
}
LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
LOperand* value = UseRegisterAtStart(instr->value());
LOperand* value = UseAtStart(instr->value());
LInstruction* result = new (zone()) LCheckNonSmi(value);
if (!instr->value()->type().IsHeapObject()) {
result = AssignEnvironment(result);
......@@ -1687,7 +1687,7 @@ LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
}
LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
LOperand* value = UseRegisterAtStart(instr->value());
LOperand* value = UseAtStart(instr->value());
return AssignEnvironment(new (zone()) LCheckSmi(value));
}
......
......@@ -1533,6 +1533,17 @@ class MacroAssembler : public Assembler {
inline void TestIfSmi(Register value) { tmll(value, Operand(1)); }
inline void TestIfSmi(MemOperand value) {
if (is_uint12(value.offset())) {
tm(value, Operand(1));
} else if (is_int20(value.offset())) {
tmy(value, Operand(1));
} else {
LoadP(r0, value);
tmll(r0, Operand(1));
}
}
inline void TestIfPositiveSmi(Register value, Register scratch) {
STATIC_ASSERT((kSmiTagMask | kSmiSignMask) ==
(intptr_t)(1UL << (kBitsPerPointer - 1) | 1));
......
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