Commit 094cb0e9 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[ignition] Use jump table for "finally" deferred commands

Bug: v8:6218
Change-Id: I5d245ea485c93fcc03fcd95c82ae0474f31ffa5e
Reviewed-on: https://chromium-review.googlesource.com/505491
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45341}
parent bb90a2e8
......@@ -191,22 +191,20 @@ class BytecodeGenerator::ControlScope::DeferredCommands final {
// Applies all recorded control-flow commands after the finally-block again.
// This generates a dynamic dispatch on the token from the entry point.
void ApplyDeferredCommands() {
// The fall-through path is covered by the default case, hence +1 here.
SwitchBuilder dispatch(builder(), static_cast<int>(deferred_.size() + 1));
for (size_t i = 0; i < deferred_.size(); ++i) {
Entry& entry = deferred_[i];
builder()->LoadLiteral(Smi::FromInt(entry.token));
builder()->CompareOperation(Token::EQ_STRICT, token_register_);
dispatch.Case(ToBooleanMode::kAlreadyBoolean, static_cast<int>(i));
}
dispatch.DefaultAt(static_cast<int>(deferred_.size()));
for (size_t i = 0; i < deferred_.size(); ++i) {
Entry& entry = deferred_[i];
dispatch.SetCaseTarget(static_cast<int>(i));
builder()->LoadAccumulatorWithRegister(result_register_);
BytecodeJumpTable* jump_table =
builder()->AllocateJumpTable(static_cast<int>(deferred_.size()), 0);
BytecodeLabel fall_through;
builder()
->LoadAccumulatorWithRegister(token_register_)
.SwitchOnSmiNoFeedback(jump_table)
.Jump(&fall_through);
for (const Entry& entry : deferred_) {
builder()
->Bind(jump_table, entry.token)
.LoadAccumulatorWithRegister(result_register_);
execution_control()->PerformCommand(entry.command, entry.statement);
}
dispatch.SetCaseTarget(static_cast<int>(deferred_.size()));
builder()->Bind(&fall_through);
}
BytecodeArrayBuilder* builder() { return generator_->builder(); }
......
......@@ -11,7 +11,7 @@ snippet: "
"
frame size: 15
parameter count: 1
bytecode array length: 262
bytecode array length: 263
bytecodes: [
/* 30 E> */ B(StackCheck),
B(LdaZero),
......@@ -116,9 +116,8 @@ bytecodes: [
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1),
B(Ldar), R(11),
B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(9),
B(JumpIfTrue), U8(4),
B(Ldar), R(9),
B(SwitchOnSmiNoFeedback), U8(10), U8(1), I8(0),
B(Jump), U8(5),
B(Ldar), R(10),
B(ReThrow),
......@@ -136,6 +135,7 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
Smi [6],
]
handlers: [
[7, 124, 130],
......@@ -150,7 +150,7 @@ snippet: "
"
frame size: 16
parameter count: 1
bytecode array length: 275
bytecode array length: 270
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaConstant), U8(0),
......@@ -257,12 +257,8 @@ bytecodes: [
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1),
B(Ldar), R(12),
B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(10),
B(JumpIfTrue), U8(10),
B(LdaSmi), I8(1),
B(TestEqualStrictNoFeedback), R(10),
B(JumpIfTrue), U8(7),
B(Ldar), R(10),
B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(11),
/* 85 S> */ B(Return),
......@@ -282,6 +278,8 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
Smi [6],
Smi [9],
]
handlers: [
[11, 127, 133],
......@@ -298,7 +296,7 @@ snippet: "
"
frame size: 15
parameter count: 1
bytecode array length: 280
bytecode array length: 281
bytecodes: [
/* 30 E> */ B(StackCheck),
B(LdaZero),
......@@ -411,9 +409,8 @@ bytecodes: [
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1),
B(Ldar), R(11),
B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(9),
B(JumpIfTrue), U8(4),
B(Ldar), R(9),
B(SwitchOnSmiNoFeedback), U8(10), U8(1), I8(0),
B(Jump), U8(5),
B(Ldar), R(10),
B(ReThrow),
......@@ -431,6 +428,7 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
Smi [6],
]
handlers: [
[7, 142, 148],
......@@ -445,7 +443,7 @@ snippet: "
"
frame size: 14
parameter count: 1
bytecode array length: 286
bytecode array length: 281
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(3), U8(1), R(8),
......@@ -555,12 +553,8 @@ bytecodes: [
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1),
B(Ldar), R(10),
B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(8),
B(JumpIfTrue), U8(10),
B(LdaSmi), I8(1),
B(TestEqualStrictNoFeedback), R(8),
B(JumpIfTrue), U8(7),
B(Ldar), R(8),
B(SwitchOnSmiNoFeedback), U8(12), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(9),
/* 105 S> */ B(Return),
......@@ -582,6 +576,8 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
Smi [6],
Smi [9],
]
handlers: [
[15, 138, 144],
......
......@@ -13,7 +13,7 @@ snippet: "
"
frame size: 12
parameter count: 1
bytecode array length: 192
bytecode array length: 181
bytecodes: [
B(Ldar), R(new_target),
B(JumpIfUndefined), U8(26),
......@@ -88,15 +88,8 @@ bytecodes: [
B(CallRuntime), U16(Runtime::k_GeneratorClose), R(6), U8(1),
B(Ldar), R(5),
B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(3),
B(JumpIfTrue), U8(16),
B(LdaSmi), I8(1),
B(TestEqualStrictNoFeedback), R(3),
B(JumpIfTrue), U8(13),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(3),
B(JumpIfTrue), U8(10),
B(Ldar), R(3),
B(SwitchOnSmiNoFeedback), U8(1), U8(3), I8(0),
B(Jump), U8(11),
B(Ldar), R(4),
/* 16 S> */ B(Return),
......@@ -109,6 +102,9 @@ bytecodes: [
]
constant pool: [
Smi [52],
Smi [6],
Smi [9],
Smi [12],
]
handlers: [
[52, 134, 140],
......@@ -121,7 +117,7 @@ snippet: "
"
frame size: 12
parameter count: 1
bytecode array length: 276
bytecode array length: 259
bytecodes: [
B(Ldar), R(new_target),
B(JumpIfUndefined), U8(26),
......@@ -230,18 +226,8 @@ bytecodes: [
B(CallRuntime), U16(Runtime::k_GeneratorClose), R(6), U8(1),
B(Ldar), R(5),
B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(3),
B(JumpIfTrue), U8(22),
B(LdaSmi), I8(1),
B(TestEqualStrictNoFeedback), R(3),
B(JumpIfTrue), U8(19),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(3),
B(JumpIfTrue), U8(16),
B(LdaSmi), I8(3),
B(TestEqualStrictNoFeedback), R(3),
B(JumpIfTrue), U8(13),
B(Ldar), R(3),
B(SwitchOnSmiNoFeedback), U8(2), U8(4), I8(0),
B(Jump), U8(14),
B(Ldar), R(4),
/* 25 S> */ B(Return),
......@@ -257,6 +243,10 @@ bytecodes: [
constant pool: [
Smi [52],
Smi [126],
Smi [6],
Smi [9],
Smi [12],
Smi [15],
]
handlers: [
[52, 209, 215],
......@@ -269,7 +259,7 @@ snippet: "
"
frame size: 18
parameter count: 1
bytecode array length: 736
bytecode array length: 708
bytecodes: [
B(Ldar), R(new_target),
B(JumpIfUndefined), U8(26),
......@@ -318,7 +308,7 @@ bytecodes: [
B(Star), R(6),
B(LdaZero),
B(Star), R(5),
B(JumpConstant), U8(15),
B(JumpConstant), U8(17),
B(Ldar), R(10),
/* 11 E> */ B(Throw),
B(Ldar), R(closure),
......@@ -510,12 +500,8 @@ bytecodes: [
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1),
B(Ldar), R(10),
B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(8),
B(JumpIfTrue), U8(10),
B(LdaSmi), I8(1),
B(TestEqualStrictNoFeedback), R(8),
B(JumpIfTrue), U8(17),
B(Ldar), R(8),
B(SwitchOnSmiNoFeedback), U8(15), U8(2), I8(0),
B(Jump), U8(28),
B(PopContext), R(1),
B(PopContext), R(1),
......@@ -553,21 +539,8 @@ bytecodes: [
B(CallRuntime), U16(Runtime::k_GeneratorClose), R(8), U8(1),
B(Ldar), R(7),
B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(5),
B(JumpIfTrue), U8(28),
B(LdaSmi), I8(1),
B(TestEqualStrictNoFeedback), R(5),
B(JumpIfTrue), U8(25),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(5),
B(JumpIfTrue), U8(22),
B(LdaSmi), I8(3),
B(TestEqualStrictNoFeedback), R(5),
B(JumpIfTrue), U8(19),
B(LdaSmi), I8(4),
B(TestEqualStrictNoFeedback), R(5),
B(JumpIfTrue), U8(16),
B(Ldar), R(5),
B(SwitchOnSmiNoFeedback), U8(18), U8(5), I8(0),
B(Jump), U8(17),
B(Ldar), R(6),
/* 44 S> */ B(Return),
......@@ -598,10 +571,17 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
Smi [561],
Smi [6],
Smi [19],
Smi [556],
Smi [6],
Smi [9],
Smi [12],
Smi [15],
Smi [18],
]
handlers: [
[52, 660, 666],
[52, 655, 661],
[133, 422, 428],
[136, 378, 380],
[515, 531, 533],
......
......@@ -273,7 +273,7 @@ snippet: "
"
frame size: 15
parameter count: 1
bytecode array length: 350
bytecode array length: 339
bytecodes: [
B(Ldar), R(new_target),
B(JumpIfUndefined), U8(26),
......@@ -417,15 +417,8 @@ bytecodes: [
B(CallRuntime), U16(Runtime::k_GeneratorClose), R(9), U8(1),
B(Ldar), R(8),
B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(6),
B(JumpIfTrue), U8(16),
B(LdaSmi), I8(1),
B(TestEqualStrictNoFeedback), R(6),
B(JumpIfTrue), U8(13),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(6),
B(JumpIfTrue), U8(10),
B(Ldar), R(6),
B(SwitchOnSmiNoFeedback), U8(4), U8(3), I8(0),
B(Jump), U8(11),
B(Ldar), R(7),
/* 62 S> */ B(Return),
......@@ -441,6 +434,9 @@ constant pool: [
FIXED_ARRAY_TYPE,
FIXED_ARRAY_TYPE,
FIXED_ARRAY_TYPE,
Smi [6],
Smi [9],
Smi [12],
]
handlers: [
[52, 292, 298],
......@@ -455,7 +451,7 @@ snippet: "
"
frame size: 14
parameter count: 1
bytecode array length: 469
bytecode array length: 452
bytecodes: [
B(Ldar), R(new_target),
B(JumpIfUndefined), U8(26),
......@@ -645,18 +641,8 @@ bytecodes: [
B(CallRuntime), U16(Runtime::k_GeneratorClose), R(8), U8(1),
B(Ldar), R(7),
B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(5),
B(JumpIfTrue), U8(22),
B(LdaSmi), I8(1),
B(TestEqualStrictNoFeedback), R(5),
B(JumpIfTrue), U8(19),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(5),
B(JumpIfTrue), U8(16),
B(LdaSmi), I8(3),
B(TestEqualStrictNoFeedback), R(5),
B(JumpIfTrue), U8(13),
B(Ldar), R(5),
B(SwitchOnSmiNoFeedback), U8(7), U8(4), I8(0),
B(Jump), U8(14),
B(Ldar), R(6),
/* 56 S> */ B(Return),
......@@ -677,6 +663,10 @@ constant pool: [
FIXED_ARRAY_TYPE,
Smi [60],
Smi [303],
Smi [6],
Smi [9],
Smi [12],
Smi [15],
]
handlers: [
[52, 402, 408],
......@@ -691,7 +681,7 @@ snippet: "
"
frame size: 12
parameter count: 1
bytecode array length: 315
bytecode array length: 304
bytecodes: [
B(CreateFunctionContext), U8(5),
B(PushContext), R(0),
......@@ -824,15 +814,8 @@ bytecodes: [
B(CallJSRuntime), U8(%async_function_promise_release), R(7), U8(2),
B(Ldar), R(6),
B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(4),
B(JumpIfTrue), U8(16),
B(LdaSmi), I8(1),
B(TestEqualStrictNoFeedback), R(4),
B(JumpIfTrue), U8(13),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(4),
B(JumpIfTrue), U8(10),
B(Ldar), R(4),
B(SwitchOnSmiNoFeedback), U8(5), U8(3), I8(0),
B(Jump), U8(11),
B(Ldar), R(5),
/* 67 S> */ B(Return),
......@@ -849,6 +832,9 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
FIXED_ARRAY_TYPE,
Smi [6],
Smi [9],
Smi [12],
]
handlers: [
[17, 255, 261],
......@@ -864,7 +850,7 @@ snippet: "
"
frame size: 15
parameter count: 1
bytecode array length: 508
bytecode array length: 491
bytecodes: [
B(Ldar), R(new_target),
B(JumpIfUndefined), U8(26),
......@@ -1068,18 +1054,8 @@ bytecodes: [
B(CallJSRuntime), U8(%async_function_promise_release), R(8), U8(2),
B(Ldar), R(7),
B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(5),
B(JumpIfTrue), U8(22),
B(LdaSmi), I8(1),
B(TestEqualStrictNoFeedback), R(5),
B(JumpIfTrue), U8(19),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(5),
B(JumpIfTrue), U8(16),
B(LdaSmi), I8(3),
B(TestEqualStrictNoFeedback), R(5),
B(JumpIfTrue), U8(13),
B(Ldar), R(5),
B(SwitchOnSmiNoFeedback), U8(7), U8(4), I8(0),
B(Jump), U8(14),
B(Ldar), R(6),
/* 61 S> */ B(Return),
......@@ -1100,6 +1076,10 @@ constant pool: [
Smi [83],
ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
FIXED_ARRAY_TYPE,
Smi [6],
Smi [9],
Smi [12],
Smi [15],
]
handlers: [
[61, 439, 445],
......
......@@ -12,7 +12,7 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 46
bytecode array length: 47
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), I8(1),
......@@ -33,9 +33,8 @@ bytecodes: [
B(Star), R(0),
B(Ldar), R(3),
/* 72 E> */ B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(1),
B(JumpIfTrue), U8(4),
B(Ldar), R(1),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(Jump), U8(5),
B(Ldar), R(2),
B(ReThrow),
......@@ -43,6 +42,7 @@ bytecodes: [
/* 79 S> */ B(Return),
]
constant pool: [
Smi [6],
]
handlers: [
[8, 12, 18],
......@@ -55,7 +55,7 @@ snippet: "
"
frame size: 7
parameter count: 1
bytecode array length: 73
bytecode array length: 74
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), I8(1),
......@@ -89,9 +89,8 @@ bytecodes: [
B(Star), R(0),
B(Ldar), R(4),
/* 92 E> */ B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(2),
B(JumpIfTrue), U8(4),
B(Ldar), R(2),
B(SwitchOnSmiNoFeedback), U8(2), U8(1), I8(0),
B(Jump), U8(5),
B(Ldar), R(3),
B(ReThrow),
......@@ -101,6 +100,7 @@ bytecodes: [
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["e"],
FIXED_ARRAY_TYPE,
Smi [6],
]
handlers: [
[8, 39, 45],
......@@ -115,7 +115,7 @@ snippet: "
"
frame size: 8
parameter count: 1
bytecode array length: 96
bytecode array length: 97
bytecodes: [
/* 30 E> */ B(StackCheck),
B(Mov), R(context), R(4),
......@@ -160,9 +160,8 @@ bytecodes: [
B(Star), R(0),
B(Ldar), R(4),
/* 116 E> */ B(SetPendingMessage),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(2),
B(JumpIfTrue), U8(4),
B(Ldar), R(2),
B(SwitchOnSmiNoFeedback), U8(3), U8(1), I8(0),
B(Jump), U8(5),
B(Ldar), R(3),
B(ReThrow),
......@@ -173,6 +172,7 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["e"],
FIXED_ARRAY_TYPE,
FIXED_ARRAY_TYPE,
Smi [6],
]
handlers: [
[4, 62, 68],
......
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