bcee140617
This adds a new InstanceOfIC where the TestInstanceOf bytecode collects constant feedback about the right-hand side of instanceof operators, including both JSFunction and JSBoundFunction instances. TurboFan then uses the feedback to optimize instanceof in places where the right-hand side is not a known constant (known to TurboFan). This addresses the odd performance cliff that we see with instanceof in functions with multiple closures. It was discovered as one of the main bottlenecks on the uglify-es test in the web-tooling-benchmark. The uglify-es test (run in separation) is ~18% faster with this change. On the micro-benchmark in the tracking bug we go from instanceofSingleClosure_Const: 69 ms. instanceofSingleClosure_Class: 246 ms. instanceofMultiClosure: 246 ms. instanceofParameter: 246 ms. to instanceofSingleClosure_Const: 70 ms. instanceofSingleClosure_Class: 75 ms. instanceofMultiClosure: 76 ms. instanceofParameter: 73 ms. boosting performance by roughly 3.6x and thus effectively removing the performance cliff around instanceof. Bug: v8:6936, v8:6971 Change-Id: Ib88dbb9eaef9cafa4a0e260fbbde73427a54046e Reviewed-on: https://chromium-review.googlesource.com/730686 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Michael Stanton <mvstanton@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Cr-Commit-Position: refs/heads/master@{#48820}
526 lines
10 KiB
Plaintext
526 lines
10 KiB
Plaintext
#
|
|
# Autogenerated by generate-bytecode-expectations.
|
|
#
|
|
|
|
---
|
|
wrap: no
|
|
test function name: f
|
|
|
|
---
|
|
snippet: "
|
|
function f() {
|
|
if (0) {
|
|
return 1;
|
|
} else {
|
|
return -1;
|
|
}
|
|
};
|
|
f();
|
|
"
|
|
frame size: 0
|
|
parameter count: 1
|
|
bytecode array length: 4
|
|
bytecodes: [
|
|
/* 10 E> */ B(StackCheck),
|
|
/* 55 S> */ B(LdaSmi), I8(-1),
|
|
/* 65 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function f() {
|
|
if ('lucky') {
|
|
return 1;
|
|
} else {
|
|
return -1;
|
|
}
|
|
};
|
|
f();
|
|
"
|
|
frame size: 0
|
|
parameter count: 1
|
|
bytecode array length: 4
|
|
bytecodes: [
|
|
/* 10 E> */ B(StackCheck),
|
|
/* 36 S> */ B(LdaSmi), I8(1),
|
|
/* 45 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function f() {
|
|
if (false) {
|
|
return 1;
|
|
} else {
|
|
return -1;
|
|
}
|
|
};
|
|
f();
|
|
"
|
|
frame size: 0
|
|
parameter count: 1
|
|
bytecode array length: 4
|
|
bytecodes: [
|
|
/* 10 E> */ B(StackCheck),
|
|
/* 59 S> */ B(LdaSmi), I8(-1),
|
|
/* 69 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function f() {
|
|
if (false) {
|
|
return 1;
|
|
}
|
|
};
|
|
f();
|
|
"
|
|
frame size: 0
|
|
parameter count: 1
|
|
bytecode array length: 3
|
|
bytecodes: [
|
|
/* 10 E> */ B(StackCheck),
|
|
/* 17 S> */ B(LdaUndefined),
|
|
/* 48 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function f() {
|
|
var a = 1;
|
|
if (a) {
|
|
a += 1;
|
|
} else {
|
|
return 2;
|
|
}
|
|
};
|
|
f();
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 21
|
|
bytecodes: [
|
|
/* 10 E> */ B(StackCheck),
|
|
/* 25 S> */ B(LdaSmi), I8(1),
|
|
B(Star), R(0),
|
|
/* 30 S> */ B(JumpIfToBooleanFalse), U8(11),
|
|
/* 43 S> */ B(Ldar), R(0),
|
|
B(AddSmi), I8(1), U8(0),
|
|
B(Star), R(0),
|
|
B(Jump), U8(5),
|
|
/* 66 S> */ B(LdaSmi), I8(2),
|
|
/* 75 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 80 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function f(a) {
|
|
if (a <= 0) {
|
|
return 200;
|
|
} else {
|
|
return -200;
|
|
}
|
|
};
|
|
f(99);
|
|
"
|
|
frame size: 0
|
|
parameter count: 2
|
|
bytecode array length: 19
|
|
bytecodes: [
|
|
/* 10 E> */ B(StackCheck),
|
|
/* 18 S> */ B(LdaZero),
|
|
/* 24 E> */ B(TestLessThanOrEqual), R(arg0), U8(0),
|
|
B(JumpIfFalse), U8(7),
|
|
/* 36 S> */ B(Wide), B(LdaSmi), I16(200),
|
|
/* 47 S> */ B(Return),
|
|
/* 63 S> */ B(Wide), B(LdaSmi), I16(-200),
|
|
/* 75 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 80 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function f(a, b) { if (a in b) { return 200; } }f('prop', { prop: 'yes'});
|
|
"
|
|
frame size: 0
|
|
parameter count: 3
|
|
bytecode array length: 14
|
|
bytecodes: [
|
|
/* 10 E> */ B(StackCheck),
|
|
/* 19 S> */ B(Ldar), R(arg1),
|
|
/* 25 E> */ B(TestIn), R(arg0),
|
|
B(JumpIfFalse), U8(7),
|
|
/* 33 S> */ B(Wide), B(LdaSmi), I16(200),
|
|
/* 44 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 47 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function f(z) { var a = 0; var b = 0; if (a === 0.01) {
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
return 200; } else { return -200; } } f(0.001);
|
|
"
|
|
frame size: 2
|
|
parameter count: 2
|
|
bytecode array length: 29
|
|
bytecodes: [
|
|
/* 10 E> */ B(StackCheck),
|
|
/* 24 S> */ B(LdaZero),
|
|
B(Star), R(0),
|
|
/* 35 S> */ B(LdaZero),
|
|
B(Star), R(1),
|
|
/* 38 S> */ B(LdaConstant), U8(0),
|
|
/* 44 E> */ B(TestEqualStrict), R(0), U8(0),
|
|
B(JumpIfFalse), U8(10),
|
|
/* 58 S> */ B(Mov), R(0), R(1),
|
|
/* 1081 S> */ B(Wide), B(LdaSmi), I16(200),
|
|
/* 1092 S> */ B(Return),
|
|
/* 1102 S> */ B(Wide), B(LdaSmi), I16(-200),
|
|
/* 1114 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 1117 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
HEAP_NUMBER_TYPE [0.01],
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function f() {
|
|
var a = 0; var b = 0;
|
|
if (a) {
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
b = a; a = b;
|
|
return 200; } else { return -200; }
|
|
};
|
|
f();
|
|
"
|
|
frame size: 2
|
|
parameter count: 1
|
|
bytecode array length: 26
|
|
bytecodes: [
|
|
/* 10 E> */ B(StackCheck),
|
|
/* 25 S> */ B(LdaZero),
|
|
B(Star), R(0),
|
|
/* 36 S> */ B(LdaZero),
|
|
B(Star), R(1),
|
|
/* 41 S> */ B(Ldar), R(0),
|
|
B(JumpIfToBooleanFalse), U8(10),
|
|
/* 52 S> */ B(Mov), R(0), R(1),
|
|
/* 1076 S> */ B(Wide), B(LdaSmi), I16(200),
|
|
/* 1087 S> */ B(Return),
|
|
/* 1097 S> */ B(Wide), B(LdaSmi), I16(-200),
|
|
/* 1109 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 1112 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function f(a, b) {
|
|
if (a == b) { return 1; }
|
|
if (a === b) { return 1; }
|
|
if (a < b) { return 1; }
|
|
if (a > b) { return 1; }
|
|
if (a <= b) { return 1; }
|
|
if (a >= b) { return 1; }
|
|
if (a in b) { return 1; }
|
|
if (a instanceof b) { return 1; }
|
|
return 0;
|
|
}
|
|
f(1, 1);
|
|
"
|
|
frame size: 0
|
|
parameter count: 3
|
|
bytecode array length: 82
|
|
bytecodes: [
|
|
/* 10 E> */ B(StackCheck),
|
|
/* 21 S> */ B(Ldar), R(arg1),
|
|
/* 27 E> */ B(TestEqual), R(arg0), U8(0),
|
|
B(JumpIfFalse), U8(5),
|
|
/* 35 S> */ B(LdaSmi), I8(1),
|
|
/* 44 S> */ B(Return),
|
|
/* 49 S> */ B(Ldar), R(arg1),
|
|
/* 55 E> */ B(TestEqualStrict), R(arg0), U8(1),
|
|
B(JumpIfFalse), U8(5),
|
|
/* 64 S> */ B(LdaSmi), I8(1),
|
|
/* 73 S> */ B(Return),
|
|
/* 78 S> */ B(Ldar), R(arg1),
|
|
/* 84 E> */ B(TestLessThan), R(arg0), U8(2),
|
|
B(JumpIfFalse), U8(5),
|
|
/* 91 S> */ B(LdaSmi), I8(1),
|
|
/* 100 S> */ B(Return),
|
|
/* 105 S> */ B(Ldar), R(arg1),
|
|
/* 111 E> */ B(TestGreaterThan), R(arg0), U8(3),
|
|
B(JumpIfFalse), U8(5),
|
|
/* 118 S> */ B(LdaSmi), I8(1),
|
|
/* 127 S> */ B(Return),
|
|
/* 132 S> */ B(Ldar), R(arg1),
|
|
/* 138 E> */ B(TestLessThanOrEqual), R(arg0), U8(4),
|
|
B(JumpIfFalse), U8(5),
|
|
/* 146 S> */ B(LdaSmi), I8(1),
|
|
/* 155 S> */ B(Return),
|
|
/* 160 S> */ B(Ldar), R(arg1),
|
|
/* 166 E> */ B(TestGreaterThanOrEqual), R(arg0), U8(5),
|
|
B(JumpIfFalse), U8(5),
|
|
/* 174 S> */ B(LdaSmi), I8(1),
|
|
/* 183 S> */ B(Return),
|
|
/* 188 S> */ B(Ldar), R(arg1),
|
|
/* 194 E> */ B(TestIn), R(arg0),
|
|
B(JumpIfFalse), U8(5),
|
|
/* 202 S> */ B(LdaSmi), I8(1),
|
|
/* 211 S> */ B(Return),
|
|
/* 216 S> */ B(Ldar), R(arg1),
|
|
/* 222 E> */ B(TestInstanceOf), R(arg0), U8(6),
|
|
B(JumpIfFalse), U8(5),
|
|
/* 238 S> */ B(LdaSmi), I8(1),
|
|
/* 247 S> */ B(Return),
|
|
/* 252 S> */ B(LdaZero),
|
|
/* 261 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function f() {
|
|
var a = 0;
|
|
if (a) {
|
|
return 20;
|
|
} else {
|
|
return -20;
|
|
}
|
|
};
|
|
f();
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 14
|
|
bytecodes: [
|
|
/* 10 E> */ B(StackCheck),
|
|
/* 25 S> */ B(LdaZero),
|
|
B(Star), R(0),
|
|
/* 30 S> */ B(JumpIfToBooleanFalse), U8(5),
|
|
/* 43 S> */ B(LdaSmi), I8(20),
|
|
/* 53 S> */ B(Return),
|
|
/* 69 S> */ B(LdaSmi), I8(-20),
|
|
/* 80 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 85 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
function f(a, b) {
|
|
if (a == b || a < 0) {
|
|
return 1;
|
|
} else if (a > 0 && b > 0) {
|
|
return 0;
|
|
} else {
|
|
return -1;
|
|
}
|
|
};
|
|
f(-1, 1);
|
|
"
|
|
frame size: 0
|
|
parameter count: 3
|
|
bytecode array length: 36
|
|
bytecodes: [
|
|
/* 10 E> */ B(StackCheck),
|
|
/* 21 S> */ B(Ldar), R(arg1),
|
|
/* 27 E> */ B(TestEqual), R(arg0), U8(0),
|
|
B(JumpIfTrue), U8(8),
|
|
B(LdaZero),
|
|
/* 37 E> */ B(TestLessThan), R(arg0), U8(1),
|
|
B(JumpIfFalse), U8(5),
|
|
/* 48 S> */ B(LdaSmi), I8(1),
|
|
/* 57 S> */ B(Return),
|
|
/* 67 S> */ B(LdaZero),
|
|
/* 73 E> */ B(TestGreaterThan), R(arg0), U8(2),
|
|
B(JumpIfFalse), U8(10),
|
|
B(LdaZero),
|
|
/* 82 E> */ B(TestGreaterThan), R(arg1), U8(3),
|
|
B(JumpIfFalse), U8(4),
|
|
/* 93 S> */ B(LdaZero),
|
|
/* 102 S> */ B(Return),
|
|
/* 118 S> */ B(LdaSmi), I8(-1),
|
|
/* 128 S> */ B(Return),
|
|
B(LdaUndefined),
|
|
/* 133 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|