Commit 246a749a authored by ulan's avatar ulan Committed by Commit bot

Use weak cell to embed known map in CompareIC

BUG=v8:3663
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#26386}
parent 34b72eca
......@@ -3661,13 +3661,15 @@ void CompareICStub::GenerateObjects(MacroAssembler* masm) {
void CompareICStub::GenerateKnownObjects(MacroAssembler* masm) {
Label miss;
Handle<WeakCell> cell = Map::WeakCellForMap(known_map_);
__ and_(r2, r1, Operand(r0));
__ JumpIfSmi(r2, &miss);
__ GetWeakValue(r4, cell);
__ ldr(r2, FieldMemOperand(r0, HeapObject::kMapOffset));
__ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset));
__ cmp(r2, Operand(known_map_));
__ cmp(r2, r4);
__ b(ne, &miss);
__ cmp(r3, Operand(known_map_));
__ cmp(r3, r4);
__ b(ne, &miss);
__ sub(r0, r0, Operand(r1));
......
......@@ -3574,6 +3574,7 @@ void CompareICStub::GenerateKnownObjects(MacroAssembler* masm) {
ASM_LOCATION("CompareICStub[KnownObjects]");
Label miss;
Handle<WeakCell> cell = Map::WeakCellForMap(known_map_);
Register result = x0;
Register rhs = x0;
......@@ -3583,11 +3584,13 @@ void CompareICStub::GenerateKnownObjects(MacroAssembler* masm) {
Register rhs_map = x10;
Register lhs_map = x11;
Register map = x12;
__ GetWeakValue(map, cell);
__ Ldr(rhs_map, FieldMemOperand(rhs, HeapObject::kMapOffset));
__ Ldr(lhs_map, FieldMemOperand(lhs, HeapObject::kMapOffset));
__ Cmp(rhs_map, Operand(known_map_));
__ Cmp(rhs_map, map);
__ B(ne, &miss);
__ Cmp(lhs_map, Operand(known_map_));
__ Cmp(lhs_map, map);
__ B(ne, &miss);
__ Sub(result, rhs, lhs);
......
......@@ -3776,15 +3776,17 @@ void CompareICStub::GenerateObjects(MacroAssembler* masm) {
void CompareICStub::GenerateKnownObjects(MacroAssembler* masm) {
Label miss;
Handle<WeakCell> cell = Map::WeakCellForMap(known_map_);
__ mov(ecx, edx);
__ and_(ecx, eax);
__ JumpIfSmi(ecx, &miss, Label::kNear);
__ GetWeakValue(edi, cell);
__ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset));
__ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset));
__ cmp(ecx, known_map_);
__ cmp(ecx, edi);
__ j(not_equal, &miss, Label::kNear);
__ cmp(ebx, known_map_);
__ cmp(ebx, edi);
__ j(not_equal, &miss, Label::kNear);
__ sub(eax, edx);
......
......@@ -3718,14 +3718,16 @@ void CompareICStub::GenerateObjects(MacroAssembler* masm) {
void CompareICStub::GenerateKnownObjects(MacroAssembler* masm) {
Label miss;
Handle<WeakCell> cell = Map::WeakCellForMap(known_map_);
Condition either_smi = masm->CheckEitherSmi(rdx, rax);
__ j(either_smi, &miss, Label::kNear);
__ GetWeakValue(rdi, cell);
__ movp(rcx, FieldOperand(rax, HeapObject::kMapOffset));
__ movp(rbx, FieldOperand(rdx, HeapObject::kMapOffset));
__ Cmp(rcx, known_map_);
__ cmpp(rcx, rdi);
__ j(not_equal, &miss, Label::kNear);
__ Cmp(rbx, known_map_);
__ cmpp(rbx, rdi);
__ j(not_equal, &miss, Label::kNear);
__ subp(rax, rdx);
......
......@@ -3437,15 +3437,17 @@ void CompareICStub::GenerateObjects(MacroAssembler* masm) {
void CompareICStub::GenerateKnownObjects(MacroAssembler* masm) {
Label miss;
Handle<WeakCell> cell = Map::WeakCellForMap(known_map_);
__ mov(ecx, edx);
__ and_(ecx, eax);
__ JumpIfSmi(ecx, &miss, Label::kNear);
__ GetWeakValue(edi, cell);
__ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset));
__ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset));
__ cmp(ecx, known_map_);
__ cmp(ecx, edi);
__ j(not_equal, &miss, Label::kNear);
__ cmp(ebx, known_map_);
__ cmp(ebx, edi);
__ j(not_equal, &miss, Label::kNear);
__ sub(eax, edx);
......
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