7e5a287853
Bug: v8:6344, v8:8015 Change-Id: I6d96f039b47980f9df8d06c4097b70012fce3c82 Reviewed-on: https://chromium-review.googlesource.com/1215163 Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#55741}
51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
// Copyright 2018 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
// Known symbols strict equality.
|
|
(function() {
|
|
const a = Symbol("a");
|
|
const b = Symbol("b");
|
|
|
|
function foo() { return a === b; }
|
|
|
|
assertFalse(foo());
|
|
assertFalse(foo());
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertFalse(foo());
|
|
})();
|
|
|
|
// Known symbol on one side strict equality.
|
|
(function() {
|
|
const a = Symbol("a");
|
|
const b = Symbol("b");
|
|
|
|
function foo(a) { return a === b; }
|
|
|
|
assertTrue(foo(b));
|
|
assertFalse(foo(a));
|
|
assertTrue(foo(b));
|
|
assertFalse(foo(a));
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertTrue(foo(b));
|
|
assertFalse(foo(a));
|
|
})();
|
|
|
|
// Feedback based symbol strict equality.
|
|
(function() {
|
|
const a = Symbol("a");
|
|
const b = Symbol("b");
|
|
|
|
function foo(a, b) { return a === b; }
|
|
|
|
assertTrue(foo(b, b));
|
|
assertFalse(foo(a, b));
|
|
assertTrue(foo(a, a));
|
|
assertFalse(foo(b, a));
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertTrue(foo(a, a));
|
|
assertFalse(foo(b, a));
|
|
})();
|