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

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

Issue 736583007: Enable "strict mode"; for debugger scripts (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « src/debug-debugger.js ('k') | no next file » | 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 // 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 5
5 // Handle id counters. 6 // Handle id counters.
6 var next_handle_ = 0; 7 var next_handle_ = 0;
7 var next_transient_handle_ = -1; 8 var next_transient_handle_ = -1;
8 9
9 // Mirror cache. 10 // Mirror cache.
10 var mirror_cache_ = []; 11 var mirror_cache_ = [];
11 var mirror_cache_enabled_ = true; 12 var mirror_cache_enabled_ = true;
12 13
13 14
(...skipping 23 matching lines...) Expand all
37 * @param {value or Object} value the value or object to retreive the mirror for 38 * @param {value or Object} value the value or object to retreive the mirror for
38 * @param {boolean} transient indicate whether this object is transient and 39 * @param {boolean} transient indicate whether this object is transient and
39 * should not be added to the mirror cache. The default is not transient. 40 * should not be added to the mirror cache. The default is not transient.
40 * @returns {Mirror} the mirror reflects the passed value or object 41 * @returns {Mirror} the mirror reflects the passed value or object
41 */ 42 */
42 function MakeMirror(value, opt_transient) { 43 function MakeMirror(value, opt_transient) {
43 var mirror; 44 var mirror;
44 45
45 // Look for non transient mirrors in the mirror cache. 46 // Look for non transient mirrors in the mirror cache.
46 if (!opt_transient && mirror_cache_enabled_) { 47 if (!opt_transient && mirror_cache_enabled_) {
47 for (id in mirror_cache_) { 48 for (var id in mirror_cache_) {
48 mirror = mirror_cache_[id]; 49 mirror = mirror_cache_[id];
49 if (mirror.value() === value) { 50 if (mirror.value() === value) {
50 return mirror; 51 return mirror;
51 } 52 }
52 // Special check for NaN as NaN == NaN is false. 53 // Special check for NaN as NaN == NaN is false.
53 if (mirror.isNumber() && isNaN(mirror.value()) && 54 if (mirror.isNumber() && isNaN(mirror.value()) &&
54 typeof value == 'number' && isNaN(value)) { 55 typeof value == 'number' && isNaN(value)) {
55 return mirror; 56 return mirror;
56 } 57 }
57 } 58 }
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 */ 1282 */
1282 ErrorMirror.prototype.message = function() { 1283 ErrorMirror.prototype.message = function() {
1283 return this.value_.message; 1284 return this.value_.message;
1284 }; 1285 };
1285 1286
1286 1287
1287 ErrorMirror.prototype.toText = function() { 1288 ErrorMirror.prototype.toText = function() {
1288 // Use the same text representation as in messages.js. 1289 // Use the same text representation as in messages.js.
1289 var text; 1290 var text;
1290 try { 1291 try {
1291 str = %_CallFunction(this.value_, builtins.ErrorToString); 1292 text = %_CallFunction(this.value_, builtins.ErrorToString);
1292 } catch (e) { 1293 } catch (e) {
1293 str = '#<Error>'; 1294 text = '#<Error>';
1294 } 1295 }
1295 return str; 1296 return text;
1296 }; 1297 };
1297 1298
1298 1299
1299 /** 1300 /**
1300 * Mirror object for a Promise object. 1301 * Mirror object for a Promise object.
1301 * @param {Object} value The Promise object 1302 * @param {Object} value The Promise object
1302 * @constructor 1303 * @constructor
1303 * @extends ObjectMirror 1304 * @extends ObjectMirror
1304 */ 1305 */
1305 function PromiseMirror(value) { 1306 function PromiseMirror(value) {
(...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after
3034 } 3035 }
3035 if (!NUMBER_IS_FINITE(value)) { 3036 if (!NUMBER_IS_FINITE(value)) {
3036 if (value > 0) { 3037 if (value > 0) {
3037 return 'Infinity'; 3038 return 'Infinity';
3038 } else { 3039 } else {
3039 return '-Infinity'; 3040 return '-Infinity';
3040 } 3041 }
3041 } 3042 }
3042 return value; 3043 return value;
3043 } 3044 }
OLDNEW
« no previous file with comments | « src/debug-debugger.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698