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( ...@@ -419,8 +419,8 @@ Register PropertyHandlerCompiler::CheckPrototypes(
__ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); __ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
if (depth != 1 || check == CHECK_ALL_MAPS) { if (depth != 1 || check == CHECK_ALL_MAPS) {
Handle<WeakCell> cell = Map::WeakCellForMap(current_map); Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
__ CmpWeakValue(scratch2, map_reg, cell); __ GetWeakValue(scratch2, cell);
__ Branch(miss, ne, scratch2, Operand(zero_reg)); __ Branch(miss, ne, scratch2, Operand(map_reg));
} }
// Check access rights to the global object. This has to happen after // Check access rights to the global object. This has to happen after
...@@ -453,8 +453,8 @@ Register PropertyHandlerCompiler::CheckPrototypes( ...@@ -453,8 +453,8 @@ Register PropertyHandlerCompiler::CheckPrototypes(
// Check the holder map. // Check the holder map.
__ lw(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); __ lw(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
Handle<WeakCell> cell = Map::WeakCellForMap(current_map); Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
__ CmpWeakValue(scratch2, scratch1, cell); __ GetWeakValue(scratch2, cell);
__ Branch(miss, ne, scratch2, Operand(zero_reg)); __ Branch(miss, ne, scratch2, Operand(scratch1));
} }
// Perform security check for access to the global object. // Perform security check for access to the global object.
......
...@@ -420,8 +420,8 @@ Register PropertyHandlerCompiler::CheckPrototypes( ...@@ -420,8 +420,8 @@ Register PropertyHandlerCompiler::CheckPrototypes(
__ ld(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); __ ld(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
if (depth != 1 || check == CHECK_ALL_MAPS) { if (depth != 1 || check == CHECK_ALL_MAPS) {
Handle<WeakCell> cell = Map::WeakCellForMap(current_map); Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
__ CmpWeakValue(scratch2, map_reg, cell); __ GetWeakValue(scratch2, cell);
__ Branch(miss, ne, scratch2, Operand(zero_reg)); __ Branch(miss, ne, scratch2, Operand(map_reg));
} }
// Check access rights to the global object. This has to happen after // Check access rights to the global object. This has to happen after
...@@ -454,8 +454,8 @@ Register PropertyHandlerCompiler::CheckPrototypes( ...@@ -454,8 +454,8 @@ Register PropertyHandlerCompiler::CheckPrototypes(
// Check the holder map. // Check the holder map.
__ ld(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); __ ld(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
Handle<WeakCell> cell = Map::WeakCellForMap(current_map); Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
__ CmpWeakValue(scratch2, scratch1, cell); __ GetWeakValue(scratch2, cell);
__ Branch(miss, ne, scratch2, Operand(zero_reg)); __ Branch(miss, ne, scratch2, Operand(scratch1));
} }
// Perform security check for access to the global object. // Perform security check for access to the global object.
......
...@@ -4027,18 +4027,15 @@ void MacroAssembler::CheckMap(Register obj, ...@@ -4027,18 +4027,15 @@ void MacroAssembler::CheckMap(Register obj,
} }
void MacroAssembler::CmpWeakValue(Register match, Register value, void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
Handle<WeakCell> cell) { li(value, Operand(cell));
li(match, Operand(cell)); lw(value, FieldMemOperand(value, WeakCell::kValueOffset));
lw(match, FieldMemOperand(match, WeakCell::kValueOffset));
Subu(match, value, match);
} }
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell, void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
Label* miss) { Label* miss) {
li(value, Operand(cell)); GetWeakValue(value, cell);
lw(value, FieldMemOperand(value, WeakCell::kValueOffset));
JumpIfSmi(value, miss); JumpIfSmi(value, miss);
} }
......
...@@ -1089,9 +1089,8 @@ class MacroAssembler: public Assembler { ...@@ -1089,9 +1089,8 @@ class MacroAssembler: public Assembler {
Handle<Code> success, Handle<Code> success,
SmiCheckType smi_check_type); SmiCheckType smi_check_type);
// Compare the given value and the value of the weak cell. Write the result // Get value of the weak cell.
// to the match register. void GetWeakValue(Register value, Handle<WeakCell> cell);
void CmpWeakValue(Register match, Register value, Handle<WeakCell> cell);
// Load the value of the weak cell in the value register. Branch to the // Load the value of the weak cell in the value register. Branch to the
// given miss label is the weak cell was cleared. // given miss label is the weak cell was cleared.
......
...@@ -3994,18 +3994,15 @@ void MacroAssembler::CheckMap(Register obj, ...@@ -3994,18 +3994,15 @@ void MacroAssembler::CheckMap(Register obj,
} }
void MacroAssembler::CmpWeakValue(Register match, Register value, void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
Handle<WeakCell> cell) { li(value, Operand(cell));
li(match, Operand(cell)); ld(value, FieldMemOperand(value, WeakCell::kValueOffset));
ld(match, FieldMemOperand(match, WeakCell::kValueOffset));
Dsubu(match, value, match);
} }
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell, void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
Label* miss) { Label* miss) {
li(value, Operand(cell)); GetWeakValue(value, cell);
ld(value, FieldMemOperand(value, WeakCell::kValueOffset));
JumpIfSmi(value, miss); JumpIfSmi(value, miss);
} }
......
...@@ -1119,9 +1119,8 @@ class MacroAssembler: public Assembler { ...@@ -1119,9 +1119,8 @@ class MacroAssembler: public Assembler {
Handle<Code> success, Handle<Code> success,
SmiCheckType smi_check_type); SmiCheckType smi_check_type);
// Compare the given value and the value of the weak cell. Write the result // Get value of the weak cell.
// to the match register. void GetWeakValue(Register value, Handle<WeakCell> cell);
void CmpWeakValue(Register match, Register value, Handle<WeakCell> cell);
// Load the value of the weak cell in the value register. Branch to the // Load the value of the weak cell in the value register. Branch to the
// given miss label is the weak cell was cleared. // 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