Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index a7683c451e3474389bd6f14a821655e99301b2d3..b50c49b0b2ed216586b05fb1137e7872778016f6 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -394,10 +394,18 @@ void LCodeGen::WriteTranslation(LEnvironment* environment, |
WriteTranslation(environment->outer(), translation); |
int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
- if (environment->is_arguments_adaptor()) { |
- translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
- } else { |
- translation->BeginJSFrame(environment->ast_id(), closure_id, height); |
+ switch (environment->frame_type()) { |
+ case JS_FUNCTION: |
+ translation->BeginJSFrame(environment->ast_id(), closure_id, height); |
+ break; |
+ case JS_CONSTRUCT: |
+ translation->BeginConstructStubFrame(closure_id, translation_size); |
+ break; |
+ case ARGUMENTS_ADAPTOR: |
+ translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
+ break; |
+ default: |
+ UNREACHABLE(); |
} |
for (int i = 0; i < translation_size; ++i) { |
LOperand* value = environment->values()->at(i); |
@@ -550,7 +558,7 @@ void LCodeGen::RegisterEnvironmentForDeoptimization( |
int jsframe_count = 0; |
for (LEnvironment* e = environment; e != NULL; e = e->outer()) { |
++frame_count; |
- if (!e->is_arguments_adaptor()) { |
+ if (e->frame_type() == JS_FUNCTION) { |
++jsframe_count; |
} |
} |
@@ -4187,6 +4195,43 @@ void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
} |
+void LCodeGen::DoAllocateObject(LAllocateObject* instr) { |
+ class DeferredAllocateObject: public LDeferredCode { |
+ public: |
+ DeferredAllocateObject(LCodeGen* codegen, LAllocateObject* instr) |
+ : LDeferredCode(codegen), instr_(instr) { } |
+ virtual void Generate() { codegen()->DoDeferredAllocateObject(instr_); } |
+ virtual LInstruction* instr() { return instr_; } |
+ private: |
+ LAllocateObject* instr_; |
+ }; |
+ |
+ DeferredAllocateObject* deferred = new DeferredAllocateObject(this, instr); |
+ |
+ // TODO(mstarzinger): Implement inlined version instead of jumping to |
+ // deferred runtime call. |
+ __ jmp(deferred->entry()); |
+ |
+ __ bind(deferred->exit()); |
+} |
+ |
+ |
+void LCodeGen::DoDeferredAllocateObject(LAllocateObject* instr) { |
+ Register result = ToRegister(instr->result()); |
+ Handle<JSFunction> constructor = instr->hydrogen()->constructor(); |
+ |
+ // TODO(3095996): Get rid of this. For now, we need to make the |
+ // result register contain a valid pointer because it is already |
+ // contained in the register pointer map. |
+ __ Set(result, Immediate(0)); |
+ |
+ PushSafepointRegistersScope scope(this); |
+ __ PushHeapObject(constructor); |
+ CallRuntimeFromDeferred(Runtime::kNewObject, 1, instr, instr->context()); |
+ __ StoreToSafepointRegisterSlot(result, eax); |
+} |
+ |
+ |
void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
ASSERT(ToRegister(instr->context()).is(esi)); |
Heap* heap = isolate()->heap(); |