v8/test/cctest/interpreter/bytecode_expectations/Switch.golden
ssanfilippo 6ae030590d [Interpreter] Refactor bytecode generator test suite.
Bytecode expectations have been moved to external (.golden) files,
one per test. Each test in the suite builds a representation of the
the compiled bytecode using BytecodeExpectationsPrinter. The output is
then compared to the golden file. If the comparision fails, a textual
diff can be used to identify the discrepancies.

Only the test snippets are left in the cc file, which also allows to
make it more compact and meaningful. Leaving the snippets in the cc
file was a deliberate choice to allow keeping the "truth" about the
tests in the cc file, which will rarely change, as opposed to golden
files.

Golden files can be generated and kept up to date using
generate-bytecode-expectations, which also means that the test suite
can be batch updated whenever the bytecode or golden format changes.

The golden format has been slightly amended (no more comments about
`void*`, add size of the bytecode array) following the consideration
made while converting the tests.

There is also a fix: BytecodeExpectationsPrinter::top_level_ was left
uninitialized, leading to undefined behaviour.

BUG=v8:4280
LOG=N

Review URL: https://codereview.chromium.org/1717293002

Cr-Commit-Position: refs/heads/master@{#34285}
2016-02-25 12:07:19 +00:00

525 lines
8.2 KiB
Plaintext

#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: number
execute: yes
wrap: yes
---
snippet: "
var a = 1;
switch(a) {
case 1: return 2;
case 2: return 3;
}
"
frame size: 3
parameter count: 1
bytecode array length: 31
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(1),
B(Star), R(0),
B(Star), R(2),
B(LdaSmi8), U8(1),
B(TestEqualStrict), R(2),
B(JumpIfTrue), U8(10),
B(LdaSmi8), U8(2),
B(TestEqualStrict), R(2),
B(JumpIfTrue), U8(7),
B(Jump), U8(8),
B(LdaSmi8), U8(2),
B(Return),
B(LdaSmi8), U8(3),
B(Return),
B(LdaUndefined),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var a = 1;
switch(a) {
case 1: a = 2; break;
case 2: a = 3; break;
}
"
frame size: 3
parameter count: 1
bytecode array length: 37
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(1),
B(Star), R(0),
B(Star), R(2),
B(LdaSmi8), U8(1),
B(TestEqualStrict), R(2),
B(JumpIfTrue), U8(10),
B(LdaSmi8), U8(2),
B(TestEqualStrict), R(2),
B(JumpIfTrue), U8(10),
B(Jump), U8(14),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(Jump), U8(8),
B(LdaSmi8), U8(3),
B(Star), R(1),
B(Jump), U8(2),
B(LdaUndefined),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var a = 1;
switch(a) {
case 1: a = 2; // fall-through
case 2: a = 3; break;
}
"
frame size: 3
parameter count: 1
bytecode array length: 35
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(1),
B(Star), R(0),
B(Star), R(2),
B(LdaSmi8), U8(1),
B(TestEqualStrict), R(2),
B(JumpIfTrue), U8(10),
B(LdaSmi8), U8(2),
B(TestEqualStrict), R(2),
B(JumpIfTrue), U8(8),
B(Jump), U8(12),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(3),
B(Star), R(1),
B(Jump), U8(2),
B(LdaUndefined),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var a = 1;
switch(a) {
case 2: break;
case 3: break;
default: a = 1; break;
}
"
frame size: 3
parameter count: 1
bytecode array length: 35
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(1),
B(Star), R(0),
B(Star), R(2),
B(LdaSmi8), U8(2),
B(TestEqualStrict), R(2),
B(JumpIfTrue), U8(10),
B(LdaSmi8), U8(3),
B(TestEqualStrict), R(2),
B(JumpIfTrue), U8(6),
B(Jump), U8(6),
B(Jump), U8(10),
B(Jump), U8(8),
B(LdaSmi8), U8(1),
B(Star), R(1),
B(Jump), U8(2),
B(LdaUndefined),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var a = 1;
switch(typeof(a)) {
case 2: a = 1; break;
case 3: a = 2; break;
default: a = 3; break;
}
"
frame size: 3
parameter count: 1
bytecode array length: 44
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(1),
B(TypeOf),
B(Star), R(0),
B(Star), R(2),
B(LdaSmi8), U8(2),
B(TestEqualStrict), R(2),
B(JumpIfTrue), U8(10),
B(LdaSmi8), U8(3),
B(TestEqualStrict), R(2),
B(JumpIfTrue), U8(10),
B(Jump), U8(14),
B(LdaSmi8), U8(1),
B(Star), R(1),
B(Jump), U8(14),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(Jump), U8(8),
B(LdaSmi8), U8(3),
B(Star), R(1),
B(Jump), U8(2),
B(LdaUndefined),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var a = 1;
switch(a) {
case typeof(a): a = 1; break;
default: a = 2; break;
}
"
frame size: 3
parameter count: 1
bytecode array length: 32
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(1),
B(Star), R(0),
B(Star), R(2),
B(Ldar), R(1),
B(TypeOf),
B(TestEqualStrict), R(2),
B(JumpIfTrue), U8(4),
B(Jump), U8(8),
B(LdaSmi8), U8(1),
B(Star), R(1),
B(Jump), U8(8),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(Jump), U8(2),
B(LdaUndefined),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var a = 1;
switch(a) {
case 1:
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
a = 2;
break;
case 2:
a = 3;
break;
}
"
frame size: 3
parameter count: 1
bytecode array length: 289
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(1),
B(Star), R(0),
B(Star), R(2),
B(LdaSmi8), U8(1),
B(TestEqualStrict), R(2),
B(JumpIfTrue), U8(10),
B(LdaSmi8), U8(2),
B(TestEqualStrict), R(2),
B(JumpIfTrueConstant), U8(0),
B(JumpConstant), U8(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(Jump), U8(8),
B(LdaSmi8), U8(3),
B(Star), R(1),
B(Jump), U8(2),
B(LdaUndefined),
B(Return),
]
constant pool: [
262,
266,
]
handlers: [
]
---
snippet: "
var a = 1;
switch(a) {
case 1:
switch(a + 1) {
case 2 : a = 1; break;
default : a = 2; break;
} // fall-through
case 2: a = 3;
}
"
frame size: 5
parameter count: 1
bytecode array length: 61
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(2),
B(Star), R(0),
B(Star), R(3),
B(LdaSmi8), U8(1),
B(TestEqualStrict), R(3),
B(JumpIfTrue), U8(10),
B(LdaSmi8), U8(2),
B(TestEqualStrict), R(3),
B(JumpIfTrue), U8(36),
B(Jump), U8(38),
B(Ldar), R(2),
B(Star), R(4),
B(LdaSmi8), U8(1),
B(Add), R(4),
B(Star), R(1),
B(Star), R(4),
B(LdaSmi8), U8(2),
B(TestEqualStrict), R(4),
B(JumpIfTrue), U8(4),
B(Jump), U8(8),
B(LdaSmi8), U8(1),
B(Star), R(2),
B(Jump), U8(8),
B(LdaSmi8), U8(2),
B(Star), R(2),
B(Jump), U8(2),
B(LdaSmi8), U8(3),
B(Star), R(2),
B(LdaUndefined),
B(Return),
]
constant pool: [
]
handlers: [
]