fce1047f00
This is a reland of commit 62632c0805
.
Reason for previous revert: Performance regressions crbug.com/1315724.
The reland only optimizes strict equal boolean literal like "a===true"
or "a===false", and we generate TestReferenceEqual rather than
TestStrictEqual for the comparasion. And also add typed optimization
for ReferenceEqual when all inputs are boolean with boolean constant.
Original change's description:
> [interpreter] Optimize strict equal boolean
>
> For strict equal boolean literal like "a===true"
> or "a===false", we could generate TestReferenceEqual
> rather than TestStrictEqual. And in `execution_result()->IsTest()`
> case, we could directly emit JumpIfTrue/JumpIfFalse.
>
> E.g.
> ```
> a === true
> ```
> Generated Bytecode From:
> ```
> LdaGlobal
> Star1
> LdaTrue
> TestEqualStrict
> ```
> To:
> ```
> LdaGlobal
> Star1
> LdaTrue
> TestReferenceEqual
> ```
>
> E.g.
> ```
> if (a === true)
> ```
> Generated Bytecode From:
> ```
> LdaGlobal
> Star1
> LdaTrue
> TestEqualStrict
> JumpIfFalse
> ```
> To
> ```
> LdaGlobal
> JumpIfTrue
> Jump
> ```
>
>
> Bug: v8:6403
> Change-Id: Ieaca147acd2d523ac0d2466e7861afb2d29a1310
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3568923
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
> Commit-Queue: 王澳 <wangao.james@bytedance.com>
> Cr-Commit-Position: refs/heads/main@{#79935}
Bug: v8:6403
Change-Id: I2ae3ab57dce85313af200fa522e3632af5c3a554
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3592039
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Jakob Linke <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80141}
401 lines
7.6 KiB
Plaintext
401 lines
7.6 KiB
Plaintext
#
|
|
# Autogenerated by generate-bytecode-expectations.
|
|
#
|
|
|
|
---
|
|
wrap: yes
|
|
|
|
---
|
|
snippet: "
|
|
var a = 1;
|
|
return a === true;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 7
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaSmi), I8(1),
|
|
B(Star0),
|
|
/* 45 S> */ B(LdaTrue),
|
|
B(TestReferenceEqual), R(0),
|
|
/* 63 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = true;
|
|
return true === a;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 6
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaTrue),
|
|
B(Star0),
|
|
/* 48 S> */ B(LdaTrue),
|
|
B(TestReferenceEqual), R(0),
|
|
/* 66 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = false;
|
|
return true !== a;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 7
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaFalse),
|
|
B(Star0),
|
|
/* 49 S> */ B(LdaTrue),
|
|
B(TestReferenceEqual), R(0),
|
|
/* 61 E> */ B(LogicalNot),
|
|
/* 67 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = 1;
|
|
return true === a ? 1 : 2;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 15
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaSmi), I8(1),
|
|
B(Star0),
|
|
/* 45 S> */ B(LdaTrue),
|
|
B(TestReferenceEqual), R(0),
|
|
B(JumpIfFalse), U8(6),
|
|
B(LdaSmi), I8(1),
|
|
B(Jump), U8(4),
|
|
B(LdaSmi), I8(2),
|
|
/* 71 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = true;
|
|
return false === a ? 1 : 2;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 14
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaTrue),
|
|
B(Star0),
|
|
/* 48 S> */ B(LdaFalse),
|
|
B(TestReferenceEqual), R(0),
|
|
B(JumpIfFalse), U8(6),
|
|
B(LdaSmi), I8(1),
|
|
B(Jump), U8(4),
|
|
B(LdaSmi), I8(2),
|
|
/* 75 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = 1;
|
|
return true !== a ? 1 : 2;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 15
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaSmi), I8(1),
|
|
B(Star0),
|
|
/* 45 S> */ B(LdaTrue),
|
|
B(TestReferenceEqual), R(0),
|
|
B(JumpIfTrue), U8(6),
|
|
B(LdaSmi), I8(1),
|
|
B(Jump), U8(4),
|
|
B(LdaSmi), I8(2),
|
|
/* 71 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = false;
|
|
return false !== null ? 1 : 2;
|
|
"
|
|
frame size: 2
|
|
parameter count: 1
|
|
bytecode array length: 16
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaFalse),
|
|
B(Star0),
|
|
/* 49 S> */ B(LdaNull),
|
|
B(Star1),
|
|
B(LdaFalse),
|
|
B(TestReferenceEqual), R(1),
|
|
B(JumpIfTrue), U8(6),
|
|
B(LdaSmi), I8(1),
|
|
B(Jump), U8(4),
|
|
B(LdaSmi), I8(2),
|
|
/* 79 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = 0;
|
|
if (a !== true) {
|
|
return 1;
|
|
}
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 12
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaZero),
|
|
B(Star0),
|
|
/* 45 S> */ B(LdaTrue),
|
|
B(TestReferenceEqual), R(0),
|
|
B(JumpIfTrue), U8(5),
|
|
/* 65 S> */ B(LdaSmi), I8(1),
|
|
/* 74 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 77 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = true;
|
|
var b = 0;
|
|
while (a !== true) {
|
|
b++;
|
|
}
|
|
"
|
|
frame size: 2
|
|
parameter count: 1
|
|
bytecode array length: 20
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaTrue),
|
|
B(Star0),
|
|
/* 56 S> */ B(LdaZero),
|
|
B(Star1),
|
|
/* 68 S> */ B(LdaTrue),
|
|
B(TestReferenceEqual), R(0),
|
|
B(JumpIfTrue), U8(11),
|
|
/* 82 S> */ B(Ldar), R(1),
|
|
B(Inc), U8(0),
|
|
B(Star1),
|
|
/* 59 E> */ B(JumpLoop), U8(10), I8(0), U8(1),
|
|
B(LdaUndefined),
|
|
/* 89 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
(0 === true) ? 1 : 2;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 15
|
|
bytecodes: [
|
|
/* 34 S> */ B(LdaZero),
|
|
B(Star0),
|
|
B(LdaTrue),
|
|
B(TestReferenceEqual), R(0),
|
|
B(JumpIfFalse), U8(6),
|
|
B(LdaSmi), I8(1),
|
|
B(Jump), U8(4),
|
|
B(LdaSmi), I8(2),
|
|
B(LdaUndefined),
|
|
/* 56 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
(0 !== true) ? 1 : 2;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 15
|
|
bytecodes: [
|
|
/* 34 S> */ B(LdaZero),
|
|
B(Star0),
|
|
B(LdaTrue),
|
|
B(TestReferenceEqual), R(0),
|
|
B(JumpIfTrue), U8(6),
|
|
B(LdaSmi), I8(1),
|
|
B(Jump), U8(4),
|
|
B(LdaSmi), I8(2),
|
|
B(LdaUndefined),
|
|
/* 56 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
(false === 0) ? 1 : 2;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 15
|
|
bytecodes: [
|
|
/* 34 S> */ B(LdaZero),
|
|
B(Star0),
|
|
B(LdaFalse),
|
|
B(TestReferenceEqual), R(0),
|
|
B(JumpIfFalse), U8(6),
|
|
B(LdaSmi), I8(1),
|
|
B(Jump), U8(4),
|
|
B(LdaSmi), I8(2),
|
|
B(LdaUndefined),
|
|
/* 57 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
(0 === true || 0 === false) ? 1 : 2;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 22
|
|
bytecodes: [
|
|
/* 34 S> */ B(LdaZero),
|
|
B(Star0),
|
|
B(LdaTrue),
|
|
B(TestReferenceEqual), R(0),
|
|
B(JumpIfTrue), U8(9),
|
|
B(LdaZero),
|
|
B(Star0),
|
|
B(LdaFalse),
|
|
B(TestReferenceEqual), R(0),
|
|
B(JumpIfFalse), U8(6),
|
|
B(LdaSmi), I8(1),
|
|
B(Jump), U8(4),
|
|
B(LdaSmi), I8(2),
|
|
B(LdaUndefined),
|
|
/* 71 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
if (0 === true || 0 === false) return 1;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 19
|
|
bytecodes: [
|
|
/* 34 S> */ B(LdaZero),
|
|
B(Star0),
|
|
B(LdaTrue),
|
|
B(TestReferenceEqual), R(0),
|
|
B(JumpIfTrue), U8(9),
|
|
B(LdaZero),
|
|
B(Star0),
|
|
B(LdaFalse),
|
|
B(TestReferenceEqual), R(0),
|
|
B(JumpIfFalse), U8(5),
|
|
/* 65 S> */ B(LdaSmi), I8(1),
|
|
/* 74 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 75 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
if (!('false' === false)) return 1;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 13
|
|
bytecodes: [
|
|
/* 34 S> */ B(LdaConstant), U8(0),
|
|
B(Star0),
|
|
B(LdaFalse),
|
|
B(TestReferenceEqual), R(0),
|
|
B(JumpIfTrue), U8(5),
|
|
/* 60 S> */ B(LdaSmi), I8(1),
|
|
/* 69 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 70 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["false"],
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
if (!('false' !== false)) return 1;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 13
|
|
bytecodes: [
|
|
/* 34 S> */ B(LdaConstant), U8(0),
|
|
B(Star0),
|
|
B(LdaFalse),
|
|
B(TestReferenceEqual), R(0),
|
|
B(JumpIfFalse), U8(5),
|
|
/* 60 S> */ B(LdaSmi), I8(1),
|
|
/* 69 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 70 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["false"],
|
|
]
|
|
handlers: [
|
|
]
|
|
|