From c61ac2cd84dd15bfc0d20d68cd891dddab07fc3c Mon Sep 17 00:00:00 2001 From: "whesse@chromium.org" Date: Wed, 23 Feb 2011 13:26:28 +0000 Subject: [PATCH] X64 Crankshaft: Add DoOuterContext to x64 lithium. Review URL: http://codereview.chromium.org/6570008 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6914 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/x64/lithium-codegen-x64.cc | 9 +++++++++ src/x64/lithium-x64.cc | 4 ++-- src/x64/lithium-x64.h | 13 +++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index d36fdfb1de..732812b001 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -2205,6 +2205,15 @@ void LCodeGen::DoContext(LContext* instr) { } +void LCodeGen::DoOuterContext(LOuterContext* instr) { + Register context = ToRegister(instr->context()); + Register result = ToRegister(instr->result()); + __ movq(result, + Operand(context, Context::SlotOffset(Context::CLOSURE_INDEX))); + __ movq(result, FieldOperand(result, JSFunction::kContextOffset)); +} + + void LCodeGen::DoGlobalObject(LGlobalObject* instr) { Register result = ToRegister(instr->result()); __ movq(result, GlobalObjectOperand()); diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index 892a421c8e..6d225c354a 100644 --- a/src/x64/lithium-x64.cc +++ b/src/x64/lithium-x64.cc @@ -1190,8 +1190,8 @@ LInstruction* LChunkBuilder::DoContext(HContext* instr) { LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { - Abort("Unimplemented: DoOuterContext"); - return NULL; + LOperand* context = UseRegisterAtStart(instr->value()); + return DefineAsRegister(new LOuterContext(context)); } diff --git a/src/x64/lithium-x64.h b/src/x64/lithium-x64.h index c37ffb87fd..fed5b8cb88 100644 --- a/src/x64/lithium-x64.h +++ b/src/x64/lithium-x64.h @@ -129,6 +129,7 @@ class LCodeGen; V(NumberUntagD) \ V(ObjectLiteral) \ V(OsrEntry) \ + V(OuterContext) \ V(Parameter) \ V(PixelArrayLength) \ V(Power) \ @@ -1280,6 +1281,18 @@ class LContext: public LTemplateInstruction<1, 0, 0> { }; +class LOuterContext: public LTemplateInstruction<1, 1, 0> { + public: + explicit LOuterContext(LOperand* context) { + inputs_[0] = context; + } + + DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context") + + LOperand* context() { return InputAt(0); } +}; + + class LGlobalObject: public LTemplateInstruction<1, 0, 0> { public: DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")