2017-04-18 14:56:06 +00:00
|
|
|
#
|
|
|
|
# Autogenerated by generate-bytecode-expectations.
|
|
|
|
#
|
|
|
|
|
|
|
|
---
|
|
|
|
wrap: no
|
|
|
|
test function name: f
|
|
|
|
|
|
|
|
---
|
|
|
|
snippet: "
|
|
|
|
function f() {
|
|
|
|
for (let x = 0; x < 10; ++x) { let y = x; }
|
|
|
|
}
|
|
|
|
f();
|
|
|
|
"
|
|
|
|
frame size: 2
|
|
|
|
parameter count: 1
|
2017-05-08 18:55:54 +00:00
|
|
|
bytecode array length: 26
|
2017-04-18 14:56:06 +00:00
|
|
|
bytecodes: [
|
|
|
|
/* 10 E> */ B(StackCheck),
|
|
|
|
/* 30 S> */ B(LdaZero),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 35 S> */ B(LdaSmi), I8(10),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 35 E> */ B(TestLessThan), R(0), U8(0),
|
2017-05-08 18:55:54 +00:00
|
|
|
B(JumpIfFalse), U8(15),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 17 E> */ B(StackCheck),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 56 S> */ B(Mov), R(0), R(1),
|
|
|
|
/* 43 S> */ B(Ldar), R(1),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(Inc), U8(1),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(0),
|
2017-05-08 18:55:54 +00:00
|
|
|
B(JumpLoop), U8(17), I8(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaUndefined),
|
|
|
|
/* 61 S> */ B(Return),
|
|
|
|
]
|
|
|
|
constant pool: [
|
|
|
|
]
|
|
|
|
handlers: [
|
|
|
|
]
|
|
|
|
|
|
|
|
---
|
|
|
|
snippet: "
|
|
|
|
function f() {
|
|
|
|
for (let x = 0; x < 10; ++x) { eval('1'); }
|
|
|
|
}
|
|
|
|
f();
|
|
|
|
"
|
2017-08-11 15:16:31 +00:00
|
|
|
frame size: 15
|
2017-04-18 14:56:06 +00:00
|
|
|
parameter count: 1
|
2018-05-02 13:57:26 +00:00
|
|
|
bytecode array length: 165
|
2017-04-18 14:56:06 +00:00
|
|
|
bytecodes: [
|
2018-05-02 13:57:26 +00:00
|
|
|
B(CreateFunctionContext), U8(0), U8(3),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(PushContext), R(4),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Ldar), R(this),
|
|
|
|
B(StaCurrentContextSlot), U8(4),
|
|
|
|
B(CreateMappedArguments),
|
|
|
|
B(StaCurrentContextSlot), U8(6),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(Ldar), R(3),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(StaCurrentContextSlot), U8(5),
|
|
|
|
/* 10 E> */ B(StackCheck),
|
2018-05-02 13:57:26 +00:00
|
|
|
B(CreateBlockContext), U8(1),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(PushContext), R(5),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaTheHole),
|
|
|
|
B(StaCurrentContextSlot), U8(4),
|
|
|
|
/* 30 S> */ B(LdaZero),
|
|
|
|
/* 30 E> */ B(StaCurrentContextSlot), U8(4),
|
|
|
|
B(LdaCurrentContextSlot), U8(4),
|
|
|
|
B(Star), R(0),
|
|
|
|
B(LdaSmi), I8(1),
|
|
|
|
B(Star), R(1),
|
|
|
|
/* 59 E> */ B(StackCheck),
|
2018-05-02 13:57:26 +00:00
|
|
|
B(CreateBlockContext), U8(2),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(PushContext), R(6),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaTheHole),
|
|
|
|
B(StaCurrentContextSlot), U8(4),
|
|
|
|
B(Ldar), R(0),
|
|
|
|
B(StaCurrentContextSlot), U8(4),
|
|
|
|
B(LdaSmi), I8(1),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(TestEqual), R(1), U8(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(JumpIfFalse), U8(7),
|
|
|
|
B(LdaZero),
|
|
|
|
B(Star), R(1),
|
|
|
|
B(Jump), U8(8),
|
|
|
|
/* 43 S> */ B(LdaCurrentContextSlot), U8(4),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(Inc), U8(1),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 43 E> */ B(StaCurrentContextSlot), U8(4),
|
|
|
|
B(LdaSmi), I8(1),
|
|
|
|
B(Star), R(2),
|
|
|
|
/* 35 S> */ B(LdaCurrentContextSlot), U8(4),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(Star), R(7),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaSmi), I8(10),
|
2017-08-11 15:16:31 +00:00
|
|
|
/* 35 E> */ B(TestLessThan), R(7), U8(2),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(JumpIfFalse), U8(4),
|
|
|
|
B(Jump), U8(6),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(PopContext), R(6),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Jump), U8(77),
|
|
|
|
B(LdaSmi), I8(1),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(TestEqual), R(2), U8(3),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(JumpIfFalse), U8(54),
|
|
|
|
/* 17 E> */ B(StackCheck),
|
2018-05-02 13:57:26 +00:00
|
|
|
/* 48 S> */ B(LdaLookupGlobalSlot), U8(3), U8(4), U8(3),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Star), R(7),
|
2018-05-02 13:57:26 +00:00
|
|
|
B(LdaConstant), U8(4),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(Star), R(8),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaZero),
|
|
|
|
B(Star), R(12),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(LdaSmi), I8(31),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Star), R(13),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(LdaSmi), I8(48),
|
|
|
|
B(Star), R(14),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Mov), R(7), R(9),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(Mov), R(8), R(10),
|
|
|
|
B(Mov), R(closure), R(11),
|
|
|
|
B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(9), U8(6),
|
|
|
|
B(Star), R(7),
|
2017-10-19 15:12:42 +00:00
|
|
|
/* 48 E> */ B(CallUndefinedReceiver1), R(7), R(8), U8(6),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaZero),
|
|
|
|
B(Star), R(2),
|
|
|
|
B(LdaCurrentContextSlot), U8(4),
|
|
|
|
B(Star), R(0),
|
|
|
|
B(JumpLoop), U8(56), I8(1),
|
|
|
|
B(LdaSmi), I8(1),
|
2017-07-27 12:45:00 +00:00
|
|
|
/* 59 E> */ B(TestEqual), R(2), U8(8),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(JumpIfFalse), U8(6),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(PopContext), R(6),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Jump), U8(7),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(PopContext), R(6),
|
2018-05-02 13:57:26 +00:00
|
|
|
B(JumpLoop), U8(123), I8(0),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(PopContext), R(5),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaUndefined),
|
|
|
|
/* 61 S> */ B(Return),
|
|
|
|
]
|
|
|
|
constant pool: [
|
2018-05-02 13:57:26 +00:00
|
|
|
SCOPE_INFO_TYPE,
|
2018-02-16 12:36:47 +00:00
|
|
|
SCOPE_INFO_TYPE,
|
|
|
|
SCOPE_INFO_TYPE,
|
2017-04-18 14:56:06 +00:00
|
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["eval"],
|
|
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["1"],
|
|
|
|
]
|
|
|
|
handlers: [
|
|
|
|
]
|
|
|
|
|
|
|
|
---
|
|
|
|
snippet: "
|
|
|
|
function f() {
|
|
|
|
for (let x = 0; x < 10; ++x) { (function() { return x; })(); }
|
|
|
|
}
|
|
|
|
f();
|
|
|
|
"
|
|
|
|
frame size: 6
|
|
|
|
parameter count: 1
|
2018-05-02 13:57:26 +00:00
|
|
|
bytecode array length: 106
|
2017-04-18 14:56:06 +00:00
|
|
|
bytecodes: [
|
|
|
|
/* 10 E> */ B(StackCheck),
|
|
|
|
/* 30 S> */ B(LdaZero),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(3),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Star), R(0),
|
|
|
|
B(LdaSmi), I8(1),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(1),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 78 E> */ B(StackCheck),
|
|
|
|
B(CreateBlockContext), U8(0),
|
|
|
|
B(PushContext), R(4),
|
|
|
|
B(LdaTheHole),
|
|
|
|
B(StaCurrentContextSlot), U8(4),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Ldar), R(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(StaCurrentContextSlot), U8(4),
|
|
|
|
B(LdaSmi), I8(1),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(TestEqual), R(1), U8(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(JumpIfFalse), U8(7),
|
|
|
|
B(LdaZero),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(1),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Jump), U8(8),
|
|
|
|
/* 43 S> */ B(LdaCurrentContextSlot), U8(4),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(Inc), U8(1),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 43 E> */ B(StaCurrentContextSlot), U8(4),
|
|
|
|
B(LdaSmi), I8(1),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(2),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 35 S> */ B(LdaCurrentContextSlot), U8(4),
|
|
|
|
B(Star), R(5),
|
|
|
|
B(LdaSmi), I8(10),
|
2017-07-27 12:45:00 +00:00
|
|
|
/* 35 E> */ B(TestLessThan), R(5), U8(2),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(JumpIfFalse), U8(4),
|
|
|
|
B(Jump), U8(6),
|
|
|
|
B(PopContext), R(4),
|
|
|
|
B(Jump), U8(45),
|
|
|
|
B(LdaSmi), I8(1),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(TestEqual), R(2), U8(3),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(JumpIfFalse), U8(22),
|
|
|
|
/* 17 E> */ B(StackCheck),
|
2017-10-19 15:12:42 +00:00
|
|
|
/* 48 S> */ B(CreateClosure), U8(1), U8(4), U8(2),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Star), R(5),
|
2017-10-19 15:12:42 +00:00
|
|
|
/* 74 E> */ B(CallUndefinedReceiver0), R(5), U8(5),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaZero),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(2),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaCurrentContextSlot), U8(4),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(JumpLoop), U8(24), I8(1),
|
|
|
|
B(LdaSmi), I8(1),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 78 E> */ B(TestEqual), R(2), U8(7),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(JumpIfFalse), U8(6),
|
|
|
|
B(PopContext), R(4),
|
|
|
|
B(Jump), U8(7),
|
|
|
|
B(PopContext), R(4),
|
2018-05-02 13:57:26 +00:00
|
|
|
B(JumpLoop), U8(91), I8(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaUndefined),
|
|
|
|
/* 80 S> */ B(Return),
|
|
|
|
]
|
|
|
|
constant pool: [
|
2018-02-16 12:36:47 +00:00
|
|
|
SCOPE_INFO_TYPE,
|
2017-04-18 14:56:06 +00:00
|
|
|
SHARED_FUNCTION_INFO_TYPE,
|
|
|
|
]
|
|
|
|
handlers: [
|
|
|
|
]
|
|
|
|
|
|
|
|
---
|
|
|
|
snippet: "
|
|
|
|
function f() {
|
|
|
|
for (let { x, y } = { x: 0, y: 3 }; y > 0; --y) { let z = x + y; }
|
|
|
|
}
|
|
|
|
f();
|
|
|
|
"
|
2019-01-10 14:40:58 +00:00
|
|
|
frame size: 4
|
2017-04-18 14:56:06 +00:00
|
|
|
parameter count: 1
|
2019-01-10 14:40:58 +00:00
|
|
|
bytecode array length: 53
|
2017-04-18 14:56:06 +00:00
|
|
|
bytecodes: [
|
|
|
|
/* 10 E> */ B(StackCheck),
|
2019-01-09 13:21:06 +00:00
|
|
|
/* 37 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41),
|
|
|
|
B(JumpIfNull), U8(4),
|
2019-01-10 14:40:58 +00:00
|
|
|
B(JumpIfNotUndefined), U8(7),
|
|
|
|
/* 26 E> */ B(CallRuntime), U16(Runtime::kThrowPatternAssignmentNonCoercible), R(0), U8(0),
|
2019-01-09 13:21:06 +00:00
|
|
|
B(Star), R(3),
|
2019-01-10 14:40:58 +00:00
|
|
|
/* 28 S> */ B(LdaNamedProperty), R(3), U8(1), U8(1),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(0),
|
2019-01-10 14:40:58 +00:00
|
|
|
/* 31 S> */ B(LdaNamedProperty), R(3), U8(2), U8(3),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(1),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 55 S> */ B(LdaZero),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 55 E> */ B(TestGreaterThan), R(1), U8(5),
|
2017-05-08 18:55:54 +00:00
|
|
|
B(JumpIfFalse), U8(19),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 17 E> */ B(StackCheck),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 75 S> */ B(Ldar), R(1),
|
|
|
|
/* 77 E> */ B(Add), R(0), U8(6),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Star), R(2),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 62 S> */ B(Ldar), R(1),
|
|
|
|
B(Dec), U8(7),
|
|
|
|
B(Star), R(1),
|
2017-05-08 18:55:54 +00:00
|
|
|
B(JumpLoop), U8(20), I8(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaUndefined),
|
|
|
|
/* 84 S> */ B(Return),
|
|
|
|
]
|
|
|
|
constant pool: [
|
2018-07-05 18:34:09 +00:00
|
|
|
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
|
2017-04-18 14:56:06 +00:00
|
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"],
|
|
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["y"],
|
|
|
|
]
|
|
|
|
handlers: [
|
|
|
|
]
|
|
|
|
|
|
|
|
---
|
|
|
|
snippet: "
|
|
|
|
function* f() {
|
|
|
|
for (let x = 0; x < 10; ++x) { let y = x; }
|
|
|
|
}
|
|
|
|
f();
|
|
|
|
"
|
2018-01-23 13:51:38 +00:00
|
|
|
frame size: 5
|
2017-04-18 14:56:06 +00:00
|
|
|
parameter count: 1
|
2018-01-24 11:19:51 +00:00
|
|
|
bytecode array length: 67
|
2017-04-18 14:56:06 +00:00
|
|
|
bytecodes: [
|
2019-01-31 15:36:58 +00:00
|
|
|
B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Mov), R(closure), R(3),
|
|
|
|
B(Mov), R(this), R(4),
|
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 11 E> */ B(StackCheck),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0),
|
|
|
|
B(ResumeGenerator), R(0), R(0), U8(3),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Star), R(3),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
|
2017-06-05 13:23:20 +00:00
|
|
|
B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Ldar), R(3),
|
2017-06-05 13:23:20 +00:00
|
|
|
/* 11 E> */ B(Throw),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Ldar), R(3),
|
2017-06-05 19:54:14 +00:00
|
|
|
/* 62 S> */ B(Return),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 31 S> */ B(LdaZero),
|
2018-10-12 07:49:50 +00:00
|
|
|
B(Star), R(1),
|
2017-05-24 13:54:57 +00:00
|
|
|
/* 36 S> */ B(LdaSmi), I8(10),
|
2018-10-12 07:49:50 +00:00
|
|
|
/* 36 E> */ B(TestLessThan), R(1), U8(0),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(JumpIfFalse), U8(15),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 18 E> */ B(StackCheck),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 57 S> */ B(Mov), R(1), R(2),
|
|
|
|
/* 44 S> */ B(Ldar), R(2),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(Inc), U8(1),
|
2018-10-12 07:49:50 +00:00
|
|
|
B(Star), R(1),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(JumpLoop), U8(17), I8(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaUndefined),
|
|
|
|
/* 62 S> */ B(Return),
|
|
|
|
]
|
|
|
|
constant pool: [
|
2018-01-23 13:51:38 +00:00
|
|
|
Smi [22],
|
2017-06-13 13:49:45 +00:00
|
|
|
Smi [10],
|
2017-06-05 13:23:20 +00:00
|
|
|
Smi [7],
|
2017-04-18 14:56:06 +00:00
|
|
|
]
|
|
|
|
handlers: [
|
|
|
|
]
|
|
|
|
|
|
|
|
---
|
|
|
|
snippet: "
|
|
|
|
function* f() {
|
|
|
|
for (let x = 0; x < 10; ++x) yield x;
|
|
|
|
}
|
|
|
|
f();
|
|
|
|
"
|
2018-01-23 13:51:38 +00:00
|
|
|
frame size: 4
|
2017-04-18 14:56:06 +00:00
|
|
|
parameter count: 1
|
2018-01-24 11:19:51 +00:00
|
|
|
bytecode array length: 99
|
2017-04-18 14:56:06 +00:00
|
|
|
bytecodes: [
|
2019-01-31 15:36:58 +00:00
|
|
|
B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Mov), R(closure), R(2),
|
|
|
|
B(Mov), R(this), R(3),
|
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 11 E> */ B(StackCheck),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0),
|
|
|
|
B(ResumeGenerator), R(0), R(0), U8(2),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Star), R(2),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
|
2017-06-05 13:23:20 +00:00
|
|
|
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Ldar), R(2),
|
2017-06-05 13:23:20 +00:00
|
|
|
/* 11 E> */ B(Throw),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Ldar), R(2),
|
2017-06-05 19:54:14 +00:00
|
|
|
/* 56 S> */ B(Return),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 31 S> */ B(LdaZero),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(1),
|
2017-05-24 13:54:57 +00:00
|
|
|
/* 36 S> */ B(LdaSmi), I8(10),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 36 E> */ B(TestLessThan), R(1), U8(0),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(JumpIfFalse), U8(47),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 18 E> */ B(StackCheck),
|
2017-07-20 12:35:28 +00:00
|
|
|
/* 47 S> */ B(LdaFalse),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(3),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Mov), R(1), R(2),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(2), U8(2),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 47 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(1),
|
|
|
|
B(ResumeGenerator), R(0), R(0), U8(2),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Star), R(2),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(SwitchOnSmiNoFeedback), U8(4), U8(2), I8(0),
|
|
|
|
B(Ldar), R(2),
|
2017-06-05 13:23:20 +00:00
|
|
|
/* 47 E> */ B(Throw),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Ldar), R(2),
|
2017-06-05 19:54:14 +00:00
|
|
|
/* 56 S> */ B(Return),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 44 S> */ B(Ldar), R(1),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(Inc), U8(1),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(1),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(JumpLoop), U8(49), I8(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaUndefined),
|
|
|
|
/* 56 S> */ B(Return),
|
|
|
|
]
|
|
|
|
constant pool: [
|
2018-01-23 13:51:38 +00:00
|
|
|
Smi [22],
|
|
|
|
Smi [68],
|
2017-06-13 13:49:45 +00:00
|
|
|
Smi [10],
|
2017-06-05 13:23:20 +00:00
|
|
|
Smi [7],
|
2017-06-13 13:49:45 +00:00
|
|
|
Smi [10],
|
2017-06-05 13:23:20 +00:00
|
|
|
Smi [7],
|
2017-04-18 14:56:06 +00:00
|
|
|
]
|
|
|
|
handlers: [
|
|
|
|
]
|
|
|
|
|
|
|
|
---
|
|
|
|
snippet: "
|
|
|
|
async function f() {
|
|
|
|
for (let x = 0; x < 10; ++x) { let y = x; }
|
|
|
|
}
|
|
|
|
f();
|
|
|
|
"
|
2018-10-11 08:35:56 +00:00
|
|
|
frame size: 8
|
2017-04-18 14:56:06 +00:00
|
|
|
parameter count: 1
|
2019-02-28 13:34:26 +00:00
|
|
|
bytecode array length: 81
|
2017-04-18 14:56:06 +00:00
|
|
|
bytecodes: [
|
2018-10-11 08:35:56 +00:00
|
|
|
B(Mov), R(closure), R(3),
|
|
|
|
B(Mov), R(this), R(4),
|
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(3), U8(2),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(0),
|
2018-10-11 08:35:56 +00:00
|
|
|
/* 16 E> */ B(StackCheck),
|
|
|
|
B(Mov), R(context), R(3),
|
2017-07-07 20:48:16 +00:00
|
|
|
/* 36 S> */ B(LdaZero),
|
2018-10-12 07:49:50 +00:00
|
|
|
B(Star), R(1),
|
2017-05-24 13:54:57 +00:00
|
|
|
/* 41 S> */ B(LdaSmi), I8(10),
|
2018-10-12 07:49:50 +00:00
|
|
|
/* 41 E> */ B(TestLessThan), R(1), U8(0),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(JumpIfFalse), U8(15),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 23 E> */ B(StackCheck),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 62 S> */ B(Mov), R(1), R(2),
|
|
|
|
/* 49 S> */ B(Ldar), R(2),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(Inc), U8(1),
|
2018-10-12 07:49:50 +00:00
|
|
|
B(Star), R(1),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(JumpLoop), U8(17), I8(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaUndefined),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(Star), R(5),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaFalse),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(Star), R(6),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Mov), R(0), R(4),
|
2018-10-11 08:35:56 +00:00
|
|
|
/* 49 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(4), U8(3),
|
[async] Improve async function handling.
This change introduces new intrinsics used to desugar async functions
in the Parser and the BytecodeGenerator, namely we introduce a new
%_AsyncFunctionEnter intrinsic that constructs the generator object
for the async function (and in the future will also create the outer
promise for the async function). This generator object is internal
and never escapes to user code, plus since async functions don't have
a "prototype" property, we can just a single map here instead of tracking
the prototype/initial_map on every async function. This saves one word
per async function plus one initial_map per async function that was
invoked at least once.
We also introduce two new intrinsics %_AsyncFunctionReject, which
rejects the outer promise with the caught exception, and another
%_AsyncFunctionResolve, which resolves the outer promise with the
right hand side of the `return` statement. These functions also perform
the DevTools part of the job (aka popping from the promise stack and
sending the debug event). This allows us to get rid of the implicit
try-finally from async functions completely; because the finally
block only called to the %AsyncFunctionPromiseRelease builtin, which
was used to inform DevTools.
In essence we now turn an async function like
```js
async function f(x) { return await bar(x); }
```
into something like this (in Parser and BytecodeGenerator respectively):
```
function f(x) {
.generator_object = %_AsyncFunctionEnter(.closure, this);
.promise = %AsyncFunctionCreatePromise();
try {
.tmp = await bar(x);
return %_AsyncFunctionResolve(.promise, .tmp);
} catch (e) {
return %_AsyncFunctionReject(.promise, e);
}
}
```
Overall the bytecode for async functions gets significantly shorter
already (and will get even shorter once we put the outer promise into
the async function generator object). For example the bytecode for a
simple async function
```js
async function f(x) { return await x; }
```
goes from 175 bytes to 110 bytes (a ~38% reduction in size), which
is in particular due to the simplification around the try-finally
removal.
Overall this seems to improve the doxbee-async-es2017-native test by
around 2-3%. On the test case mentioned in v8:8276 we go from
1124ms to 441ms, which corresponds to a 60% reduction in total
execution time!
Tbr: marja@chromium.org
Bug: v8:7253, v8:7522, v8:8276
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;luci.chromium.try:linux_chromium_rel_ng;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Id29dc92de7490b387ff697860c900cee44c9a7a4
Reviewed-on: https://chromium-review.googlesource.com/c/1269041
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56502}
2018-10-10 05:54:39 +00:00
|
|
|
/* 67 S> */ B(Return),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(4),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(CreateCatchContext), R(4), U8(0),
|
|
|
|
B(Star), R(3),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaTheHole),
|
|
|
|
B(SetPendingMessage),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(Ldar), R(3),
|
|
|
|
B(PushContext), R(4),
|
[async] Improve async function handling.
This change introduces new intrinsics used to desugar async functions
in the Parser and the BytecodeGenerator, namely we introduce a new
%_AsyncFunctionEnter intrinsic that constructs the generator object
for the async function (and in the future will also create the outer
promise for the async function). This generator object is internal
and never escapes to user code, plus since async functions don't have
a "prototype" property, we can just a single map here instead of tracking
the prototype/initial_map on every async function. This saves one word
per async function plus one initial_map per async function that was
invoked at least once.
We also introduce two new intrinsics %_AsyncFunctionReject, which
rejects the outer promise with the caught exception, and another
%_AsyncFunctionResolve, which resolves the outer promise with the
right hand side of the `return` statement. These functions also perform
the DevTools part of the job (aka popping from the promise stack and
sending the debug event). This allows us to get rid of the implicit
try-finally from async functions completely; because the finally
block only called to the %AsyncFunctionPromiseRelease builtin, which
was used to inform DevTools.
In essence we now turn an async function like
```js
async function f(x) { return await bar(x); }
```
into something like this (in Parser and BytecodeGenerator respectively):
```
function f(x) {
.generator_object = %_AsyncFunctionEnter(.closure, this);
.promise = %AsyncFunctionCreatePromise();
try {
.tmp = await bar(x);
return %_AsyncFunctionResolve(.promise, .tmp);
} catch (e) {
return %_AsyncFunctionReject(.promise, e);
}
}
```
Overall the bytecode for async functions gets significantly shorter
already (and will get even shorter once we put the outer promise into
the async function generator object). For example the bytecode for a
simple async function
```js
async function f(x) { return await x; }
```
goes from 175 bytes to 110 bytes (a ~38% reduction in size), which
is in particular due to the simplification around the try-finally
removal.
Overall this seems to improve the doxbee-async-es2017-native test by
around 2-3%. On the test case mentioned in v8:8276 we go from
1124ms to 441ms, which corresponds to a 60% reduction in total
execution time!
Tbr: marja@chromium.org
Bug: v8:7253, v8:7522, v8:8276
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;luci.chromium.try:linux_chromium_rel_ng;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Id29dc92de7490b387ff697860c900cee44c9a7a4
Reviewed-on: https://chromium-review.googlesource.com/c/1269041
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56502}
2018-10-10 05:54:39 +00:00
|
|
|
B(LdaImmutableCurrentContextSlot), U8(4),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(Star), R(6),
|
2018-05-30 14:21:39 +00:00
|
|
|
B(LdaFalse),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(Star), R(7),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Mov), R(0), R(5),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(5), U8(3),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 67 S> */ B(Return),
|
|
|
|
]
|
|
|
|
constant pool: [
|
2018-02-16 12:36:47 +00:00
|
|
|
SCOPE_INFO_TYPE,
|
2017-04-18 14:56:06 +00:00
|
|
|
]
|
|
|
|
handlers: [
|
2019-02-28 13:34:26 +00:00
|
|
|
[16, 53, 53],
|
2017-04-18 14:56:06 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
---
|
|
|
|
snippet: "
|
|
|
|
async function f() {
|
|
|
|
for (let x = 0; x < 10; ++x) await x;
|
|
|
|
}
|
|
|
|
f();
|
|
|
|
"
|
2018-10-11 08:35:56 +00:00
|
|
|
frame size: 7
|
2017-04-18 14:56:06 +00:00
|
|
|
parameter count: 1
|
2019-02-28 13:34:26 +00:00
|
|
|
bytecode array length: 117
|
2017-04-18 14:56:06 +00:00
|
|
|
bytecodes: [
|
2019-01-31 15:36:58 +00:00
|
|
|
B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(Mov), R(closure), R(2),
|
|
|
|
B(Mov), R(this), R(3),
|
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(2), U8(2),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(0),
|
2018-10-11 08:35:56 +00:00
|
|
|
/* 16 E> */ B(StackCheck),
|
|
|
|
B(Mov), R(context), R(2),
|
2017-07-07 20:48:16 +00:00
|
|
|
/* 36 S> */ B(LdaZero),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(1),
|
2017-05-24 13:54:57 +00:00
|
|
|
/* 41 S> */ B(LdaSmi), I8(10),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 41 E> */ B(TestLessThan), R(1), U8(0),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(JumpIfFalse), U8(47),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 23 E> */ B(StackCheck),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 52 S> */ B(Mov), R(0), R(3),
|
|
|
|
B(Mov), R(1), R(4),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(3), U8(2),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 52 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0),
|
|
|
|
B(ResumeGenerator), R(0), R(0), U8(3),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(Star), R(3),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
|
[async] Improve async function handling.
This change introduces new intrinsics used to desugar async functions
in the Parser and the BytecodeGenerator, namely we introduce a new
%_AsyncFunctionEnter intrinsic that constructs the generator object
for the async function (and in the future will also create the outer
promise for the async function). This generator object is internal
and never escapes to user code, plus since async functions don't have
a "prototype" property, we can just a single map here instead of tracking
the prototype/initial_map on every async function. This saves one word
per async function plus one initial_map per async function that was
invoked at least once.
We also introduce two new intrinsics %_AsyncFunctionReject, which
rejects the outer promise with the caught exception, and another
%_AsyncFunctionResolve, which resolves the outer promise with the
right hand side of the `return` statement. These functions also perform
the DevTools part of the job (aka popping from the promise stack and
sending the debug event). This allows us to get rid of the implicit
try-finally from async functions completely; because the finally
block only called to the %AsyncFunctionPromiseRelease builtin, which
was used to inform DevTools.
In essence we now turn an async function like
```js
async function f(x) { return await bar(x); }
```
into something like this (in Parser and BytecodeGenerator respectively):
```
function f(x) {
.generator_object = %_AsyncFunctionEnter(.closure, this);
.promise = %AsyncFunctionCreatePromise();
try {
.tmp = await bar(x);
return %_AsyncFunctionResolve(.promise, .tmp);
} catch (e) {
return %_AsyncFunctionReject(.promise, e);
}
}
```
Overall the bytecode for async functions gets significantly shorter
already (and will get even shorter once we put the outer promise into
the async function generator object). For example the bytecode for a
simple async function
```js
async function f(x) { return await x; }
```
goes from 175 bytes to 110 bytes (a ~38% reduction in size), which
is in particular due to the simplification around the try-finally
removal.
Overall this seems to improve the doxbee-async-es2017-native test by
around 2-3%. On the test case mentioned in v8:8276 we go from
1124ms to 441ms, which corresponds to a 60% reduction in total
execution time!
Tbr: marja@chromium.org
Bug: v8:7253, v8:7522, v8:8276
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;luci.chromium.try:linux_chromium_rel_ng;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Id29dc92de7490b387ff697860c900cee44c9a7a4
Reviewed-on: https://chromium-review.googlesource.com/c/1269041
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56502}
2018-10-10 05:54:39 +00:00
|
|
|
B(Star), R(4),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaZero),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(TestReferenceEqual), R(4),
|
2017-07-13 13:53:13 +00:00
|
|
|
B(JumpIfTrue), U8(5),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(Ldar), R(3),
|
Reland "[async-iteration] implement spec-change to `yield` in async generators"
Per https://github.com/tc39/proposal-async-iteration/pull/102/files:
AsyncGeneratorResolve no longer unwraps a value component. Instead, the value is
unwrapped before the builtin call via Await, allowing Promise rejections to
affect the generator control flow.
Thus, all `yield <expr>` implicitly become `yield await <expr>`.
Additionally, `return <expr>` becomes `return await <expr>`. Finally, when the
generator is resumed with `.return()`, the parameter passed to .return() is
awaited before generator execution properly continues).
BUG=v8:6187, v8:5855
R=littledan@chromium.org, neis@chromium.org, adamk@chromium.org
TBR=rmcilroy@chromium.org, neis@chromium.org
Cq-Include-Trybots: master.tryserver.v8:v8_linux_noi18n_rel_ng
Change-Id: Id7718028fd555481f9f4ca0dbecfa788e3057c48
Reviewed-on: https://chromium-review.googlesource.com/594500
Reviewed-by: Caitlin Potter <caitp@igalia.com>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Caitlin Potter <caitp@igalia.com>
Cr-Commit-Position: refs/heads/master@{#47058}
2017-08-01 14:45:03 +00:00
|
|
|
B(ReThrow),
|
2019-01-31 15:36:58 +00:00
|
|
|
/* 49 S> */ B(Ldar), R(1),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(Inc), U8(1),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Star), R(1),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(JumpLoop), U8(49), I8(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaUndefined),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(Star), R(4),
|
[async] Improve async function handling.
This change introduces new intrinsics used to desugar async functions
in the Parser and the BytecodeGenerator, namely we introduce a new
%_AsyncFunctionEnter intrinsic that constructs the generator object
for the async function (and in the future will also create the outer
promise for the async function). This generator object is internal
and never escapes to user code, plus since async functions don't have
a "prototype" property, we can just a single map here instead of tracking
the prototype/initial_map on every async function. This saves one word
per async function plus one initial_map per async function that was
invoked at least once.
We also introduce two new intrinsics %_AsyncFunctionReject, which
rejects the outer promise with the caught exception, and another
%_AsyncFunctionResolve, which resolves the outer promise with the
right hand side of the `return` statement. These functions also perform
the DevTools part of the job (aka popping from the promise stack and
sending the debug event). This allows us to get rid of the implicit
try-finally from async functions completely; because the finally
block only called to the %AsyncFunctionPromiseRelease builtin, which
was used to inform DevTools.
In essence we now turn an async function like
```js
async function f(x) { return await bar(x); }
```
into something like this (in Parser and BytecodeGenerator respectively):
```
function f(x) {
.generator_object = %_AsyncFunctionEnter(.closure, this);
.promise = %AsyncFunctionCreatePromise();
try {
.tmp = await bar(x);
return %_AsyncFunctionResolve(.promise, .tmp);
} catch (e) {
return %_AsyncFunctionReject(.promise, e);
}
}
```
Overall the bytecode for async functions gets significantly shorter
already (and will get even shorter once we put the outer promise into
the async function generator object). For example the bytecode for a
simple async function
```js
async function f(x) { return await x; }
```
goes from 175 bytes to 110 bytes (a ~38% reduction in size), which
is in particular due to the simplification around the try-finally
removal.
Overall this seems to improve the doxbee-async-es2017-native test by
around 2-3%. On the test case mentioned in v8:8276 we go from
1124ms to 441ms, which corresponds to a 60% reduction in total
execution time!
Tbr: marja@chromium.org
Bug: v8:7253, v8:7522, v8:8276
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;luci.chromium.try:linux_chromium_rel_ng;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Id29dc92de7490b387ff697860c900cee44c9a7a4
Reviewed-on: https://chromium-review.googlesource.com/c/1269041
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56502}
2018-10-10 05:54:39 +00:00
|
|
|
B(LdaTrue),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(Star), R(5),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Mov), R(0), R(3),
|
2018-10-11 08:35:56 +00:00
|
|
|
/* 49 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(3), U8(3),
|
[async] Improve async function handling.
This change introduces new intrinsics used to desugar async functions
in the Parser and the BytecodeGenerator, namely we introduce a new
%_AsyncFunctionEnter intrinsic that constructs the generator object
for the async function (and in the future will also create the outer
promise for the async function). This generator object is internal
and never escapes to user code, plus since async functions don't have
a "prototype" property, we can just a single map here instead of tracking
the prototype/initial_map on every async function. This saves one word
per async function plus one initial_map per async function that was
invoked at least once.
We also introduce two new intrinsics %_AsyncFunctionReject, which
rejects the outer promise with the caught exception, and another
%_AsyncFunctionResolve, which resolves the outer promise with the
right hand side of the `return` statement. These functions also perform
the DevTools part of the job (aka popping from the promise stack and
sending the debug event). This allows us to get rid of the implicit
try-finally from async functions completely; because the finally
block only called to the %AsyncFunctionPromiseRelease builtin, which
was used to inform DevTools.
In essence we now turn an async function like
```js
async function f(x) { return await bar(x); }
```
into something like this (in Parser and BytecodeGenerator respectively):
```
function f(x) {
.generator_object = %_AsyncFunctionEnter(.closure, this);
.promise = %AsyncFunctionCreatePromise();
try {
.tmp = await bar(x);
return %_AsyncFunctionResolve(.promise, .tmp);
} catch (e) {
return %_AsyncFunctionReject(.promise, e);
}
}
```
Overall the bytecode for async functions gets significantly shorter
already (and will get even shorter once we put the outer promise into
the async function generator object). For example the bytecode for a
simple async function
```js
async function f(x) { return await x; }
```
goes from 175 bytes to 110 bytes (a ~38% reduction in size), which
is in particular due to the simplification around the try-finally
removal.
Overall this seems to improve the doxbee-async-es2017-native test by
around 2-3%. On the test case mentioned in v8:8276 we go from
1124ms to 441ms, which corresponds to a 60% reduction in total
execution time!
Tbr: marja@chromium.org
Bug: v8:7253, v8:7522, v8:8276
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;luci.chromium.try:linux_chromium_rel_ng;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Id29dc92de7490b387ff697860c900cee44c9a7a4
Reviewed-on: https://chromium-review.googlesource.com/c/1269041
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56502}
2018-10-10 05:54:39 +00:00
|
|
|
/* 61 S> */ B(Return),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Star), R(3),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(CreateCatchContext), R(3), U8(1),
|
|
|
|
B(Star), R(2),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaTheHole),
|
|
|
|
B(SetPendingMessage),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(Ldar), R(2),
|
|
|
|
B(PushContext), R(3),
|
[async] Improve async function handling.
This change introduces new intrinsics used to desugar async functions
in the Parser and the BytecodeGenerator, namely we introduce a new
%_AsyncFunctionEnter intrinsic that constructs the generator object
for the async function (and in the future will also create the outer
promise for the async function). This generator object is internal
and never escapes to user code, plus since async functions don't have
a "prototype" property, we can just a single map here instead of tracking
the prototype/initial_map on every async function. This saves one word
per async function plus one initial_map per async function that was
invoked at least once.
We also introduce two new intrinsics %_AsyncFunctionReject, which
rejects the outer promise with the caught exception, and another
%_AsyncFunctionResolve, which resolves the outer promise with the
right hand side of the `return` statement. These functions also perform
the DevTools part of the job (aka popping from the promise stack and
sending the debug event). This allows us to get rid of the implicit
try-finally from async functions completely; because the finally
block only called to the %AsyncFunctionPromiseRelease builtin, which
was used to inform DevTools.
In essence we now turn an async function like
```js
async function f(x) { return await bar(x); }
```
into something like this (in Parser and BytecodeGenerator respectively):
```
function f(x) {
.generator_object = %_AsyncFunctionEnter(.closure, this);
.promise = %AsyncFunctionCreatePromise();
try {
.tmp = await bar(x);
return %_AsyncFunctionResolve(.promise, .tmp);
} catch (e) {
return %_AsyncFunctionReject(.promise, e);
}
}
```
Overall the bytecode for async functions gets significantly shorter
already (and will get even shorter once we put the outer promise into
the async function generator object). For example the bytecode for a
simple async function
```js
async function f(x) { return await x; }
```
goes from 175 bytes to 110 bytes (a ~38% reduction in size), which
is in particular due to the simplification around the try-finally
removal.
Overall this seems to improve the doxbee-async-es2017-native test by
around 2-3%. On the test case mentioned in v8:8276 we go from
1124ms to 441ms, which corresponds to a 60% reduction in total
execution time!
Tbr: marja@chromium.org
Bug: v8:7253, v8:7522, v8:8276
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;luci.chromium.try:linux_chromium_rel_ng;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Id29dc92de7490b387ff697860c900cee44c9a7a4
Reviewed-on: https://chromium-review.googlesource.com/c/1269041
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56502}
2018-10-10 05:54:39 +00:00
|
|
|
B(LdaImmutableCurrentContextSlot), U8(4),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(Star), R(5),
|
2018-05-30 14:21:39 +00:00
|
|
|
B(LdaTrue),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(Star), R(6),
|
2019-01-31 15:36:58 +00:00
|
|
|
B(Mov), R(0), R(4),
|
2018-10-11 08:35:56 +00:00
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(4), U8(3),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 61 S> */ B(Return),
|
|
|
|
]
|
|
|
|
constant pool: [
|
2018-10-11 08:35:56 +00:00
|
|
|
Smi [46],
|
2018-02-16 12:36:47 +00:00
|
|
|
SCOPE_INFO_TYPE,
|
2017-04-18 14:56:06 +00:00
|
|
|
]
|
|
|
|
handlers: [
|
2019-02-28 13:34:26 +00:00
|
|
|
[20, 89, 89],
|
2017-04-18 14:56:06 +00:00
|
|
|
]
|
|
|
|
|