X87: [fullcode] Change fullcode to compile finally using the token approach.
port 334d17946c
(r33780)
original commit message:
This change should unify handling of finally blocks in Turbofan's
AstGraphBuilder and in full-code. This should enable smooth deoptimization
from finally blocks.
BUG=
Review URL: https://codereview.chromium.org/1675003002
Cr-Commit-Position: refs/heads/master@{#33794}
This commit is contained in:
parent
0e22baac12
commit
0067ed0f26
@ -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 __
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user