[interpreter] Add BytecodeGenerator::Abort().

Add a method to emit abort for code which should
not be reachable.

BUG=v8:4280
LOG=N

Review-Url: https://codereview.chromium.org/2002833005
Cr-Commit-Position: refs/heads/master@{#36438}
This commit is contained in:
oth 2016-05-23 04:51:38 -07:00 committed by Commit bot
parent b2d8bfc793
commit 8d5d9e18ea
2 changed files with 11 additions and 7 deletions

View File

@ -657,13 +657,7 @@ void BytecodeGenerator::BuildIndexedJump(Register index, size_t start_index,
.JumpIfTrue(&(targets[i]));
}
RegisterAllocationScope register_scope(this);
Register reason = register_allocator()->NewRegister();
BailoutReason bailout_reason = BailoutReason::kInvalidJumpTableIndex;
builder()
->LoadLiteral(Smi::FromInt(static_cast<int>(bailout_reason)))
.StoreAccumulatorInRegister(reason)
.CallRuntime(Runtime::kAbort, reason, 1);
BuildAbort(BailoutReason::kInvalidJumpTableIndex);
}
void BytecodeGenerator::VisitIterationHeader(IterationStatement* stmt,
@ -1959,6 +1953,15 @@ void BytecodeGenerator::BuildKeyedSuperPropertyStore(Register receiver,
builder()->CallRuntime(function_id, receiver, 4);
}
void BytecodeGenerator::BuildAbort(BailoutReason bailout_reason) {
RegisterAllocationScope register_scope(this);
Register reason = register_allocator()->NewRegister();
builder()
->LoadLiteral(Smi::FromInt(static_cast<int>(bailout_reason)))
.StoreAccumulatorInRegister(reason)
.CallRuntime(Runtime::kAbort, reason, 1);
}
void BytecodeGenerator::BuildThrowReferenceError(Handle<String> name) {
RegisterAllocationScope register_scope(this);
Register name_reg = register_allocator()->NewRegister();

View File

@ -105,6 +105,7 @@ class BytecodeGenerator final : public AstVisitor {
void BuildKeyedSuperPropertyLoad(Register receiver, Register home_object,
Register key);
void BuildAbort(BailoutReason bailout_reason);
void BuildThrowIfHole(Handle<String> name);
void BuildThrowIfNotHole(Handle<String> name);
void BuildThrowReassignConstant(Handle<String> name);