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

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

Issue 7343005: Support scope information and evaluation in optimized frames (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/runtime.h » ('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-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 const kFrameDetailsSourcePositionIndex = 5; 1243 const kFrameDetailsSourcePositionIndex = 5;
1244 const kFrameDetailsConstructCallIndex = 6; 1244 const kFrameDetailsConstructCallIndex = 6;
1245 const kFrameDetailsAtReturnIndex = 7; 1245 const kFrameDetailsAtReturnIndex = 7;
1246 const kFrameDetailsFlagsIndex = 8; 1246 const kFrameDetailsFlagsIndex = 8;
1247 const kFrameDetailsFirstDynamicIndex = 9; 1247 const kFrameDetailsFirstDynamicIndex = 9;
1248 1248
1249 const kFrameDetailsNameIndex = 0; 1249 const kFrameDetailsNameIndex = 0;
1250 const kFrameDetailsValueIndex = 1; 1250 const kFrameDetailsValueIndex = 1;
1251 const kFrameDetailsNameValueSize = 2; 1251 const kFrameDetailsNameValueSize = 2;
1252 1252
1253 const kFrameDetailsFlagDebuggerFrame = 1; 1253 const kFrameDetailsFlagDebuggerFrameMask = 1 << 0;
1254 const kFrameDetailsFlagOptimizedFrame = 2; 1254 const kFrameDetailsFlagOptimizedFrameMask = 1 << 1;
1255 const kFrameDetailsFlagInlinedFrame = 4; 1255 const kFrameDetailsFlagInlinedFrameIndexMask = 7 << 2;
1256 1256
1257 /** 1257 /**
1258 * Wrapper for the frame details information retreived from the VM. The frame 1258 * Wrapper for the frame details information retreived from the VM. The frame
1259 * details from the VM is an array with the following content. See runtime.cc 1259 * details from the VM is an array with the following content. See runtime.cc
1260 * Runtime_GetFrameDetails. 1260 * Runtime_GetFrameDetails.
1261 * 0: Id 1261 * 0: Id
1262 * 1: Receiver 1262 * 1: Receiver
1263 * 2: Function 1263 * 2: Function
1264 * 3: Argument count 1264 * 3: Argument count
1265 * 4: Local count 1265 * 4: Local count
1266 * 5: Source position 1266 * 5: Source position
1267 * 6: Construct call 1267 * 6: Construct call
1268 * 7: Is at return 1268 * 7: Is at return
1269 * 8: Flags (debugger frame, optimized frame, inlined frame) 1269 * 8: Flags (debugger frame, optimized frame, inlined frame index)
1270 * Arguments name, value 1270 * Arguments name, value
1271 * Locals name, value 1271 * Locals name, value
1272 * Return value if any 1272 * Return value if any
1273 * @param {number} break_id Current break id 1273 * @param {number} break_id Current break id
1274 * @param {number} index Frame number 1274 * @param {number} index Frame number
1275 * @constructor 1275 * @constructor
1276 */ 1276 */
1277 function FrameDetails(break_id, index) { 1277 function FrameDetails(break_id, index) {
1278 this.break_id_ = break_id; 1278 this.break_id_ = break_id;
1279 this.details_ = %GetFrameDetails(break_id, index); 1279 this.details_ = %GetFrameDetails(break_id, index);
(...skipping 25 matching lines...) Expand all
1305 1305
1306 1306
1307 FrameDetails.prototype.isAtReturn = function() { 1307 FrameDetails.prototype.isAtReturn = function() {
1308 %CheckExecutionState(this.break_id_); 1308 %CheckExecutionState(this.break_id_);
1309 return this.details_[kFrameDetailsAtReturnIndex]; 1309 return this.details_[kFrameDetailsAtReturnIndex];
1310 } 1310 }
1311 1311
1312 1312
1313 FrameDetails.prototype.isDebuggerFrame = function() { 1313 FrameDetails.prototype.isDebuggerFrame = function() {
1314 %CheckExecutionState(this.break_id_); 1314 %CheckExecutionState(this.break_id_);
1315 var f = kFrameDetailsFlagDebuggerFrame; 1315 var f = kFrameDetailsFlagDebuggerFrameMask;
1316 return (this.details_[kFrameDetailsFlagsIndex] & f) == f; 1316 return (this.details_[kFrameDetailsFlagsIndex] & f) == f;
1317 } 1317 }
1318 1318
1319 1319
1320 FrameDetails.prototype.isOptimizedFrame = function() { 1320 FrameDetails.prototype.isOptimizedFrame = function() {
1321 %CheckExecutionState(this.break_id_); 1321 %CheckExecutionState(this.break_id_);
1322 var f = kFrameDetailsFlagOptimizedFrame; 1322 var f = kFrameDetailsFlagOptimizedFrameMask;
1323 return (this.details_[kFrameDetailsFlagsIndex] & f) == f; 1323 return (this.details_[kFrameDetailsFlagsIndex] & f) == f;
1324 } 1324 }
1325 1325
1326 1326
1327 FrameDetails.prototype.isInlinedFrame = function() { 1327 FrameDetails.prototype.isInlinedFrame = function() {
1328 %CheckExecutionState(this.break_id_); 1328 return this.inlinedFrameIndex() > 0;
1329 var f = kFrameDetailsFlagInlinedFrame;
1330 return (this.details_[kFrameDetailsFlagsIndex] & f) == f;
1331 } 1329 }
1332 1330
1333 1331
1332 FrameDetails.prototype.inlinedFrameIndex = function() {
1333 %CheckExecutionState(this.break_id_);
1334 var f = kFrameDetailsFlagInlinedFrameIndexMask;
1335 return (this.details_[kFrameDetailsFlagsIndex] & f) >> 2
1336 }
1337
1338
1334 FrameDetails.prototype.argumentCount = function() { 1339 FrameDetails.prototype.argumentCount = function() {
1335 %CheckExecutionState(this.break_id_); 1340 %CheckExecutionState(this.break_id_);
1336 return this.details_[kFrameDetailsArgumentCountIndex]; 1341 return this.details_[kFrameDetailsArgumentCountIndex];
1337 } 1342 }
1338 1343
1339 1344
1340 FrameDetails.prototype.argumentName = function(index) { 1345 FrameDetails.prototype.argumentName = function(index) {
1341 %CheckExecutionState(this.break_id_); 1346 %CheckExecutionState(this.break_id_);
1342 if (index >= 0 && index < this.argumentCount()) { 1347 if (index >= 0 && index < this.argumentCount()) {
1343 return this.details_[kFrameDetailsFirstDynamicIndex + 1348 return this.details_[kFrameDetailsFirstDynamicIndex +
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 FrameMirror.prototype.isOptimizedFrame = function() { 1474 FrameMirror.prototype.isOptimizedFrame = function() {
1470 return this.details_.isOptimizedFrame(); 1475 return this.details_.isOptimizedFrame();
1471 }; 1476 };
1472 1477
1473 1478
1474 FrameMirror.prototype.isInlinedFrame = function() { 1479 FrameMirror.prototype.isInlinedFrame = function() {
1475 return this.details_.isInlinedFrame(); 1480 return this.details_.isInlinedFrame();
1476 }; 1481 };
1477 1482
1478 1483
1484 FrameMirror.prototype.inlinedFrameIndex = function() {
1485 return this.details_.inlinedFrameIndex();
1486 };
1487
1488
1479 FrameMirror.prototype.argumentCount = function() { 1489 FrameMirror.prototype.argumentCount = function() {
1480 return this.details_.argumentCount(); 1490 return this.details_.argumentCount();
1481 }; 1491 };
1482 1492
1483 1493
1484 FrameMirror.prototype.argumentName = function(index) { 1494 FrameMirror.prototype.argumentName = function(index) {
1485 return this.details_.argumentName(index); 1495 return this.details_.argumentName(index);
1486 }; 1496 };
1487 1497
1488 1498
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 return this.details_.scopeCount(); 1568 return this.details_.scopeCount();
1559 }; 1569 };
1560 1570
1561 1571
1562 FrameMirror.prototype.scope = function(index) { 1572 FrameMirror.prototype.scope = function(index) {
1563 return new ScopeMirror(this, index); 1573 return new ScopeMirror(this, index);
1564 }; 1574 };
1565 1575
1566 1576
1567 FrameMirror.prototype.evaluate = function(source, disable_break, opt_context_obj ect) { 1577 FrameMirror.prototype.evaluate = function(source, disable_break, opt_context_obj ect) {
1568 var result = %DebugEvaluate(this.break_id_, this.details_.frameId(), 1578 var result = %DebugEvaluate(this.break_id_,
1569 source, Boolean(disable_break), opt_context_object ); 1579 this.details_.frameId(),
1580 this.details_.inlinedFrameIndex(),
1581 source,
1582 Boolean(disable_break),
1583 opt_context_object);
1570 return MakeMirror(result); 1584 return MakeMirror(result);
1571 }; 1585 };
1572 1586
1573 1587
1574 FrameMirror.prototype.invocationText = function() { 1588 FrameMirror.prototype.invocationText = function() {
1575 // Format frame invoaction (receiver, function and arguments). 1589 // Format frame invoaction (receiver, function and arguments).
1576 var result = ''; 1590 var result = '';
1577 var func = this.func(); 1591 var func = this.func();
1578 var receiver = this.receiver(); 1592 var receiver = this.receiver();
1579 if (this.isConstructCall()) { 1593 if (this.isConstructCall()) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 } 1726 }
1713 1727
1714 1728
1715 const kScopeDetailsTypeIndex = 0; 1729 const kScopeDetailsTypeIndex = 0;
1716 const kScopeDetailsObjectIndex = 1; 1730 const kScopeDetailsObjectIndex = 1;
1717 1731
1718 function ScopeDetails(frame, index) { 1732 function ScopeDetails(frame, index) {
1719 this.break_id_ = frame.break_id_; 1733 this.break_id_ = frame.break_id_;
1720 this.details_ = %GetScopeDetails(frame.break_id_, 1734 this.details_ = %GetScopeDetails(frame.break_id_,
1721 frame.details_.frameId(), 1735 frame.details_.frameId(),
1736 frame.details_.inlinedFrameIndex(),
1722 index); 1737 index);
1723 } 1738 }
1724 1739
1725 1740
1726 ScopeDetails.prototype.type = function() { 1741 ScopeDetails.prototype.type = function() {
1727 %CheckExecutionState(this.break_id_); 1742 %CheckExecutionState(this.break_id_);
1728 return this.details_[kScopeDetailsTypeIndex]; 1743 return this.details_[kScopeDetailsTypeIndex];
1729 } 1744 }
1730 1745
1731 1746
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 } 2417 }
2403 if (!NUMBER_IS_FINITE(value)) { 2418 if (!NUMBER_IS_FINITE(value)) {
2404 if (value > 0) { 2419 if (value > 0) {
2405 return 'Infinity'; 2420 return 'Infinity';
2406 } else { 2421 } else {
2407 return '-Infinity'; 2422 return '-Infinity';
2408 } 2423 }
2409 } 2424 }
2410 return value; 2425 return value;
2411 } 2426 }
OLDNEW
« no previous file with comments | « no previous file | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698