Index: src/full-codegen/x87/full-codegen-x87.cc |
diff --git a/src/full-codegen/x87/full-codegen-x87.cc b/src/full-codegen/x87/full-codegen-x87.cc |
index bd076752eefa06adeb5e4530eec0b7e75b97ba73..d06f53fbb0bc32f91c0ce4e2acf98d920231fef7 100644 |
--- a/src/full-codegen/x87/full-codegen-x87.cc |
+++ b/src/full-codegen/x87/full-codegen-x87.cc |
@@ -1851,8 +1851,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { |
__ j(not_equal, &resume); |
__ push(result_register()); |
EmitCreateIteratorResult(true); |
- EmitUnwindBeforeReturn(); |
- EmitReturnSequence(); |
+ EmitUnwindAndReturn(); |
__ bind(&suspend); |
VisitForAccumulatorValue(expr->generator_object()); |
@@ -4474,18 +4473,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()); |
@@ -4503,15 +4490,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); |
} |
@@ -4530,6 +4508,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 __ |