Commit 22af061a authored by Jacob.Bramley@arm.com's avatar Jacob.Bramley@arm.com

ARM64: Add and use SmiTagAndPush.

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
parent d208d2f6
......@@ -157,9 +157,9 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
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)
......
......@@ -1175,11 +1175,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
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);
......
......@@ -5492,8 +5492,7 @@ void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) {
// 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());
......@@ -5542,8 +5541,7 @@ void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) {
__ 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);
}
......
......@@ -1350,6 +1350,18 @@ void MacroAssembler::SmiUntagToFloat(FPRegister dst,
}
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) {
......
......@@ -873,6 +873,10 @@ class MacroAssembler : public Assembler {
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.
......
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