| Index: test/mjsunit/harmony/mirror-simd.js
|
| diff --git a/test/mjsunit/harmony/mirror-simd.js b/test/mjsunit/harmony/mirror-simd.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..83dc83abd7f23cac1c1492a4311fd5907208b2e5
|
| --- /dev/null
|
| +++ b/test/mjsunit/harmony/mirror-simd.js
|
| @@ -0,0 +1,54 @@
|
| +// Copyright 2015 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: --expose-debug-as debug --harmony-simd
|
| +// Test the mirror objects for SIMD values.
|
| +
|
| +function testMirror(simd_name, type_name, value_as_string) {
|
| + // Create mirror and JSON representation.
|
| + var value = eval(value_as_string);
|
| + var mirror = debug.MakeMirror(value);
|
| + for (var prop in mirror)
|
| + print(prop, mirror[prop]);
|
| + var serializer = debug.MakeMirrorSerializer();
|
| + var json = JSON.stringify(serializer.serializeValue(mirror));
|
| +
|
| + // Check the mirror hierachy.
|
| + assertTrue(mirror instanceof debug.Mirror);
|
| + assertTrue(mirror instanceof debug.ValueMirror);
|
| + assertTrue(mirror instanceof debug[simd_name + 'Mirror']);
|
| +
|
| + // Check the mirror properties.
|
| + assertTrue(mirror['is' + simd_name]());
|
| + assertEquals(type_name, mirror.type());
|
| + assertTrue(mirror.isPrimitive());
|
| + assertSame(value, mirror.value());
|
| + assertEquals(value_as_string, mirror.toText());
|
| +
|
| + // Parse JSON representation and check.
|
| + var fromJSON = eval('(' + json + ')');
|
| + assertEquals(simd_name, fromJSON.type);
|
| +}
|
| +
|
| +testMirror('Float32x4', 'float32x4', 'SIMD.Float32x4(1.25, 2.5, 3, 4)');
|
| +testMirror('Float32x4', 'float32x4', 'SIMD.Float32x4(0, 0, NaN, 1)');
|
| +
|
| +testMirror('Int32x4', 'int32x4', 'SIMD.Int32x4(1, 2, 3, 4)');
|
| +testMirror('Int16x8', 'int16x8',
|
| + 'SIMD.Int16x8(1, 2, 3, 4, 5, 6, 7, 8)');
|
| +testMirror('Int8x16', 'int8x16',
|
| + 'SIMD.Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)');
|
| +
|
| +testMirror('Uint32x4', 'uint32x4', 'SIMD.Uint32x4(1, 2, 3, 4)');
|
| +testMirror('Uint16x8', 'uint16x8',
|
| + 'SIMD.Uint16x8(1, 2, 3, 4, 5, 6, 7, 8)');
|
| +testMirror('Uint8x16', 'uint8x16',
|
| + 'SIMD.Uint8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)');
|
| +
|
| +testMirror('Bool32x4', 'bool32x4', 'SIMD.Bool32x4(true, false, true, false)');
|
| +testMirror('Bool16x8', 'bool16x8',
|
| + 'SIMD.Bool16x8(true, false, true, false, true, false, true, false)');
|
| +testMirror('Bool8x16', 'bool8x16',
|
| + 'SIMD.Bool8x16(true, false, true, false, true, false, true, false, ' +
|
| + 'true, false, true, false, true, false, true, false)');
|
|
|