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),
|
|
|
|
B(Star), R(1),
|
|
|
|
/* 35 S> */ B(LdaSmi), I8(10),
|
2017-07-27 12:45:00 +00:00
|
|
|
/* 35 E> */ B(TestLessThan), R(1), 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),
|
|
|
|
/* 56 S> */ B(Mov), R(1), R(0),
|
|
|
|
/* 43 S> */ B(Ldar), R(0),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(Inc), U8(1),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Star), R(1),
|
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),
|
|
|
|
B(Star), R(0),
|
|
|
|
B(Star), R(1),
|
|
|
|
B(LdaSmi), I8(1),
|
|
|
|
B(Star), R(2),
|
|
|
|
/* 78 E> */ B(StackCheck),
|
|
|
|
B(CreateBlockContext), U8(0),
|
|
|
|
B(PushContext), R(4),
|
|
|
|
B(LdaTheHole),
|
|
|
|
B(StaCurrentContextSlot), U8(4),
|
|
|
|
B(Ldar), R(1),
|
|
|
|
B(StaCurrentContextSlot), U8(4),
|
|
|
|
B(LdaSmi), I8(1),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(TestEqual), R(2), U8(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(JumpIfFalse), U8(7),
|
|
|
|
B(LdaZero),
|
|
|
|
B(Star), R(2),
|
|
|
|
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(3),
|
|
|
|
/* 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),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(TestEqual), R(3), 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),
|
|
|
|
B(Star), R(3),
|
|
|
|
B(LdaCurrentContextSlot), U8(4),
|
|
|
|
B(Star), R(1),
|
|
|
|
B(JumpLoop), U8(24), I8(1),
|
|
|
|
B(LdaSmi), I8(1),
|
2017-07-27 12:45:00 +00:00
|
|
|
/* 78 E> */ B(TestEqual), R(3), 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();
|
|
|
|
"
|
|
|
|
frame size: 6
|
|
|
|
parameter count: 1
|
2017-05-08 18:55:54 +00:00
|
|
|
bytecode array length: 68
|
2017-04-18 14:56:06 +00:00
|
|
|
bytecodes: [
|
|
|
|
/* 10 E> */ B(StackCheck),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(CreateObjectLiteral), U8(0), U8(0), U8(41), R(4),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Mov), R(4), R(3),
|
|
|
|
B(Ldar), R(3),
|
|
|
|
B(JumpIfUndefined), U8(6),
|
|
|
|
B(Ldar), R(3),
|
|
|
|
B(JumpIfNotNull), U8(16),
|
2018-07-10 12:52:05 +00:00
|
|
|
B(LdaSmi), I8(78),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Star), R(4),
|
|
|
|
B(LdaConstant), U8(1),
|
|
|
|
B(Star), R(5),
|
|
|
|
B(CallRuntime), U16(Runtime::kNewTypeError), R(4), U8(2),
|
2017-06-15 21:24:37 +00:00
|
|
|
/* 28 E> */ B(Throw),
|
2017-10-19 15:12:42 +00:00
|
|
|
/* 37 S> */ B(LdaNamedProperty), R(3), U8(1), U8(1),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Star), R(1),
|
2017-10-19 15:12:42 +00:00
|
|
|
/* 37 S> */ B(LdaNamedProperty), R(3), U8(2), U8(3),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Star), R(2),
|
|
|
|
/* 55 S> */ B(LdaZero),
|
2017-10-19 15:12:42 +00:00
|
|
|
/* 55 E> */ B(TestGreaterThan), R(2), 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),
|
[inspector] moved var initialization break location before init expression (reland)
This CL improves break locations for expressions like 'var a = <expr>'. Without CL we use <expr> position as break location for initialization statement, with this CL we use position of first character after '=' as position.
Benefits (see test for details):
- only one break in expressions which includes mix of property lookup and calls, e.g. var p = Promise.resolve().then(x => x * 2),
- removed redundant break location for expressions like: let { x, y } = { x: 1, y: 2}.
TBR=dgozman@chromium.org,rmcilroy@chromium.org,machenbach@chromium.org,marja@chromium.org,kozyatinskiy@chromium.org,devtools-reviews@chromium.org,v8-reviews@googlegroups.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: v8:5909
Change-Id: Ie84fa79afeed09e28cf8478ba610a0cfbfdfc294
Reviewed-on: https://chromium-review.googlesource.com/518116
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45598}
2017-05-30 12:25:55 +00:00
|
|
|
/* 75 S> */ B(Ldar), R(2),
|
2017-10-19 15:12:42 +00:00
|
|
|
/* 77 E> */ B(Add), R(1), U8(6),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Star), R(0),
|
|
|
|
/* 62 S> */ B(Ldar), R(2),
|
2017-10-19 15:12:42 +00:00
|
|
|
B(Dec), U8(7),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Star), R(2),
|
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: [
|
2018-01-23 13:51:38 +00:00
|
|
|
B(SwitchOnGeneratorState), R(2), U8(0), U8(1),
|
|
|
|
B(Mov), R(closure), R(3),
|
|
|
|
B(Mov), R(this), R(4),
|
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(2),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 11 E> */ B(StackCheck),
|
2018-01-23 13:51:38 +00:00
|
|
|
/* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(3), U8(0),
|
|
|
|
B(ResumeGenerator), R(2), R(0), U8(3),
|
|
|
|
B(Star), R(3),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), 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),
|
2017-05-24 13:54:57 +00:00
|
|
|
B(Star), R(1),
|
|
|
|
/* 36 S> */ B(LdaSmi), I8(10),
|
2017-07-27 12:45:00 +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),
|
2017-05-24 13:54:57 +00:00
|
|
|
/* 57 S> */ B(Mov), R(1), R(0),
|
2017-07-07 20:48:16 +00:00
|
|
|
/* 44 S> */ B(Ldar), R(0),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(Inc), U8(1),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(1),
|
|
|
|
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: [
|
2018-01-23 13:51:38 +00:00
|
|
|
B(SwitchOnGeneratorState), R(1), U8(0), U8(2),
|
|
|
|
B(Mov), R(closure), R(2),
|
|
|
|
B(Mov), R(this), R(3),
|
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(1),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 11 E> */ B(StackCheck),
|
2018-01-23 13:51:38 +00:00
|
|
|
/* 11 E> */ B(SuspendGenerator), R(1), R(0), U8(2), U8(0),
|
|
|
|
B(ResumeGenerator), R(1), R(0), U8(2),
|
|
|
|
B(Star), R(2),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), 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),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(0),
|
2017-05-24 13:54:57 +00:00
|
|
|
/* 36 S> */ B(LdaSmi), I8(10),
|
2017-07-27 12:45:00 +00:00
|
|
|
/* 36 E> */ B(TestLessThan), R(0), 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),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Mov), R(0), R(2),
|
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(2), U8(2),
|
|
|
|
/* 47 E> */ B(SuspendGenerator), R(1), R(0), U8(2), U8(1),
|
|
|
|
B(ResumeGenerator), R(1), R(0), U8(2),
|
|
|
|
B(Star), R(2),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), 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),
|
2017-07-07 20:48:16 +00:00
|
|
|
/* 44 S> */ B(Ldar), R(0),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(Inc), U8(1),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(0),
|
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();
|
|
|
|
"
|
2017-09-06 22:48:36 +00:00
|
|
|
frame size: 12
|
2017-04-18 14:56:06 +00:00
|
|
|
parameter count: 1
|
2018-05-30 14:21:39 +00:00
|
|
|
bytecode array length: 140
|
2017-04-18 14:56:06 +00:00
|
|
|
bytecodes: [
|
2017-05-12 17:29:53 +00:00
|
|
|
/* 16 E> */ B(StackCheck),
|
2017-09-06 22:48:36 +00:00
|
|
|
B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(3),
|
|
|
|
B(Mov), R(context), R(6),
|
|
|
|
B(Mov), R(context), R(7),
|
|
|
|
/* 36 S> */ B(LdaZero),
|
2017-05-24 13:54:57 +00:00
|
|
|
B(Star), R(1),
|
|
|
|
/* 41 S> */ B(LdaSmi), I8(10),
|
2017-07-27 12:45:00 +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),
|
2017-05-24 13:54:57 +00:00
|
|
|
/* 62 S> */ B(Mov), R(1), R(0),
|
2017-07-07 20:48:16 +00:00
|
|
|
/* 49 S> */ B(Ldar), R(0),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(Inc), U8(1),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(1),
|
|
|
|
B(JumpLoop), U8(17), I8(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaUndefined),
|
2017-09-06 22:48:36 +00:00
|
|
|
B(Star), R(9),
|
|
|
|
B(Mov), R(3), R(8),
|
[builtins] Refactor the promise resolution and rejection logic.
This introduces dedicated builtins
- FulfillPromise,
- RejectPromise, and
- ResolvePromise,
which perform the corresponding operations from the language
specification, and removes the redundant entry points and the
excessive inlining of these operations into other builtins. We
also add the same logic on the C++ side, so that we don't need
to go into JavaScript land when resolving/rejecting from the
API.
The C++ side has a complete implementation, including full support
for the debugger and the current PromiseHook machinery. This is to
avoid constantly crossing the boundary for those cases, and to also
simplify the CSA side (and soon the TurboFan side), where we only
do the fast-path and bail out to the runtime for the general handling.
On top of this we introduce %_RejectPromise and %_ResolvePromise,
which are entry points used by the bytecode and parser desugarings
for async functions, and also used by the V8 Extras API. Thanks to
this we can uniformly optimize these in TurboFan, where we have
corresponding operators JSRejectPromise and JSResolvePromise, which
currently just call into the builtins, but middle-term can be further
optimized, i.e. to skip the "then" lookup for JSResolvePromise when
we know something about the resolution.
In TurboFan we can also already inline the default PromiseCapability
[[Reject]] and [[Resolve]] functions, although this is not as effective
as it can be right now, until we have inlining support for the Promise
constructor (being worked on by petermarshall@ right now) and/or SFI
based CALL_IC feedback.
Overall this change is meant as a refactoring without significant
performance impact anywhere; it seems to improve performance of
simple async functions a bit, but otherwise is neutral.
Bug: v8:7253
Change-Id: Id0b979f9b2843560e38cd8df4b02627dad4b6d8c
Reviewed-on: https://chromium-review.googlesource.com/911632
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51260}
2018-02-12 19:10:29 +00:00
|
|
|
/* 49 E> */ B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(8), U8(2),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaZero),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(4),
|
|
|
|
B(Mov), R(3), R(5),
|
2018-05-04 09:29:20 +00:00
|
|
|
B(Jump), U8(55),
|
|
|
|
B(Jump), U8(39),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(8),
|
2018-05-04 09:29:20 +00:00
|
|
|
B(CreateCatchContext), R(8), U8(0),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(7),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaTheHole),
|
|
|
|
B(SetPendingMessage),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Ldar), R(7),
|
|
|
|
B(PushContext), R(8),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaImmutableCurrentContextSlot), U8(4),
|
2017-09-06 22:48:36 +00:00
|
|
|
B(Star), R(10),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaFalse),
|
2017-09-06 22:48:36 +00:00
|
|
|
B(Star), R(11),
|
|
|
|
B(Mov), R(3), R(9),
|
[builtins] Refactor the promise resolution and rejection logic.
This introduces dedicated builtins
- FulfillPromise,
- RejectPromise, and
- ResolvePromise,
which perform the corresponding operations from the language
specification, and removes the redundant entry points and the
excessive inlining of these operations into other builtins. We
also add the same logic on the C++ side, so that we don't need
to go into JavaScript land when resolving/rejecting from the
API.
The C++ side has a complete implementation, including full support
for the debugger and the current PromiseHook machinery. This is to
avoid constantly crossing the boundary for those cases, and to also
simplify the CSA side (and soon the TurboFan side), where we only
do the fast-path and bail out to the runtime for the general handling.
On top of this we introduce %_RejectPromise and %_ResolvePromise,
which are entry points used by the bytecode and parser desugarings
for async functions, and also used by the V8 Extras API. Thanks to
this we can uniformly optimize these in TurboFan, where we have
corresponding operators JSRejectPromise and JSResolvePromise, which
currently just call into the builtins, but middle-term can be further
optimized, i.e. to skip the "then" lookup for JSResolvePromise when
we know something about the resolution.
In TurboFan we can also already inline the default PromiseCapability
[[Reject]] and [[Resolve]] functions, although this is not as effective
as it can be right now, until we have inlining support for the Promise
constructor (being worked on by petermarshall@ right now) and/or SFI
based CALL_IC feedback.
Overall this change is meant as a refactoring without significant
performance impact anywhere; it seems to improve performance of
simple async functions a bit, but otherwise is neutral.
Bug: v8:7253
Change-Id: Id0b979f9b2843560e38cd8df4b02627dad4b6d8c
Reviewed-on: https://chromium-review.googlesource.com/911632
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51260}
2018-02-12 19:10:29 +00:00
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_RejectPromise), R(9), U8(3),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(PopContext), R(8),
|
2017-05-16 15:20:09 +00:00
|
|
|
B(LdaZero),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(4),
|
|
|
|
B(Mov), R(3), R(5),
|
[ignition] Always write the deferred command result register
For deferred commands (such as in try-finally), some deferred commands
save and restore the accumulator using a result register (e.g. return,
throw, rethrow), while others don't (e.g. break, continue,
fall-through).
However, conditionally reading this result register that may not ever be
written caused it to be considered live from the start of the function,
as far as the liveness analysis could statically tell.
Now, we write the result register for all deferred commands, including
the fall-through. As a micro-optimization, we re-use the Smi command
tokeen to clobber the result, rather than emitting an LdaUndefined.
Bug: chromium:758472
Change-Id: I2ea65e2249b40ee6403216e654a8bb88d50bec3b
Reviewed-on: https://chromium-review.googlesource.com/635592
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47612}
2017-08-25 16:04:42 +00:00
|
|
|
B(Jump), U8(16),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaSmi), I8(-1),
|
[ignition] Always write the deferred command result register
For deferred commands (such as in try-finally), some deferred commands
save and restore the accumulator using a result register (e.g. return,
throw, rethrow), while others don't (e.g. break, continue,
fall-through).
However, conditionally reading this result register that may not ever be
written caused it to be considered live from the start of the function,
as far as the liveness analysis could statically tell.
Now, we write the result register for all deferred commands, including
the fall-through. As a micro-optimization, we re-use the Smi command
tokeen to clobber the result, rather than emitting an LdaUndefined.
Bug: chromium:758472
Change-Id: I2ea65e2249b40ee6403216e654a8bb88d50bec3b
Reviewed-on: https://chromium-review.googlesource.com/635592
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47612}
2017-08-25 16:04:42 +00:00
|
|
|
B(Star), R(5),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(4),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(Jump), U8(8),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(5),
|
2017-05-24 15:48:27 +00:00
|
|
|
B(LdaSmi), I8(1),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(4),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaTheHole),
|
|
|
|
B(SetPendingMessage),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(6),
|
2018-05-30 14:21:39 +00:00
|
|
|
B(LdaFalse),
|
|
|
|
B(Star), R(8),
|
|
|
|
B(Mov), R(3), R(7),
|
|
|
|
B(CallJSRuntime), U8(%async_function_promise_release), R(7), U8(2),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Ldar), R(6),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(SetPendingMessage),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Ldar), R(4),
|
2018-05-04 09:29:20 +00:00
|
|
|
B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0),
|
2017-05-16 15:20:09 +00:00
|
|
|
B(Jump), U8(8),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Ldar), R(5),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 67 S> */ B(Return),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Ldar), R(5),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(ReThrow),
|
|
|
|
B(LdaUndefined),
|
|
|
|
/* 67 S> */ B(Return),
|
|
|
|
]
|
|
|
|
constant pool: [
|
2018-02-16 12:36:47 +00:00
|
|
|
SCOPE_INFO_TYPE,
|
2017-05-16 11:36:04 +00:00
|
|
|
Smi [6],
|
|
|
|
Smi [9],
|
2017-04-18 14:56:06 +00:00
|
|
|
]
|
|
|
|
handlers: [
|
2018-05-04 09:29:20 +00:00
|
|
|
[10, 93, 101],
|
2017-09-06 22:48:36 +00:00
|
|
|
[13, 54, 56],
|
2017-04-18 14:56:06 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
---
|
|
|
|
snippet: "
|
|
|
|
async function f() {
|
|
|
|
for (let x = 0; x < 10; ++x) await x;
|
|
|
|
}
|
|
|
|
f();
|
|
|
|
"
|
2018-01-23 13:51:38 +00:00
|
|
|
frame size: 11
|
2017-04-18 14:56:06 +00:00
|
|
|
parameter count: 1
|
2018-05-30 14:21:39 +00:00
|
|
|
bytecode array length: 191
|
2017-04-18 14:56:06 +00:00
|
|
|
bytecodes: [
|
2018-01-23 13:51:38 +00:00
|
|
|
B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
|
|
|
|
B(Mov), R(closure), R(3),
|
|
|
|
B(Mov), R(this), R(4),
|
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(1),
|
2017-05-12 17:29:53 +00:00
|
|
|
/* 16 E> */ B(StackCheck),
|
2017-09-06 22:48:36 +00:00
|
|
|
B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(2),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Mov), R(context), R(5),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(Mov), R(context), R(6),
|
2017-07-07 20:48:16 +00:00
|
|
|
/* 36 S> */ B(LdaZero),
|
|
|
|
B(Star), R(0),
|
2017-05-24 13:54:57 +00:00
|
|
|
/* 41 S> */ B(LdaSmi), I8(10),
|
2017-07-27 12:45:00 +00:00
|
|
|
/* 41 E> */ B(TestLessThan), R(0), U8(0),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(JumpIfFalse), U8(50),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 23 E> */ B(StackCheck),
|
2018-01-23 13:51:38 +00:00
|
|
|
/* 52 S> */ B(Mov), R(1), R(7),
|
|
|
|
B(Mov), R(0), R(8),
|
|
|
|
B(Mov), R(2), R(9),
|
2018-05-14 08:55:07 +00:00
|
|
|
B(CallJSRuntime), U8(%async_function_await_uncaught), R(7), U8(3),
|
2018-01-23 13:51:38 +00:00
|
|
|
/* 52 E> */ B(SuspendGenerator), R(1), R(0), U8(7), U8(0),
|
|
|
|
B(ResumeGenerator), R(1), R(0), U8(7),
|
|
|
|
B(Star), R(7),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Star), R(8),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaZero),
|
2018-04-18 00:04:34 +00:00
|
|
|
B(TestReferenceEqual), R(8),
|
2017-07-13 13:53:13 +00:00
|
|
|
B(JumpIfTrue), U8(5),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Ldar), R(7),
|
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),
|
2017-07-07 20:48:16 +00:00
|
|
|
/* 49 S> */ B(Ldar), R(0),
|
2017-07-27 12:45:00 +00:00
|
|
|
B(Inc), U8(1),
|
2017-07-07 20:48:16 +00:00
|
|
|
B(Star), R(0),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(JumpLoop), U8(52), I8(0),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaUndefined),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Star), R(8),
|
|
|
|
B(Mov), R(2), R(7),
|
[builtins] Refactor the promise resolution and rejection logic.
This introduces dedicated builtins
- FulfillPromise,
- RejectPromise, and
- ResolvePromise,
which perform the corresponding operations from the language
specification, and removes the redundant entry points and the
excessive inlining of these operations into other builtins. We
also add the same logic on the C++ side, so that we don't need
to go into JavaScript land when resolving/rejecting from the
API.
The C++ side has a complete implementation, including full support
for the debugger and the current PromiseHook machinery. This is to
avoid constantly crossing the boundary for those cases, and to also
simplify the CSA side (and soon the TurboFan side), where we only
do the fast-path and bail out to the runtime for the general handling.
On top of this we introduce %_RejectPromise and %_ResolvePromise,
which are entry points used by the bytecode and parser desugarings
for async functions, and also used by the V8 Extras API. Thanks to
this we can uniformly optimize these in TurboFan, where we have
corresponding operators JSRejectPromise and JSResolvePromise, which
currently just call into the builtins, but middle-term can be further
optimized, i.e. to skip the "then" lookup for JSResolvePromise when
we know something about the resolution.
In TurboFan we can also already inline the default PromiseCapability
[[Reject]] and [[Resolve]] functions, although this is not as effective
as it can be right now, until we have inlining support for the Promise
constructor (being worked on by petermarshall@ right now) and/or SFI
based CALL_IC feedback.
Overall this change is meant as a refactoring without significant
performance impact anywhere; it seems to improve performance of
simple async functions a bit, but otherwise is neutral.
Bug: v8:7253
Change-Id: Id0b979f9b2843560e38cd8df4b02627dad4b6d8c
Reviewed-on: https://chromium-review.googlesource.com/911632
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51260}
2018-02-12 19:10:29 +00:00
|
|
|
/* 49 E> */ B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(7), U8(2),
|
2017-05-16 15:20:09 +00:00
|
|
|
B(LdaZero),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Star), R(3),
|
|
|
|
B(Mov), R(2), R(4),
|
2018-05-04 09:29:20 +00:00
|
|
|
B(Jump), U8(55),
|
|
|
|
B(Jump), U8(39),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(Star), R(7),
|
2018-05-04 09:29:20 +00:00
|
|
|
B(CreateCatchContext), R(7), U8(1),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Star), R(6),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaTheHole),
|
|
|
|
B(SetPendingMessage),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Ldar), R(6),
|
|
|
|
B(PushContext), R(7),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaImmutableCurrentContextSlot), U8(4),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Star), R(9),
|
2017-06-02 11:55:48 +00:00
|
|
|
B(LdaFalse),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Star), R(10),
|
|
|
|
B(Mov), R(2), R(8),
|
[builtins] Refactor the promise resolution and rejection logic.
This introduces dedicated builtins
- FulfillPromise,
- RejectPromise, and
- ResolvePromise,
which perform the corresponding operations from the language
specification, and removes the redundant entry points and the
excessive inlining of these operations into other builtins. We
also add the same logic on the C++ side, so that we don't need
to go into JavaScript land when resolving/rejecting from the
API.
The C++ side has a complete implementation, including full support
for the debugger and the current PromiseHook machinery. This is to
avoid constantly crossing the boundary for those cases, and to also
simplify the CSA side (and soon the TurboFan side), where we only
do the fast-path and bail out to the runtime for the general handling.
On top of this we introduce %_RejectPromise and %_ResolvePromise,
which are entry points used by the bytecode and parser desugarings
for async functions, and also used by the V8 Extras API. Thanks to
this we can uniformly optimize these in TurboFan, where we have
corresponding operators JSRejectPromise and JSResolvePromise, which
currently just call into the builtins, but middle-term can be further
optimized, i.e. to skip the "then" lookup for JSResolvePromise when
we know something about the resolution.
In TurboFan we can also already inline the default PromiseCapability
[[Reject]] and [[Resolve]] functions, although this is not as effective
as it can be right now, until we have inlining support for the Promise
constructor (being worked on by petermarshall@ right now) and/or SFI
based CALL_IC feedback.
Overall this change is meant as a refactoring without significant
performance impact anywhere; it seems to improve performance of
simple async functions a bit, but otherwise is neutral.
Bug: v8:7253
Change-Id: Id0b979f9b2843560e38cd8df4b02627dad4b6d8c
Reviewed-on: https://chromium-review.googlesource.com/911632
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51260}
2018-02-12 19:10:29 +00:00
|
|
|
B(InvokeIntrinsic), U8(Runtime::k_RejectPromise), R(8), U8(3),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(PopContext), R(7),
|
2017-05-16 15:20:09 +00:00
|
|
|
B(LdaZero),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Star), R(3),
|
|
|
|
B(Mov), R(2), R(4),
|
[ignition] Always write the deferred command result register
For deferred commands (such as in try-finally), some deferred commands
save and restore the accumulator using a result register (e.g. return,
throw, rethrow), while others don't (e.g. break, continue,
fall-through).
However, conditionally reading this result register that may not ever be
written caused it to be considered live from the start of the function,
as far as the liveness analysis could statically tell.
Now, we write the result register for all deferred commands, including
the fall-through. As a micro-optimization, we re-use the Smi command
tokeen to clobber the result, rather than emitting an LdaUndefined.
Bug: chromium:758472
Change-Id: I2ea65e2249b40ee6403216e654a8bb88d50bec3b
Reviewed-on: https://chromium-review.googlesource.com/635592
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47612}
2017-08-25 16:04:42 +00:00
|
|
|
B(Jump), U8(16),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaSmi), I8(-1),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(Star), R(4),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Star), R(3),
|
2017-06-02 11:55:48 +00:00
|
|
|
B(Jump), U8(8),
|
2017-08-11 15:16:31 +00:00
|
|
|
B(Star), R(4),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(LdaSmi), I8(1),
|
|
|
|
B(Star), R(3),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(LdaTheHole),
|
|
|
|
B(SetPendingMessage),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Star), R(5),
|
2018-05-30 14:21:39 +00:00
|
|
|
B(LdaTrue),
|
|
|
|
B(Star), R(7),
|
|
|
|
B(Mov), R(2), R(6),
|
|
|
|
B(CallJSRuntime), U8(%async_function_promise_release), R(6), U8(2),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Ldar), R(5),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(SetPendingMessage),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Ldar), R(3),
|
2018-05-04 09:29:20 +00:00
|
|
|
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
|
2017-05-16 15:20:09 +00:00
|
|
|
B(Jump), U8(8),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Ldar), R(4),
|
2017-04-18 14:56:06 +00:00
|
|
|
/* 61 S> */ B(Return),
|
2018-01-23 13:51:38 +00:00
|
|
|
B(Ldar), R(4),
|
2017-04-18 14:56:06 +00:00
|
|
|
B(ReThrow),
|
|
|
|
B(LdaUndefined),
|
|
|
|
/* 61 S> */ B(Return),
|
|
|
|
]
|
|
|
|
constant pool: [
|
2018-01-23 13:51:38 +00:00
|
|
|
Smi [58],
|
2018-02-16 12:36:47 +00:00
|
|
|
SCOPE_INFO_TYPE,
|
2017-05-16 11:36:04 +00:00
|
|
|
Smi [6],
|
|
|
|
Smi [9],
|
2017-04-18 14:56:06 +00:00
|
|
|
]
|
|
|
|
handlers: [
|
2018-05-04 09:29:20 +00:00
|
|
|
[26, 144, 152],
|
2018-01-24 11:19:51 +00:00
|
|
|
[29, 105, 107],
|
2017-04-18 14:56:06 +00:00
|
|
|
]
|
|
|
|
|