Commit a25003cf authored by balazs.kilvady's avatar balazs.kilvady Committed by Commit bot

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}
parent edf3dab4
......@@ -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.
......
......@@ -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.
......
......@@ -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);
}
......
......@@ -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.
......
......@@ -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);
}
......
......@@ -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.
......
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