From: ulan Date: Mon, 22 Dec 2014 13:38:05 +0000 (-0800) Subject: Use weak cell in monomorphic KeyedStore IC. X-Git-Tag: upstream/4.7.83~5117 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eff42215f08259d9f1329818604866d5467522f7;p=platform%2Fupstream%2Fv8.git 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} --- diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc index 2c798c174..0aa886bac 100644 --- a/src/arm/macro-assembler-arm.cc +++ b/src/arm/macro-assembler-arm.cc @@ -2252,18 +2252,16 @@ void MacroAssembler::CheckMap(Register obj, } -void MacroAssembler::DispatchMap(Register obj, - Register scratch, - Handle map, - Handle success, - SmiCheckType smi_check_type) { +void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1, + Register scratch2, Handle cell, + Handle success, + SmiCheckType smi_check_type) { Label fail; if (smi_check_type == DO_SMI_CHECK) { JumpIfSmi(obj, &fail); } - ldr(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); - mov(ip, Operand(map)); - cmp(scratch, ip); + ldr(scratch1, FieldMemOperand(obj, HeapObject::kMapOffset)); + CmpWeakValue(scratch1, cell, scratch2); Jump(success, RelocInfo::CODE_TARGET, eq); bind(&fail); } diff --git a/src/arm/macro-assembler-arm.h b/src/arm/macro-assembler-arm.h index 65f77fb69..d83b64b80 100644 --- a/src/arm/macro-assembler-arm.h +++ b/src/arm/macro-assembler-arm.h @@ -914,14 +914,12 @@ class MacroAssembler: public Assembler { SmiCheckType smi_check_type); - // Check if the map of an object is equal to a specified map and branch to a - // specified target if equal. Skip the smi check if not required (object is - // known to be a heap object) - void DispatchMap(Register obj, - Register scratch, - Handle map, - Handle success, - SmiCheckType smi_check_type); + // Check if the map of an object is equal to a specified weak map and branch + // to a specified target if equal. Skip the smi check if not required + // (object is known to be a heap object) + void DispatchWeakMap(Register obj, Register scratch1, Register scratch2, + Handle cell, Handle success, + SmiCheckType smi_check_type); // Compare the given value and the value of weak cell. void CmpWeakValue(Register value, Handle cell, Register scratch); diff --git a/src/arm64/macro-assembler-arm64.cc b/src/arm64/macro-assembler-arm64.cc index d359528e1..0253e7cdc 100644 --- a/src/arm64/macro-assembler-arm64.cc +++ b/src/arm64/macro-assembler-arm64.cc @@ -3788,17 +3788,16 @@ void MacroAssembler::CheckMap(Register obj_map, } -void MacroAssembler::DispatchMap(Register obj, - Register scratch, - Handle map, - Handle success, - SmiCheckType smi_check_type) { +void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1, + Register scratch2, Handle cell, + Handle success, + SmiCheckType smi_check_type) { Label fail; if (smi_check_type == DO_SMI_CHECK) { JumpIfSmi(obj, &fail); } - Ldr(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); - Cmp(scratch, Operand(map)); + Ldr(scratch1, FieldMemOperand(obj, HeapObject::kMapOffset)); + CmpWeakValue(scratch1, cell, scratch2); B(ne, &fail); Jump(success, RelocInfo::CODE_TARGET); Bind(&fail); diff --git a/src/arm64/macro-assembler-arm64.h b/src/arm64/macro-assembler-arm64.h index 905d4493e..ee4358955 100644 --- a/src/arm64/macro-assembler-arm64.h +++ b/src/arm64/macro-assembler-arm64.h @@ -1478,14 +1478,12 @@ class MacroAssembler : public Assembler { Label* fail, SmiCheckType smi_check_type); - // Check if the map of an object is equal to a specified map and branch to a - // specified target if equal. Skip the smi check if not required (object is - // known to be a heap object) - void DispatchMap(Register obj, - Register scratch, - Handle map, - Handle success, - SmiCheckType smi_check_type); + // Check if the map of an object is equal to a specified weak map and branch + // to a specified target if equal. Skip the smi check if not required + // (object is known to be a heap object) + void DispatchWeakMap(Register obj, Register scratch1, Register scratch2, + Handle cell, Handle success, + SmiCheckType smi_check_type); // Compare the given value and the value of weak cell. void CmpWeakValue(Register value, Handle cell, Register scratch); diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index 41ac21315..38259d765 100644 --- a/src/ia32/macro-assembler-ia32.cc +++ b/src/ia32/macro-assembler-ia32.cc @@ -740,16 +740,16 @@ void MacroAssembler::CheckMap(Register obj, } -void MacroAssembler::DispatchMap(Register obj, - Register unused, - Handle map, - Handle success, - SmiCheckType smi_check_type) { +void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1, + Register scratch2, Handle cell, + Handle success, + SmiCheckType smi_check_type) { Label fail; if (smi_check_type == DO_SMI_CHECK) { JumpIfSmi(obj, &fail); } - cmp(FieldOperand(obj, HeapObject::kMapOffset), Immediate(map)); + mov(scratch1, FieldOperand(obj, HeapObject::kMapOffset)); + CmpWeakValue(scratch1, cell, scratch2); j(equal, success); bind(&fail); diff --git a/src/ia32/macro-assembler-ia32.h b/src/ia32/macro-assembler-ia32.h index d4f8f7bf1..83f621644 100644 --- a/src/ia32/macro-assembler-ia32.h +++ b/src/ia32/macro-assembler-ia32.h @@ -411,14 +411,12 @@ class MacroAssembler: public Assembler { Label* fail, SmiCheckType smi_check_type); - // Check if the map of an object is equal to a specified map and branch to a - // specified target if equal. Skip the smi check if not required (object is - // known to be a heap object) - void DispatchMap(Register obj, - Register unused, - Handle map, - Handle success, - SmiCheckType smi_check_type); + // Check if the map of an object is equal to a specified weak map and branch + // to a specified target if equal. Skip the smi check if not required + // (object is known to be a heap object) + void DispatchWeakMap(Register obj, Register scratch1, Register scratch2, + Handle cell, Handle success, + SmiCheckType smi_check_type); // Check if the object in register heap_object is a string. Afterwards the // register map contains the object map and the register instance_type diff --git a/src/ic/ic-compiler.cc b/src/ic/ic-compiler.cc index 3a1731268..cdb7ea588 100644 --- a/src/ic/ic-compiler.cc +++ b/src/ic/ic-compiler.cc @@ -451,7 +451,10 @@ Handle PropertyICCompiler::CompileKeyedStoreMonomorphic( stub = StoreElementStub(isolate(), elements_kind).GetCode(); } - __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK); + Handle cell = Map::WeakCellForMap(receiver_map); + + __ DispatchWeakMap(receiver(), scratch1(), scratch2(), cell, stub, + DO_SMI_CHECK); TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc index 78a583f5b..90c3499a9 100644 --- a/src/mips/macro-assembler-mips.cc +++ b/src/mips/macro-assembler-mips.cc @@ -3998,17 +3998,17 @@ void MacroAssembler::CheckMap(Register obj, } -void MacroAssembler::DispatchMap(Register obj, - Register scratch, - Handle map, - Handle success, - SmiCheckType smi_check_type) { +void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1, + Register scratch2, Handle cell, + Handle success, + SmiCheckType smi_check_type) { Label fail; if (smi_check_type == DO_SMI_CHECK) { JumpIfSmi(obj, &fail); } - lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); - Jump(success, RelocInfo::CODE_TARGET, eq, scratch, Operand(map)); + lw(scratch1, FieldMemOperand(obj, HeapObject::kMapOffset)); + GetWeakValue(scratch2, cell); + Jump(success, RelocInfo::CODE_TARGET, eq, scratch1, Operand(scratch2)); bind(&fail); } diff --git a/src/mips/macro-assembler-mips.h b/src/mips/macro-assembler-mips.h index 7a2c20951..0bc1e15aa 100644 --- a/src/mips/macro-assembler-mips.h +++ b/src/mips/macro-assembler-mips.h @@ -1080,14 +1080,12 @@ class MacroAssembler: public Assembler { Label* fail, SmiCheckType smi_check_type); - // Check if the map of an object is equal to a specified map and branch to a - // specified target if equal. Skip the smi check if not required (object is - // known to be a heap object) - void DispatchMap(Register obj, - Register scratch, - Handle map, - Handle success, - SmiCheckType smi_check_type); + // Check if the map of an object is equal to a specified weak map and branch + // to a specified target if equal. Skip the smi check if not required + // (object is known to be a heap object) + void DispatchWeakMap(Register obj, Register scratch1, Register scratch2, + Handle cell, Handle success, + SmiCheckType smi_check_type); // Get value of the weak cell. void GetWeakValue(Register value, Handle cell); diff --git a/src/mips64/macro-assembler-mips64.cc b/src/mips64/macro-assembler-mips64.cc index f04331d0e..2de1c2a1a 100644 --- a/src/mips64/macro-assembler-mips64.cc +++ b/src/mips64/macro-assembler-mips64.cc @@ -3965,17 +3965,17 @@ void MacroAssembler::CheckMap(Register obj, } -void MacroAssembler::DispatchMap(Register obj, - Register scratch, - Handle map, - Handle success, - SmiCheckType smi_check_type) { +void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1, + Register scratch2, Handle cell, + Handle success, + SmiCheckType smi_check_type) { Label fail; if (smi_check_type == DO_SMI_CHECK) { JumpIfSmi(obj, &fail); } - ld(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); - Jump(success, RelocInfo::CODE_TARGET, eq, scratch, Operand(map)); + ld(scratch1, FieldMemOperand(obj, HeapObject::kMapOffset)); + GetWeakValue(scratch2, cell); + Jump(success, RelocInfo::CODE_TARGET, eq, scratch1, Operand(scratch2)); bind(&fail); } diff --git a/src/mips64/macro-assembler-mips64.h b/src/mips64/macro-assembler-mips64.h index 1cc3f9589..a9e877253 100644 --- a/src/mips64/macro-assembler-mips64.h +++ b/src/mips64/macro-assembler-mips64.h @@ -1110,14 +1110,12 @@ class MacroAssembler: public Assembler { Label* fail, SmiCheckType smi_check_type); - // Check if the map of an object is equal to a specified map and branch to a - // specified target if equal. Skip the smi check if not required (object is - // known to be a heap object) - void DispatchMap(Register obj, - Register scratch, - Handle map, - Handle success, - SmiCheckType smi_check_type); + // Check if the map of an object is equal to a specified weak map and branch + // to a specified target if equal. Skip the smi check if not required + // (object is known to be a heap object) + void DispatchWeakMap(Register obj, Register scratch1, Register scratch2, + Handle cell, Handle success, + SmiCheckType smi_check_type); // Get value of the weak cell. void GetWeakValue(Register value, Handle cell); diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index ba4e308e5..5b897de54 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -3630,18 +3630,17 @@ void MacroAssembler::EnumLength(Register dst, Register map) { } -void MacroAssembler::DispatchMap(Register obj, - Register unused, - Handle map, - Handle success, - SmiCheckType smi_check_type) { +void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1, + Register scratch2, Handle cell, + Handle success, + SmiCheckType smi_check_type) { Label fail; if (smi_check_type == DO_SMI_CHECK) { 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); - bind(&fail); } diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h index 82c047af5..465666555 100644 --- a/src/x64/macro-assembler-x64.h +++ b/src/x64/macro-assembler-x64.h @@ -992,14 +992,12 @@ class MacroAssembler: public Assembler { Label* fail, SmiCheckType smi_check_type); - // Check if the map of an object is equal to a specified map and branch to a - // specified target if equal. Skip the smi check if not required (object is - // known to be a heap object) - void DispatchMap(Register obj, - Register unused, - Handle map, - Handle success, - SmiCheckType smi_check_type); + // Check if the map of an object is equal to a specified weak map and branch + // to a specified target if equal. Skip the smi check if not required + // (object is known to be a heap object) + void DispatchWeakMap(Register obj, Register scratch1, Register scratch2, + Handle cell, Handle success, + SmiCheckType smi_check_type); // Check if the object in register heap_object is a string. Afterwards the // register map contains the object map and the register instance_type diff --git a/src/x87/macro-assembler-x87.cc b/src/x87/macro-assembler-x87.cc index 9fa5c8efc..008b2af63 100644 --- a/src/x87/macro-assembler-x87.cc +++ b/src/x87/macro-assembler-x87.cc @@ -654,16 +654,16 @@ void MacroAssembler::CheckMap(Register obj, } -void MacroAssembler::DispatchMap(Register obj, - Register unused, - Handle map, - Handle success, - SmiCheckType smi_check_type) { +void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1, + Register scratch2, Handle cell, + Handle success, + SmiCheckType smi_check_type) { Label fail; if (smi_check_type == DO_SMI_CHECK) { JumpIfSmi(obj, &fail); } - cmp(FieldOperand(obj, HeapObject::kMapOffset), Immediate(map)); + mov(scratch1, FieldOperand(obj, HeapObject::kMapOffset)); + CmpWeakValue(scratch1, cell, scratch2); j(equal, success); bind(&fail); diff --git a/src/x87/macro-assembler-x87.h b/src/x87/macro-assembler-x87.h index 16a323f52..b7972651d 100644 --- a/src/x87/macro-assembler-x87.h +++ b/src/x87/macro-assembler-x87.h @@ -378,14 +378,12 @@ class MacroAssembler: public Assembler { Label* fail, SmiCheckType smi_check_type); - // Check if the map of an object is equal to a specified map and branch to a - // specified target if equal. Skip the smi check if not required (object is - // known to be a heap object) - void DispatchMap(Register obj, - Register unused, - Handle map, - Handle success, - SmiCheckType smi_check_type); + // Check if the map of an object is equal to a specified weak map and branch + // to a specified target if equal. Skip the smi check if not required + // (object is known to be a heap object) + void DispatchWeakMap(Register obj, Register scratch1, Register scratch2, + Handle cell, Handle success, + SmiCheckType smi_check_type); // Check if the object in register heap_object is a string. Afterwards the // register map contains the object map and the register instance_type