v8/test/unittests
Benedikt Meurer f19c4a594f [turbofan] ReceiverOrNullOrUndefined feedback for JSEqual.
This changes the ReceiverOrOddball feedback on JSStrictEqual to
ReceiverOrNullOrUndefined feedback, which can also safely be
consumed by JSEqual (we cannot generally accept any oddball here
since booleans trigger implicit conversions, unfortunately).
Thus we replace the previously introduced CheckReceiverOrOddball
with CheckReceiverOrNullOrUndefined, and drop CheckOddball, since
we will no longer collect Oddball feedback separately.

TurboFan will then turn a JSEqual[ReceiverOrNullOrUndefined] into
a sequence like this:

```
left = CheckReceiverOrNullOrUndefined(left);
right = CheckReceiverOrNullOrUndefined(right);
result = if ObjectIsUndetectable(left) then
           ObjectIsUndetectable(right)
         else
           ReferenceEqual(left, right);
```

This significantly improves the peak performance of abstract equality
with Receiver, Null or Undefined inputs. On the test case outlined in
http://crbug.com/v8/8356 we go from

  naive: 2946 ms.
  tenary: 2134 ms.

to

  naive: 2230 ms.
  tenary: 2250 ms.

which corresponds to a 25% improvement on the abstract equality case.
For regular code this will probably yield more performance, since we
get rid of the JSEqual operator, which might have arbitrary side
effects and thus blocks all kinds of TurboFan optimizations. The
JSStrictEqual case is slightly slower now, since it has to rule out
booleans as well (even though that's not strictly necessary, but
consistency is key here).

This way developers can safely use `a == b` instead of doing a dance
like `a == null ? b == null : a === b` (which is what dart2js does
right now) when both `a` and `b` are known to be Receiver, Null or
Undefined. The abstract equality is not only faster to parse than
the tenary, but also generates a shorter bytecode sequence. In the
test case referenced in http://crbug.com/v8/8356 the bytecode for
`naive` is

```
StackCheck
Ldar a1
TestEqual a0, [0]
JumpIfFalse [5]
LdaSmi [1]
Return
LdaSmi [2]
Return
```

which is 14 bytes, whereas the `tenary` function generates

```
StackCheck
Ldar a0
TestUndetectable
JumpIfFalse [7]
Ldar a1
TestUndetectable
Jump [7]
Ldar a1
TestEqualStrict a0, [0]
JumpIfToBooleanFalse [5]
LdaSmi [1]
Return
LdaSmi [2]
Return
```

which is 24 bytes. So the `naive` version is 40% smaller and requires
fewer bytecode dispatches.

Bug: chromium:898455, v8:8356
Change-Id: If3961b2518b4438700706b3bd6071d546305e233
Reviewed-on: https://chromium-review.googlesource.com/c/1297315
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56948}
2018-10-24 13:45:22 +00:00
..
api [cleanup] Refactor general tests to use default members. 2018-09-14 14:40:47 +00:00
asmjs [cleanup] Refactor base, compiler, and wasm classes to use bools instead of converting ints. 2018-09-20 09:14:25 +00:00
assembler ppc64,aix: fixed Abort() calling sequence on Aix 2018-10-03 19:40:59 +00:00
base [base] Introduce MutexGuard as typedef for LockGuard<Mutex> 2018-10-12 15:44:51 +00:00
compiler [turbofan] ReceiverOrNullOrUndefined feedback for JSEqual. 2018-10-24 13:45:22 +00:00
compiler-dispatcher [CompilerDispatcher] Add support for aborting a job. 2018-10-15 13:31:26 +00:00
heap Reland "[heap] Clean-up MemoryChunk allocation area constants." 2018-10-24 13:27:41 +00:00
interpreter Reland "[interpreter] Separate bytecodes for one-shot property loads and stores" 2018-09-27 13:56:53 +00:00
libplatform [cleanup] Mark libplatform methods in subclasses with override. 2018-09-14 16:43:37 +00:00
objects Use MicrotaskQueue class as the default microtask storage 2018-09-19 05:20:36 +00:00
parser [cleanup] Refactor general tests to use default members. 2018-09-14 14:40:47 +00:00
torque [torque] fix bug in Stack::DeleteRange 2018-10-16 09:24:45 +00:00
wasm [wasm] Do not store ModuleEnv 2018-10-23 12:47:14 +00:00
zone Fix a bug in ZoneChunkList::Find() at chunk boundaries. 2018-08-22 09:37:41 +00:00
allocation-unittest.cc [cleanup] Mark test/ methods in subclasses with override. 2018-09-17 07:40:00 +00:00
background-compile-task-unittest.cc [Compiler] Remove CompilerDispatcherJob and use BackgroundCompileTask directly 2018-10-09 10:39:27 +00:00
bigint-unittest.cc Reland: [cleanup] Refactor the Factory 2018-04-09 19:52:22 +00:00
BUILD.gn [torque] fix bug in Stack::DeleteRange 2018-10-16 09:24:45 +00:00
cancelable-tasks-unittest.cc [cleanup] Mark test/ methods in subclasses with override. 2018-09-17 07:40:00 +00:00
char-predicates-unittest.cc
code-stub-assembler-unittest.cc Make CallInterfaceDescriptor isolate-independent 2018-06-18 15:55:53 +00:00
code-stub-assembler-unittest.h [cleanup] Refactor general tests to use default members. 2018-09-14 14:40:47 +00:00
counters-unittest.cc [cleanup] Mark test/ methods in subclasses with override. 2018-09-17 07:40:00 +00:00
DEPS
detachable-vector-unittest.cc
eh-frame-iterator-unittest.cc
eh-frame-writer-unittest.cc
locked-queue-unittest.cc
object-unittest.cc [cleanup] Introduce STRUCT_MAPS_LIST generated from STRUCT_LIST. 2018-09-21 16:10:34 +00:00
register-configuration-unittest.cc [cleanup] Mark test/ methods in subclasses with override. 2018-09-17 07:40:00 +00:00
run-all-unittests.cc [cleanup] Refactor general tests to use default members. 2018-09-14 14:40:47 +00:00
source-position-table-unittest.cc [cleanup] Refactor general tests to use default members. 2018-09-14 14:40:47 +00:00
strings-storage-unittest.cc Extend hash seed to 64 bits 2018-07-16 11:19:42 +00:00
test-helpers.cc [Compile] Refactor CompilerDispatcher for inner function compilation jobs 2018-09-20 14:06:39 +00:00
test-helpers.h [Compiler] Remove CompilerDispatcherJob and use BackgroundCompileTask directly 2018-10-09 10:39:27 +00:00
test-utils.cc Remove always-true --harmony-bigint runtime flag 2018-10-01 11:31:13 +00:00
test-utils.h [Compile] Refactor CompilerDispatcher for inner function compilation jobs 2018-09-20 14:06:39 +00:00
testcfg.py
unicode-unittest.cc Consolidate UTF-8 Vector<char> to uc16 decoding into Iterator 2018-02-20 20:04:41 +00:00
unittests.status [wasm] Skip failing test on native arm/mips 2018-09-19 06:06:58 +00:00
utils-unittest.cc [turbofan] Add --trace-turbo-filter 2018-05-16 09:33:15 +00:00
value-serializer-unittest.cc [deprecation] Deprecate ToBoolean(Local<Context>) 2018-09-24 12:02:09 +00:00