Use weak cell in monomorphic KeyedStore IC.
BUG=v8:3629 LOG=N Review URL: https://codereview.chromium.org/817873003 Cr-Commit-Position: refs/heads/master@{#25923}
This commit is contained in:
parent
ee98a1d760
commit
eff42215f0
@ -2252,18 +2252,16 @@ void MacroAssembler::CheckMap(Register obj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::DispatchMap(Register obj,
|
void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1,
|
||||||
Register scratch,
|
Register scratch2, Handle<WeakCell> cell,
|
||||||
Handle<Map> map,
|
Handle<Code> success,
|
||||||
Handle<Code> success,
|
SmiCheckType smi_check_type) {
|
||||||
SmiCheckType smi_check_type) {
|
|
||||||
Label fail;
|
Label fail;
|
||||||
if (smi_check_type == DO_SMI_CHECK) {
|
if (smi_check_type == DO_SMI_CHECK) {
|
||||||
JumpIfSmi(obj, &fail);
|
JumpIfSmi(obj, &fail);
|
||||||
}
|
}
|
||||||
ldr(scratch, FieldMemOperand(obj, HeapObject::kMapOffset));
|
ldr(scratch1, FieldMemOperand(obj, HeapObject::kMapOffset));
|
||||||
mov(ip, Operand(map));
|
CmpWeakValue(scratch1, cell, scratch2);
|
||||||
cmp(scratch, ip);
|
|
||||||
Jump(success, RelocInfo::CODE_TARGET, eq);
|
Jump(success, RelocInfo::CODE_TARGET, eq);
|
||||||
bind(&fail);
|
bind(&fail);
|
||||||
}
|
}
|
||||||
|
@ -914,14 +914,12 @@ class MacroAssembler: public Assembler {
|
|||||||
SmiCheckType smi_check_type);
|
SmiCheckType smi_check_type);
|
||||||
|
|
||||||
|
|
||||||
// Check if the map of an object is equal to a specified map and branch to a
|
// Check if the map of an object is equal to a specified weak map and branch
|
||||||
// specified target if equal. Skip the smi check if not required (object is
|
// to a specified target if equal. Skip the smi check if not required
|
||||||
// known to be a heap object)
|
// (object is known to be a heap object)
|
||||||
void DispatchMap(Register obj,
|
void DispatchWeakMap(Register obj, Register scratch1, Register scratch2,
|
||||||
Register scratch,
|
Handle<WeakCell> cell, Handle<Code> success,
|
||||||
Handle<Map> map,
|
SmiCheckType smi_check_type);
|
||||||
Handle<Code> success,
|
|
||||||
SmiCheckType smi_check_type);
|
|
||||||
|
|
||||||
// Compare the given value and the value of weak cell.
|
// Compare the given value and the value of weak cell.
|
||||||
void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch);
|
void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch);
|
||||||
|
@ -3788,17 +3788,16 @@ void MacroAssembler::CheckMap(Register obj_map,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::DispatchMap(Register obj,
|
void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1,
|
||||||
Register scratch,
|
Register scratch2, Handle<WeakCell> cell,
|
||||||
Handle<Map> map,
|
Handle<Code> success,
|
||||||
Handle<Code> success,
|
SmiCheckType smi_check_type) {
|
||||||
SmiCheckType smi_check_type) {
|
|
||||||
Label fail;
|
Label fail;
|
||||||
if (smi_check_type == DO_SMI_CHECK) {
|
if (smi_check_type == DO_SMI_CHECK) {
|
||||||
JumpIfSmi(obj, &fail);
|
JumpIfSmi(obj, &fail);
|
||||||
}
|
}
|
||||||
Ldr(scratch, FieldMemOperand(obj, HeapObject::kMapOffset));
|
Ldr(scratch1, FieldMemOperand(obj, HeapObject::kMapOffset));
|
||||||
Cmp(scratch, Operand(map));
|
CmpWeakValue(scratch1, cell, scratch2);
|
||||||
B(ne, &fail);
|
B(ne, &fail);
|
||||||
Jump(success, RelocInfo::CODE_TARGET);
|
Jump(success, RelocInfo::CODE_TARGET);
|
||||||
Bind(&fail);
|
Bind(&fail);
|
||||||
|
@ -1478,14 +1478,12 @@ class MacroAssembler : public Assembler {
|
|||||||
Label* fail,
|
Label* fail,
|
||||||
SmiCheckType smi_check_type);
|
SmiCheckType smi_check_type);
|
||||||
|
|
||||||
// Check if the map of an object is equal to a specified map and branch to a
|
// Check if the map of an object is equal to a specified weak map and branch
|
||||||
// specified target if equal. Skip the smi check if not required (object is
|
// to a specified target if equal. Skip the smi check if not required
|
||||||
// known to be a heap object)
|
// (object is known to be a heap object)
|
||||||
void DispatchMap(Register obj,
|
void DispatchWeakMap(Register obj, Register scratch1, Register scratch2,
|
||||||
Register scratch,
|
Handle<WeakCell> cell, Handle<Code> success,
|
||||||
Handle<Map> map,
|
SmiCheckType smi_check_type);
|
||||||
Handle<Code> success,
|
|
||||||
SmiCheckType smi_check_type);
|
|
||||||
|
|
||||||
// Compare the given value and the value of weak cell.
|
// Compare the given value and the value of weak cell.
|
||||||
void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch);
|
void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch);
|
||||||
|
@ -740,16 +740,16 @@ void MacroAssembler::CheckMap(Register obj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::DispatchMap(Register obj,
|
void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1,
|
||||||
Register unused,
|
Register scratch2, Handle<WeakCell> cell,
|
||||||
Handle<Map> map,
|
Handle<Code> success,
|
||||||
Handle<Code> success,
|
SmiCheckType smi_check_type) {
|
||||||
SmiCheckType smi_check_type) {
|
|
||||||
Label fail;
|
Label fail;
|
||||||
if (smi_check_type == DO_SMI_CHECK) {
|
if (smi_check_type == DO_SMI_CHECK) {
|
||||||
JumpIfSmi(obj, &fail);
|
JumpIfSmi(obj, &fail);
|
||||||
}
|
}
|
||||||
cmp(FieldOperand(obj, HeapObject::kMapOffset), Immediate(map));
|
mov(scratch1, FieldOperand(obj, HeapObject::kMapOffset));
|
||||||
|
CmpWeakValue(scratch1, cell, scratch2);
|
||||||
j(equal, success);
|
j(equal, success);
|
||||||
|
|
||||||
bind(&fail);
|
bind(&fail);
|
||||||
|
@ -411,14 +411,12 @@ class MacroAssembler: public Assembler {
|
|||||||
Label* fail,
|
Label* fail,
|
||||||
SmiCheckType smi_check_type);
|
SmiCheckType smi_check_type);
|
||||||
|
|
||||||
// Check if the map of an object is equal to a specified map and branch to a
|
// Check if the map of an object is equal to a specified weak map and branch
|
||||||
// specified target if equal. Skip the smi check if not required (object is
|
// to a specified target if equal. Skip the smi check if not required
|
||||||
// known to be a heap object)
|
// (object is known to be a heap object)
|
||||||
void DispatchMap(Register obj,
|
void DispatchWeakMap(Register obj, Register scratch1, Register scratch2,
|
||||||
Register unused,
|
Handle<WeakCell> cell, Handle<Code> success,
|
||||||
Handle<Map> map,
|
SmiCheckType smi_check_type);
|
||||||
Handle<Code> success,
|
|
||||||
SmiCheckType smi_check_type);
|
|
||||||
|
|
||||||
// Check if the object in register heap_object is a string. Afterwards the
|
// Check if the object in register heap_object is a string. Afterwards the
|
||||||
// register map contains the object map and the register instance_type
|
// register map contains the object map and the register instance_type
|
||||||
|
@ -451,7 +451,10 @@ Handle<Code> PropertyICCompiler::CompileKeyedStoreMonomorphic(
|
|||||||
stub = StoreElementStub(isolate(), elements_kind).GetCode();
|
stub = StoreElementStub(isolate(), elements_kind).GetCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
__ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK);
|
Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map);
|
||||||
|
|
||||||
|
__ DispatchWeakMap(receiver(), scratch1(), scratch2(), cell, stub,
|
||||||
|
DO_SMI_CHECK);
|
||||||
|
|
||||||
TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss);
|
TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss);
|
||||||
|
|
||||||
|
@ -3998,17 +3998,17 @@ void MacroAssembler::CheckMap(Register obj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::DispatchMap(Register obj,
|
void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1,
|
||||||
Register scratch,
|
Register scratch2, Handle<WeakCell> cell,
|
||||||
Handle<Map> map,
|
Handle<Code> success,
|
||||||
Handle<Code> success,
|
SmiCheckType smi_check_type) {
|
||||||
SmiCheckType smi_check_type) {
|
|
||||||
Label fail;
|
Label fail;
|
||||||
if (smi_check_type == DO_SMI_CHECK) {
|
if (smi_check_type == DO_SMI_CHECK) {
|
||||||
JumpIfSmi(obj, &fail);
|
JumpIfSmi(obj, &fail);
|
||||||
}
|
}
|
||||||
lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset));
|
lw(scratch1, FieldMemOperand(obj, HeapObject::kMapOffset));
|
||||||
Jump(success, RelocInfo::CODE_TARGET, eq, scratch, Operand(map));
|
GetWeakValue(scratch2, cell);
|
||||||
|
Jump(success, RelocInfo::CODE_TARGET, eq, scratch1, Operand(scratch2));
|
||||||
bind(&fail);
|
bind(&fail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1080,14 +1080,12 @@ class MacroAssembler: public Assembler {
|
|||||||
Label* fail,
|
Label* fail,
|
||||||
SmiCheckType smi_check_type);
|
SmiCheckType smi_check_type);
|
||||||
|
|
||||||
// Check if the map of an object is equal to a specified map and branch to a
|
// Check if the map of an object is equal to a specified weak map and branch
|
||||||
// specified target if equal. Skip the smi check if not required (object is
|
// to a specified target if equal. Skip the smi check if not required
|
||||||
// known to be a heap object)
|
// (object is known to be a heap object)
|
||||||
void DispatchMap(Register obj,
|
void DispatchWeakMap(Register obj, Register scratch1, Register scratch2,
|
||||||
Register scratch,
|
Handle<WeakCell> cell, Handle<Code> success,
|
||||||
Handle<Map> map,
|
SmiCheckType smi_check_type);
|
||||||
Handle<Code> success,
|
|
||||||
SmiCheckType smi_check_type);
|
|
||||||
|
|
||||||
// Get value of the weak cell.
|
// Get value of the weak cell.
|
||||||
void GetWeakValue(Register value, Handle<WeakCell> cell);
|
void GetWeakValue(Register value, Handle<WeakCell> cell);
|
||||||
|
@ -3965,17 +3965,17 @@ void MacroAssembler::CheckMap(Register obj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::DispatchMap(Register obj,
|
void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1,
|
||||||
Register scratch,
|
Register scratch2, Handle<WeakCell> cell,
|
||||||
Handle<Map> map,
|
Handle<Code> success,
|
||||||
Handle<Code> success,
|
SmiCheckType smi_check_type) {
|
||||||
SmiCheckType smi_check_type) {
|
|
||||||
Label fail;
|
Label fail;
|
||||||
if (smi_check_type == DO_SMI_CHECK) {
|
if (smi_check_type == DO_SMI_CHECK) {
|
||||||
JumpIfSmi(obj, &fail);
|
JumpIfSmi(obj, &fail);
|
||||||
}
|
}
|
||||||
ld(scratch, FieldMemOperand(obj, HeapObject::kMapOffset));
|
ld(scratch1, FieldMemOperand(obj, HeapObject::kMapOffset));
|
||||||
Jump(success, RelocInfo::CODE_TARGET, eq, scratch, Operand(map));
|
GetWeakValue(scratch2, cell);
|
||||||
|
Jump(success, RelocInfo::CODE_TARGET, eq, scratch1, Operand(scratch2));
|
||||||
bind(&fail);
|
bind(&fail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1110,14 +1110,12 @@ class MacroAssembler: public Assembler {
|
|||||||
Label* fail,
|
Label* fail,
|
||||||
SmiCheckType smi_check_type);
|
SmiCheckType smi_check_type);
|
||||||
|
|
||||||
// Check if the map of an object is equal to a specified map and branch to a
|
// Check if the map of an object is equal to a specified weak map and branch
|
||||||
// specified target if equal. Skip the smi check if not required (object is
|
// to a specified target if equal. Skip the smi check if not required
|
||||||
// known to be a heap object)
|
// (object is known to be a heap object)
|
||||||
void DispatchMap(Register obj,
|
void DispatchWeakMap(Register obj, Register scratch1, Register scratch2,
|
||||||
Register scratch,
|
Handle<WeakCell> cell, Handle<Code> success,
|
||||||
Handle<Map> map,
|
SmiCheckType smi_check_type);
|
||||||
Handle<Code> success,
|
|
||||||
SmiCheckType smi_check_type);
|
|
||||||
|
|
||||||
// Get value of the weak cell.
|
// Get value of the weak cell.
|
||||||
void GetWeakValue(Register value, Handle<WeakCell> cell);
|
void GetWeakValue(Register value, Handle<WeakCell> cell);
|
||||||
|
@ -3630,18 +3630,17 @@ void MacroAssembler::EnumLength(Register dst, Register map) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::DispatchMap(Register obj,
|
void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1,
|
||||||
Register unused,
|
Register scratch2, Handle<WeakCell> cell,
|
||||||
Handle<Map> map,
|
Handle<Code> success,
|
||||||
Handle<Code> success,
|
SmiCheckType smi_check_type) {
|
||||||
SmiCheckType smi_check_type) {
|
|
||||||
Label fail;
|
Label fail;
|
||||||
if (smi_check_type == DO_SMI_CHECK) {
|
if (smi_check_type == DO_SMI_CHECK) {
|
||||||
JumpIfSmi(obj, &fail);
|
JumpIfSmi(obj, &fail);
|
||||||
}
|
}
|
||||||
Cmp(FieldOperand(obj, HeapObject::kMapOffset), map);
|
movq(scratch1, FieldOperand(obj, HeapObject::kMapOffset));
|
||||||
|
CmpWeakValue(scratch1, cell, scratch2);
|
||||||
j(equal, success, RelocInfo::CODE_TARGET);
|
j(equal, success, RelocInfo::CODE_TARGET);
|
||||||
|
|
||||||
bind(&fail);
|
bind(&fail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -992,14 +992,12 @@ class MacroAssembler: public Assembler {
|
|||||||
Label* fail,
|
Label* fail,
|
||||||
SmiCheckType smi_check_type);
|
SmiCheckType smi_check_type);
|
||||||
|
|
||||||
// Check if the map of an object is equal to a specified map and branch to a
|
// Check if the map of an object is equal to a specified weak map and branch
|
||||||
// specified target if equal. Skip the smi check if not required (object is
|
// to a specified target if equal. Skip the smi check if not required
|
||||||
// known to be a heap object)
|
// (object is known to be a heap object)
|
||||||
void DispatchMap(Register obj,
|
void DispatchWeakMap(Register obj, Register scratch1, Register scratch2,
|
||||||
Register unused,
|
Handle<WeakCell> cell, Handle<Code> success,
|
||||||
Handle<Map> map,
|
SmiCheckType smi_check_type);
|
||||||
Handle<Code> success,
|
|
||||||
SmiCheckType smi_check_type);
|
|
||||||
|
|
||||||
// Check if the object in register heap_object is a string. Afterwards the
|
// Check if the object in register heap_object is a string. Afterwards the
|
||||||
// register map contains the object map and the register instance_type
|
// register map contains the object map and the register instance_type
|
||||||
|
@ -654,16 +654,16 @@ void MacroAssembler::CheckMap(Register obj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::DispatchMap(Register obj,
|
void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1,
|
||||||
Register unused,
|
Register scratch2, Handle<WeakCell> cell,
|
||||||
Handle<Map> map,
|
Handle<Code> success,
|
||||||
Handle<Code> success,
|
SmiCheckType smi_check_type) {
|
||||||
SmiCheckType smi_check_type) {
|
|
||||||
Label fail;
|
Label fail;
|
||||||
if (smi_check_type == DO_SMI_CHECK) {
|
if (smi_check_type == DO_SMI_CHECK) {
|
||||||
JumpIfSmi(obj, &fail);
|
JumpIfSmi(obj, &fail);
|
||||||
}
|
}
|
||||||
cmp(FieldOperand(obj, HeapObject::kMapOffset), Immediate(map));
|
mov(scratch1, FieldOperand(obj, HeapObject::kMapOffset));
|
||||||
|
CmpWeakValue(scratch1, cell, scratch2);
|
||||||
j(equal, success);
|
j(equal, success);
|
||||||
|
|
||||||
bind(&fail);
|
bind(&fail);
|
||||||
|
@ -378,14 +378,12 @@ class MacroAssembler: public Assembler {
|
|||||||
Label* fail,
|
Label* fail,
|
||||||
SmiCheckType smi_check_type);
|
SmiCheckType smi_check_type);
|
||||||
|
|
||||||
// Check if the map of an object is equal to a specified map and branch to a
|
// Check if the map of an object is equal to a specified weak map and branch
|
||||||
// specified target if equal. Skip the smi check if not required (object is
|
// to a specified target if equal. Skip the smi check if not required
|
||||||
// known to be a heap object)
|
// (object is known to be a heap object)
|
||||||
void DispatchMap(Register obj,
|
void DispatchWeakMap(Register obj, Register scratch1, Register scratch2,
|
||||||
Register unused,
|
Handle<WeakCell> cell, Handle<Code> success,
|
||||||
Handle<Map> map,
|
SmiCheckType smi_check_type);
|
||||||
Handle<Code> success,
|
|
||||||
SmiCheckType smi_check_type);
|
|
||||||
|
|
||||||
// Check if the object in register heap_object is a string. Afterwards the
|
// Check if the object in register heap_object is a string. Afterwards the
|
||||||
// register map contains the object map and the register instance_type
|
// register map contains the object map and the register instance_type
|
||||||
|
Loading…
Reference in New Issue
Block a user