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

Side by Side Diff: src/debug/mirrors.js

Issue 1419813010: [runtime] Remove the very dangerous %_CallFunction intrinsic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/debug.js ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('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 // 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 4
5 (function(global, utils) { 5 (function(global, utils) {
6 "use strict"; 6 "use strict";
7 7
8 // ---------------------------------------------------------------------------- 8 // ----------------------------------------------------------------------------
9 // Imports 9 // Imports
10 10
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 /** 537 /**
538 * Base class for all value mirror objects. 538 * Base class for all value mirror objects.
539 * @param {string} type The type of the mirror 539 * @param {string} type The type of the mirror
540 * @param {value} value The value reflected by this mirror 540 * @param {value} value The value reflected by this mirror
541 * @param {boolean} transient indicate whether this object is transient with a 541 * @param {boolean} transient indicate whether this object is transient with a
542 * transient handle 542 * transient handle
543 * @constructor 543 * @constructor
544 * @extends Mirror 544 * @extends Mirror
545 */ 545 */
546 function ValueMirror(type, value, transient) { 546 function ValueMirror(type, value, transient) {
547 %_CallFunction(this, type, Mirror); 547 %_Call(Mirror, this, type);
548 this.value_ = value; 548 this.value_ = value;
549 if (!transient) { 549 if (!transient) {
550 this.allocateHandle_(); 550 this.allocateHandle_();
551 } else { 551 } else {
552 this.allocateTransientHandle_(); 552 this.allocateTransientHandle_();
553 } 553 }
554 } 554 }
555 inherits(ValueMirror, Mirror); 555 inherits(ValueMirror, Mirror);
556 556
557 557
(...skipping 25 matching lines...) Expand all
583 return this.value_; 583 return this.value_;
584 }; 584 };
585 585
586 586
587 /** 587 /**
588 * Mirror object for Undefined. 588 * Mirror object for Undefined.
589 * @constructor 589 * @constructor
590 * @extends ValueMirror 590 * @extends ValueMirror
591 */ 591 */
592 function UndefinedMirror() { 592 function UndefinedMirror() {
593 %_CallFunction(this, MirrorType.UNDEFINED_TYPE, UNDEFINED, ValueMirror); 593 %_Call(ValueMirror, this, MirrorType.UNDEFINED_TYPE, UNDEFINED);
594 } 594 }
595 inherits(UndefinedMirror, ValueMirror); 595 inherits(UndefinedMirror, ValueMirror);
596 596
597 597
598 UndefinedMirror.prototype.toText = function() { 598 UndefinedMirror.prototype.toText = function() {
599 return 'undefined'; 599 return 'undefined';
600 }; 600 };
601 601
602 602
603 /** 603 /**
604 * Mirror object for null. 604 * Mirror object for null.
605 * @constructor 605 * @constructor
606 * @extends ValueMirror 606 * @extends ValueMirror
607 */ 607 */
608 function NullMirror() { 608 function NullMirror() {
609 %_CallFunction(this, MirrorType.NULL_TYPE, null, ValueMirror); 609 %_Call(ValueMirror, this, MirrorType.NULL_TYPE, null);
610 } 610 }
611 inherits(NullMirror, ValueMirror); 611 inherits(NullMirror, ValueMirror);
612 612
613 613
614 NullMirror.prototype.toText = function() { 614 NullMirror.prototype.toText = function() {
615 return 'null'; 615 return 'null';
616 }; 616 };
617 617
618 618
619 /** 619 /**
620 * Mirror object for boolean values. 620 * Mirror object for boolean values.
621 * @param {boolean} value The boolean value reflected by this mirror 621 * @param {boolean} value The boolean value reflected by this mirror
622 * @constructor 622 * @constructor
623 * @extends ValueMirror 623 * @extends ValueMirror
624 */ 624 */
625 function BooleanMirror(value) { 625 function BooleanMirror(value) {
626 %_CallFunction(this, MirrorType.BOOLEAN_TYPE, value, ValueMirror); 626 %_Call(ValueMirror, this, MirrorType.BOOLEAN_TYPE, value);
627 } 627 }
628 inherits(BooleanMirror, ValueMirror); 628 inherits(BooleanMirror, ValueMirror);
629 629
630 630
631 BooleanMirror.prototype.toText = function() { 631 BooleanMirror.prototype.toText = function() {
632 return this.value_ ? 'true' : 'false'; 632 return this.value_ ? 'true' : 'false';
633 }; 633 };
634 634
635 635
636 /** 636 /**
637 * Mirror object for number values. 637 * Mirror object for number values.
638 * @param {number} value The number value reflected by this mirror 638 * @param {number} value The number value reflected by this mirror
639 * @constructor 639 * @constructor
640 * @extends ValueMirror 640 * @extends ValueMirror
641 */ 641 */
642 function NumberMirror(value) { 642 function NumberMirror(value) {
643 %_CallFunction(this, MirrorType.NUMBER_TYPE, value, ValueMirror); 643 %_Call(ValueMirror, this, MirrorType.NUMBER_TYPE, value);
644 } 644 }
645 inherits(NumberMirror, ValueMirror); 645 inherits(NumberMirror, ValueMirror);
646 646
647 647
648 NumberMirror.prototype.toText = function() { 648 NumberMirror.prototype.toText = function() {
649 return %_NumberToString(this.value_); 649 return %_NumberToString(this.value_);
650 }; 650 };
651 651
652 652
653 /** 653 /**
654 * Mirror object for string values. 654 * Mirror object for string values.
655 * @param {string} value The string value reflected by this mirror 655 * @param {string} value The string value reflected by this mirror
656 * @constructor 656 * @constructor
657 * @extends ValueMirror 657 * @extends ValueMirror
658 */ 658 */
659 function StringMirror(value) { 659 function StringMirror(value) {
660 %_CallFunction(this, MirrorType.STRING_TYPE, value, ValueMirror); 660 %_Call(ValueMirror, this, MirrorType.STRING_TYPE, value);
661 } 661 }
662 inherits(StringMirror, ValueMirror); 662 inherits(StringMirror, ValueMirror);
663 663
664 664
665 StringMirror.prototype.length = function() { 665 StringMirror.prototype.length = function() {
666 return this.value_.length; 666 return this.value_.length;
667 }; 667 };
668 668
669 StringMirror.prototype.getTruncatedValue = function(maxLength) { 669 StringMirror.prototype.getTruncatedValue = function(maxLength) {
670 if (maxLength != -1 && this.length() > maxLength) { 670 if (maxLength != -1 && this.length() > maxLength) {
671 return this.value_.substring(0, maxLength) + 671 return this.value_.substring(0, maxLength) +
672 '... (length: ' + this.length() + ')'; 672 '... (length: ' + this.length() + ')';
673 } 673 }
674 return this.value_; 674 return this.value_;
675 }; 675 };
676 676
677 StringMirror.prototype.toText = function() { 677 StringMirror.prototype.toText = function() {
678 return this.getTruncatedValue(kMaxProtocolStringLength); 678 return this.getTruncatedValue(kMaxProtocolStringLength);
679 }; 679 };
680 680
681 681
682 /** 682 /**
683 * Mirror object for a Symbol 683 * Mirror object for a Symbol
684 * @param {Object} value The Symbol 684 * @param {Object} value The Symbol
685 * @constructor 685 * @constructor
686 * @extends Mirror 686 * @extends Mirror
687 */ 687 */
688 function SymbolMirror(value) { 688 function SymbolMirror(value) {
689 %_CallFunction(this, MirrorType.SYMBOL_TYPE, value, ValueMirror); 689 %_Call(ValueMirror, this, MirrorType.SYMBOL_TYPE, value);
690 } 690 }
691 inherits(SymbolMirror, ValueMirror); 691 inherits(SymbolMirror, ValueMirror);
692 692
693 693
694 SymbolMirror.prototype.description = function() { 694 SymbolMirror.prototype.description = function() {
695 return %SymbolDescription(%_ValueOf(this.value_)); 695 return %SymbolDescription(%_ValueOf(this.value_));
696 } 696 }
697 697
698 698
699 SymbolMirror.prototype.toText = function() { 699 SymbolMirror.prototype.toText = function() {
700 return %_CallFunction(this.value_, SymbolToString); 700 return %_Call(SymbolToString, this.value_);
701 } 701 }
702 702
703 703
704 /** 704 /**
705 * Mirror object for objects. 705 * Mirror object for objects.
706 * @param {object} value The object reflected by this mirror 706 * @param {object} value The object reflected by this mirror
707 * @param {boolean} transient indicate whether this object is transient with a 707 * @param {boolean} transient indicate whether this object is transient with a
708 * transient handle 708 * transient handle
709 * @constructor 709 * @constructor
710 * @extends ValueMirror 710 * @extends ValueMirror
711 */ 711 */
712 function ObjectMirror(value, type, transient) { 712 function ObjectMirror(value, type, transient) {
713 type = type || MirrorType.OBJECT_TYPE; 713 type = type || MirrorType.OBJECT_TYPE;
714 %_CallFunction(this, type, value, transient, ValueMirror); 714 %_Call(ValueMirror, this, type, value, transient);
715 } 715 }
716 inherits(ObjectMirror, ValueMirror); 716 inherits(ObjectMirror, ValueMirror);
717 717
718 718
719 ObjectMirror.prototype.className = function() { 719 ObjectMirror.prototype.className = function() {
720 return %_ClassOf(this.value_); 720 return %_ClassOf(this.value_);
721 }; 721 };
722 722
723 723
724 ObjectMirror.prototype.constructorFunction = function() { 724 ObjectMirror.prototype.constructorFunction = function() {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 } 954 }
955 955
956 956
957 /** 957 /**
958 * Mirror object for functions. 958 * Mirror object for functions.
959 * @param {function} value The function object reflected by this mirror. 959 * @param {function} value The function object reflected by this mirror.
960 * @constructor 960 * @constructor
961 * @extends ObjectMirror 961 * @extends ObjectMirror
962 */ 962 */
963 function FunctionMirror(value) { 963 function FunctionMirror(value) {
964 %_CallFunction(this, value, MirrorType.FUNCTION_TYPE, ObjectMirror); 964 %_Call(ObjectMirror, this, value, MirrorType.FUNCTION_TYPE);
965 this.resolved_ = true; 965 this.resolved_ = true;
966 } 966 }
967 inherits(FunctionMirror, ObjectMirror); 967 inherits(FunctionMirror, ObjectMirror);
968 968
969 969
970 /** 970 /**
971 * Returns whether the function is resolved. 971 * Returns whether the function is resolved.
972 * @return {boolean} True if the function is resolved. Unresolved functions can 972 * @return {boolean} True if the function is resolved. Unresolved functions can
973 * only originate as functions from stack frames 973 * only originate as functions from stack frames
974 */ 974 */
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 /** 1108 /**
1109 * Mirror object for unresolved functions. 1109 * Mirror object for unresolved functions.
1110 * @param {string} value The name for the unresolved function reflected by this 1110 * @param {string} value The name for the unresolved function reflected by this
1111 * mirror. 1111 * mirror.
1112 * @constructor 1112 * @constructor
1113 * @extends ObjectMirror 1113 * @extends ObjectMirror
1114 */ 1114 */
1115 function UnresolvedFunctionMirror(value) { 1115 function UnresolvedFunctionMirror(value) {
1116 // Construct this using the ValueMirror as an unresolved function is not a 1116 // Construct this using the ValueMirror as an unresolved function is not a
1117 // real object but just a string. 1117 // real object but just a string.
1118 %_CallFunction(this, MirrorType.FUNCTION_TYPE, value, ValueMirror); 1118 %_Call(ValueMirror, this, MirrorType.FUNCTION_TYPE, value);
1119 this.propertyCount_ = 0; 1119 this.propertyCount_ = 0;
1120 this.elementCount_ = 0; 1120 this.elementCount_ = 0;
1121 this.resolved_ = false; 1121 this.resolved_ = false;
1122 } 1122 }
1123 inherits(UnresolvedFunctionMirror, FunctionMirror); 1123 inherits(UnresolvedFunctionMirror, FunctionMirror);
1124 1124
1125 1125
1126 UnresolvedFunctionMirror.prototype.className = function() { 1126 UnresolvedFunctionMirror.prototype.className = function() {
1127 return 'Function'; 1127 return 'Function';
1128 }; 1128 };
(...skipping 29 matching lines...) Expand all
1158 }; 1158 };
1159 1159
1160 1160
1161 /** 1161 /**
1162 * Mirror object for arrays. 1162 * Mirror object for arrays.
1163 * @param {Array} value The Array object reflected by this mirror 1163 * @param {Array} value The Array object reflected by this mirror
1164 * @constructor 1164 * @constructor
1165 * @extends ObjectMirror 1165 * @extends ObjectMirror
1166 */ 1166 */
1167 function ArrayMirror(value) { 1167 function ArrayMirror(value) {
1168 %_CallFunction(this, value, ObjectMirror); 1168 %_Call(ObjectMirror, this, value);
1169 } 1169 }
1170 inherits(ArrayMirror, ObjectMirror); 1170 inherits(ArrayMirror, ObjectMirror);
1171 1171
1172 1172
1173 ArrayMirror.prototype.length = function() { 1173 ArrayMirror.prototype.length = function() {
1174 return this.value_.length; 1174 return this.value_.length;
1175 }; 1175 };
1176 1176
1177 1177
1178 ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index, 1178 ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index,
(...skipping 16 matching lines...) Expand all
1195 }; 1195 };
1196 1196
1197 1197
1198 /** 1198 /**
1199 * Mirror object for dates. 1199 * Mirror object for dates.
1200 * @param {Date} value The Date object reflected by this mirror 1200 * @param {Date} value The Date object reflected by this mirror
1201 * @constructor 1201 * @constructor
1202 * @extends ObjectMirror 1202 * @extends ObjectMirror
1203 */ 1203 */
1204 function DateMirror(value) { 1204 function DateMirror(value) {
1205 %_CallFunction(this, value, ObjectMirror); 1205 %_Call(ObjectMirror, this, value);
1206 } 1206 }
1207 inherits(DateMirror, ObjectMirror); 1207 inherits(DateMirror, ObjectMirror);
1208 1208
1209 1209
1210 DateMirror.prototype.toText = function() { 1210 DateMirror.prototype.toText = function() {
1211 var s = JSONStringify(this.value_); 1211 var s = JSONStringify(this.value_);
1212 return s.substring(1, s.length - 1); // cut quotes 1212 return s.substring(1, s.length - 1); // cut quotes
1213 }; 1213 };
1214 1214
1215 1215
1216 /** 1216 /**
1217 * Mirror object for regular expressions. 1217 * Mirror object for regular expressions.
1218 * @param {RegExp} value The RegExp object reflected by this mirror 1218 * @param {RegExp} value The RegExp object reflected by this mirror
1219 * @constructor 1219 * @constructor
1220 * @extends ObjectMirror 1220 * @extends ObjectMirror
1221 */ 1221 */
1222 function RegExpMirror(value) { 1222 function RegExpMirror(value) {
1223 %_CallFunction(this, value, MirrorType.REGEXP_TYPE, ObjectMirror); 1223 %_Call(ObjectMirror, this, value, MirrorType.REGEXP_TYPE);
1224 } 1224 }
1225 inherits(RegExpMirror, ObjectMirror); 1225 inherits(RegExpMirror, ObjectMirror);
1226 1226
1227 1227
1228 /** 1228 /**
1229 * Returns the source to the regular expression. 1229 * Returns the source to the regular expression.
1230 * @return {string or undefined} The source to the regular expression 1230 * @return {string or undefined} The source to the regular expression
1231 */ 1231 */
1232 RegExpMirror.prototype.source = function() { 1232 RegExpMirror.prototype.source = function() {
1233 return this.value_.source; 1233 return this.value_.source;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 }; 1285 };
1286 1286
1287 1287
1288 /** 1288 /**
1289 * Mirror object for error objects. 1289 * Mirror object for error objects.
1290 * @param {Error} value The error object reflected by this mirror 1290 * @param {Error} value The error object reflected by this mirror
1291 * @constructor 1291 * @constructor
1292 * @extends ObjectMirror 1292 * @extends ObjectMirror
1293 */ 1293 */
1294 function ErrorMirror(value) { 1294 function ErrorMirror(value) {
1295 %_CallFunction(this, value, MirrorType.ERROR_TYPE, ObjectMirror); 1295 %_Call(ObjectMirror, this, value, MirrorType.ERROR_TYPE);
1296 } 1296 }
1297 inherits(ErrorMirror, ObjectMirror); 1297 inherits(ErrorMirror, ObjectMirror);
1298 1298
1299 1299
1300 /** 1300 /**
1301 * Returns the message for this eror object. 1301 * Returns the message for this eror object.
1302 * @return {string or undefined} The message for this eror object 1302 * @return {string or undefined} The message for this eror object
1303 */ 1303 */
1304 ErrorMirror.prototype.message = function() { 1304 ErrorMirror.prototype.message = function() {
1305 return this.value_.message; 1305 return this.value_.message;
1306 }; 1306 };
1307 1307
1308 1308
1309 ErrorMirror.prototype.toText = function() { 1309 ErrorMirror.prototype.toText = function() {
1310 // Use the same text representation as in messages.js. 1310 // Use the same text representation as in messages.js.
1311 var text; 1311 var text;
1312 try { 1312 try {
1313 text = %_CallFunction(this.value_, ErrorToString); 1313 text = %_Call(ErrorToString, this.value_);
1314 } catch (e) { 1314 } catch (e) {
1315 text = '#<Error>'; 1315 text = '#<Error>';
1316 } 1316 }
1317 return text; 1317 return text;
1318 }; 1318 };
1319 1319
1320 1320
1321 /** 1321 /**
1322 * Mirror object for a Promise object. 1322 * Mirror object for a Promise object.
1323 * @param {Object} value The Promise object 1323 * @param {Object} value The Promise object
1324 * @constructor 1324 * @constructor
1325 * @extends ObjectMirror 1325 * @extends ObjectMirror
1326 */ 1326 */
1327 function PromiseMirror(value) { 1327 function PromiseMirror(value) {
1328 %_CallFunction(this, value, MirrorType.PROMISE_TYPE, ObjectMirror); 1328 %_Call(ObjectMirror, this, value, MirrorType.PROMISE_TYPE);
1329 } 1329 }
1330 inherits(PromiseMirror, ObjectMirror); 1330 inherits(PromiseMirror, ObjectMirror);
1331 1331
1332 1332
1333 function PromiseGetStatus_(value) { 1333 function PromiseGetStatus_(value) {
1334 var status = %DebugGetProperty(value, promiseStatusSymbol); 1334 var status = %DebugGetProperty(value, promiseStatusSymbol);
1335 if (status == 0) return "pending"; 1335 if (status == 0) return "pending";
1336 if (status == 1) return "resolved"; 1336 if (status == 1) return "resolved";
1337 return "rejected"; 1337 return "rejected";
1338 } 1338 }
1339 1339
1340 1340
1341 function PromiseGetValue_(value) { 1341 function PromiseGetValue_(value) {
1342 return %DebugGetProperty(value, promiseValueSymbol); 1342 return %DebugGetProperty(value, promiseValueSymbol);
1343 } 1343 }
1344 1344
1345 1345
1346 PromiseMirror.prototype.status = function() { 1346 PromiseMirror.prototype.status = function() {
1347 return PromiseGetStatus_(this.value_); 1347 return PromiseGetStatus_(this.value_);
1348 }; 1348 };
1349 1349
1350 1350
1351 PromiseMirror.prototype.promiseValue = function() { 1351 PromiseMirror.prototype.promiseValue = function() {
1352 return MakeMirror(PromiseGetValue_(this.value_)); 1352 return MakeMirror(PromiseGetValue_(this.value_));
1353 }; 1353 };
1354 1354
1355 1355
1356 function MapMirror(value) { 1356 function MapMirror(value) {
1357 %_CallFunction(this, value, MirrorType.MAP_TYPE, ObjectMirror); 1357 %_Call(ObjectMirror, this, value, MirrorType.MAP_TYPE);
1358 } 1358 }
1359 inherits(MapMirror, ObjectMirror); 1359 inherits(MapMirror, ObjectMirror);
1360 1360
1361 1361
1362 /** 1362 /**
1363 * Returns an array of key/value pairs of a map. 1363 * Returns an array of key/value pairs of a map.
1364 * This will keep keys alive for WeakMaps. 1364 * This will keep keys alive for WeakMaps.
1365 * 1365 *
1366 * @param {number=} opt_limit Max elements to return. 1366 * @param {number=} opt_limit Max elements to return.
1367 * @returns {Array.<Object>} Array of key/value pairs of a map. 1367 * @returns {Array.<Object>} Array of key/value pairs of a map.
1368 */ 1368 */
1369 MapMirror.prototype.entries = function(opt_limit) { 1369 MapMirror.prototype.entries = function(opt_limit) {
1370 var result = []; 1370 var result = [];
1371 1371
1372 if (IS_WEAKMAP(this.value_)) { 1372 if (IS_WEAKMAP(this.value_)) {
1373 var entries = %GetWeakMapEntries(this.value_, opt_limit || 0); 1373 var entries = %GetWeakMapEntries(this.value_, opt_limit || 0);
1374 for (var i = 0; i < entries.length; i += 2) { 1374 for (var i = 0; i < entries.length; i += 2) {
1375 result.push({ 1375 result.push({
1376 key: entries[i], 1376 key: entries[i],
1377 value: entries[i + 1] 1377 value: entries[i + 1]
1378 }); 1378 });
1379 } 1379 }
1380 return result; 1380 return result;
1381 } 1381 }
1382 1382
1383 var iter = %_CallFunction(this.value_, MapEntries); 1383 var iter = %_Call(MapEntries, this.value_);
1384 var next; 1384 var next;
1385 while ((!opt_limit || result.length < opt_limit) && 1385 while ((!opt_limit || result.length < opt_limit) &&
1386 !(next = iter.next()).done) { 1386 !(next = iter.next()).done) {
1387 result.push({ 1387 result.push({
1388 key: next.value[0], 1388 key: next.value[0],
1389 value: next.value[1] 1389 value: next.value[1]
1390 }); 1390 });
1391 } 1391 }
1392 return result; 1392 return result;
1393 }; 1393 };
1394 1394
1395 1395
1396 function SetMirror(value) { 1396 function SetMirror(value) {
1397 %_CallFunction(this, value, MirrorType.SET_TYPE, ObjectMirror); 1397 %_Call(ObjectMirror, this, value, MirrorType.SET_TYPE);
1398 } 1398 }
1399 inherits(SetMirror, ObjectMirror); 1399 inherits(SetMirror, ObjectMirror);
1400 1400
1401 1401
1402 function IteratorGetValues_(iter, next_function, opt_limit) { 1402 function IteratorGetValues_(iter, next_function, opt_limit) {
1403 var result = []; 1403 var result = [];
1404 var next; 1404 var next;
1405 while ((!opt_limit || result.length < opt_limit) && 1405 while ((!opt_limit || result.length < opt_limit) &&
1406 !(next = %_CallFunction(iter, next_function)).done) { 1406 !(next = %_Call(next_function, iter)).done) {
1407 result.push(next.value); 1407 result.push(next.value);
1408 } 1408 }
1409 return result; 1409 return result;
1410 } 1410 }
1411 1411
1412 1412
1413 /** 1413 /**
1414 * Returns an array of elements of a set. 1414 * Returns an array of elements of a set.
1415 * This will keep elements alive for WeakSets. 1415 * This will keep elements alive for WeakSets.
1416 * 1416 *
1417 * @param {number=} opt_limit Max elements to return. 1417 * @param {number=} opt_limit Max elements to return.
1418 * @returns {Array.<Object>} Array of elements of a set. 1418 * @returns {Array.<Object>} Array of elements of a set.
1419 */ 1419 */
1420 SetMirror.prototype.values = function(opt_limit) { 1420 SetMirror.prototype.values = function(opt_limit) {
1421 if (IS_WEAKSET(this.value_)) { 1421 if (IS_WEAKSET(this.value_)) {
1422 return %GetWeakSetValues(this.value_, opt_limit || 0); 1422 return %GetWeakSetValues(this.value_, opt_limit || 0);
1423 } 1423 }
1424 1424
1425 var iter = %_CallFunction(this.value_, SetValues); 1425 var iter = %_Call(SetValues, this.value_);
1426 return IteratorGetValues_(iter, SetIteratorNext, opt_limit); 1426 return IteratorGetValues_(iter, SetIteratorNext, opt_limit);
1427 }; 1427 };
1428 1428
1429 1429
1430 function IteratorMirror(value) { 1430 function IteratorMirror(value) {
1431 %_CallFunction(this, value, MirrorType.ITERATOR_TYPE, ObjectMirror); 1431 %_Call(ObjectMirror, this, value, MirrorType.ITERATOR_TYPE);
1432 } 1432 }
1433 inherits(IteratorMirror, ObjectMirror); 1433 inherits(IteratorMirror, ObjectMirror);
1434 1434
1435 1435
1436 /** 1436 /**
1437 * Returns a preview of elements of an iterator. 1437 * Returns a preview of elements of an iterator.
1438 * Does not change the backing iterator state. 1438 * Does not change the backing iterator state.
1439 * 1439 *
1440 * @param {number=} opt_limit Max elements to return. 1440 * @param {number=} opt_limit Max elements to return.
1441 * @returns {Array.<Object>} Array of elements of an iterator. 1441 * @returns {Array.<Object>} Array of elements of an iterator.
(...skipping 11 matching lines...) Expand all
1453 }; 1453 };
1454 1454
1455 1455
1456 /** 1456 /**
1457 * Mirror object for a Generator object. 1457 * Mirror object for a Generator object.
1458 * @param {Object} data The Generator object 1458 * @param {Object} data The Generator object
1459 * @constructor 1459 * @constructor
1460 * @extends Mirror 1460 * @extends Mirror
1461 */ 1461 */
1462 function GeneratorMirror(value) { 1462 function GeneratorMirror(value) {
1463 %_CallFunction(this, value, MirrorType.GENERATOR_TYPE, ObjectMirror); 1463 %_Call(ObjectMirror, this, value, MirrorType.GENERATOR_TYPE);
1464 } 1464 }
1465 inherits(GeneratorMirror, ObjectMirror); 1465 inherits(GeneratorMirror, ObjectMirror);
1466 1466
1467 1467
1468 function GeneratorGetStatus_(value) { 1468 function GeneratorGetStatus_(value) {
1469 var continuation = %GeneratorGetContinuation(value); 1469 var continuation = %GeneratorGetContinuation(value);
1470 if (continuation < 0) return "running"; 1470 if (continuation < 0) return "running";
1471 if (continuation == 0) return "closed"; 1471 if (continuation == 0) return "closed";
1472 return "suspended"; 1472 return "suspended";
1473 } 1473 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 1520
1521 /** 1521 /**
1522 * Base mirror object for properties. 1522 * Base mirror object for properties.
1523 * @param {ObjectMirror} mirror The mirror object having this property 1523 * @param {ObjectMirror} mirror The mirror object having this property
1524 * @param {string} name The name of the property 1524 * @param {string} name The name of the property
1525 * @param {Array} details Details about the property 1525 * @param {Array} details Details about the property
1526 * @constructor 1526 * @constructor
1527 * @extends Mirror 1527 * @extends Mirror
1528 */ 1528 */
1529 function PropertyMirror(mirror, name, details) { 1529 function PropertyMirror(mirror, name, details) {
1530 %_CallFunction(this, MirrorType.PROPERTY_TYPE, Mirror); 1530 %_Call(Mirror, this, MirrorType.PROPERTY_TYPE);
1531 this.mirror_ = mirror; 1531 this.mirror_ = mirror;
1532 this.name_ = name; 1532 this.name_ = name;
1533 this.value_ = details[0]; 1533 this.value_ = details[0];
1534 this.details_ = details[1]; 1534 this.details_ = details[1];
1535 this.is_interceptor_ = details[2]; 1535 this.is_interceptor_ = details[2];
1536 if (details.length > 3) { 1536 if (details.length > 3) {
1537 this.exception_ = details[3]; 1537 this.exception_ = details[3];
1538 this.getter_ = details[4]; 1538 this.getter_ = details[4];
1539 this.setter_ = details[5]; 1539 this.setter_ = details[5];
1540 } 1540 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 /** 1663 /**
1664 * Mirror object for internal properties. Internal property reflects properties 1664 * Mirror object for internal properties. Internal property reflects properties
1665 * not accessible from user code such as [[BoundThis]] in bound function. 1665 * not accessible from user code such as [[BoundThis]] in bound function.
1666 * Their names are merely symbolic. 1666 * Their names are merely symbolic.
1667 * @param {string} name The name of the property 1667 * @param {string} name The name of the property
1668 * @param {value} property value 1668 * @param {value} property value
1669 * @constructor 1669 * @constructor
1670 * @extends Mirror 1670 * @extends Mirror
1671 */ 1671 */
1672 function InternalPropertyMirror(name, value) { 1672 function InternalPropertyMirror(name, value) {
1673 %_CallFunction(this, MirrorType.INTERNAL_PROPERTY_TYPE, Mirror); 1673 %_Call(Mirror, this, MirrorType.INTERNAL_PROPERTY_TYPE);
1674 this.name_ = name; 1674 this.name_ = name;
1675 this.value_ = value; 1675 this.value_ = value;
1676 } 1676 }
1677 inherits(InternalPropertyMirror, Mirror); 1677 inherits(InternalPropertyMirror, Mirror);
1678 1678
1679 1679
1680 InternalPropertyMirror.prototype.name = function() { 1680 InternalPropertyMirror.prototype.name = function() {
1681 return this.name_; 1681 return this.name_;
1682 }; 1682 };
1683 1683
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 1876
1877 /** 1877 /**
1878 * Mirror object for stack frames. 1878 * Mirror object for stack frames.
1879 * @param {number} break_id The break id in the VM for which this frame is 1879 * @param {number} break_id The break id in the VM for which this frame is
1880 valid 1880 valid
1881 * @param {number} index The frame index (top frame is index 0) 1881 * @param {number} index The frame index (top frame is index 0)
1882 * @constructor 1882 * @constructor
1883 * @extends Mirror 1883 * @extends Mirror
1884 */ 1884 */
1885 function FrameMirror(break_id, index) { 1885 function FrameMirror(break_id, index) {
1886 %_CallFunction(this, MirrorType.FRAME_TYPE, Mirror); 1886 %_Call(Mirror, this, MirrorType.FRAME_TYPE);
1887 this.break_id_ = break_id; 1887 this.break_id_ = break_id;
1888 this.index_ = index; 1888 this.index_ = index;
1889 this.details_ = new FrameDetails(break_id, index); 1889 this.details_ = new FrameDetails(break_id, index);
1890 } 1890 }
1891 inherits(FrameMirror, Mirror); 1891 inherits(FrameMirror, Mirror);
1892 1892
1893 1893
1894 FrameMirror.prototype.details = function() { 1894 FrameMirror.prototype.details = function() {
1895 return this.details_; 1895 return this.details_;
1896 }; 1896 };
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
2307 * Mirror object for scope of frame or function. Either frame or function must 2307 * Mirror object for scope of frame or function. Either frame or function must
2308 * be specified. 2308 * be specified.
2309 * @param {FrameMirror} frame The frame this scope is a part of 2309 * @param {FrameMirror} frame The frame this scope is a part of
2310 * @param {FunctionMirror} function The function this scope is a part of 2310 * @param {FunctionMirror} function The function this scope is a part of
2311 * @param {number} index The scope index in the frame 2311 * @param {number} index The scope index in the frame
2312 * @param {Array=} opt_details Raw scope details data 2312 * @param {Array=} opt_details Raw scope details data
2313 * @constructor 2313 * @constructor
2314 * @extends Mirror 2314 * @extends Mirror
2315 */ 2315 */
2316 function ScopeMirror(frame, fun, index, opt_details) { 2316 function ScopeMirror(frame, fun, index, opt_details) {
2317 %_CallFunction(this, MirrorType.SCOPE_TYPE, Mirror); 2317 %_Call(Mirror, this, MirrorType.SCOPE_TYPE);
2318 if (frame) { 2318 if (frame) {
2319 this.frame_index_ = frame.index_; 2319 this.frame_index_ = frame.index_;
2320 } else { 2320 } else {
2321 this.frame_index_ = UNDEFINED; 2321 this.frame_index_ = UNDEFINED;
2322 } 2322 }
2323 this.scope_index_ = index; 2323 this.scope_index_ = index;
2324 this.details_ = new ScopeDetails(frame, fun, index, opt_details); 2324 this.details_ = new ScopeDetails(frame, fun, index, opt_details);
2325 } 2325 }
2326 inherits(ScopeMirror, Mirror); 2326 inherits(ScopeMirror, Mirror);
2327 2327
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 }; 2362 };
2363 2363
2364 2364
2365 /** 2365 /**
2366 * Mirror object for script source. 2366 * Mirror object for script source.
2367 * @param {Script} script The script object 2367 * @param {Script} script The script object
2368 * @constructor 2368 * @constructor
2369 * @extends Mirror 2369 * @extends Mirror
2370 */ 2370 */
2371 function ScriptMirror(script) { 2371 function ScriptMirror(script) {
2372 %_CallFunction(this, MirrorType.SCRIPT_TYPE, Mirror); 2372 %_Call(Mirror, this, MirrorType.SCRIPT_TYPE);
2373 this.script_ = script; 2373 this.script_ = script;
2374 this.context_ = new ContextMirror(script.context_data); 2374 this.context_ = new ContextMirror(script.context_data);
2375 this.allocateHandle_(); 2375 this.allocateHandle_();
2376 } 2376 }
2377 inherits(ScriptMirror, Mirror); 2377 inherits(ScriptMirror, Mirror);
2378 2378
2379 2379
2380 ScriptMirror.prototype.value = function() { 2380 ScriptMirror.prototype.value = function() {
2381 return this.script_; 2381 return this.script_;
2382 }; 2382 };
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2483 }; 2483 };
2484 2484
2485 2485
2486 /** 2486 /**
2487 * Mirror object for context. 2487 * Mirror object for context.
2488 * @param {Object} data The context data 2488 * @param {Object} data The context data
2489 * @constructor 2489 * @constructor
2490 * @extends Mirror 2490 * @extends Mirror
2491 */ 2491 */
2492 function ContextMirror(data) { 2492 function ContextMirror(data) {
2493 %_CallFunction(this, MirrorType.CONTEXT_TYPE, Mirror); 2493 %_Call(Mirror, this, MirrorType.CONTEXT_TYPE);
2494 this.data_ = data; 2494 this.data_ = data;
2495 this.allocateHandle_(); 2495 this.allocateHandle_();
2496 } 2496 }
2497 inherits(ContextMirror, Mirror); 2497 inherits(ContextMirror, Mirror);
2498 2498
2499 2499
2500 ContextMirror.prototype.data = function() { 2500 ContextMirror.prototype.data = function() {
2501 return this.data_; 2501 return this.data_;
2502 }; 2502 };
2503 2503
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
3122 // Functions needed by the debugger runtime. 3122 // Functions needed by the debugger runtime.
3123 utils.InstallFunctions(utils, DONT_ENUM, [ 3123 utils.InstallFunctions(utils, DONT_ENUM, [
3124 "ClearMirrorCache", ClearMirrorCache 3124 "ClearMirrorCache", ClearMirrorCache
3125 ]); 3125 ]);
3126 3126
3127 // Export to debug.js 3127 // Export to debug.js
3128 utils.Export(function(to) { 3128 utils.Export(function(to) {
3129 to.MirrorType = MirrorType; 3129 to.MirrorType = MirrorType;
3130 }); 3130 });
3131 }) 3131 })
OLDNEW
« no previous file with comments | « src/debug/debug.js ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698