Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: src/mirror-debugger.js

Issue 1219943002: Expose SIMD.Float32x4 type to Javascript. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2006-2012 the V8 project authors. All rights reserved. 1 // Copyright 2006-2012 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 "use strict"; 4 "use strict";
5 5
6 // Handle id counters. 6 // Handle id counters.
7 var next_handle_ = 0; 7 var next_handle_ = 0;
8 var next_transient_handle_ = -1; 8 var next_transient_handle_ = -1;
9 9
10 // Mirror cache. 10 // Mirror cache.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 if (IS_UNDEFINED(value)) { 61 if (IS_UNDEFINED(value)) {
62 mirror = new UndefinedMirror(); 62 mirror = new UndefinedMirror();
63 } else if (IS_NULL(value)) { 63 } else if (IS_NULL(value)) {
64 mirror = new NullMirror(); 64 mirror = new NullMirror();
65 } else if (IS_BOOLEAN(value)) { 65 } else if (IS_BOOLEAN(value)) {
66 mirror = new BooleanMirror(value); 66 mirror = new BooleanMirror(value);
67 } else if (IS_NUMBER(value)) { 67 } else if (IS_NUMBER(value)) {
68 mirror = new NumberMirror(value); 68 mirror = new NumberMirror(value);
69 } else if (IS_FLOAT32X4(value)) {
70 mirror = new Float32x4Mirror(value);
69 } else if (IS_STRING(value)) { 71 } else if (IS_STRING(value)) {
70 mirror = new StringMirror(value); 72 mirror = new StringMirror(value);
71 } else if (IS_SYMBOL(value)) { 73 } else if (IS_SYMBOL(value)) {
72 mirror = new SymbolMirror(value); 74 mirror = new SymbolMirror(value);
73 } else if (IS_ARRAY(value)) { 75 } else if (IS_ARRAY(value)) {
74 mirror = new ArrayMirror(value); 76 mirror = new ArrayMirror(value);
75 } else if (IS_DATE(value)) { 77 } else if (IS_DATE(value)) {
76 mirror = new DateMirror(value); 78 mirror = new DateMirror(value);
77 } else if (IS_FUNCTION(value)) { 79 } else if (IS_FUNCTION(value)) {
78 mirror = new FunctionMirror(value); 80 mirror = new FunctionMirror(value);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 ctor.prototype = new tempCtor(); 146 ctor.prototype = new tempCtor();
145 ctor.prototype.constructor = ctor; 147 ctor.prototype.constructor = ctor;
146 } 148 }
147 149
148 150
149 // Type names of the different mirrors. 151 // Type names of the different mirrors.
150 var UNDEFINED_TYPE = 'undefined'; 152 var UNDEFINED_TYPE = 'undefined';
151 var NULL_TYPE = 'null'; 153 var NULL_TYPE = 'null';
152 var BOOLEAN_TYPE = 'boolean'; 154 var BOOLEAN_TYPE = 'boolean';
153 var NUMBER_TYPE = 'number'; 155 var NUMBER_TYPE = 'number';
156 var FLOAT32X4_TYPE = 'float32x4';
154 var STRING_TYPE = 'string'; 157 var STRING_TYPE = 'string';
155 var SYMBOL_TYPE = 'symbol'; 158 var SYMBOL_TYPE = 'symbol';
156 var OBJECT_TYPE = 'object'; 159 var OBJECT_TYPE = 'object';
157 var FUNCTION_TYPE = 'function'; 160 var FUNCTION_TYPE = 'function';
158 var REGEXP_TYPE = 'regexp'; 161 var REGEXP_TYPE = 'regexp';
159 var ERROR_TYPE = 'error'; 162 var ERROR_TYPE = 'error';
160 var PROPERTY_TYPE = 'property'; 163 var PROPERTY_TYPE = 'property';
161 var INTERNAL_PROPERTY_TYPE = 'internalProperty'; 164 var INTERNAL_PROPERTY_TYPE = 'internalProperty';
162 var FRAME_TYPE = 'frame'; 165 var FRAME_TYPE = 'frame';
163 var SCRIPT_TYPE = 'script'; 166 var SCRIPT_TYPE = 'script';
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 Block: 5, 207 Block: 5,
205 Script: 6 }; 208 Script: 6 };
206 209
207 210
208 // Mirror hierarchy: 211 // Mirror hierarchy:
209 // - Mirror 212 // - Mirror
210 // - ValueMirror 213 // - ValueMirror
211 // - UndefinedMirror 214 // - UndefinedMirror
212 // - NullMirror 215 // - NullMirror
213 // - NumberMirror 216 // - NumberMirror
217 // - Float32x4Mirror
214 // - StringMirror 218 // - StringMirror
215 // - SymbolMirror 219 // - SymbolMirror
216 // - ObjectMirror 220 // - ObjectMirror
217 // - FunctionMirror 221 // - FunctionMirror
218 // - UnresolvedFunctionMirror 222 // - UnresolvedFunctionMirror
219 // - ArrayMirror 223 // - ArrayMirror
220 // - DateMirror 224 // - DateMirror
221 // - RegExpMirror 225 // - RegExpMirror
222 // - ErrorMirror 226 // - ErrorMirror
223 // - PromiseMirror 227 // - PromiseMirror
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 /** 289 /**
286 * Check whether the mirror reflects a number value. 290 * Check whether the mirror reflects a number value.
287 * @returns {boolean} True if the mirror reflects a number value 291 * @returns {boolean} True if the mirror reflects a number value
288 */ 292 */
289 Mirror.prototype.isNumber = function() { 293 Mirror.prototype.isNumber = function() {
290 return this instanceof NumberMirror; 294 return this instanceof NumberMirror;
291 }; 295 };
292 296
293 297
294 /** 298 /**
299 * Check whether the mirror reflects a Float32x4 value.
300 * @returns {boolean} True if the mirror reflects a Float32x4 value
301 */
302 Mirror.prototype.isFloat32x4 = function() {
303 return this instanceof Float32x4Mirror;
304 };
305
306
307 /**
295 * Check whether the mirror reflects a string value. 308 * Check whether the mirror reflects a string value.
296 * @returns {boolean} True if the mirror reflects a string value 309 * @returns {boolean} True if the mirror reflects a string value
297 */ 310 */
298 Mirror.prototype.isString = function() { 311 Mirror.prototype.isString = function() {
299 return this instanceof StringMirror; 312 return this instanceof StringMirror;
300 }; 313 };
301 314
302 315
303 /** 316 /**
304 * Check whether the mirror reflects a symbol. 317 * Check whether the mirror reflects a symbol.
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 /** 536 /**
524 * Check whether this is a primitive value. 537 * Check whether this is a primitive value.
525 * @return {boolean} True if the mirror reflects a primitive value 538 * @return {boolean} True if the mirror reflects a primitive value
526 */ 539 */
527 ValueMirror.prototype.isPrimitive = function() { 540 ValueMirror.prototype.isPrimitive = function() {
528 var type = this.type(); 541 var type = this.type();
529 return type === 'undefined' || 542 return type === 'undefined' ||
530 type === 'null' || 543 type === 'null' ||
531 type === 'boolean' || 544 type === 'boolean' ||
532 type === 'number' || 545 type === 'number' ||
546 type === 'float32x4' ||
533 type === 'string' || 547 type === 'string' ||
534 type === 'symbol'; 548 type === 'symbol';
535 }; 549 };
536 550
537 551
538 /** 552 /**
539 * Get the actual value reflected by this mirror. 553 * Get the actual value reflected by this mirror.
540 * @return {value} The value reflected by this mirror 554 * @return {value} The value reflected by this mirror
541 */ 555 */
542 ValueMirror.prototype.value = function() { 556 ValueMirror.prototype.value = function() {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 } 618 }
605 inherits(NumberMirror, ValueMirror); 619 inherits(NumberMirror, ValueMirror);
606 620
607 621
608 NumberMirror.prototype.toText = function() { 622 NumberMirror.prototype.toText = function() {
609 return %_NumberToString(this.value_); 623 return %_NumberToString(this.value_);
610 }; 624 };
611 625
612 626
613 /** 627 /**
628 * Mirror object for Float32x4 values.
629 * @param {Float32x4} value The float32x4 value reflected by this mirror
630 * @constructor
631 * @extends ValueMirror
632 */
633 function Float32x4Mirror(value) {
634 %_CallFunction(this, Float32x4_TYPE, value, ValueMirror);
rossberg 2015/07/02 13:35:43 Isn't this spelled FLOAT32X4_TYPE?
bbudge 2015/07/06 23:59:04 Yes, thanks.
635 }
636 inherits(Float32x4Mirror, ValueMirror);
637
638
639 Float32x4Mirror.prototype.toText = function() {
640 return $float32x4ToString(this.value_);
641 };
642
643
644 /**
614 * Mirror object for string values. 645 * Mirror object for string values.
615 * @param {string} value The string value reflected by this mirror 646 * @param {string} value The string value reflected by this mirror
616 * @constructor 647 * @constructor
617 * @extends ValueMirror 648 * @extends ValueMirror
618 */ 649 */
619 function StringMirror(value) { 650 function StringMirror(value) {
620 %_CallFunction(this, STRING_TYPE, value, ValueMirror); 651 %_CallFunction(this, STRING_TYPE, value, ValueMirror);
621 } 652 }
622 inherits(StringMirror, ValueMirror); 653 inherits(StringMirror, ValueMirror);
623 654
(...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after
2568 JSONProtocolSerializer.prototype.serializeReferenceWithDisplayData_ = 2599 JSONProtocolSerializer.prototype.serializeReferenceWithDisplayData_ =
2569 function(mirror) { 2600 function(mirror) {
2570 var o = {}; 2601 var o = {};
2571 o.ref = mirror.handle(); 2602 o.ref = mirror.handle();
2572 o.type = mirror.type(); 2603 o.type = mirror.type();
2573 switch (mirror.type()) { 2604 switch (mirror.type()) {
2574 case UNDEFINED_TYPE: 2605 case UNDEFINED_TYPE:
2575 case NULL_TYPE: 2606 case NULL_TYPE:
2576 case BOOLEAN_TYPE: 2607 case BOOLEAN_TYPE:
2577 case NUMBER_TYPE: 2608 case NUMBER_TYPE:
2609 case FLOAT32X4_TYPE:
2578 o.value = mirror.value(); 2610 o.value = mirror.value();
2579 break; 2611 break;
2580 case STRING_TYPE: 2612 case STRING_TYPE:
2581 o.value = mirror.getTruncatedValue(this.maxStringLength_()); 2613 o.value = mirror.getTruncatedValue(this.maxStringLength_());
2582 break; 2614 break;
2583 case SYMBOL_TYPE: 2615 case SYMBOL_TYPE:
2584 o.description = mirror.description(); 2616 o.description = mirror.description();
2585 break; 2617 break;
2586 case FUNCTION_TYPE: 2618 case FUNCTION_TYPE:
2587 o.name = mirror.name(); 2619 o.name = mirror.name();
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
3017 } 3049 }
3018 if (!NUMBER_IS_FINITE(value)) { 3050 if (!NUMBER_IS_FINITE(value)) {
3019 if (value > 0) { 3051 if (value > 0) {
3020 return 'Infinity'; 3052 return 'Infinity';
3021 } else { 3053 } else {
3022 return '-Infinity'; 3054 return '-Infinity';
3023 } 3055 }
3024 } 3056 }
3025 return value; 3057 return value;
3026 } 3058 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698