Reviewers: rossberg,
Description:
Add mirror debugger support for SIMD.float32x4.
LOG=N
BUG=v8:4124
Please review this at https://codereview.chromium.org/1235283005/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+71, -1 lines):
M src/mirror-debugger.js
A test/mjsunit/harmony/mirror-simd.js
Index: src/mirror-debugger.js
diff --git a/src/mirror-debugger.js b/src/mirror-debugger.js
index
dbdc68e68f88e282a88737c26dd68ea6d631ce06..e6b5781ed6b0f6ae0efe691a83b283b3f9967ac1
100644
--- a/src/mirror-debugger.js
+++ b/src/mirror-debugger.js
@@ -70,6 +70,8 @@ function MakeMirror(value, opt_transient) {
mirror = new StringMirror(value);
} else if (IS_SYMBOL(value)) {
mirror = new SymbolMirror(value);
+ } else if (IS_FLOAT32X4(value)) {
+ mirror = new Float32x4Mirror(value);
} else if (IS_ARRAY(value)) {
mirror = new ArrayMirror(value);
} else if (IS_DATE(value)) {
@@ -153,6 +155,7 @@ var BOOLEAN_TYPE = 'boolean';
var NUMBER_TYPE = 'number';
var STRING_TYPE = 'string';
var SYMBOL_TYPE = 'symbol';
+var FLOAT32X4_TYPE = 'float32x4';
var OBJECT_TYPE = 'object';
var FUNCTION_TYPE = 'function';
var REGEXP_TYPE = 'regexp';
@@ -213,6 +216,7 @@ var ScopeType = { Global: 0,
// - NumberMirror
// - StringMirror
// - SymbolMirror
+// - Float32x4Mirror
// - ObjectMirror
// - FunctionMirror
// - UnresolvedFunctionMirror
@@ -310,6 +314,15 @@ Mirror.prototype.isSymbol = function() {
/**
+ * Check whether the mirror reflects a SIMD float32x4 value.
+ * @returns {boolean} True if the mirror reflects a SIMD float32x4 value
+ */
+Mirror.prototype.isFloat32x4 = function() {
+ return this instanceof Float32x4Mirror;
+};
+
+
+/**
* Check whether the mirror reflects an object.
* @returns {boolean} True if the mirror reflects an object
*/
@@ -531,7 +544,8 @@ ValueMirror.prototype.isPrimitive = function() {
type === 'boolean' ||
type === 'number' ||
type === 'string' ||
- type === 'symbol';
+ type === 'symbol' ||
+ type === 'float32x4';
};
@@ -662,6 +676,23 @@ SymbolMirror.prototype.toText = function() {
/**
+ * Mirror object for a Float32x4 value
+ * @param {Object} value The Float32x4 value
+ * @constructor
+ * @extends Mirror
+ */
+function Float32x4Mirror(value) {
+ %_CallFunction(this, FLOAT32X4_TYPE, value, ValueMirror);
+}
+inherits(Float32x4Mirror, ValueMirror);
+
+
+Float32x4Mirror.prototype.toText = function() {
+ return %_CallFunction(this.value_, builtins.$float32x4ToString);
+}
+
+
+/**
* Mirror object for objects.
* @param {object} value The object reflected by this mirror
* @param {boolean} transient indicate whether this object is transient
with a
@@ -2592,6 +2623,7 @@
JSONProtocolSerializer.prototype.serializeReferenceWithDisplayData_ =
break;
case ERROR_TYPE:
case REGEXP_TYPE:
+ case FLOAT32X4_TYPE:
o.value = mirror.toText();
break;
case OBJECT_TYPE:
@@ -2661,6 +2693,10 @@ JSONProtocolSerializer.prototype.serialize_ =
function(mirror, reference,
content.description = mirror.description();
break;
+ case FLOAT32X4_TYPE:
+ content.value = mirror.toText();
+ break;
+
case OBJECT_TYPE:
case FUNCTION_TYPE:
case ERROR_TYPE:
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..914cd46a5e82dd59b00ef7fc010f11e7bf933150
--- /dev/null
+++ b/test/mjsunit/harmony/mirror-simd.js
@@ -0,0 +1,34 @@
+// 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 testFloat32x4Mirror(value, asText) {
+ // Create mirror and JSON representation.
+ var mirror = debug.MakeMirror(value);
+ 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.Float32x4Mirror);
+
+ // Check the mirror properties.
+ assertTrue(mirror.isFloat32x4());
+ assertEquals('float32x4', mirror.type());
+ assertTrue(mirror.isPrimitive());
+ assertSame(value, mirror.value());
+ assertEquals(asText, mirror.toText());
+
+ // Parse JSON representation and check.
+ var fromJSON = eval('(' + json + ')');
+ assertEquals('float32x4', fromJSON.type);
+}
+
+testFloat32x4Mirror(
+ SIMD.float32x4(1.25, 2.5, 3, 4), "Float32x4(1.25, 2.5, 3, 4)");
+// -0 prints as 0.
+testFloat32x4Mirror(SIMD.float32x4(0, -0, NaN, 1), "Float32x4(0, 0, NaN,
1)");
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.