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

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

Issue 258823012: Expose promise value through promise mirror. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/es6/mirror-promises.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2012 the V8 project authors. All rights reserved. 1 // Copyright 2006-2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 1209
1210 1210
1211 PromiseMirror.prototype.status = function() { 1211 PromiseMirror.prototype.status = function() {
1212 var status = %GetPromiseStatus(this.value_); 1212 var status = %GetPromiseStatus(this.value_);
1213 if (status == 0) return "pending"; 1213 if (status == 0) return "pending";
1214 if (status == 1) return "resolved"; 1214 if (status == 1) return "resolved";
1215 return "rejected"; 1215 return "rejected";
1216 }; 1216 };
1217 1217
1218 1218
1219 PromiseMirror.prototype.promiseValue = function() {
1220 return %GetPromiseValue(this.value_);
1221 };
1222
1223
1219 /** 1224 /**
1220 * Base mirror object for properties. 1225 * Base mirror object for properties.
1221 * @param {ObjectMirror} mirror The mirror object having this property 1226 * @param {ObjectMirror} mirror The mirror object having this property
1222 * @param {string} name The name of the property 1227 * @param {string} name The name of the property
1223 * @param {Array} details Details about the property 1228 * @param {Array} details Details about the property
1224 * @constructor 1229 * @constructor
1225 * @extends Mirror 1230 * @extends Mirror
1226 */ 1231 */
1227 function PropertyMirror(mirror, name, details) { 1232 function PropertyMirror(mirror, name, details) {
1228 %_CallFunction(this, PROPERTY_TYPE, Mirror); 1233 %_CallFunction(this, PROPERTY_TYPE, Mirror);
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 } 2531 }
2527 2532
2528 if (mirror.isDate()) { 2533 if (mirror.isDate()) {
2529 // Add date specific properties. 2534 // Add date specific properties.
2530 content.value = mirror.value(); 2535 content.value = mirror.value();
2531 } 2536 }
2532 2537
2533 if (mirror.isPromise()) { 2538 if (mirror.isPromise()) {
2534 // Add promise specific properties. 2539 // Add promise specific properties.
2535 content.status = mirror.status(); 2540 content.status = mirror.status();
2541 content.promiseValue = mirror.promiseValue();
2536 } 2542 }
2537 2543
2538 // Add actual properties - named properties followed by indexed properties. 2544 // Add actual properties - named properties followed by indexed properties.
2539 var propertyNames = mirror.propertyNames(PropertyKind.Named); 2545 var propertyNames = mirror.propertyNames(PropertyKind.Named);
2540 var propertyIndexes = mirror.propertyNames(PropertyKind.Indexed); 2546 var propertyIndexes = mirror.propertyNames(PropertyKind.Indexed);
2541 var p = new Array(propertyNames.length + propertyIndexes.length); 2547 var p = new Array(propertyNames.length + propertyIndexes.length);
2542 for (var i = 0; i < propertyNames.length; i++) { 2548 for (var i = 0; i < propertyNames.length; i++) {
2543 var propertyMirror = mirror.property(propertyNames[i]); 2549 var propertyMirror = mirror.property(propertyNames[i]);
2544 p[i] = this.serializeProperty_(propertyMirror); 2550 p[i] = this.serializeProperty_(propertyMirror);
2545 if (details) { 2551 if (details) {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 } 2739 }
2734 if (!NUMBER_IS_FINITE(value)) { 2740 if (!NUMBER_IS_FINITE(value)) {
2735 if (value > 0) { 2741 if (value > 0) {
2736 return 'Infinity'; 2742 return 'Infinity';
2737 } else { 2743 } else {
2738 return '-Infinity'; 2744 return '-Infinity';
2739 } 2745 }
2740 } 2746 }
2741 return value; 2747 return value;
2742 } 2748 }
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/mirror-promises.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698