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

Unified Diff: src/d8.js

Issue 119108: Add more debugging information to scripts compiled through eval (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/d8.cc ('k') | src/debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.js
===================================================================
--- src/d8.js (revision 2090)
+++ src/d8.js (working copy)
@@ -93,6 +93,13 @@
Normal: 2 };
+// The different types of script compilations matching enum
+// Script::CompilationType in objects.h.
+Debug.ScriptCompilationType = { Host: 0,
+ Eval: 1,
+ JSON: 2 };
+
+
// Current debug state.
const kNoFrame = -1;
Debug.State = {
@@ -963,7 +970,18 @@
if (body[i].name) {
result += body[i].name;
} else {
- result += '[unnamed] ';
+ if (body[i].compilationType == Debug.ScriptCompilationType.Eval) {
+ result += 'eval from ';
+ var script_value = response.lookup(body[i].evalFromScript.ref);
+ result += ' ' + script_value.field('name');
+ result += ':' + (body[i].evalFromLocation.line + 1);
+ result += ':' + body[i].evalFromLocation.column;
+ } else if (body[i].compilationType ==
+ Debug.ScriptCompilationType.JSON) {
+ result += 'JSON ';
+ } else { // body[i].compilation == Debug.ScriptCompilationType.Host
+ result += '[unnamed] ';
+ }
}
result += ' (lines: ';
result += body[i].lineCount;
@@ -1126,6 +1144,15 @@
/**
+ * Get a metadata field from a protocol value.
+ * @return {Object} the metadata field value
+ */
+ProtocolValue.prototype.field = function(name) {
+ return this.value_[name];
+}
+
+
+/**
* Check is the value is a primitive value.
* @return {boolean} true if the value is primitive
*/
« no previous file with comments | « src/d8.cc ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698