From d9de2aaa17531262228bae402e03be83365c2f23 Mon Sep 17 00:00:00 2001 From: yangguo Date: Tue, 9 Dec 2014 08:09:39 -0800 Subject: [PATCH] Revert of Do not embed constant functions in StoreTransition stub. (patchset #3 id:40001 of https://codereview.chromium.org/769733003/) Reason for revert: GC stress failure: http://build.chromium.org/p/client.v8/builders/V8%20Mac%20GC%20Stress%20-%201/builds/1038 Original issue's description: > Do not embed constant functions in StoreTransition stub. > > BUG=v8:3629 > LOG=N TBR=ishell@google.com,ishell@chromium.org,ulan@chromium.org NOTREECHECKS=true NOTRY=true BUG=v8:3629 Review URL: https://codereview.chromium.org/785253002 Cr-Commit-Position: refs/heads/master@{#25728} --- src/ic/arm/handler-compiler-arm.cc | 13 +++---------- src/ic/arm64/handler-compiler-arm64.cc | 13 +++---------- src/ic/handler-compiler.cc | 5 ++--- src/ic/handler-compiler.h | 3 +-- src/ic/ia32/handler-compiler-ia32.cc | 12 ++---------- src/ic/mips/handler-compiler-mips.cc | 13 +++---------- src/ic/mips64/handler-compiler-mips64.cc | 13 +++---------- src/ic/x64/handler-compiler-x64.cc | 13 ++----------- src/ic/x87/handler-compiler-x87.cc | 12 ++---------- 9 files changed, 21 insertions(+), 76 deletions(-) diff --git a/src/ic/arm/handler-compiler-arm.cc b/src/ic/arm/handler-compiler-arm.cc index 5dcbd0f35c..ba499ab308 100644 --- a/src/ic/arm/handler-compiler-arm.cc +++ b/src/ic/arm/handler-compiler-arm.cc @@ -336,18 +336,11 @@ void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle transition, } -void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg, - int descriptor, +void NamedStoreHandlerCompiler::GenerateConstantCheck(Object* constant, Register value_reg, - Register scratch, Label* miss_label) { - DCHECK(!map_reg.is(scratch)); - DCHECK(!map_reg.is(value_reg)); - DCHECK(!value_reg.is(scratch)); - __ LoadInstanceDescriptors(map_reg, scratch); - __ ldr(scratch, - FieldMemOperand(scratch, DescriptorArray::GetValueOffset(descriptor))); - __ cmp(value_reg, scratch); + __ Move(scratch1(), handle(constant, isolate())); + __ cmp(value_reg, scratch1()); __ b(ne, miss_label); } diff --git a/src/ic/arm64/handler-compiler-arm64.cc b/src/ic/arm64/handler-compiler-arm64.cc index 9e414e2d40..2d5999ab47 100644 --- a/src/ic/arm64/handler-compiler-arm64.cc +++ b/src/ic/arm64/handler-compiler-arm64.cc @@ -380,18 +380,11 @@ void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle transition, } -void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg, - int descriptor, +void NamedStoreHandlerCompiler::GenerateConstantCheck(Object* constant, Register value_reg, - Register scratch, Label* miss_label) { - DCHECK(!map_reg.is(scratch)); - DCHECK(!map_reg.is(value_reg)); - DCHECK(!value_reg.is(scratch)); - __ LoadInstanceDescriptors(map_reg, scratch); - __ Ldr(scratch, - FieldMemOperand(scratch, DescriptorArray::GetValueOffset(descriptor))); - __ Cmp(value_reg, scratch); + __ LoadObject(scratch1(), handle(constant, isolate())); + __ Cmp(value_reg, scratch1()); __ B(ne, miss_label); } diff --git a/src/ic/handler-compiler.cc b/src/ic/handler-compiler.cc index b942a705fa..9915ed11dc 100644 --- a/src/ic/handler-compiler.cc +++ b/src/ic/handler-compiler.cc @@ -340,10 +340,9 @@ Handle NamedStoreHandlerCompiler::CompileStoreTransition( // Call to respective StoreTransitionStub. if (details.type() == CONSTANT) { + GenerateConstantCheck(descriptors->GetValue(descriptor), value(), &miss); + GenerateRestoreMap(transition, scratch2(), &miss); - DCHECK(descriptors->GetValue(descriptor)->IsJSFunction()); - Register map_reg = StoreTransitionDescriptor::MapRegister(); - GenerateConstantCheck(map_reg, descriptor, value(), scratch2(), &miss); GenerateRestoreName(name); StoreTransitionStub stub(isolate()); GenerateTailCall(masm(), stub.GetCode()); diff --git a/src/ic/handler-compiler.h b/src/ic/handler-compiler.h index efb0a397c8..ec07572fe5 100644 --- a/src/ic/handler-compiler.h +++ b/src/ic/handler-compiler.h @@ -234,8 +234,7 @@ class NamedStoreHandlerCompiler : public PropertyHandlerCompiler { void GenerateRestoreMap(Handle transition, Register scratch, Label* miss); - void GenerateConstantCheck(Register map_reg, int descriptor, - Register value_reg, Register scratch, + void GenerateConstantCheck(Object* constant, Register value_reg, Label* miss_label); void GenerateFieldTypeChecks(HeapType* field_type, Register value_reg, diff --git a/src/ic/ia32/handler-compiler-ia32.cc b/src/ic/ia32/handler-compiler-ia32.cc index 6e009038d2..d707e695d6 100644 --- a/src/ic/ia32/handler-compiler-ia32.cc +++ b/src/ic/ia32/handler-compiler-ia32.cc @@ -343,18 +343,10 @@ void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle transition, } -void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg, - int descriptor, +void NamedStoreHandlerCompiler::GenerateConstantCheck(Object* constant, Register value_reg, - Register scratch, Label* miss_label) { - DCHECK(!map_reg.is(scratch)); - DCHECK(!map_reg.is(value_reg)); - DCHECK(!value_reg.is(scratch)); - __ LoadInstanceDescriptors(map_reg, scratch); - __ mov(scratch, - FieldOperand(scratch, DescriptorArray::GetValueOffset(descriptor))); - __ cmp(value_reg, scratch); + __ CmpObject(value_reg, handle(constant, isolate())); __ j(not_equal, miss_label); } diff --git a/src/ic/mips/handler-compiler-mips.cc b/src/ic/mips/handler-compiler-mips.cc index f8ebc9407c..3167dea9d3 100644 --- a/src/ic/mips/handler-compiler-mips.cc +++ b/src/ic/mips/handler-compiler-mips.cc @@ -332,18 +332,11 @@ void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle transition, } -void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg, - int descriptor, +void NamedStoreHandlerCompiler::GenerateConstantCheck(Object* constant, Register value_reg, - Register scratch, Label* miss_label) { - DCHECK(!map_reg.is(scratch)); - DCHECK(!map_reg.is(value_reg)); - DCHECK(!value_reg.is(scratch)); - __ LoadInstanceDescriptors(map_reg, scratch); - __ lw(scratch, - FieldMemOperand(scratch, DescriptorArray::GetValueOffset(descriptor))); - __ Branch(miss_label, ne, value_reg, Operand(scratch)); + __ li(scratch1(), handle(constant, isolate())); + __ Branch(miss_label, ne, value_reg, Operand(scratch1())); } diff --git a/src/ic/mips64/handler-compiler-mips64.cc b/src/ic/mips64/handler-compiler-mips64.cc index df87625e56..6a35d6c174 100644 --- a/src/ic/mips64/handler-compiler-mips64.cc +++ b/src/ic/mips64/handler-compiler-mips64.cc @@ -333,18 +333,11 @@ void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle transition, } -void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg, - int descriptor, +void NamedStoreHandlerCompiler::GenerateConstantCheck(Object* constant, Register value_reg, - Register scratch, Label* miss_label) { - DCHECK(!map_reg.is(scratch)); - DCHECK(!map_reg.is(value_reg)); - DCHECK(!value_reg.is(scratch)); - __ LoadInstanceDescriptors(map_reg, scratch); - __ ld(scratch, - FieldMemOperand(scratch, DescriptorArray::GetValueOffset(descriptor))); - __ Branch(miss_label, ne, value_reg, Operand(scratch)); + __ li(scratch1(), handle(constant, isolate())); + __ Branch(miss_label, ne, value_reg, Operand(scratch1())); } diff --git a/src/ic/x64/handler-compiler-x64.cc b/src/ic/x64/handler-compiler-x64.cc index dfbadcce11..2e19fb5aba 100644 --- a/src/ic/x64/handler-compiler-x64.cc +++ b/src/ic/x64/handler-compiler-x64.cc @@ -335,19 +335,10 @@ void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle transition, } } - -void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg, - int descriptor, +void NamedStoreHandlerCompiler::GenerateConstantCheck(Object* constant, Register value_reg, - Register scratch, Label* miss_label) { - DCHECK(!map_reg.is(scratch)); - DCHECK(!map_reg.is(value_reg)); - DCHECK(!value_reg.is(scratch)); - __ LoadInstanceDescriptors(map_reg, scratch); - __ movp(scratch, - FieldOperand(scratch, DescriptorArray::GetValueOffset(descriptor))); - __ cmpp(value_reg, scratch); + __ Cmp(value_reg, handle(constant, isolate())); __ j(not_equal, miss_label); } diff --git a/src/ic/x87/handler-compiler-x87.cc b/src/ic/x87/handler-compiler-x87.cc index 00a7e08caf..1a2335b8a4 100644 --- a/src/ic/x87/handler-compiler-x87.cc +++ b/src/ic/x87/handler-compiler-x87.cc @@ -343,18 +343,10 @@ void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle transition, } -void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg, - int descriptor, +void NamedStoreHandlerCompiler::GenerateConstantCheck(Object* constant, Register value_reg, - Register scratch, Label* miss_label) { - DCHECK(!map_reg.is(scratch)); - DCHECK(!map_reg.is(value_reg)); - DCHECK(!value_reg.is(scratch)); - __ LoadInstanceDescriptors(map_reg, scratch); - __ mov(scratch, - FieldOperand(scratch, DescriptorArray::GetValueOffset(descriptor))); - __ cmp(value_reg, scratch); + __ CmpObject(value_reg, handle(constant, isolate())); __ j(not_equal, miss_label); }