MIPS: Change CmpWeakValue to a more MIPS like GetWeakValue.

This approach saves one instruction by eliminating the use of Subu as a
pseudo-comparison.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#25662}
This commit is contained in:
balazs.kilvady 2014-12-04 08:29:01 -08:00 committed by Commit bot
parent edf3dab466
commit a25003cfa6
6 changed files with 20 additions and 28 deletions

View File

@ -419,8 +419,8 @@ Register PropertyHandlerCompiler::CheckPrototypes(
__ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
if (depth != 1 || check == CHECK_ALL_MAPS) {
Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
__ CmpWeakValue(scratch2, map_reg, cell);
__ Branch(miss, ne, scratch2, Operand(zero_reg));
__ GetWeakValue(scratch2, cell);
__ Branch(miss, ne, scratch2, Operand(map_reg));
}
// Check access rights to the global object. This has to happen after
@ -453,8 +453,8 @@ Register PropertyHandlerCompiler::CheckPrototypes(
// Check the holder map.
__ lw(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
__ CmpWeakValue(scratch2, scratch1, cell);
__ Branch(miss, ne, scratch2, Operand(zero_reg));
__ GetWeakValue(scratch2, cell);
__ Branch(miss, ne, scratch2, Operand(scratch1));
}
// Perform security check for access to the global object.

View File

@ -420,8 +420,8 @@ Register PropertyHandlerCompiler::CheckPrototypes(
__ ld(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
if (depth != 1 || check == CHECK_ALL_MAPS) {
Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
__ CmpWeakValue(scratch2, map_reg, cell);
__ Branch(miss, ne, scratch2, Operand(zero_reg));
__ GetWeakValue(scratch2, cell);
__ Branch(miss, ne, scratch2, Operand(map_reg));
}
// Check access rights to the global object. This has to happen after
@ -454,8 +454,8 @@ Register PropertyHandlerCompiler::CheckPrototypes(
// Check the holder map.
__ ld(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
__ CmpWeakValue(scratch2, scratch1, cell);
__ Branch(miss, ne, scratch2, Operand(zero_reg));
__ GetWeakValue(scratch2, cell);
__ Branch(miss, ne, scratch2, Operand(scratch1));
}
// Perform security check for access to the global object.

View File

@ -4027,18 +4027,15 @@ void MacroAssembler::CheckMap(Register obj,
}
void MacroAssembler::CmpWeakValue(Register match, Register value,
Handle<WeakCell> cell) {
li(match, Operand(cell));
lw(match, FieldMemOperand(match, WeakCell::kValueOffset));
Subu(match, value, match);
void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
li(value, Operand(cell));
lw(value, FieldMemOperand(value, WeakCell::kValueOffset));
}
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
Label* miss) {
li(value, Operand(cell));
lw(value, FieldMemOperand(value, WeakCell::kValueOffset));
GetWeakValue(value, cell);
JumpIfSmi(value, miss);
}

View File

@ -1089,9 +1089,8 @@ class MacroAssembler: public Assembler {
Handle<Code> success,
SmiCheckType smi_check_type);
// Compare the given value and the value of the weak cell. Write the result
// to the match register.
void CmpWeakValue(Register match, Register value, Handle<WeakCell> cell);
// Get value of the weak cell.
void GetWeakValue(Register value, Handle<WeakCell> cell);
// Load the value of the weak cell in the value register. Branch to the
// given miss label is the weak cell was cleared.

View File

@ -3994,18 +3994,15 @@ void MacroAssembler::CheckMap(Register obj,
}
void MacroAssembler::CmpWeakValue(Register match, Register value,
Handle<WeakCell> cell) {
li(match, Operand(cell));
ld(match, FieldMemOperand(match, WeakCell::kValueOffset));
Dsubu(match, value, match);
void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
li(value, Operand(cell));
ld(value, FieldMemOperand(value, WeakCell::kValueOffset));
}
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
Label* miss) {
li(value, Operand(cell));
ld(value, FieldMemOperand(value, WeakCell::kValueOffset));
GetWeakValue(value, cell);
JumpIfSmi(value, miss);
}

View File

@ -1119,9 +1119,8 @@ class MacroAssembler: public Assembler {
Handle<Code> success,
SmiCheckType smi_check_type);
// Compare the given value and the value of the weak cell. Write the result
// to the match register.
void CmpWeakValue(Register match, Register value, Handle<WeakCell> cell);
// Get value of the weak cell.
void GetWeakValue(Register value, Handle<WeakCell> cell);
// Load the value of the weak cell in the value register. Branch to the
// given miss label is the weak cell was cleared.