v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.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

464 lines
8.9 KiB
Plaintext

#
# Autogenerated by generate-bytecode-expectations.
#
---
pool type: mixed
execute: yes
wrap: yes
---
snippet: "
return { };
"
frame size: 1
parameter count: 1
bytecode array length: 8
bytecodes: [
B(StackCheck),
B(CreateObjectLiteral), U8(0), U8(0), U8(13),
B(Star), R(0),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
---
snippet: "
return { name: 'string', val: 9.2 };
"
frame size: 1
parameter count: 1
bytecode array length: 8
bytecodes: [
B(StackCheck),
B(CreateObjectLiteral), U8(0), U8(0), U8(9),
B(Star), R(0),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
---
snippet: "
var a = 1; return { name: 'string', val: a };
"
frame size: 2
parameter count: 1
bytecode array length: 20
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(CreateObjectLiteral), U8(0), U8(0), U8(9),
B(Star), R(1),
B(Ldar), R(0),
B(StoreICSloppy), R(1), U8(1), U8(1),
B(Ldar), R(1),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
---
snippet: "
var a = 1; return { val: a, val: a + 1 };
"
frame size: 3
parameter count: 1
bytecode array length: 26
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(CreateObjectLiteral), U8(0), U8(0), U8(9),
B(Star), R(1),
B(Ldar), R(0),
B(Star), R(2),
B(LdaSmi8), U8(1),
B(Add), R(2),
B(StoreICSloppy), R(1), U8(1), U8(1),
B(Ldar), R(1),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
---
snippet: "
return { func: function() { } };
"
frame size: 1
parameter count: 1
bytecode array length: 17
bytecodes: [
B(StackCheck),
B(CreateObjectLiteral), U8(0), U8(0), U8(9),
B(Star), R(0),
B(CreateClosure), U8(1), U8(0),
B(StoreICSloppy), R(0), U8(2), U8(1),
B(Ldar), R(0),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
---
snippet: "
return { func(a) { return a; } };
"
frame size: 1
parameter count: 1
bytecode array length: 17
bytecodes: [
B(StackCheck),
B(CreateObjectLiteral), U8(0), U8(0), U8(9),
B(Star), R(0),
B(CreateClosure), U8(1), U8(0),
B(StoreICSloppy), R(0), U8(2), U8(1),
B(Ldar), R(0),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
---
snippet: "
return { get a() { return 2; } };
"
frame size: 6
parameter count: 1
bytecode array length: 33
bytecodes: [
B(StackCheck),
B(CreateObjectLiteral), U8(0), U8(0), U8(9),
B(Star), R(0),
B(Mov), R(0), R(1),
B(LdaConstant), U8(1),
B(Star), R(2),
B(CreateClosure), U8(2), U8(0),
B(Star), R(3),
B(LdaNull),
B(Star), R(4),
B(LdaZero),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), R(1), U8(5),
B(Ldar), R(0),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
---
snippet: "
return { get a() { return this.x; }, set a(val) { this.x = val } };
"
frame size: 6
parameter count: 1
bytecode array length: 35
bytecodes: [
B(StackCheck),
B(CreateObjectLiteral), U8(0), U8(0), U8(9),
B(Star), R(0),
B(Mov), R(0), R(1),
B(LdaConstant), U8(1),
B(Star), R(2),
B(CreateClosure), U8(2), U8(0),
B(Star), R(3),
B(CreateClosure), U8(3), U8(0),
B(Star), R(4),
B(LdaZero),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), R(1), U8(5),
B(Ldar), R(0),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
---
snippet: "
return { set b(val) { this.y = val } };
"
frame size: 6
parameter count: 1
bytecode array length: 33
bytecodes: [
B(StackCheck),
B(CreateObjectLiteral), U8(0), U8(0), U8(9),
B(Star), R(0),
B(Mov), R(0), R(1),
B(LdaConstant), U8(1),
B(Star), R(2),
B(LdaNull),
B(Star), R(3),
B(CreateClosure), U8(2), U8(0),
B(Star), R(4),
B(LdaZero),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), R(1), U8(5),
B(Ldar), R(0),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
---
snippet: "
var a = 1; return { 1: a };
"
frame size: 6
parameter count: 1
bytecode array length: 33
bytecodes: [
B(StackCheck),
B(LdaSmi8), U8(1),
B(Star), R(0),
B(CreateObjectLiteral), U8(0), U8(0), U8(9),
B(Star), R(1),
B(Mov), R(1), R(2),
B(LdaSmi8), U8(1),
B(Star), R(3),
B(Ldar), R(0),
B(Star), R(4),
B(LdaZero),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4),
B(Ldar), R(1),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
---
snippet: "
return { __proto__: null };
"
frame size: 3
parameter count: 1
bytecode array length: 21
bytecodes: [
B(StackCheck),
B(CreateObjectLiteral), U8(0), U8(0), U8(13),
B(Star), R(0),
B(Mov), R(0), R(1),
B(LdaNull),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kInternalSetPrototype), R(1), U8(2),
B(Ldar), R(0),
B(Return),
]
constant pool: [
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
---
snippet: "
var a = 'test'; return { [a]: 1 };
"
frame size: 7
parameter count: 1
bytecode array length: 37
bytecodes: [
B(StackCheck),
B(LdaConstant), U8(0),
B(Star), R(0),
B(CreateObjectLiteral), U8(1), U8(0), U8(13),
B(Star), R(1),
B(Mov), R(1), R(2),
B(Ldar), R(0),
B(ToName),
B(Star), R(3),
B(LdaSmi8), U8(1),
B(Star), R(4),
B(LdaZero),
B(Star), R(5),
B(LdaZero),
B(Star), R(6),
B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5),
B(Ldar), R(1),
B(Return),
]
constant pool: [
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
---
snippet: "
var a = 'test'; return { val: a, [a]: 1 };
"
frame size: 7
parameter count: 1
bytecode array length: 43
bytecodes: [
B(StackCheck),
B(LdaConstant), U8(0),
B(Star), R(0),
B(CreateObjectLiteral), U8(1), U8(0), U8(9),
B(Star), R(1),
B(Ldar), R(0),
B(StoreICSloppy), R(1), U8(2), U8(1),
B(Mov), R(1), R(2),
B(Ldar), R(0),
B(ToName),
B(Star), R(3),
B(LdaSmi8), U8(1),
B(Star), R(4),
B(LdaZero),
B(Star), R(5),
B(LdaZero),
B(Star), R(6),
B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5),
B(Ldar), R(1),
B(Return),
]
constant pool: [
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
]
handlers: [
]
---
snippet: "
var a = 'test'; return { [a]: 1, __proto__: {} };
"
frame size: 7
parameter count: 1
bytecode array length: 53
bytecodes: [
B(StackCheck),
B(LdaConstant), U8(0),
B(Star), R(0),
B(CreateObjectLiteral), U8(1), U8(1), U8(13),
B(Star), R(1),
B(Mov), R(1), R(2),
B(Ldar), R(0),
B(ToName),
B(Star), R(3),
B(LdaSmi8), U8(1),
B(Star), R(4),
B(LdaZero),
B(Star), R(5),
B(LdaZero),
B(Star), R(6),
B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5),
B(Mov), R(1), R(2),
B(CreateObjectLiteral), U8(1), U8(0), U8(13),
B(Star), R(4),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kInternalSetPrototype), R(2), U8(2),
B(Ldar), R(1),
B(Return),
]
constant pool: [
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::FIXED_ARRAY_TYPE,
]
handlers: [
]
---
snippet: "
var n = 'name'; return { [n]: 'val', get a() { }, set a(b) {} };
"
frame size: 7
parameter count: 1
bytecode array length: 77
bytecodes: [
B(StackCheck),
B(LdaConstant), U8(0),
B(Star), R(0),
B(CreateObjectLiteral), U8(1), U8(0), U8(13),
B(Star), R(1),
B(Mov), R(1), R(2),
B(Ldar), R(0),
B(ToName),
B(Star), R(3),
B(LdaConstant), U8(2),
B(Star), R(4),
B(LdaZero),
B(Star), R(5),
B(LdaZero),
B(Star), R(6),
B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5),
B(Mov), R(1), R(2),
B(LdaConstant), U8(3),
B(Star), R(3),
B(CreateClosure), U8(4), U8(0),
B(Star), R(4),
B(LdaZero),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kDefineGetterPropertyUnchecked), R(2), U8(4),
B(Mov), R(1), R(2),
B(LdaConstant), U8(3),
B(Star), R(3),
B(CreateClosure), U8(5), U8(0),
B(Star), R(4),
B(LdaZero),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kDefineSetterPropertyUnchecked), R(2), U8(4),
B(Ldar), R(1),
B(Return),
]
constant pool: [
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]