Commit 6ae03059 authored by ssanfilippo's avatar ssanfilippo Committed by Commit bot

[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}
parent 6695290c
......@@ -6,6 +6,7 @@
'files': [
'./cctest.status',
'./testcfg.py',
'./interpreter/bytecode_expectations/',
],
},
'includes': [
......
......@@ -224,14 +224,14 @@ void BytecodeExpectationsPrinter::PrintFrameSize(
int frame_size = bytecode_array->frame_size();
DCHECK_EQ(frame_size % kPointerSize, 0);
stream << "frame size: " << frame_size / kPointerSize;
if (frame_size > 0) stream << " # in multiples of sizeof(void*)";
stream << "\nparameter count: " << bytecode_array->parameter_count() << '\n';
stream << "frame size: " << frame_size / kPointerSize
<< "\nparameter count: " << bytecode_array->parameter_count() << '\n';
}
void BytecodeExpectationsPrinter::PrintBytecodeSequence(
std::ostream& stream, i::Handle<i::BytecodeArray> bytecode_array) const {
stream << "bytecodes: [\n";
stream << "bytecode array length: " << bytecode_array->length()
<< "\nbytecodes: [\n";
BytecodeArrayIterator bytecode_iter(bytecode_array);
for (; !bytecode_iter.done(); bytecode_iter.Advance()) {
stream << " ";
......
......@@ -36,6 +36,7 @@ class BytecodeExpectationsPrinter final {
const_pool_type_(t),
execute_(true),
wrap_(true),
top_level_(false),
test_function_name_(kDefaultTopFunctionName) {}
void PrintExpectation(std::ostream& stream, // NOLINT
......
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: mixed
execute: yes
wrap: yes
---
snippet: "
return [ 1, 2 ];
"
frame size: 0
parameter count: 1
bytecode array length: 6
bytecodes: [
B(StackCheck),
B(CreateArrayLiteral), U8(0), U8(0), U8(3),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
---
snippet: "
var a = 1; return [ a, a + 1 ];
"
frame size: 4
parameter count: 1
bytecode array length: 39
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(CreateArrayLiteral), U8(0), U8(0), U8(3),
B(Star), R(2),
B(LdaZero),
B(Star), R(1),
B(Ldar), R(0),
B(KeyedStoreICSloppy), R(2), R(1), U8(1),
B(LdaSmi8), U8(1),
B(Star), R(1),
B(Ldar), R(0),
B(Star), R(3),
B(LdaSmi8), U8(1),
B(Add), R(3),
B(KeyedStoreICSloppy), R(2), R(1), U8(1),
B(Ldar), R(2),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
---
snippet: "
return [ [ 1, 2 ], [ 3 ] ];
"
frame size: 0
parameter count: 1
bytecode array length: 6
bytecodes: [
B(StackCheck),
B(CreateArrayLiteral), U8(0), U8(2), U8(2),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
---
snippet: "
var a = 1; return [ [ a, 2 ], [ a + 2 ] ];
"
frame size: 6
parameter count: 1
bytecode array length: 69
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(CreateArrayLiteral), U8(0), U8(2), U8(2),
B(Star), R(2),
B(LdaZero),
B(Star), R(1),
B(CreateArrayLiteral), U8(1), U8(0), U8(3),
B(Star), R(4),
B(LdaZero),
B(Star), R(3),
B(Ldar), R(0),
B(KeyedStoreICSloppy), R(4), R(3), U8(1),
B(Ldar), R(4),
B(KeyedStoreICSloppy), R(2), R(1), U8(5),
B(LdaSmi8), U8(1),
B(Star), R(1),
B(CreateArrayLiteral), U8(2), U8(1), U8(3),
B(Star), R(4),
B(LdaZero),
B(Star), R(3),
B(Ldar), R(0),
B(Star), R(5),
B(LdaSmi8), U8(2),
B(Add), R(5),
B(KeyedStoreICSloppy), R(4), R(3), U8(3),
B(Ldar), R(4),
B(KeyedStoreICSloppy), R(2), R(1), U8(5),
B(Ldar), R(2),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: string
execute: yes
wrap: yes
---
snippet: "
var x = 0, y = 1;
return (x = 2, y = 3, x = 4, y = 5);
"
frame size: 2
parameter count: 1
bytecode array length: 25
bytecodes: [
B(StackCheck),
B(LdaZero),
B(Star), R(0),
B(LdaSmi8), U8(1),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Star), R(0),
B(LdaSmi8), U8(3),
B(Star), R(1),
B(LdaSmi8), U8(4),
B(Star), R(0),
B(LdaSmi8), U8(5),
B(Star), R(1),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var x = 55;
var y = (x = 100);
return y;
"
frame size: 2
parameter count: 1
bytecode array length: 12
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(55),
B(Star), R(0),
B(LdaSmi8), U8(100),
B(Star), R(0),
B(Star), R(1),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var x = 55;
x = x + (x = 100) + (x = 101);
return x;
"
frame size: 3
parameter count: 1
bytecode array length: 24
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(55),
B(Star), R(0),
B(Star), R(1),
B(LdaSmi8), U8(100),
B(Star), R(0),
B(Add), R(1),
B(Star), R(2),
B(LdaSmi8), U8(101),
B(Star), R(0),
B(Add), R(2),
B(Star), R(0),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var x = 55;
x = (x = 56) - x + (x = 57);
x++;
return x;
"
frame size: 3
parameter count: 1
bytecode array length: 32
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(55),
B(Star), R(0),
B(LdaSmi8), U8(56),
B(Star), R(0),
B(Star), R(1),
B(Ldar), R(0),
B(Sub), R(1),
B(Star), R(2),
B(LdaSmi8), U8(57),
B(Star), R(0),
B(Add), R(2),
B(Star), R(0),
B(ToNumber),
B(Star), R(1),
B(Inc),
B(Star), R(0),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var x = 55;
var y = x + (x = 1) + (x = 2) + (x = 3);
return y;
"
frame size: 4
parameter count: 1
bytecode array length: 32
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(55),
B(Star), R(0),
B(Star), R(2),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(Add), R(2),
B(Star), R(3),
B(LdaSmi8), U8(2),
B(Star), R(0),
B(Add), R(3),
B(Star), R(2),
B(LdaSmi8), U8(3),
B(Star), R(0),
B(Add), R(2),
B(Star), R(1),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var x = 55;
var x = x + (x = 1) + (x = 2) + (x = 3);
return x;
"
frame size: 3
parameter count: 1
bytecode array length: 32
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(55),
B(Star), R(0),
B(Star), R(1),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(Add), R(1),
B(Star), R(2),
B(LdaSmi8), U8(2),
B(Star), R(0),
B(Add), R(2),
B(Star), R(1),
B(LdaSmi8), U8(3),
B(Star), R(0),
B(Add), R(1),
B(Star), R(0),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var x = 10, y = 20;
return x + (x = 1) + (x + 1) * (y = 2) + (y = 3) + (x = 4) + (y = 5) + y;
"
frame size: 5
parameter count: 1
bytecode array length: 70
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(10),
B(Star), R(0),
B(LdaSmi8), U8(20),
B(Star), R(1),
B(Ldar), R(0),
B(Star), R(2),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(Add), R(2),
B(Star), R(3),
B(Ldar), R(0),
B(Star), R(2),
B(LdaSmi8), U8(1),
B(Add), R(2),
B(Star), R(4),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(Mul), R(4),
B(Add), R(3),
B(Star), R(2),
B(LdaSmi8), U8(3),
B(Star), R(1),
B(Add), R(2),
B(Star), R(3),
B(LdaSmi8), U8(4),
B(Star), R(0),
B(Add), R(3),
B(Star), R(2),
B(LdaSmi8), U8(5),
B(Star), R(1),
B(Add), R(2),
B(Star), R(3),
B(Ldar), R(1),
B(Add), R(3),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var x = 17;
return 1 + x + (x++) + (++x);
"
frame size: 4
parameter count: 1
bytecode array length: 38
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(17),
B(Star), R(0),
B(LdaSmi8), U8(1),
B(Star), R(1),
B(Ldar), R(0),
B(Add), R(1),
B(Star), R(2),
B(Ldar), R(0),
B(ToNumber),
B(Star), R(1),
B(Inc),
B(Star), R(0),
B(Ldar), R(1),
B(Add), R(2),
B(Star), R(3),
B(Ldar), R(0),
B(ToNumber),
B(Inc),
B(Star), R(0),
B(Add), R(3),
B(Return),
]
constant pool: [
]
handlers: [
]
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: number
execute: yes
wrap: yes
---
snippet: "
var a = 1; if (a || a < 0) { return 1; }
"
frame size: 2
parameter count: 1
bytecode array length: 21
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(JumpIfToBooleanTrue), U8(9),
B(Ldar), R(0),
B(Star), R(1),
B(LdaZero),
B(TestLessThan), R(1),
B(JumpIfToBooleanFalse), U8(5),
B(LdaSmi8), U8(1),
B(Return),
B(LdaUndefined),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var a = 1; if (a && a < 0) { return 1; }
"
frame size: 2
parameter count: 1
bytecode array length: 21
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(JumpIfToBooleanFalse), U8(9),
B(Ldar), R(0),
B(Star), R(1),
B(LdaZero),
B(TestLessThan), R(1),
B(JumpIfToBooleanFalse), U8(5),
B(LdaSmi8), U8(1),
B(Return),
B(LdaUndefined),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var a = 1; a = (a || a < 0) ? 2 : 3;
"
frame size: 2
parameter count: 1
bytecode array length: 26
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(JumpIfToBooleanTrue), U8(9),
B(Ldar), R(0),
B(Star), R(1),
B(LdaZero),
B(TestLessThan), R(1),
B(JumpIfToBooleanFalse), U8(6),
B(LdaSmi8), U8(2),
B(Jump), U8(4),
B(LdaSmi8), U8(3),
B(Star), R(0),
B(LdaUndefined),
B(Return),
]
constant pool: [
]
handlers: [
]
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: mixed
execute: yes
wrap: yes
---
snippet: "
var x = 0;
label: {
x = x + 1;
break label;
x = x + 1;
}
return x;
"
frame size: 2
parameter count: 1
bytecode array length: 17
bytecodes: [
B(StackCheck),
B(LdaZero),
B(Star), R(0),
B(Star), R(1),
B(LdaSmi8), U8(1),
B(Add), R(1),
B(Star), R(0),
B(Jump), U8(2),
B(Ldar), R(0),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var sum = 0;
outer: {
for (var x = 0; x < 10; ++x) {
for (var y = 0; y < 3; ++y) {
++sum;
if (x + y == 12) { break outer; }
}
}
}
return sum;
"
frame size: 5
parameter count: 1
bytecode array length: 75
bytecodes: [
B(StackCheck),
B(LdaZero),
B(Star), R(0),
B(LdaZero),
B(Star), R(1),
B(Ldar), R(1),
B(Star), R(3),
B(LdaSmi8), U8(10),
B(TestLessThan), R(3),
B(JumpIfFalse), U8(57),
B(StackCheck),
B(LdaZero),
B(Star), R(2),
B(Ldar), R(2),
B(Star), R(3),
B(LdaSmi8), U8(3),
B(TestLessThan), R(3),
B(JumpIfFalse), U8(35),
B(StackCheck),
B(Ldar), R(0),
B(ToNumber),
B(Inc),
B(Star), R(0),
B(Ldar), R(1),
B(Star), R(3),
B(Ldar), R(2),
B(Add), R(3),
B(Star), R(4),
B(LdaSmi8), U8(12),
B(TestEqual), R(4),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Ldar), R(2),
B(ToNumber),
B(Inc),
B(Star), R(2),
B(Jump), U8(-41),
B(Ldar), R(1),
B(ToNumber),
B(Inc),
B(Star), R(1),
B(Jump), U8(-63),
B(Ldar), R(0),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
outer: {
let y = 10;
function f() { return y; }
break outer;
}
"
frame size: 5
parameter count: 1
bytecode array length: 51
bytecodes: [
B(StackCheck),
B(LdaConstant), U8(0),
B(Star), R(3),
B(Ldar), R(closure),
B(Star), R(4),
B(CallRuntime), U16(Runtime::kPushBlockContext), R(3), U8(2),
B(PushContext), R(2),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(CreateClosure), U8(1), U8(0),
B(Star), R(0),
B(LdaSmi8), U8(10),
B(StaContextSlot), R(context), U8(4),
B(Ldar), R(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(2),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1),
B(Star), R(1),
B(Jump), U8(2),
B(PopContext), R(2),
B(LdaUndefined),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
---
snippet: "
let x = 1;
outer: {
inner: {
let y = 2;
function f() { return x + y; }
if (y) break outer;
y = 3;
}
}
x = 4;
"
frame size: 6
parameter count: 1
bytecode array length: 131
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(2),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(StackCheck),
B(LdaSmi8), U8(1),
B(StaContextSlot), R(context), U8(4),
B(LdaConstant), U8(0),
B(Star), R(4),
B(Ldar), R(closure),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kPushBlockContext), R(4), U8(2),
B(PushContext), R(3),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(CreateClosure), U8(1), U8(0),
B(Star), R(0),
B(LdaSmi8), U8(2),
B(StaContextSlot), R(context), U8(4),
B(Ldar), R(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(2),
B(Star), R(4),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1),
B(Star), R(1),
B(LdaContextSlot), R(context), U8(4),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(3),
B(Star), R(4),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1),
B(JumpIfToBooleanFalse), U8(6),
B(PopContext), R(3),
B(Jump), U8(27),
B(LdaSmi8), U8(3),
B(Star), R(4),
B(LdaContextSlot), R(context), U8(4),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(3),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1),
B(Ldar), R(4),
B(StaContextSlot), R(context), U8(4),
B(PopContext), R(3),
B(LdaSmi8), U8(4),
B(Star), R(4),
B(LdaContextSlot), R(context), U8(4),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(4),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1),
B(Ldar), R(4),
B(StaContextSlot), R(context), U8(4),
B(LdaUndefined),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: string
execute: yes
wrap: no
test function name: f
---
snippet: "
function t() { }
function f() { return t(); }
f();
"
frame size: 2
parameter count: 1
bytecode array length: 15
bytecodes: [
B(StackCheck),
B(LdaUndefined),
B(Star), R(1),
B(LdaGlobal), U8(0), U8(3),
B(Star), R(0),
B(Call), R(0), R(1), U8(1), U8(1),
B(Return),
]
constant pool: [
"t",
]
handlers: [
]
---
snippet: "
function t(a, b, c) { }
function f() { return t(1, 2, 3); }
f();
"
frame size: 5
parameter count: 1
bytecode array length: 27
bytecodes: [
B(StackCheck),
B(LdaUndefined),
B(Star), R(1),
B(LdaGlobal), U8(0), U8(3),
B(Star), R(0),
B(LdaSmi8), U8(1),
B(Star), R(2),
B(LdaSmi8), U8(2),
B(Star), R(3),
B(LdaSmi8), U8(3),
B(Star), R(4),
B(Call), R(0), R(1), U8(4), U8(1),
B(Return),
]
constant pool: [
"t",
]
handlers: [
]
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: mixed
execute: yes
wrap: yes
---
snippet: "
g = function(){}; eval(''); return g();
"
frame size: 9
parameter count: 1
bytecode array length: 85
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(0),
B(Ldar), R(this),
B(StaContextSlot), R(context), U8(4),
B(CreateMappedArguments),
B(StaContextSlot), R(context), U8(5),
B(Ldar), R(new_target),
B(StaContextSlot), R(context), U8(6),
B(StackCheck),
B(CreateClosure), U8(0), U8(0),
B(StaLookupSlotSloppy), U8(1),
B(LdaConstant), U8(2),
B(Star), R(3),
B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1),
B(LdaConstant), U8(3),
B(Star), R(3),
B(Mov), R(1), R(4),
B(Mov), R(3), R(5),
B(Mov), R(closure), R(6),
B(LdaZero),
B(Star), R(7),
B(LdaSmi8), U8(30),
B(Star), R(8),
B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(5),
B(Star), R(1),
B(Call), R(1), R(2), U8(2), U8(0),
B(LdaConstant), U8(1),
B(Star), R(3),
B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1),
B(Call), R(1), R(2), U8(1), U8(3),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: mixed
execute: yes
wrap: no
test function name: f
---
snippet: "
function bar() { this.value = 0; }
function f() { return new bar(); }
f();
"
frame size: 1
parameter count: 1
bytecode array length: 11
bytecodes: [
B(StackCheck),
B(LdaGlobal), U8(0), U8(2),
B(Star), R(0),
B(New), R(0), R(0), U8(0),
B(Return),
]
constant pool: [
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
---
snippet: "
function bar(x) { this.value = 18; this.x = x;}
function f() { return new bar(3); }
f();
"
frame size: 2
parameter count: 1
bytecode array length: 17
bytecodes: [
B(StackCheck),
B(LdaGlobal), U8(0), U8(2),
B(Star), R(0),
B(LdaSmi8), U8(3),
B(Star), R(1),
B(Ldar), R(0),
B(New), R(0), R(1), U8(1),
B(Return),
]
constant pool: [
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
---
snippet: "
function bar(w, x, y, z) {
this.value = 18;
this.x = x;
this.y = y;
this.z = z;
}
function f() { return new bar(3, 4, 5); }
f();
"
frame size: 4
parameter count: 1
bytecode array length: 25
bytecodes: [
B(StackCheck),
B(LdaGlobal), U8(0), U8(2),
B(Star), R(0),
B(LdaSmi8), U8(3),
B(Star), R(1),
B(LdaSmi8), U8(4),
B(Star), R(2),
B(LdaSmi8), U8(5),
B(Star), R(3),
B(Ldar), R(0),
B(New), R(0), R(1), U8(3),
B(Return),
]
constant pool: [
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: mixed
execute: yes
wrap: no
test function name: f
---
snippet: "
function f() { %TheHole() }
f();
"
frame size: 0
parameter count: 1
bytecode array length: 8
bytecodes: [
B(StackCheck),
B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0),
B(LdaUndefined),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
function f(a) { return %IsArray(a) }
f(undefined);
"
frame size: 1
parameter count: 2
bytecode array length: 11
bytecodes: [
B(StackCheck),
B(Ldar), R(arg0),
B(Star), R(0),
B(CallRuntime), U16(Runtime::kIsArray), R(0), U8(1),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
function f() { return %Add(1, 2) }
f();
"
frame size: 2
parameter count: 1
bytecode array length: 15
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(LdaSmi8), U8(2),
B(Star), R(1),
B(CallRuntime), U16(Runtime::kAdd), R(0), U8(2),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
function f() { return %spread_iterable([1]) }
f();
"
frame size: 2
parameter count: 1
bytecode array length: 16
bytecodes: [
B(StackCheck),
B(LdaUndefined),
B(Star), R(0),
B(CreateArrayLiteral), U8(0), U8(0), U8(3),
B(Star), R(1),
B(CallJSRuntime), U16(127), R(0), U8(2),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: mixed
execute: yes
wrap: yes
---
snippet: "
class Person {
constructor(name) { this.name = name; }
speak() { console.log(this.name + ' is speaking.'); }
}
"
frame size: 9
parameter count: 1
bytecode array length: 71
bytecodes: [
B(LdaTheHole),
B(Star), R(1),
B(StackCheck),
B(LdaTheHole),
B(Star), R(0),
B(LdaTheHole),
B(Star), R(2),
B(CreateClosure), U8(0), U8(0),
B(Star), R(3),
B(LdaSmi8), U8(34),
B(Star), R(4),
B(LdaConstant), U8(1),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(4),
B(Star), R(2),
B(LoadIC), R(2), U8(2), U8(1),
B(Star), R(3),
B(Mov), R(3), R(4),
B(LdaConstant), U8(3),
B(Star), R(5),
B(CreateClosure), U8(4), U8(0),
B(Star), R(6),
B(LdaSmi8), U8(2),
B(Star), R(7),
B(LdaZero),
B(Star), R(8),
B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(4), U8(5),
B(CallRuntime), U16(Runtime::kFinalizeClassDefinition), R(2), U8(2),
B(Star), R(0),
B(Star), R(1),
B(LdaUndefined),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
kInstanceTypeDontCare,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
---
snippet: "
class person {
constructor(name) { this.name = name; }
speak() { console.log(this.name + ' is speaking.'); }
}
"
frame size: 9
parameter count: 1
bytecode array length: 71
bytecodes: [
B(LdaTheHole),
B(Star), R(1),
B(StackCheck),
B(LdaTheHole),
B(Star), R(0),
B(LdaTheHole),
B(Star), R(2),
B(CreateClosure), U8(0), U8(0),
B(Star), R(3),
B(LdaSmi8), U8(34),
B(Star), R(4),
B(LdaConstant), U8(1),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(4),
B(Star), R(2),
B(LoadIC), R(2), U8(2), U8(1),
B(Star), R(3),
B(Mov), R(3), R(4),
B(LdaConstant), U8(3),
B(Star), R(5),
B(CreateClosure), U8(4), U8(0),
B(Star), R(6),
B(LdaSmi8), U8(2),
B(Star), R(7),
B(LdaZero),
B(Star), R(8),
B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(4), U8(5),
B(CallRuntime), U16(Runtime::kFinalizeClassDefinition), R(2), U8(2),
B(Star), R(0),
B(Star), R(1),
B(LdaUndefined),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
kInstanceTypeDontCare,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
---
snippet: "
var n0 = 'a';
var n1 = 'b';
class N {
[n0]() { return n0; }
static [n1]() { return n1; }
}
"
frame size: 10
parameter count: 1
bytecode array length: 125
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(2),
B(LdaTheHole),
B(Star), R(1),
B(StackCheck),
B(LdaConstant), U8(0),
B(StaContextSlot), R(context), U8(4),
B(LdaConstant), U8(1),
B(StaContextSlot), R(context), U8(5),
B(LdaTheHole),
B(Star), R(0),
B(LdaTheHole),
B(Star), R(3),
B(CreateClosure), U8(2), U8(0),
B(Star), R(4),
B(LdaSmi8), U8(62),
B(Star), R(5),
B(LdaConstant), U8(3),
B(Star), R(6),
B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4),
B(Star), R(3),
B(LoadIC), R(3), U8(4), U8(1),
B(Star), R(4),
B(Mov), R(4), R(5),
B(LdaContextSlot), R(context), U8(4),
B(ToName),
B(Star), R(6),
B(CreateClosure), U8(5), U8(0),
B(Star), R(7),
B(LdaSmi8), U8(2),
B(Star), R(8),
B(LdaSmi8), U8(1),
B(Star), R(9),
B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(5), U8(5),
B(Mov), R(3), R(5),
B(LdaContextSlot), R(context), U8(5),
B(ToName),
B(Star), R(6),
B(LdaConstant), U8(4),
B(TestEqualStrict), R(6),
B(JumpIfFalse), U8(7),
B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0),
B(CreateClosure), U8(6), U8(0),
B(Star), R(7),
B(LdaSmi8), U8(1),
B(Star), R(9),
B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(5), U8(5),
B(CallRuntime), U16(Runtime::kFinalizeClassDefinition), R(3), U8(2),
B(Star), R(0),
B(Star), R(1),
B(LdaUndefined),
B(Return),
]
constant pool: [
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
kInstanceTypeDontCare,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
---
snippet: "
var count = 0;
class C { constructor() { count++; }}
return new C();
"
frame size: 10
parameter count: 1
bytecode array length: 74
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(2),
B(LdaTheHole),
B(Star), R(1),
B(StackCheck),
B(LdaZero),
B(StaContextSlot), R(context), U8(4),
B(LdaTheHole),
B(Star), R(0),
B(LdaTheHole),
B(Star), R(3),
B(CreateClosure), U8(0), U8(0),
B(Star), R(4),
B(LdaSmi8), U8(49),
B(Star), R(5),
B(LdaSmi8), U8(86),
B(Star), R(6),
B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4),
B(Star), R(3),
B(LoadIC), R(3), U8(1), U8(1),
B(Star), R(4),
B(CallRuntime), U16(Runtime::kFinalizeClassDefinition), R(3), U8(2),
B(Star), R(0),
B(Star), R(1),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(2),
B(Star), R(4),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1),
B(Star), R(3),
B(New), R(3), R(0), U8(0),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: mixed
execute: yes
wrap: yes
---
snippet: "
var a = 1; a += 2;
"
frame size: 2
parameter count: 1
bytecode array length: 15
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Add), R(1),
B(Star), R(0),
B(LdaUndefined),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var a = 1; a /= 2;
"
frame size: 2
parameter count: 1
bytecode array length: 15
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(Star), R(1),
B(LdaSmi8), U8(2),
B(Div), R(1),
B(Star), R(0),
B(LdaUndefined),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var a = { val: 2 }; a.name *= 2;
"
frame size: 3
parameter count: 1
bytecode array length: 27
bytecodes: [
B(StackCheck),
B(CreateObjectLiteral), U8(0), U8(0), U8(9),
B(Star), R(1),
B(Star), R(0),
B(Star), R(1),
B(LoadIC), R(1), U8(1), U8(1),
B(Star), R(2),
B(LdaSmi8), U8(2),
B(Mul), R(2),
B(StoreICSloppy), R(1), U8(1), U8(3),
B(LdaUndefined),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
---
snippet: "
var a = { 1: 2 }; a[1] ^= 2;
"
frame size: 4
parameter count: 1
bytecode array length: 30
bytecodes: [
B(StackCheck),
B(CreateObjectLiteral), U8(0), U8(0), U8(9),
B(Star), R(1),
B(Star), R(0),
B(Star), R(1),
B(LdaSmi8), U8(1),
B(Star), R(2),
B(KeyedLoadIC), R(1), U8(1),
B(Star), R(3),
B(LdaSmi8), U8(2),
B(BitwiseXor), R(3),
B(KeyedStoreICSloppy), R(1), R(2), U8(3),
B(LdaUndefined),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
---
snippet: "
var a = 1; (function f() { return a; }); a |= 24;
"
frame size: 2
parameter count: 1
bytecode array length: 30
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(0),
B(StackCheck),
B(LdaSmi8), U8(1),
B(StaContextSlot), R(context), U8(4),
B(CreateClosure), U8(0), U8(0),
B(LdaContextSlot), R(context), U8(4),
B(Star), R(1),
B(LdaSmi8), U8(24),
B(BitwiseOr), R(1),
B(StaContextSlot), R(context), U8(4),
B(LdaUndefined),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: number
execute: yes
wrap: yes
---
snippet: "
return 1 ? 2 : 3;
"
frame size: 0
parameter count: 1
bytecode array length: 12
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(JumpIfToBooleanFalse), U8(6),
B(LdaSmi8), U8(2),
B(Jump), U8(4),
B(LdaSmi8), U8(3),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
return 1 ? 2 ? 3 : 4 : 5;
"
frame size: 0
parameter count: 1
bytecode array length: 20
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(JumpIfToBooleanFalse), U8(14),
B(LdaSmi8), U8(2),
B(JumpIfToBooleanFalse), U8(6),
B(LdaSmi8), U8(3),
B(Jump), U8(4),
B(LdaSmi8), U8(4),
B(Jump), U8(4),
B(LdaSmi8), U8(5),
B(Return),
]
constant pool: [
]
handlers: [
]
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: string
execute: yes
wrap: yes
---
snippet: "
const x = 10;
"
frame size: 1
parameter count: 1
bytecode array length: 10
bytecodes: [
B(LdaTheHole),
B(Star), R(0),
B(StackCheck),
B(LdaSmi8), U8(10),
B(Star), R(0),
B(LdaUndefined),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
const x = 10; return x;
"
frame size: 2
parameter count: 1
bytecode array length: 20
bytecodes: [
B(LdaTheHole),
B(Star), R(0),
B(StackCheck),
B(LdaSmi8), U8(10),
B(Star), R(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(0),
B(Star), R(1),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(1), U8(1),
B(Return),
]
constant pool: [
"x",
]
handlers: [
]
---
snippet: "
const x = ( x = 20);
"
frame size: 3
parameter count: 1
bytecode array length: 32
bytecodes: [
B(LdaTheHole),
B(Star), R(0),
B(StackCheck),
B(LdaSmi8), U8(20),
B(Star), R(1),
B(Ldar), R(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(0),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1),
B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
B(Ldar), R(1),
B(Star), R(0),
B(LdaUndefined),
B(Return),
]
constant pool: [
"x",
]
handlers: [
]
---
snippet: "
const x = 10; x = 20;
"
frame size: 3
parameter count: 1
bytecode array length: 36
bytecodes: [
B(LdaTheHole),
B(Star), R(0),
B(StackCheck),
B(LdaSmi8), U8(10),
B(Star), R(0),
B(LdaSmi8), U8(20),
B(Star), R(1),
B(Ldar), R(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(0),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1),
B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
B(Ldar), R(1),
B(Star), R(0),
B(LdaUndefined),
B(Return),
]
constant pool: [
"x",
]
handlers: [
]
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: mixed
execute: yes
wrap: yes
---
snippet: "
const x = 10; function f1() {return x;}
"
frame size: 2
parameter count: 1
bytecode array length: 24
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(1),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(CreateClosure), U8(0), U8(0),
B(Star), R(0),
B(StackCheck),
B(LdaSmi8), U8(10),
B(StaContextSlot), R(context), U8(4),
B(LdaUndefined),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
---
snippet: "
const x = 10; function f1() {return x;} return x;
"
frame size: 3
parameter count: 1
bytecode array length: 37
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(1),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(CreateClosure), U8(0), U8(0),
B(Star), R(0),
B(StackCheck),
B(LdaSmi8), U8(10),
B(StaContextSlot), R(context), U8(4),
B(LdaContextSlot), R(context), U8(4),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(1),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
---
snippet: "
const x = (x = 20); function f1() {return x;}
"
frame size: 4
parameter count: 1
bytecode array length: 50
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(1),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(CreateClosure), U8(0), U8(0),
B(Star), R(0),
B(StackCheck),
B(LdaSmi8), U8(20),
B(Star), R(2),
B(LdaContextSlot), R(context), U8(4),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(1),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1),
B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
B(Ldar), R(2),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4),
B(LdaUndefined),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
---
snippet: "
const x = 10; x = 20; function f1() {return x;}
"
frame size: 4
parameter count: 1
bytecode array length: 52
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(1),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(CreateClosure), U8(0), U8(0),
B(Star), R(0),
B(StackCheck),
B(LdaSmi8), U8(10),
B(StaContextSlot), R(context), U8(4),
B(LdaSmi8), U8(20),
B(Star), R(2),
B(LdaContextSlot), R(context), U8(4),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(1),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1),
B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
B(Ldar), R(2),
B(StaContextSlot), R(context), U8(4),
B(LdaUndefined),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: mixed
execute: yes
wrap: no
test function name: f
---
snippet: "
function f(arg1) { return function() { arg1 = 2; }; }
f();
"
frame size: 1
parameter count: 2
bytecode array length: 17
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(0),
B(Ldar), R(arg0),
B(StaContextSlot), R(context), U8(4),
B(StackCheck),
B(CreateClosure), U8(0), U8(0),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
---
snippet: "
function f(arg1) { var a = function() { arg1 = 2; }; return arg1; }
f();
"
frame size: 2
parameter count: 2
bytecode array length: 22
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(1),
B(Ldar), R(arg0),
B(StaContextSlot), R(context), U8(4),
B(StackCheck),
B(CreateClosure), U8(0), U8(0),
B(Star), R(0),
B(LdaContextSlot), R(context), U8(4),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
---
snippet: "
function f(a1, a2, a3, a4) { return function() { a1 = a3; }; }
f();
"
frame size: 1
parameter count: 5
bytecode array length: 22
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(0),
B(Ldar), R(arg0),
B(StaContextSlot), R(context), U8(5),
B(Ldar), R(arg2),
B(StaContextSlot), R(context), U8(4),
B(StackCheck),
B(CreateClosure), U8(0), U8(0),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
---
snippet: "
function f() { var self = this; return function() { self = 2; }; }
f();
"
frame size: 1
parameter count: 1
bytecode array length: 17
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(0),
B(StackCheck),
B(Ldar), R(this),
B(StaContextSlot), R(context), U8(4),
B(CreateClosure), U8(0), U8(0),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: mixed
execute: yes
wrap: yes
---
snippet: "
var a = 1; return ++a;
"
frame size: 1
parameter count: 1
bytecode array length: 10
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(ToNumber),
B(Inc),
B(Star), R(0),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var a = 1; return a++;
"
frame size: 2
parameter count: 1
bytecode array length: 14
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(ToNumber),
B(Star), R(1),
B(Inc),
B(Star), R(0),
B(Ldar), R(1),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var a = 1; return --a;
"
frame size: 1
parameter count: 1
bytecode array length: 10
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(ToNumber),
B(Dec),
B(Star), R(0),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var a = 1; return a--;
"
frame size: 2
parameter count: 1
bytecode array length: 14
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(ToNumber),
B(Star), R(1),
B(Dec),
B(Star), R(0),
B(Ldar), R(1),
B(Return),
]
constant pool: [
]
handlers: [
]
---
snippet: "
var a = { val: 1 }; return a.val++;
"
frame size: 3
parameter count: 1
bytecode array length: 26
bytecodes: [
B(StackCheck),
B(CreateObjectLiteral), U8(0), U8(0), U8(9),
B(Star), R(1),
B(Star), R(0),
B(Star), R(1),
B(LoadIC), R(1), U8(1), U8(1),
B(ToNumber),
B(Star), R(2),
B(Inc),
B(StoreICSloppy), R(1), U8(1), U8(3),
B(Ldar), R(2),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
---
snippet: "
var a = { val: 1 }; return --a.val;
"
frame size: 2
parameter count: 1
bytecode array length: 22
bytecodes: [
B(StackCheck),
B(CreateObjectLiteral), U8(0), U8(0), U8(9),
B(Star), R(1),
B(Star), R(0),
B(Star), R(1),
B(LoadIC), R(1), U8(1), U8(1),
B(ToNumber),
B(Dec),
B(StoreICSloppy), R(1), U8(1), U8(3),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
---
snippet: "
var name = 'var'; var a = { val: 1 }; return a[name]--;
"
frame size: 5
parameter count: 1
bytecode array length: 33
bytecodes: [
B(StackCheck),
B(LdaConstant), U8(0),
B(Star), R(0),
B(CreateObjectLiteral), U8(1), U8(0), U8(9),
B(Star), R(2),
B(Star), R(1),
B(Star), R(2),
B(Ldar), R(0),
B(Star), R(3),
B(KeyedLoadIC), R(2), U8(1),
B(ToNumber),
B(Star), R(4),
B(Dec),
B(KeyedStoreICSloppy), R(2), R(3), U8(3),
B(Ldar), R(4),
B(Return),
]
constant pool: [
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
---
snippet: "
var name = 'var'; var a = { val: 1 }; return ++a[name];
"
frame size: 4
parameter count: 1
bytecode array length: 29
bytecodes: [
B(StackCheck),
B(LdaConstant), U8(0),
B(Star), R(0),
B(CreateObjectLiteral), U8(1), U8(0), U8(9),
B(Star), R(2),
B(Star), R(1),
B(Star), R(2),
B(Ldar), R(0),
B(Star), R(3),
B(KeyedLoadIC), R(2), U8(1),
B(ToNumber),
B(Inc),
B(KeyedStoreICSloppy), R(2), R(3), U8(3),
B(Return),
]
constant pool: [
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
---
snippet: "
var a = 1; var b = function() { return a }; return ++a;
"
frame size: 2
parameter count: 1
bytecode array length: 27
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(1),
B(StackCheck),
B(LdaSmi8), U8(1),
B(StaContextSlot), R(context), U8(4),
B(CreateClosure), U8(0), U8(0),
B(Star), R(0),
B(LdaContextSlot), R(context), U8(4),
B(ToNumber),
B(Inc),
B(StaContextSlot), R(context), U8(4),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
---
snippet: "
var a = 1; var b = function() { return a }; return a--;
"
frame size: 3
parameter count: 1
bytecode array length: 31
bytecodes: [
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1),
B(PushContext), R(1),
B(StackCheck),
B(LdaSmi8), U8(1),
B(StaContextSlot), R(context), U8(4),
B(CreateClosure), U8(0), U8(0),
B(Star), R(0),
B(LdaContextSlot), R(context), U8(4),
B(ToNumber),
B(Star), R(2),
B(Dec),
B(StaContextSlot), R(context), U8(4),
B(Ldar), R(2),
B(Return),
]
constant pool: [
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
---
snippet: "
var idx = 1; var a = [1, 2]; return a[idx++] = 2;
"
frame size: 4
parameter count: 1
bytecode array length: 28
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(CreateArrayLiteral), U8(0), U8(0), U8(3),
B(Star), R(1),
B(Star), R(2),
B(Ldar), R(0),
B(ToNumber),
B(Star), R(3),
B(Inc),
B(Star), R(0),
B(LdaSmi8), U8(2),
B(KeyedStoreICSloppy), R(2), R(3), U8(1),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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