Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: src/full-codegen/full-codegen.cc

Issue 1969423002: [Interpreter] Remove InterpreterExitTrampoline and replace with returning to the entry trampoline. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen/full-codegen.cc
diff --git a/src/full-codegen/full-codegen.cc b/src/full-codegen/full-codegen.cc
index 1bd12d511087c9ffad97d1724ea6e154ae0a6174..6cf3aef7e63f74f713066ee9275e50b7c1c26324 100644
--- a/src/full-codegen/full-codegen.cc
+++ b/src/full-codegen/full-codegen.cc
@@ -162,8 +162,8 @@ void FullCodeGenerator::Initialize() {
masm_->set_predictable_code_size(true);
}
-
-void FullCodeGenerator::PrepareForBailout(Expression* node, State state) {
+void FullCodeGenerator::PrepareForBailout(Expression* node,
+ BailoutState state) {
PrepareForBailoutForId(node->id(), state);
}
@@ -186,9 +186,9 @@ void FullCodeGenerator::RecordJSReturnSite(Call* call) {
// if the function was inlined, i.e., this is the return address in the
// inlined function's frame.
//
- // The state is ignored. We defensively set it to TOS_REG, which is the
- // real state of the unoptimized code at the return site.
- PrepareForBailoutForId(call->ReturnId(), TOS_REG);
+ // The bailout state is ignored. We defensively set it to TOS_REGISTER, which
+ // is the real state of the unoptimized code at the return site.
+ PrepareForBailoutForId(call->ReturnId(), BailoutState::TOS_REGISTER);
#ifdef DEBUG
// In debug builds, mark the return so we can verify that this function
// was called.
@@ -197,13 +197,13 @@ void FullCodeGenerator::RecordJSReturnSite(Call* call) {
#endif
}
-
-void FullCodeGenerator::PrepareForBailoutForId(BailoutId id, State state) {
+void FullCodeGenerator::PrepareForBailoutForId(BailoutId id,
+ BailoutState state) {
// There's no need to prepare this code for bailouts from already optimized
// code or code that can't be optimized.
if (!info_->HasDeoptimizationSupport()) return;
unsigned pc_and_state =
- StateField::encode(state) | PcField::encode(masm_->pc_offset());
+ BailoutStateField::encode(state) | PcField::encode(masm_->pc_offset());
DCHECK(Smi::IsValid(pc_and_state));
#ifdef DEBUG
for (int i = 0; i < bailout_entries_.length(); ++i) {
@@ -750,7 +750,7 @@ void FullCodeGenerator::VisitLogicalExpression(BinaryOperation* expr) {
} else {
VisitForControl(left, test->true_label(), &eval_right, &eval_right);
}
- PrepareForBailoutForId(right_id, NO_REGISTERS);
+ PrepareForBailoutForId(right_id, BailoutState::NO_REGISTERS);
__ bind(&eval_right);
} else if (context()->IsAccumulatorValue()) {
@@ -769,7 +769,7 @@ void FullCodeGenerator::VisitLogicalExpression(BinaryOperation* expr) {
__ jmp(&done);
__ bind(&discard);
__ Drop(1);
- PrepareForBailoutForId(right_id, NO_REGISTERS);
+ PrepareForBailoutForId(right_id, BailoutState::NO_REGISTERS);
} else if (context()->IsStackValue()) {
VisitForAccumulatorValue(left);
@@ -784,7 +784,7 @@ void FullCodeGenerator::VisitLogicalExpression(BinaryOperation* expr) {
}
__ bind(&discard);
__ Drop(1);
- PrepareForBailoutForId(right_id, NO_REGISTERS);
+ PrepareForBailoutForId(right_id, BailoutState::NO_REGISTERS);
} else {
DCHECK(context()->IsEffect());
@@ -794,7 +794,7 @@ void FullCodeGenerator::VisitLogicalExpression(BinaryOperation* expr) {
} else {
VisitForControl(left, &done, &eval_right, &eval_right);
}
- PrepareForBailoutForId(right_id, NO_REGISTERS);
+ PrepareForBailoutForId(right_id, BailoutState::NO_REGISTERS);
__ bind(&eval_right);
}
@@ -852,7 +852,7 @@ void FullCodeGenerator::VisitProperty(Property* expr) {
EmitKeyedSuperPropertyLoad(expr);
}
}
- PrepareForBailoutForId(expr->LoadId(), TOS_REG);
+ PrepareForBailoutForId(expr->LoadId(), BailoutState::TOS_REGISTER);
context()->Plug(result_register());
}
@@ -864,7 +864,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
if (proxy != NULL && (proxy->var()->IsUnallocatedOrGlobalSlot() ||
proxy->var()->IsLookupSlot())) {
EmitVariableLoad(proxy, INSIDE_TYPEOF);
- PrepareForBailout(proxy, TOS_REG);
+ PrepareForBailout(proxy, BailoutState::TOS_REGISTER);
} else {
// This expression cannot throw a reference error at the top level.
VisitInDuplicateContext(expr);
@@ -912,24 +912,24 @@ void FullCodeGenerator::VisitIfStatement(IfStatement* stmt) {
if (stmt->HasElseStatement()) {
VisitForControl(stmt->condition(), &then_part, &else_part, &then_part);
- PrepareForBailoutForId(stmt->ThenId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->ThenId(), BailoutState::NO_REGISTERS);
__ bind(&then_part);
Visit(stmt->then_statement());
__ jmp(&done);
- PrepareForBailoutForId(stmt->ElseId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->ElseId(), BailoutState::NO_REGISTERS);
__ bind(&else_part);
Visit(stmt->else_statement());
} else {
VisitForControl(stmt->condition(), &then_part, &done, &then_part);
- PrepareForBailoutForId(stmt->ThenId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->ThenId(), BailoutState::NO_REGISTERS);
__ bind(&then_part);
Visit(stmt->then_statement());
- PrepareForBailoutForId(stmt->ElseId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->ElseId(), BailoutState::NO_REGISTERS);
}
__ bind(&done);
- PrepareForBailoutForId(stmt->IfId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->IfId(), BailoutState::NO_REGISTERS);
}
void FullCodeGenerator::EmitContinue(Statement* target) {
@@ -1093,7 +1093,7 @@ void FullCodeGenerator::EmitPropertyKey(ObjectLiteralProperty* property,
BailoutId bailout_id) {
VisitForStackValue(property->key());
CallRuntimeWithOperands(Runtime::kToName);
- PrepareForBailoutForId(bailout_id, NO_REGISTERS);
+ PrepareForBailoutForId(bailout_id, BailoutState::NO_REGISTERS);
PushOperand(result_register());
}
@@ -1119,12 +1119,12 @@ void FullCodeGenerator::VisitWithStatement(WithStatement* stmt) {
Callable callable = CodeFactory::ToObject(isolate());
__ Move(callable.descriptor().GetRegisterParameter(0), result_register());
__ Call(callable.code(), RelocInfo::CODE_TARGET);
- PrepareForBailoutForId(stmt->ToObjectId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->ToObjectId(), BailoutState::NO_REGISTERS);
PushOperand(result_register());
PushFunctionArgumentForContextAllocation();
CallRuntimeWithOperands(Runtime::kPushWithContext);
StoreToFrameField(StandardFrameConstants::kContextOffset, context_register());
- PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->EntryId(), BailoutState::NO_REGISTERS);
Scope* saved_scope = scope();
scope_ = stmt->scope();
@@ -1156,7 +1156,7 @@ void FullCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) {
// Record the position of the do while condition and make sure it is
// possible to break on the condition.
__ bind(loop_statement.continue_label());
- PrepareForBailoutForId(stmt->ContinueId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->ContinueId(), BailoutState::NO_REGISTERS);
// Here is the actual 'while' keyword.
SetExpressionAsStatementPosition(stmt->cond());
@@ -1166,12 +1166,12 @@ void FullCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) {
&book_keeping);
// Check stack before looping.
- PrepareForBailoutForId(stmt->BackEdgeId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->BackEdgeId(), BailoutState::NO_REGISTERS);
__ bind(&book_keeping);
EmitBackEdgeBookkeeping(stmt, &body);
__ jmp(&body);
- PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS);
__ bind(loop_statement.break_label());
decrement_loop_depth();
}
@@ -1192,7 +1192,7 @@ void FullCodeGenerator::VisitWhileStatement(WhileStatement* stmt) {
loop_statement.break_label(),
&body);
- PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->BodyId(), BailoutState::NO_REGISTERS);
__ bind(&body);
Visit(stmt->body());
@@ -1202,7 +1202,7 @@ void FullCodeGenerator::VisitWhileStatement(WhileStatement* stmt) {
EmitBackEdgeBookkeeping(stmt, &loop);
__ jmp(&loop);
- PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS);
__ bind(loop_statement.break_label());
decrement_loop_depth();
}
@@ -1225,11 +1225,11 @@ void FullCodeGenerator::VisitForStatement(ForStatement* stmt) {
// Emit the test at the bottom of the loop (even if empty).
__ jmp(&test);
- PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->BodyId(), BailoutState::NO_REGISTERS);
__ bind(&body);
Visit(stmt->body());
- PrepareForBailoutForId(stmt->ContinueId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->ContinueId(), BailoutState::NO_REGISTERS);
__ bind(loop_statement.continue_label());
if (stmt->next() != NULL) {
SetStatementPosition(stmt->next());
@@ -1250,7 +1250,7 @@ void FullCodeGenerator::VisitForStatement(ForStatement* stmt) {
__ jmp(&body);
}
- PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS);
__ bind(loop_statement.break_label());
decrement_loop_depth();
}
@@ -1286,12 +1286,12 @@ void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) {
Visit(stmt->body());
// Check stack before looping.
- PrepareForBailoutForId(stmt->BackEdgeId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->BackEdgeId(), BailoutState::NO_REGISTERS);
EmitBackEdgeBookkeeping(stmt, loop_statement.continue_label());
__ jmp(loop_statement.continue_label());
// Exit and decrement the loop depth.
- PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS);
__ bind(loop_statement.break_label());
decrement_loop_depth();
}
@@ -1435,7 +1435,7 @@ void FullCodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) {
__ DebugBreak();
// Ignore the return value.
- PrepareForBailoutForId(stmt->DebugBreakId(), NO_REGISTERS);
+ PrepareForBailoutForId(stmt->DebugBreakId(), BailoutState::NO_REGISTERS);
}
@@ -1450,7 +1450,7 @@ void FullCodeGenerator::VisitConditional(Conditional* expr) {
VisitForControl(expr->condition(), &true_case, &false_case, &true_case);
int original_stack_depth = operand_stack_depth_;
- PrepareForBailoutForId(expr->ThenId(), NO_REGISTERS);
+ PrepareForBailoutForId(expr->ThenId(), BailoutState::NO_REGISTERS);
__ bind(&true_case);
SetExpressionPosition(expr->then_expression());
if (context()->IsTest()) {
@@ -1465,7 +1465,7 @@ void FullCodeGenerator::VisitConditional(Conditional* expr) {
}
operand_stack_depth_ = original_stack_depth;
- PrepareForBailoutForId(expr->ElseId(), NO_REGISTERS);
+ PrepareForBailoutForId(expr->ElseId(), BailoutState::NO_REGISTERS);
__ bind(&false_case);
SetExpressionPosition(expr->else_expression());
VisitInDuplicateContext(expr->else_expression());
@@ -1516,7 +1516,7 @@ void FullCodeGenerator::VisitClassLiteral(ClassLiteral* lit) {
PushOperand(Smi::FromInt(lit->end_position()));
CallRuntimeWithOperands(Runtime::kDefineClass);
- PrepareForBailoutForId(lit->CreateLiteralId(), TOS_REG);
+ PrepareForBailoutForId(lit->CreateLiteralId(), BailoutState::TOS_REGISTER);
PushOperand(result_register());
// Load the "prototype" from the constructor.
@@ -1525,7 +1525,7 @@ void FullCodeGenerator::VisitClassLiteral(ClassLiteral* lit) {
Heap::kprototype_stringRootIndex);
__ Move(LoadDescriptor::SlotRegister(), SmiFromSlot(lit->PrototypeSlot()));
CallLoadIC(NOT_INSIDE_TYPEOF);
- PrepareForBailoutForId(lit->PrototypeId(), TOS_REG);
+ PrepareForBailoutForId(lit->PrototypeId(), BailoutState::TOS_REGISTER);
PushOperand(result_register());
EmitClassDefineProperties(lit);
@@ -1666,7 +1666,7 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
VisitForStackValue(args->at(i));
}
- PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
+ PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS);
EmitCallJSRuntimeFunction(expr);
context()->DropAndPlug(1, result_register());
@@ -1688,7 +1688,7 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
}
// Call the C runtime function.
- PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
+ PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS);
__ CallRuntime(expr->function(), arg_count);
OperandStackDepthDecrement(arg_count);
context()->Plug(result_register());
@@ -1877,7 +1877,7 @@ FullCodeGenerator::EnterBlockScopeIfNeeded::EnterBlockScopeIfNeeded(
saved_scope_ = codegen_->scope();
if (scope == NULL) {
- codegen_->PrepareForBailoutForId(entry_id, NO_REGISTERS);
+ codegen_->PrepareForBailoutForId(entry_id, BailoutState::NO_REGISTERS);
needs_block_context_ = false;
} else {
needs_block_context_ = scope->NeedsContext();
@@ -1894,12 +1894,13 @@ FullCodeGenerator::EnterBlockScopeIfNeeded::EnterBlockScopeIfNeeded(
codegen_->context_register());
}
CHECK_EQ(0, scope->num_stack_slots());
- codegen_->PrepareForBailoutForId(entry_id, NO_REGISTERS);
+ codegen_->PrepareForBailoutForId(entry_id, BailoutState::NO_REGISTERS);
}
{
Comment cmnt(masm(), "[ Declarations");
codegen_->VisitDeclarations(scope->declarations());
- codegen_->PrepareForBailoutForId(declarations_id, NO_REGISTERS);
+ codegen_->PrepareForBailoutForId(declarations_id,
+ BailoutState::NO_REGISTERS);
}
}
}
@@ -1913,7 +1914,7 @@ FullCodeGenerator::EnterBlockScopeIfNeeded::~EnterBlockScopeIfNeeded() {
codegen_->StoreToFrameField(StandardFrameConstants::kContextOffset,
codegen_->context_register());
}
- codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS);
+ codegen_->PrepareForBailoutForId(exit_id_, BailoutState::NO_REGISTERS);
codegen_->scope_ = saved_scope_;
}
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698