From ce77e9499df6d38159d9bd97602e73c73cba0720 Mon Sep 17 00:00:00 2001 From: "whesse@chromium.org" Date: Tue, 24 May 2011 15:11:48 +0000 Subject: [PATCH] Remove some dead code from full-codegen on all platforms. BUG= TEST= Review URL: http://codereview.chromium.org/6966033 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8047 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/full-codegen-arm.cc | 25 ++++++++++++------------- src/ia32/full-codegen-ia32.cc | 24 +++++++++++------------- src/mips/full-codegen-mips.cc | 27 +++++++++++++-------------- src/x64/full-codegen-x64.cc | 25 +++++++++++-------------- 4 files changed, 47 insertions(+), 54 deletions(-) diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc index e1f82304e..22846c38b 100644 --- a/src/arm/full-codegen-arm.cc +++ b/src/arm/full-codegen-arm.cc @@ -760,23 +760,22 @@ void FullCodeGenerator::EmitDeclaration(Variable* variable, } } else if (prop != NULL) { - if (function != NULL || mode == Variable::CONST) { - // We are declaring a function or constant that rewrites to a - // property. Use (keyed) IC to set the initial value. We - // cannot visit the rewrite because it's shared and we risk - // recording duplicate AST IDs for bailouts from optimized code. + // A const declaration aliasing a parameter is an illegal redeclaration. + ASSERT(mode != Variable::CONST); + if (function != NULL) { + // We are declaring a function that rewrites to a property. + // Use (keyed) IC to set the initial value. We cannot visit the + // rewrite because it's shared and we risk recording duplicate AST + // IDs for bailouts from optimized code. ASSERT(prop->obj()->AsVariableProxy() != NULL); { AccumulatorValueContext for_object(this); EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); } - if (function != NULL) { - __ push(r0); - VisitForAccumulatorValue(function); - __ pop(r2); - } else { - __ mov(r2, r0); - __ LoadRoot(r0, Heap::kTheHoleValueRootIndex); - } + + __ push(r0); + VisitForAccumulatorValue(function); + __ pop(r2); + ASSERT(prop->key()->AsLiteral() != NULL && prop->key()->AsLiteral()->handle()->IsSmi()); __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc index 06ea56b2b..8b941e9a3 100644 --- a/src/ia32/full-codegen-ia32.cc +++ b/src/ia32/full-codegen-ia32.cc @@ -727,24 +727,22 @@ void FullCodeGenerator::EmitDeclaration(Variable* variable, } } else if (prop != NULL) { - if (function != NULL || mode == Variable::CONST) { - // We are declaring a function or constant that rewrites to a - // property. Use (keyed) IC to set the initial value. We cannot - // visit the rewrite because it's shared and we risk recording - // duplicate AST IDs for bailouts from optimized code. + // A const declaration aliasing a parameter is an illegal redeclaration. + ASSERT(mode != Variable::CONST); + if (function != NULL) { + // We are declaring a function that rewrites to a property. + // Use (keyed) IC to set the initial value. We cannot visit the + // rewrite because it's shared and we risk recording duplicate AST + // IDs for bailouts from optimized code. ASSERT(prop->obj()->AsVariableProxy() != NULL); { AccumulatorValueContext for_object(this); EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); } - if (function != NULL) { - __ push(eax); - VisitForAccumulatorValue(function); - __ pop(edx); - } else { - __ mov(edx, eax); - __ mov(eax, isolate()->factory()->the_hole_value()); - } + __ push(eax); + VisitForAccumulatorValue(function); + __ pop(edx); + ASSERT(prop->key()->AsLiteral() != NULL && prop->key()->AsLiteral()->handle()->IsSmi()); __ SafeSet(ecx, Immediate(prop->key()->AsLiteral()->handle())); diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc index 842edcc16..7d9d2156c 100644 --- a/src/mips/full-codegen-mips.cc +++ b/src/mips/full-codegen-mips.cc @@ -752,24 +752,23 @@ void FullCodeGenerator::EmitDeclaration(Variable* variable, } } else if (prop != NULL) { - if (function != NULL || mode == Variable::CONST) { - // We are declaring a function or constant that rewrites to a - // property. Use (keyed) IC to set the initial value. We - // cannot visit the rewrite because it's shared and we risk - // recording duplicate AST IDs for bailouts from optimized code. + // A const declaration aliasing a parameter is an illegal redeclaration. + ASSERT(mode != Variable::CONST); + if (function != NULL) { + // We are declaring a function that rewrites to a property. + // Use (keyed) IC to set the initial value. We cannot visit the + // rewrite because it's shared and we risk recording duplicate AST + // IDs for bailouts from optimized code. ASSERT(prop->obj()->AsVariableProxy() != NULL); { AccumulatorValueContext for_object(this); EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); } - if (function != NULL) { - __ push(result_register()); - VisitForAccumulatorValue(function); - __ mov(a0, result_register()); - __ pop(a2); - } else { - __ mov(a2, result_register()); - __ LoadRoot(a0, Heap::kTheHoleValueRootIndex); - } + + __ push(result_register()); + VisitForAccumulatorValue(function); + __ mov(a0, result_register()); + __ pop(a2); + ASSERT(prop->key()->AsLiteral() != NULL && prop->key()->AsLiteral()->handle()->IsSmi()); __ li(a1, Operand(prop->key()->AsLiteral()->handle())); diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc index 4253d9fa1..329fd18dc 100644 --- a/src/x64/full-codegen-x64.cc +++ b/src/x64/full-codegen-x64.cc @@ -730,23 +730,20 @@ void FullCodeGenerator::EmitDeclaration(Variable* variable, } } else if (prop != NULL) { - if (function != NULL || mode == Variable::CONST) { - // We are declaring a function or constant that rewrites to a - // property. Use (keyed) IC to set the initial value. We - // cannot visit the rewrite because it's shared and we risk - // recording duplicate AST IDs for bailouts from optimized code. + // A const declaration aliasing a parameter is an illegal redeclaration. + ASSERT(mode != Variable::CONST); + if (function != NULL) { + // We are declaring a function that rewrites to a property. + // Use (keyed) IC to set the initial value. We cannot visit the + // rewrite because it's shared and we risk recording duplicate AST + // IDs for bailouts from optimized code. ASSERT(prop->obj()->AsVariableProxy() != NULL); { AccumulatorValueContext for_object(this); EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); } - if (function != NULL) { - __ push(rax); - VisitForAccumulatorValue(function); - __ pop(rdx); - } else { - __ movq(rdx, rax); - __ LoadRoot(rax, Heap::kTheHoleValueRootIndex); - } + __ push(rax); + VisitForAccumulatorValue(function); + __ pop(rdx); ASSERT(prop->key()->AsLiteral() != NULL && prop->key()->AsLiteral()->handle()->IsSmi()); __ Move(rcx, prop->key()->AsLiteral()->handle()); @@ -754,7 +751,7 @@ void FullCodeGenerator::EmitDeclaration(Variable* variable, Handle ic = is_strict_mode() ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() : isolate()->builtins()->KeyedStoreIC_Initialize(); - EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop)); + EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); } } } -- 2.34.1