Commit e4a8161a authored by paul.lind's avatar paul.lind Committed by Commit bot

MIPS: minor cleanup in macro-assembler.

Fix some dodgy temp-register usage and remove some unnecessary
push/pop's.

BUG=

Review URL: https://codereview.chromium.org/1324553004

Cr-Commit-Position: refs/heads/master@{#30646}
parent 4329a7c2
......@@ -1225,9 +1225,8 @@ void MacroAssembler::FlushICache(Register address, unsigned instructions) {
MultiPush(saved_regs);
AllowExternalCallThatCantCauseGC scope(this);
// Save to a0 in case address == t0.
Move(a0, address);
PrepareCallCFunction(2, t0);
PrepareCallCFunction(2, t8);
li(a1, instructions * kInstrSize);
CallCFunction(ExternalReference::flush_icache_function(isolate()), 2);
......@@ -5150,13 +5149,10 @@ void MacroAssembler::AssertSmi(Register object) {
void MacroAssembler::AssertString(Register object) {
if (emit_debug_code()) {
STATIC_ASSERT(kSmiTag == 0);
SmiTst(object, t0);
Check(ne, kOperandIsASmiAndNotAString, t0, Operand(zero_reg));
push(object);
lw(object, FieldMemOperand(object, HeapObject::kMapOffset));
lbu(object, FieldMemOperand(object, Map::kInstanceTypeOffset));
Check(lo, kOperandIsNotAString, object, Operand(FIRST_NONSTRING_TYPE));
pop(object);
SmiTst(object, t8);
Check(ne, kOperandIsASmiAndNotAString, t8, Operand(zero_reg));
GetObjectType(object, t8, t8);
Check(lo, kOperandIsNotAString, t8, Operand(FIRST_NONSTRING_TYPE));
}
}
......@@ -5164,13 +5160,10 @@ void MacroAssembler::AssertString(Register object) {
void MacroAssembler::AssertName(Register object) {
if (emit_debug_code()) {
STATIC_ASSERT(kSmiTag == 0);
SmiTst(object, t0);
Check(ne, kOperandIsASmiAndNotAName, t0, Operand(zero_reg));
push(object);
lw(object, FieldMemOperand(object, HeapObject::kMapOffset));
lbu(object, FieldMemOperand(object, Map::kInstanceTypeOffset));
Check(le, kOperandIsNotAName, object, Operand(LAST_NAME_TYPE));
pop(object);
SmiTst(object, t8);
Check(ne, kOperandIsASmiAndNotAName, t8, Operand(zero_reg));
GetObjectType(object, t8, t8);
Check(le, kOperandIsNotAName, t8, Operand(LAST_NAME_TYPE));
}
}
......@@ -5178,10 +5171,10 @@ void MacroAssembler::AssertName(Register object) {
void MacroAssembler::AssertFunction(Register object) {
if (emit_debug_code()) {
STATIC_ASSERT(kSmiTag == 0);
SmiTst(object, t0);
Check(ne, kOperandIsASmiAndNotAFunction, t0, Operand(zero_reg));
GetObjectType(object, t0, t0);
Check(eq, kOperandIsNotAFunction, t0, Operand(JS_FUNCTION_TYPE));
SmiTst(object, t8);
Check(ne, kOperandIsASmiAndNotAFunction, t8, Operand(zero_reg));
GetObjectType(object, t8, t8);
Check(eq, kOperandIsNotAFunction, t8, Operand(JS_FUNCTION_TYPE));
}
}
......@@ -5193,11 +5186,9 @@ void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
AssertNotSmi(object);
LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
Branch(&done_checking, eq, object, Operand(scratch));
push(object);
lw(object, FieldMemOperand(object, HeapObject::kMapOffset));
lw(t8, FieldMemOperand(object, HeapObject::kMapOffset));
LoadRoot(scratch, Heap::kAllocationSiteMapRootIndex);
Assert(eq, kExpectedUndefinedOrCell, object, Operand(scratch));
pop(object);
Assert(eq, kExpectedUndefinedOrCell, t8, Operand(scratch));
bind(&done_checking);
}
}
......
......@@ -1439,9 +1439,8 @@ void MacroAssembler::FlushICache(Register address, unsigned instructions) {
MultiPush(saved_regs);
AllowExternalCallThatCantCauseGC scope(this);
// Save to a0 in case address == a4.
Move(a0, address);
PrepareCallCFunction(2, a4);
PrepareCallCFunction(2, t8);
li(a1, instructions * kInstrSize);
CallCFunction(ExternalReference::flush_icache_function(isolate()), 2);
......@@ -5348,13 +5347,10 @@ void MacroAssembler::AssertSmi(Register object) {
void MacroAssembler::AssertString(Register object) {
if (emit_debug_code()) {
STATIC_ASSERT(kSmiTag == 0);
SmiTst(object, a4);
Check(ne, kOperandIsASmiAndNotAString, a4, Operand(zero_reg));
push(object);
ld(object, FieldMemOperand(object, HeapObject::kMapOffset));
lbu(object, FieldMemOperand(object, Map::kInstanceTypeOffset));
Check(lo, kOperandIsNotAString, object, Operand(FIRST_NONSTRING_TYPE));
pop(object);
SmiTst(object, t8);
Check(ne, kOperandIsASmiAndNotAString, t8, Operand(zero_reg));
GetObjectType(object, t8, t8);
Check(lo, kOperandIsNotAString, t8, Operand(FIRST_NONSTRING_TYPE));
}
}
......@@ -5362,13 +5358,10 @@ void MacroAssembler::AssertString(Register object) {
void MacroAssembler::AssertName(Register object) {
if (emit_debug_code()) {
STATIC_ASSERT(kSmiTag == 0);
SmiTst(object, a4);
Check(ne, kOperandIsASmiAndNotAName, a4, Operand(zero_reg));
push(object);
ld(object, FieldMemOperand(object, HeapObject::kMapOffset));
lbu(object, FieldMemOperand(object, Map::kInstanceTypeOffset));
Check(le, kOperandIsNotAName, object, Operand(LAST_NAME_TYPE));
pop(object);
SmiTst(object, t8);
Check(ne, kOperandIsASmiAndNotAName, t8, Operand(zero_reg));
GetObjectType(object, t8, t8);
Check(le, kOperandIsNotAName, t8, Operand(LAST_NAME_TYPE));
}
}
......@@ -5376,10 +5369,10 @@ void MacroAssembler::AssertName(Register object) {
void MacroAssembler::AssertFunction(Register object) {
if (emit_debug_code()) {
STATIC_ASSERT(kSmiTag == 0);
SmiTst(object, t0);
Check(ne, kOperandIsASmiAndNotAFunction, t0, Operand(zero_reg));
GetObjectType(object, t0, t0);
Check(eq, kOperandIsNotAFunction, t0, Operand(JS_FUNCTION_TYPE));
SmiTst(object, t8);
Check(ne, kOperandIsASmiAndNotAFunction, t8, Operand(zero_reg));
GetObjectType(object, t8, t8);
Check(eq, kOperandIsNotAFunction, t8, Operand(JS_FUNCTION_TYPE));
}
}
......@@ -5391,11 +5384,9 @@ void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
AssertNotSmi(object);
LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
Branch(&done_checking, eq, object, Operand(scratch));
push(object);
ld(object, FieldMemOperand(object, HeapObject::kMapOffset));
ld(t8, FieldMemOperand(object, HeapObject::kMapOffset));
LoadRoot(scratch, Heap::kAllocationSiteMapRootIndex);
Assert(eq, kExpectedUndefinedOrCell, object, Operand(scratch));
pop(object);
Assert(eq, kExpectedUndefinedOrCell, t8, Operand(scratch));
bind(&done_checking);
}
}
......
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