| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 BeforeCompile: 4, | 86 BeforeCompile: 4, |
| 87 AfterCompile: 5 }; | 87 AfterCompile: 5 }; |
| 88 | 88 |
| 89 | 89 |
| 90 // The different types of scripts matching enum ScriptType in objects.h. | 90 // The different types of scripts matching enum ScriptType in objects.h. |
| 91 Debug.ScriptType = { Native: 0, | 91 Debug.ScriptType = { Native: 0, |
| 92 Extension: 1, | 92 Extension: 1, |
| 93 Normal: 2 }; | 93 Normal: 2 }; |
| 94 | 94 |
| 95 | 95 |
| 96 // The different types of script compilations matching enum |
| 97 // Script::CompilationType in objects.h. |
| 98 Debug.ScriptCompilationType = { Host: 0, |
| 99 Eval: 1, |
| 100 JSON: 2 }; |
| 101 |
| 102 |
| 96 // Current debug state. | 103 // Current debug state. |
| 97 const kNoFrame = -1; | 104 const kNoFrame = -1; |
| 98 Debug.State = { | 105 Debug.State = { |
| 99 currentFrame: kNoFrame, | 106 currentFrame: kNoFrame, |
| 100 currentSourceLine: -1 | 107 currentSourceLine: -1 |
| 101 } | 108 } |
| 102 var trace_compile = false; // Tracing all compile events? | 109 var trace_compile = false; // Tracing all compile events? |
| 103 | 110 |
| 104 | 111 |
| 105 // Process a debugger JSON message into a display text and a running status. | 112 // Process a debugger JSON message into a display text and a running status. |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 if (i != 0) result += '\n'; | 963 if (i != 0) result += '\n'; |
| 957 if (body[i].id) { | 964 if (body[i].id) { |
| 958 result += body[i].id; | 965 result += body[i].id; |
| 959 } else { | 966 } else { |
| 960 result += '[no id]'; | 967 result += '[no id]'; |
| 961 } | 968 } |
| 962 result += ', '; | 969 result += ', '; |
| 963 if (body[i].name) { | 970 if (body[i].name) { |
| 964 result += body[i].name; | 971 result += body[i].name; |
| 965 } else { | 972 } else { |
| 966 result += '[unnamed] '; | 973 if (body[i].compilationType == Debug.ScriptCompilationType.Eval) { |
| 974 result += 'eval from '; |
| 975 var script_value = response.lookup(body[i].evalFromScript.ref); |
| 976 result += ' ' + script_value.field('name'); |
| 977 result += ':' + (body[i].evalFromLocation.line + 1); |
| 978 result += ':' + body[i].evalFromLocation.column; |
| 979 } else if (body[i].compilationType == |
| 980 Debug.ScriptCompilationType.JSON) { |
| 981 result += 'JSON '; |
| 982 } else { // body[i].compilation == Debug.ScriptCompilationType.Host |
| 983 result += '[unnamed] '; |
| 984 } |
| 967 } | 985 } |
| 968 result += ' (lines: '; | 986 result += ' (lines: '; |
| 969 result += body[i].lineCount; | 987 result += body[i].lineCount; |
| 970 result += ', length: '; | 988 result += ', length: '; |
| 971 result += body[i].sourceLength; | 989 result += body[i].sourceLength; |
| 972 if (body[i].type == Debug.ScriptType.Native) { | 990 if (body[i].type == Debug.ScriptType.Native) { |
| 973 result += ', native'; | 991 result += ', native'; |
| 974 } else if (body[i].type == Debug.ScriptType.Extension) { | 992 } else if (body[i].type == Debug.ScriptType.Extension) { |
| 975 result += ', extension'; | 993 result += ', extension'; |
| 976 } | 994 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 /** | 1137 /** |
| 1120 * Get the value type. | 1138 * Get the value type. |
| 1121 * @return {String} the value type | 1139 * @return {String} the value type |
| 1122 */ | 1140 */ |
| 1123 ProtocolValue.prototype.type = function() { | 1141 ProtocolValue.prototype.type = function() { |
| 1124 return this.value_.type; | 1142 return this.value_.type; |
| 1125 } | 1143 } |
| 1126 | 1144 |
| 1127 | 1145 |
| 1128 /** | 1146 /** |
| 1147 * Get a metadata field from a protocol value. |
| 1148 * @return {Object} the metadata field value |
| 1149 */ |
| 1150 ProtocolValue.prototype.field = function(name) { |
| 1151 return this.value_[name]; |
| 1152 } |
| 1153 |
| 1154 |
| 1155 /** |
| 1129 * Check is the value is a primitive value. | 1156 * Check is the value is a primitive value. |
| 1130 * @return {boolean} true if the value is primitive | 1157 * @return {boolean} true if the value is primitive |
| 1131 */ | 1158 */ |
| 1132 ProtocolValue.prototype.isPrimitive = function() { | 1159 ProtocolValue.prototype.isPrimitive = function() { |
| 1133 return this.isUndefined() || this.isNull() || this.isBoolean() || | 1160 return this.isUndefined() || this.isNull() || this.isBoolean() || |
| 1134 this.isNumber() || this.isString(); | 1161 this.isNumber() || this.isString(); |
| 1135 } | 1162 } |
| 1136 | 1163 |
| 1137 | 1164 |
| 1138 /** | 1165 /** |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 json += NumberToJSON_(elem); | 1506 json += NumberToJSON_(elem); |
| 1480 } else if (typeof(elem) === 'string') { | 1507 } else if (typeof(elem) === 'string') { |
| 1481 json += StringToJSON_(elem); | 1508 json += StringToJSON_(elem); |
| 1482 } else { | 1509 } else { |
| 1483 json += elem; | 1510 json += elem; |
| 1484 } | 1511 } |
| 1485 } | 1512 } |
| 1486 json += ']'; | 1513 json += ']'; |
| 1487 return json; | 1514 return json; |
| 1488 } | 1515 } |
| OLD | NEW |