In some cases, this allows SmiTag and Push to be combined into a single
operation.
BUG=
R=ulan@chromium.org
Review URL: https://codereview.chromium.org/
311133003
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21690
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
while (!non_object_list.IsEmpty()) {
// Store each non-object register as two SMIs.
Register reg = Register(non_object_list.PopLowestIndex());
- __ Push(reg);
- __ Poke(wzr, 0);
- __ Push(reg.W(), wzr);
+ __ Lsr(scratch, reg, 32);
+ __ SmiTagAndPush(scratch, reg);
+
// Stack:
// jssp[12]: reg[63:32]
// jssp[8]: 0x00000000 (SMI tag & padding)
FieldMemOperand(x2, DescriptorArray::kEnumCacheBridgeCacheOffset));
// Set up the four remaining stack slots.
- __ Push(x0); // Map.
- __ Mov(x0, Smi::FromInt(0));
- // Push enumeration cache, enumeration cache length (as smi) and zero.
- __ SmiTag(x1);
- __ Push(x2, x1, x0);
+ __ Push(x0, x2); // Map, enumeration cache.
+ __ SmiTagAndPush(x1, xzr); // Enum cache length, zero (both as smis).
__ B(&loop);
__ Bind(&no_descriptors);
// Push the index as a smi. This is safe because of the checks in
// DoStringCharCodeAt above.
Register index = ToRegister(instr->index());
- __ SmiTag(index);
- __ Push(index);
+ __ SmiTagAndPush(index);
CallRuntimeFromDeferred(Runtime::kHiddenStringCharCodeAt, 2, instr,
instr->context());
__ Mov(result, 0);
PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters);
- __ SmiTag(char_code);
- __ Push(char_code);
+ __ SmiTagAndPush(char_code);
CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr, instr->context());
__ StoreToSafepointRegisterSlot(x0, result);
}
}
+void MacroAssembler::SmiTagAndPush(Register src) {
+ STATIC_ASSERT((kSmiShift == 32) && (kSmiTag == 0));
+ Push(src.W(), wzr);
+}
+
+
+void MacroAssembler::SmiTagAndPush(Register src1, Register src2) {
+ STATIC_ASSERT((kSmiShift == 32) && (kSmiTag == 0));
+ Push(src1.W(), wzr, src2.W(), wzr);
+}
+
+
void MacroAssembler::JumpIfSmi(Register value,
Label* smi_label,
Label* not_smi_label) {
Register src,
UntagMode mode = kNotSpeculativeUntag);
+ // Tag and push in one step.
+ inline void SmiTagAndPush(Register src);
+ inline void SmiTagAndPush(Register src1, Register src2);
+
// Compute the absolute value of 'smi' and leave the result in 'smi'
// register. If 'smi' is the most negative SMI, the absolute value cannot
// be represented as a SMI and a jump to 'slow' is done.