From f9575fb82af16f1d029e76ba7391b15d13268721 Mon Sep 17 00:00:00 2001 From: "bmeurer@chromium.org" Date: Tue, 28 Jan 2014 09:42:24 +0000 Subject: [PATCH] Remove obsolete instruction HOuterContext. HOuterContext can be expressed in terms of HLoadNamedField. R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/131513015 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18867 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/lithium-arm.cc | 6 ------ src/arm/lithium-arm.h | 13 ------------- src/arm/lithium-codegen-arm.cc | 8 -------- src/hydrogen-instructions.h | 24 ------------------------ src/hydrogen.cc | 3 ++- src/ia32/lithium-codegen-ia32.cc | 8 -------- src/ia32/lithium-ia32.cc | 6 ------ src/ia32/lithium-ia32.h | 13 ------------- src/mips/lithium-codegen-mips.cc | 8 -------- src/mips/lithium-mips.cc | 6 ------ src/mips/lithium-mips.h | 13 ------------- src/x64/lithium-codegen-x64.cc | 8 -------- src/x64/lithium-x64.cc | 6 ------ src/x64/lithium-x64.h | 13 ------------- 14 files changed, 2 insertions(+), 133 deletions(-) diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc index c12e9b8083..ad790b72ff 100644 --- a/src/arm/lithium-arm.cc +++ b/src/arm/lithium-arm.cc @@ -1042,12 +1042,6 @@ LInstruction* LChunkBuilder::DoContext(HContext* instr) { } -LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { - LOperand* context = UseRegisterAtStart(instr->value()); - return DefineAsRegister(new(zone()) LOuterContext(context)); -} - - LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { LOperand* context = UseFixed(instr->context(), cp); return MarkAsCall(new(zone()) LDeclareGlobals(context), instr); diff --git a/src/arm/lithium-arm.h b/src/arm/lithium-arm.h index cee6b858b0..0fc30760da 100644 --- a/src/arm/lithium-arm.h +++ b/src/arm/lithium-arm.h @@ -145,7 +145,6 @@ class LCodeGen; V(NumberTagU) \ V(NumberUntagD) \ V(OsrEntry) \ - V(OuterContext) \ V(Parameter) \ V(Power) \ V(PushArgument) \ @@ -1775,18 +1774,6 @@ class LContext V8_FINAL : public LTemplateInstruction<1, 0, 0> { }; -class LOuterContext V8_FINAL : public LTemplateInstruction<1, 1, 0> { - public: - explicit LOuterContext(LOperand* context) { - inputs_[0] = context; - } - - LOperand* context() { return inputs_[0]; } - - DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context") -}; - - class LDeclareGlobals V8_FINAL : public LTemplateInstruction<0, 1, 0> { public: explicit LDeclareGlobals(LOperand* context) { diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 062c7d1832..07a3c49adf 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -3619,14 +3619,6 @@ void LCodeGen::DoContext(LContext* instr) { } -void LCodeGen::DoOuterContext(LOuterContext* instr) { - Register context = ToRegister(instr->context()); - Register result = ToRegister(instr->result()); - __ ldr(result, - MemOperand(context, Context::SlotOffset(Context::PREVIOUS_INDEX))); -} - - void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { ASSERT(ToRegister(instr->context()).is(cp)); __ push(cp); // The context is the first argument. diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index dbf61835f8..138c617e17 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -149,7 +149,6 @@ class LChunkBuilder; V(Mod) \ V(Mul) \ V(OsrEntry) \ - V(OuterContext) \ V(Parameter) \ V(Power) \ V(PushArgument) \ @@ -2126,29 +2125,6 @@ class HThisFunction V8_FINAL : public HTemplateInstruction<0> { }; -class HOuterContext V8_FINAL : public HUnaryOperation { - public: - DECLARE_INSTRUCTION_FACTORY_P1(HOuterContext, HValue*); - - DECLARE_CONCRETE_INSTRUCTION(OuterContext); - - virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { - return Representation::Tagged(); - } - - protected: - virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } - - private: - explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { - set_representation(Representation::Tagged()); - SetFlag(kUseGVN); - } - - virtual bool IsDeletable() const V8_OVERRIDE { return true; } -}; - - class HDeclareGlobals V8_FINAL : public HUnaryOperation { public: DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HDeclareGlobals, diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 3698a322c0..0dbe2a35bb 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -4693,7 +4693,8 @@ HValue* HOptimizedGraphBuilder::BuildContextChainWalk(Variable* var) { HValue* context = environment()->context(); int length = current_info()->scope()->ContextChainLength(var->scope()); while (length-- > 0) { - context = Add(context); + context = AddLoadNamedField( + context, HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX)); } return context; } diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index dd5465398e..f99f0f597a 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -3762,14 +3762,6 @@ void LCodeGen::DoContext(LContext* instr) { } -void LCodeGen::DoOuterContext(LOuterContext* instr) { - Register context = ToRegister(instr->context()); - Register result = ToRegister(instr->result()); - __ mov(result, - Operand(context, Context::SlotOffset(Context::PREVIOUS_INDEX))); -} - - void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { ASSERT(ToRegister(instr->context()).is(esi)); __ push(esi); // The context is the first argument. diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc index 95b810f665..8d82836f69 100644 --- a/src/ia32/lithium-ia32.cc +++ b/src/ia32/lithium-ia32.cc @@ -1127,12 +1127,6 @@ LInstruction* LChunkBuilder::DoContext(HContext* instr) { } -LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { - LOperand* context = UseRegisterAtStart(instr->value()); - return DefineAsRegister(new(zone()) LOuterContext(context)); -} - - LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { LOperand* context = UseFixed(instr->context(), esi); return MarkAsCall(new(zone()) LDeclareGlobals(context), instr); diff --git a/src/ia32/lithium-ia32.h b/src/ia32/lithium-ia32.h index bea6381d08..e222ad433f 100644 --- a/src/ia32/lithium-ia32.h +++ b/src/ia32/lithium-ia32.h @@ -145,7 +145,6 @@ class LCodeGen; V(NumberTagU) \ V(NumberUntagD) \ V(OsrEntry) \ - V(OuterContext) \ V(Parameter) \ V(Power) \ V(PushArgument) \ @@ -1778,18 +1777,6 @@ class LContext V8_FINAL : public LTemplateInstruction<1, 0, 0> { }; -class LOuterContext V8_FINAL : public LTemplateInstruction<1, 1, 0> { - public: - explicit LOuterContext(LOperand* context) { - inputs_[0] = context; - } - - LOperand* context() { return inputs_[0]; } - - DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context") -}; - - class LDeclareGlobals V8_FINAL : public LTemplateInstruction<0, 1, 0> { public: explicit LDeclareGlobals(LOperand* context) { diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 5479806576..8a2711f3e2 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -3494,14 +3494,6 @@ void LCodeGen::DoContext(LContext* instr) { } -void LCodeGen::DoOuterContext(LOuterContext* instr) { - Register context = ToRegister(instr->context()); - Register result = ToRegister(instr->result()); - __ lw(result, - MemOperand(context, Context::SlotOffset(Context::PREVIOUS_INDEX))); -} - - void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { ASSERT(ToRegister(instr->context()).is(cp)); __ li(scratch0(), instr->hydrogen()->pairs()); diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc index d14b11f0ef..c61c8a1a27 100644 --- a/src/mips/lithium-mips.cc +++ b/src/mips/lithium-mips.cc @@ -1045,12 +1045,6 @@ LInstruction* LChunkBuilder::DoContext(HContext* instr) { } -LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { - LOperand* context = UseRegisterAtStart(instr->value()); - return DefineAsRegister(new(zone()) LOuterContext(context)); -} - - LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { LOperand* context = UseFixed(instr->context(), cp); return MarkAsCall(new(zone()) LDeclareGlobals(context), instr); diff --git a/src/mips/lithium-mips.h b/src/mips/lithium-mips.h index dc58b44825..aefdea5aef 100644 --- a/src/mips/lithium-mips.h +++ b/src/mips/lithium-mips.h @@ -144,7 +144,6 @@ class LCodeGen; V(NumberTagU) \ V(NumberUntagD) \ V(OsrEntry) \ - V(OuterContext) \ V(Parameter) \ V(Power) \ V(PushArgument) \ @@ -1753,18 +1752,6 @@ class LContext V8_FINAL : public LTemplateInstruction<1, 0, 0> { }; -class LOuterContext V8_FINAL : public LTemplateInstruction<1, 1, 0> { - public: - explicit LOuterContext(LOperand* context) { - inputs_[0] = context; - } - - LOperand* context() { return inputs_[0]; } - - DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context") -}; - - class LDeclareGlobals V8_FINAL : public LTemplateInstruction<0, 1, 0> { public: explicit LDeclareGlobals(LOperand* context) { diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index 17ded772bc..5cb2e9c206 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -3331,14 +3331,6 @@ void LCodeGen::DoContext(LContext* instr) { } -void LCodeGen::DoOuterContext(LOuterContext* instr) { - Register context = ToRegister(instr->context()); - Register result = ToRegister(instr->result()); - __ movp(result, - Operand(context, Context::SlotOffset(Context::PREVIOUS_INDEX))); -} - - void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { ASSERT(ToRegister(instr->context()).is(rsi)); __ push(rsi); // The context is the first argument. diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index 493650328d..76c8315723 100644 --- a/src/x64/lithium-x64.cc +++ b/src/x64/lithium-x64.cc @@ -1049,12 +1049,6 @@ LInstruction* LChunkBuilder::DoContext(HContext* instr) { } -LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { - LOperand* context = UseRegisterAtStart(instr->value()); - return DefineAsRegister(new(zone()) LOuterContext(context)); -} - - LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { LOperand* context = UseFixed(instr->context(), rsi); return MarkAsCall(new(zone()) LDeclareGlobals(context), instr); diff --git a/src/x64/lithium-x64.h b/src/x64/lithium-x64.h index da432d2dbd..1f2ddd229a 100644 --- a/src/x64/lithium-x64.h +++ b/src/x64/lithium-x64.h @@ -143,7 +143,6 @@ class LCodeGen; V(NumberTagU) \ V(NumberUntagD) \ V(OsrEntry) \ - V(OuterContext) \ V(Parameter) \ V(Power) \ V(PushArgument) \ @@ -1720,18 +1719,6 @@ class LContext V8_FINAL : public LTemplateInstruction<1, 0, 0> { }; -class LOuterContext V8_FINAL : public LTemplateInstruction<1, 1, 0> { - public: - explicit LOuterContext(LOperand* context) { - inputs_[0] = context; - } - - LOperand* context() { return inputs_[0]; } - - DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context") -}; - - class LDeclareGlobals V8_FINAL : public LTemplateInstruction<0, 1, 0> { public: explicit LDeclareGlobals(LOperand* context) {