Index: src/full-codegen/ia32/full-codegen-ia32.cc |
diff --git a/src/full-codegen/ia32/full-codegen-ia32.cc b/src/full-codegen/ia32/full-codegen-ia32.cc |
index 59a40840229e664a5f9da00d0942932e60da7016..1bd9a798b0683c036f0498a7331cc8c1b820750c 100644 |
--- a/src/full-codegen/ia32/full-codegen-ia32.cc |
+++ b/src/full-codegen/ia32/full-codegen-ia32.cc |
@@ -17,8 +17,7 @@ |
namespace v8 { |
namespace internal { |
-#define __ ACCESS_MASM(masm_) |
- |
+#define __ ACCESS_MASM(masm()) |
class JumpPatchSite BASE_EMBEDDED { |
public: |
@@ -68,6 +67,7 @@ class JumpPatchSite BASE_EMBEDDED { |
__ j(cc, target, distance); |
} |
+ MacroAssembler* masm() { return masm_; } |
MacroAssembler* masm_; |
Label patch_site_; |
#ifdef DEBUG |
@@ -1856,8 +1856,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { |
__ j(not_equal, &resume); |
__ push(result_register()); |
EmitCreateIteratorResult(true); |
- EmitUnwindBeforeReturn(); |
- EmitReturnSequence(); |
+ EmitUnwindAndReturn(); |
__ bind(&suspend); |
VisitForAccumulatorValue(expr->generator_object()); |
@@ -1887,8 +1886,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { |
case Yield::kFinal: { |
// Pop value from top-of-stack slot, box result into result register. |
EmitCreateIteratorResult(true); |
- EmitUnwindBeforeReturn(); |
- EmitReturnSequence(); |
+ EmitUnwindAndReturn(); |
break; |
} |
@@ -4587,18 +4585,6 @@ void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { |
// Non-local control flow support. |
void FullCodeGenerator::EnterFinallyBlock() { |
- // Cook return address on top of stack (smi encoded Code* delta) |
- DCHECK(!result_register().is(edx)); |
- __ pop(edx); |
- __ sub(edx, Immediate(masm_->CodeObject())); |
- STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 1); |
- STATIC_ASSERT(kSmiTag == 0); |
- __ SmiTag(edx); |
- __ push(edx); |
- |
- // Store result register while executing finally block. |
- __ push(result_register()); |
- |
// Store pending message while executing finally block. |
ExternalReference pending_message_obj = |
ExternalReference::address_of_pending_message_obj(isolate()); |
@@ -4616,15 +4602,6 @@ void FullCodeGenerator::ExitFinallyBlock() { |
ExternalReference pending_message_obj = |
ExternalReference::address_of_pending_message_obj(isolate()); |
__ mov(Operand::StaticVariable(pending_message_obj), edx); |
- |
- // Restore result register from stack. |
- __ pop(result_register()); |
- |
- // Uncook return address. |
- __ pop(edx); |
- __ SmiUntag(edx); |
- __ add(edx, Immediate(masm_->CodeObject())); |
- __ jmp(edx); |
} |
@@ -4643,6 +4620,32 @@ void FullCodeGenerator::EmitLoadStoreICSlot(FeedbackVectorSlot slot) { |
Immediate(SmiFromSlot(slot))); |
} |
+void FullCodeGenerator::DeferredCommands::EmitCommands() { |
+ DCHECK(!result_register().is(edx)); |
+ __ Pop(result_register()); // Restore the accumulator. |
+ __ Pop(edx); // Get the token. |
+ for (DeferredCommand cmd : commands_) { |
+ Label skip; |
+ __ cmp(edx, Immediate(Smi::FromInt(cmd.token))); |
+ __ j(not_equal, &skip); |
+ switch (cmd.command) { |
+ case kReturn: |
+ codegen_->EmitUnwindAndReturn(); |
+ break; |
+ case kThrow: |
+ __ Push(result_register()); |
+ __ CallRuntime(Runtime::kReThrow); |
+ break; |
+ case kContinue: |
+ codegen_->EmitContinue(cmd.target); |
+ break; |
+ case kBreak: |
+ codegen_->EmitBreak(cmd.target); |
+ break; |
+ } |
+ __ bind(&skip); |
+ } |
+} |
#undef __ |