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}
This commit is contained in:
sampsong 2016-12-19 12:32:37 -08:00 committed by Commit bot
parent 35bf403f0d
commit 8c6ace9884
3 changed files with 43 additions and 4 deletions

View File

@ -4870,14 +4870,42 @@ void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
void LCodeGen::DoCheckSmi(LCheckSmi* instr) { void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
LOperand* input = instr->value(); 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); DeoptimizeIf(ne, instr, DeoptimizeReason::kNotASmi, cr0);
} }
void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
if (!instr->hydrogen()->value()->type().IsHeapObject()) { if (!instr->hydrogen()->value()->type().IsHeapObject()) {
LOperand* input = instr->value(); 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); DeoptimizeIf(eq, instr, DeoptimizeReason::kSmi, cr0);
} }
} }

View File

@ -1678,7 +1678,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
} }
LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) { LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
LOperand* value = UseRegisterAtStart(instr->value()); LOperand* value = UseAtStart(instr->value());
LInstruction* result = new (zone()) LCheckNonSmi(value); LInstruction* result = new (zone()) LCheckNonSmi(value);
if (!instr->value()->type().IsHeapObject()) { if (!instr->value()->type().IsHeapObject()) {
result = AssignEnvironment(result); result = AssignEnvironment(result);
@ -1687,7 +1687,7 @@ LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
} }
LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
LOperand* value = UseRegisterAtStart(instr->value()); LOperand* value = UseAtStart(instr->value());
return AssignEnvironment(new (zone()) LCheckSmi(value)); return AssignEnvironment(new (zone()) LCheckSmi(value));
} }

View File

@ -1533,6 +1533,17 @@ class MacroAssembler : public Assembler {
inline void TestIfSmi(Register value) { tmll(value, Operand(1)); } 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) { inline void TestIfPositiveSmi(Register value, Register scratch) {
STATIC_ASSERT((kSmiTagMask | kSmiSignMask) == STATIC_ASSERT((kSmiTagMask | kSmiSignMask) ==
(intptr_t)(1UL << (kBitsPerPointer - 1) | 1)); (intptr_t)(1UL << (kBitsPerPointer - 1) | 1));