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

Side by Side Diff: src/inspector/debugger-script.js

Issue 2415073003: [debug] [reland] Consistently use script from FrameMirror (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | src/inspector/debugger_script_externs.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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 var scopeObject = DebuggerScript._buildScopeObject(scopeTypes[i] , scopeObjects[i]); 486 var scopeObject = DebuggerScript._buildScopeObject(scopeTypes[i] , scopeObjects[i]);
487 if (scopeObject) { 487 if (scopeObject) {
488 scopeTypes[j] = scopeTypes[i]; 488 scopeTypes[j] = scopeTypes[i];
489 scopeNames[j] = scopeNames[i]; 489 scopeNames[j] = scopeNames[i];
490 scopeChain[j] = scopeObject; 490 scopeChain[j] = scopeObject;
491 491
492 var funcMirror = scopeFunctions ? MakeMirror(scopeFunctions[ i]) : null; 492 var funcMirror = scopeFunctions ? MakeMirror(scopeFunctions[ i]) : null;
493 if (!funcMirror || !funcMirror.isFunction()) 493 if (!funcMirror || !funcMirror.isFunction())
494 funcMirror = new UnresolvedFunctionMirror(funcObject); 494 funcMirror = new UnresolvedFunctionMirror(funcObject);
495 495
496 var script = /** @type {!FunctionMirror} */(funcMirror).scri pt(); 496 var script = /** @type {!FunctionMirror} */(funcMirror).scri pt();
kozy 2016/10/13 16:06:18 Does WASM frame contain scope chain? If yes, then
Clemens Hammacher 2016/10/14 10:22:50 No, there is no scope chain for WASM frames. Also,
497 scopeStartLocations[j] = createLocation(script, scopeStartPo sitions[i]); 497 scopeStartLocations[j] = createLocation(script, scopeStartPo sitions[i]);
498 scopeEndLocations[j] = createLocation(script, scopeEndPositi ons[i]); 498 scopeEndLocations[j] = createLocation(script, scopeEndPositi ons[i]);
499 ++j; 499 ++j;
500 } 500 }
501 } 501 }
502 scopeTypes.length = scopeChain.length; 502 scopeTypes.length = scopeChain.length;
503 scopeNames.length = scopeChain.length; 503 scopeNames.length = scopeChain.length;
504 scopeObjects = null; // Free for GC. 504 scopeObjects = null; // Free for GC.
505 scopeFunctions = null; 505 scopeFunctions = null;
506 scopeStartPositions = null; 506 scopeStartPositions = null;
507 scopeEndPositions = null; 507 scopeEndPositions = null;
508 } 508 }
509 return scopeChain; 509 return scopeChain;
510 } 510 }
511 511
512 /** 512 /**
513 * @return {!JavaScriptCallFrameDetails} 513 * @return {!JavaScriptCallFrameDetails}
514 */ 514 */
515 function lazyDetails() 515 function lazyDetails()
516 { 516 {
517 if (!details) { 517 if (!details) {
518 var scopeObjects = ensureScopeChain(); 518 var scopeObjects = ensureScopeChain();
519 var script = ensureFuncMirror().script(); 519 var script = frameMirror.script();
kozy 2016/10/13 16:06:18 Please store scriptMirror at the beginning of this
Clemens Hammacher 2016/10/14 10:22:50 Done. I also removed two checks for the existence
520 /** @type {!Array<Scope>} */ 520 /** @type {!Array<Scope>} */
521 var scopes = []; 521 var scopes = [];
522 for (var i = 0; i < scopeObjects.length; ++i) { 522 for (var i = 0; i < scopeObjects.length; ++i) {
523 var scope = { 523 var scope = {
524 "type": /** @type {string} */(DebuggerScript._scopeTypeNames .get(scopeTypes[i])), 524 "type": /** @type {string} */(DebuggerScript._scopeTypeNames .get(scopeTypes[i])),
525 "object": scopeObjects[i], 525 "object": scopeObjects[i],
526 }; 526 };
527 if (scopeNames[i]) 527 if (scopeNames[i])
528 scope.name = scopeNames[i]; 528 scope.name = scopeNames[i];
529 if (scopeStartLocations[i]) 529 if (scopeStartLocations[i])
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 } 568 }
569 return /** @type {!FunctionMirror} */(funcMirror); 569 return /** @type {!FunctionMirror} */(funcMirror);
570 } 570 }
571 571
572 /** 572 /**
573 * @return {!{line: number, column: number}} 573 * @return {!{line: number, column: number}}
574 */ 574 */
575 function ensureLocation() 575 function ensureLocation()
576 { 576 {
577 if (!location) { 577 if (!location) {
578 var script = ensureFuncMirror().script(); 578 var script = frameMirror.script();
579 if (script) 579 if (script)
580 location = script.locationFromPosition(sourcePosition, true); 580 location = script.locationFromPosition(sourcePosition, true);
581 if (!location) 581 if (!location)
582 location = { line: 0, column: 0 }; 582 location = { line: 0, column: 0 };
583 } 583 }
584 return location; 584 return location;
585 } 585 }
586 586
587 /** 587 /**
588 * @return {number} 588 * @return {number}
(...skipping 24 matching lines...) Expand all
613 if (context) 613 if (context)
614 return DebuggerScript._executionContextId(context.data()); 614 return DebuggerScript._executionContextId(context.data());
615 return 0; 615 return 0;
616 } 616 }
617 617
618 /** 618 /**
619 * @return {number|undefined} 619 * @return {number|undefined}
620 */ 620 */
621 function sourceID() 621 function sourceID()
622 { 622 {
623 var script = ensureFuncMirror().script(); 623 var script = frameMirror.script();
624 return script && script.id(); 624 return script && script.id();
625 } 625 }
626 626
627 /** 627 /**
628 * @param {string} expression 628 * @param {string} expression
629 * @return {*} 629 * @return {*}
630 */ 630 */
631 function evaluate(expression) 631 function evaluate(expression)
632 { 632 {
633 return frameMirror.evaluate(expression, false).value(); 633 return frameMirror.evaluate(expression, false).value();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 break; 703 break;
704 } 704 }
705 return result; 705 return result;
706 } 706 }
707 707
708 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it. 708 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it.
709 ToggleMirrorCache(false); 709 ToggleMirrorCache(false);
710 710
711 return DebuggerScript; 711 return DebuggerScript;
712 })(); 712 })();
OLDNEW
« no previous file with comments | « no previous file | src/inspector/debugger_script_externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698