| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --harmony-simd --harmony-tostring --harmony-reflect | 5 // Flags: --harmony-simd --harmony-tostring --harmony-reflect |
| 6 // Flags: --allow-natives-syntax --expose-natives-as natives --noalways-opt | 6 // Flags: --allow-natives-syntax --expose-natives-as natives --noalways-opt |
| 7 | 7 |
| 8 function lanesForType(typeName) { | 8 function lanesForType(typeName) { |
| 9 // The lane count follows the first 'x' in the type name, which begins with | 9 // The lane count follows the first 'x' in the type name, which begins with |
| 10 // 'float', 'int', or 'bool'. | 10 // 'float', 'int', or 'bool'. |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 test(true, false); | 399 test(true, false); |
| 400 test(false, true); | 400 test(false, true); |
| 401 break; | 401 break; |
| 402 } | 402 } |
| 403 } | 403 } |
| 404 | 404 |
| 405 | 405 |
| 406 function TestSameValue(type, lanes) { | 406 function TestSameValue(type, lanes) { |
| 407 var simdFn = SIMD[type]; | 407 var simdFn = SIMD[type]; |
| 408 var instance = createInstance(type); | 408 var instance = createInstance(type); |
| 409 var sameValue = natives.$sameValue; | 409 var sameValue = Object.is |
| 410 var sameValueZero = natives.$sameValueZero; | 410 var sameValueZero = natives.ImportNow("SameValueZero"); |
| 411 | 411 |
| 412 // SIMD values should not be the same as instances of different types. | 412 // SIMD values should not be the same as instances of different types. |
| 413 checkTypeMatrix(type, function(other) { | 413 checkTypeMatrix(type, function(other) { |
| 414 assertFalse(sameValue(instance, other)); | 414 assertFalse(sameValue(instance, other)); |
| 415 assertFalse(sameValueZero(instance, other)); | 415 assertFalse(sameValueZero(instance, other)); |
| 416 }); | 416 }); |
| 417 | 417 |
| 418 // Test that f(a, b) is the same as f(SIMD(a), SIMD(b)) for sameValue and | 418 // Test that f(a, b) is the same as f(SIMD(a), SIMD(b)) for sameValue and |
| 419 // sameValueZero, at every lane. | 419 // sameValueZero, at every lane. |
| 420 function test(a, b) { | 420 function test(a, b) { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 assertSame(Object.getPrototypeOf(SIMD), Object.prototype); | 611 assertSame(Object.getPrototypeOf(SIMD), Object.prototype); |
| 612 assertSame(SIMD + "", "[object SIMD]"); | 612 assertSame(SIMD + "", "[object SIMD]"); |
| 613 // The SIMD object is mutable. | 613 // The SIMD object is mutable. |
| 614 SIMD.foo = "foo"; | 614 SIMD.foo = "foo"; |
| 615 assertSame(SIMD.foo, "foo"); | 615 assertSame(SIMD.foo, "foo"); |
| 616 delete SIMD.foo; | 616 delete SIMD.foo; |
| 617 delete SIMD.Bool8x16; | 617 delete SIMD.Bool8x16; |
| 618 assertSame(SIMD.Bool8x16, undefined); | 618 assertSame(SIMD.Bool8x16, undefined); |
| 619 } | 619 } |
| 620 TestSIMDObject() | 620 TestSIMDObject() |
| OLD | NEW |