From 8ea8055bd686ae92c5806b130b423724d2edfaef Mon Sep 17 00:00:00 2001 From: "weiliang.lin@intel.com" Date: Tue, 10 Jun 2014 08:09:56 +0000 Subject: [PATCH] X87: Preliminary support for block contexts in hydrogen. Port r21684. Origin message: Preliminary support for block contexts in hydrogen. Patch from Steven Keuchel ; BUG=v8:2198 LOG=N TEST=mjsunit/harmony/block-let-crankshaft.js R=ulan@chromium.org Review URL: https://codereview.chromium.org/315233002 Patch from Chunyang Dai . git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21730 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/x87/lithium-codegen-x87.cc | 15 +++++++++++++++ src/x87/lithium-x87.cc | 16 ++++++++++++++++ src/x87/lithium-x87.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc index 898df47..3cb3fab 100644 --- a/src/x87/lithium-codegen-x87.cc +++ b/src/x87/lithium-codegen-x87.cc @@ -5680,6 +5680,21 @@ void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { } +void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { + Register context = ToRegister(instr->context()); + __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), context); +} + + +void LCodeGen::DoAllocateBlockContext(LAllocateBlockContext* instr) { + Handle scope_info = instr->scope_info(); + __ Push(scope_info); + __ push(ToRegister(instr->function())); + CallRuntime(Runtime::kHiddenPushBlockContext, 2, instr); + RecordSafepoint(Safepoint::kNoLazyDeopt); +} + + #undef __ } } // namespace v8::internal diff --git a/src/x87/lithium-x87.cc b/src/x87/lithium-x87.cc index efa3c92..707783d 100644 --- a/src/x87/lithium-x87.cc +++ b/src/x87/lithium-x87.cc @@ -2639,6 +2639,22 @@ LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { } +LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { + LOperand* context = UseRegisterAtStart(instr->context()); + return new(zone()) LStoreFrameContext(context); +} + + +LInstruction* LChunkBuilder::DoAllocateBlockContext( + HAllocateBlockContext* instr) { + LOperand* context = UseFixed(instr->context(), esi); + LOperand* function = UseRegisterAtStart(instr->function()); + LAllocateBlockContext* result = + new(zone()) LAllocateBlockContext(context, function); + return MarkAsCall(DefineFixed(result, esi), instr); +} + + } } // namespace v8::internal #endif // V8_TARGET_ARCH_X87 diff --git a/src/x87/lithium-x87.h b/src/x87/lithium-x87.h index abf12c6..6683f02 100644 --- a/src/x87/lithium-x87.h +++ b/src/x87/lithium-x87.h @@ -20,6 +20,7 @@ class LCodeGen; #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ V(AccessArgumentsAt) \ V(AddI) \ + V(AllocateBlockContext) \ V(Allocate) \ V(ApplyArguments) \ V(ArgumentsElements) \ @@ -138,6 +139,7 @@ class LCodeGen; V(StackCheck) \ V(StoreCodeEntry) \ V(StoreContextSlot) \ + V(StoreFrameContext) \ V(StoreGlobalCell) \ V(StoreKeyed) \ V(StoreKeyedGeneric) \ @@ -2669,6 +2671,35 @@ class LLoadFieldByIndex V8_FINAL : public LTemplateInstruction<1, 2, 0> { }; +class LStoreFrameContext: public LTemplateInstruction<0, 1, 0> { + public: + explicit LStoreFrameContext(LOperand* context) { + inputs_[0] = context; + } + + LOperand* context() { return inputs_[0]; } + + DECLARE_CONCRETE_INSTRUCTION(StoreFrameContext, "store-frame-context") +}; + + +class LAllocateBlockContext: public LTemplateInstruction<1, 2, 0> { + public: + LAllocateBlockContext(LOperand* context, LOperand* function) { + inputs_[0] = context; + inputs_[1] = function; + } + + LOperand* context() { return inputs_[0]; } + LOperand* function() { return inputs_[1]; } + + Handle scope_info() { return hydrogen()->scope_info(); } + + DECLARE_CONCRETE_INSTRUCTION(AllocateBlockContext, "allocate-block-context") + DECLARE_HYDROGEN_ACCESSOR(AllocateBlockContext) +}; + + class LChunkBuilder; class LPlatformChunk V8_FINAL : public LChunk { public: -- 2.7.4