mirror of
				https://github.com/tc39/test262.git
				synced 2025-10-28 10:13:55 +01:00 
			
		
		
		
	sourceRevisionAtLastExport: 33f2fb0e53d135f0ee17cfccd9d993eb2a6f47de targetRevisionAtLastExport: 31340cbd9add103f586d501b0c3354b7b182abc0
		
			
				
	
	
		
			175 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			175 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| // Copyright 2017 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
 | |
| 
 | |
| (function() {
 | |
|   function foo(o) { return Object.is(o, -0); }
 | |
|   assertTrue(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertFalse(foo(NaN));
 | |
|   assertFalse(foo(''));
 | |
|   assertFalse(foo([]));
 | |
|   assertFalse(foo({}));
 | |
|   %OptimizeFunctionOnNextCall(foo);
 | |
|   assertTrue(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertFalse(foo(NaN));
 | |
|   assertFalse(foo(''));
 | |
|   assertFalse(foo([]));
 | |
|   assertFalse(foo({}));
 | |
| })();
 | |
| 
 | |
| (function() {
 | |
|   function foo(o) { return Object.is(-0, o); }
 | |
|   assertTrue(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertFalse(foo(NaN));
 | |
|   assertFalse(foo(''));
 | |
|   assertFalse(foo([]));
 | |
|   assertFalse(foo({}));
 | |
|   %OptimizeFunctionOnNextCall(foo);
 | |
|   assertTrue(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertFalse(foo(NaN));
 | |
|   assertFalse(foo(''));
 | |
|   assertFalse(foo([]));
 | |
|   assertFalse(foo({}));
 | |
| })();
 | |
| 
 | |
| (function() {
 | |
|   function foo(o) { return Object.is(+o, -0); }
 | |
|   assertTrue(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertFalse(foo(NaN));
 | |
|   %OptimizeFunctionOnNextCall(foo);
 | |
|   assertTrue(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertFalse(foo(NaN));
 | |
| })();
 | |
| 
 | |
| (function() {
 | |
|   function foo(o) { return Object.is(-0, +o); }
 | |
|   assertTrue(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertFalse(foo(NaN));
 | |
|   %OptimizeFunctionOnNextCall(foo);
 | |
|   assertTrue(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertFalse(foo(NaN));
 | |
| })();
 | |
| 
 | |
| (function() {
 | |
|   function foo(o) { return Object.is(o, NaN); }
 | |
|   assertFalse(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertTrue(foo(NaN));
 | |
|   assertFalse(foo(''));
 | |
|   assertFalse(foo([]));
 | |
|   assertFalse(foo({}));
 | |
|   %OptimizeFunctionOnNextCall(foo);
 | |
|   assertFalse(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertTrue(foo(NaN));
 | |
|   assertFalse(foo(''));
 | |
|   assertFalse(foo([]));
 | |
|   assertFalse(foo({}));
 | |
| })();
 | |
| 
 | |
| (function() {
 | |
|   function foo(o) { return Object.is(NaN, o); }
 | |
|   assertFalse(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertTrue(foo(NaN));
 | |
|   assertFalse(foo(''));
 | |
|   assertFalse(foo([]));
 | |
|   assertFalse(foo({}));
 | |
|   %OptimizeFunctionOnNextCall(foo);
 | |
|   assertFalse(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertTrue(foo(NaN));
 | |
|   assertFalse(foo(''));
 | |
|   assertFalse(foo([]));
 | |
|   assertFalse(foo({}));
 | |
| })();
 | |
| 
 | |
| (function() {
 | |
|   function foo(o) { return Object.is(+o, NaN); }
 | |
|   assertFalse(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertTrue(foo(NaN));
 | |
|   %OptimizeFunctionOnNextCall(foo);
 | |
|   assertFalse(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertTrue(foo(NaN));
 | |
| })();
 | |
| 
 | |
| (function() {
 | |
|   function foo(o) { return Object.is(NaN, +o); }
 | |
|   assertFalse(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertTrue(foo(NaN));
 | |
|   %OptimizeFunctionOnNextCall(foo);
 | |
|   assertFalse(foo(-0));
 | |
|   assertFalse(foo(0));
 | |
|   assertTrue(foo(NaN));
 | |
| })();
 | |
| 
 | |
| (function() {
 | |
|   function foo(o) { return Object.is(`${o}`, "foo"); }
 | |
|   assertFalse(foo("bar"));
 | |
|   assertTrue(foo("foo"));
 | |
|   %OptimizeFunctionOnNextCall(foo);
 | |
|   assertFalse(foo("bar"));
 | |
|   assertTrue(foo("foo"));
 | |
| })();
 | |
| 
 | |
| (function() {
 | |
|   function foo(o) { return Object.is(String(o), "foo"); }
 | |
|   assertFalse(foo("bar"));
 | |
|   assertTrue(foo("foo"));
 | |
|   %OptimizeFunctionOnNextCall(foo);
 | |
|   assertFalse(foo("bar"));
 | |
|   assertTrue(foo("foo"));
 | |
| })();
 | |
| 
 | |
| (function() {
 | |
|   function foo(o) { return Object.is(o, o); }
 | |
|   assertTrue(foo(-0));
 | |
|   assertTrue(foo(0));
 | |
|   assertTrue(foo(NaN));
 | |
|   assertTrue(foo(''));
 | |
|   assertTrue(foo([]));
 | |
|   assertTrue(foo({}));
 | |
|   %OptimizeFunctionOnNextCall(foo);
 | |
|   assertTrue(foo(-0));
 | |
|   assertTrue(foo(0));
 | |
|   assertTrue(foo(NaN));
 | |
|   assertTrue(foo(''));
 | |
|   assertTrue(foo([]));
 | |
|   assertTrue(foo({}));
 | |
| })();
 | |
| 
 | |
| (function() {
 | |
|   function foo(o) { return Object.is(o|0, 0); }
 | |
|   assertTrue(foo(0));
 | |
|   assertTrue(foo(-0));
 | |
|   assertTrue(foo(NaN));
 | |
|   assertFalse(foo(1));
 | |
|   %OptimizeFunctionOnNextCall(foo);
 | |
|   assertTrue(foo(0));
 | |
|   assertTrue(foo(-0));
 | |
|   assertTrue(foo(NaN));
 | |
|   assertFalse(foo(1));
 | |
| })();
 | |
| 
 | |
| (function() {
 | |
|   const s = Symbol();
 | |
|   function foo() { return Object.is(s, Symbol()); }
 | |
|   assertFalse(foo());
 | |
|   assertFalse(foo());
 | |
|   %OptimizeFunctionOnNextCall(foo);
 | |
|   assertFalse(foo());
 | |
| })();
 |