Commit 8d5d9e18 authored by oth's avatar oth Committed by Commit bot

[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}
parent b2d8bfc7
......@@ -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();
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment