OLD | NEW |
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 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 } else if (request.command == 'source') { | 1238 } else if (request.command == 'source') { |
1239 this.sourceRequest_(request, response); | 1239 this.sourceRequest_(request, response); |
1240 } else if (request.command == 'scripts') { | 1240 } else if (request.command == 'scripts') { |
1241 this.scriptsRequest_(request, response); | 1241 this.scriptsRequest_(request, response); |
1242 } else if (request.command == 'threads') { | 1242 } else if (request.command == 'threads') { |
1243 this.threadsRequest_(request, response); | 1243 this.threadsRequest_(request, response); |
1244 } else if (request.command == 'suspend') { | 1244 } else if (request.command == 'suspend') { |
1245 this.suspendRequest_(request, response); | 1245 this.suspendRequest_(request, response); |
1246 } else if (request.command == 'version') { | 1246 } else if (request.command == 'version') { |
1247 this.versionRequest_(request, response); | 1247 this.versionRequest_(request, response); |
| 1248 } else if (request.command == 'profile') { |
| 1249 this.profileRequest_(request, response); |
1248 } else { | 1250 } else { |
1249 throw new Error('Unknown command "' + request.command + '" in request'); | 1251 throw new Error('Unknown command "' + request.command + '" in request'); |
1250 } | 1252 } |
1251 } catch (e) { | 1253 } catch (e) { |
1252 // If there is no response object created one (without command). | 1254 // If there is no response object created one (without command). |
1253 if (!response) { | 1255 if (!response) { |
1254 response = this.createResponse(); | 1256 response = this.createResponse(); |
1255 } | 1257 } |
1256 response.success = false; | 1258 response.success = false; |
1257 response.message = %ToString(e); | 1259 response.message = %ToString(e); |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 }; | 1919 }; |
1918 | 1920 |
1919 | 1921 |
1920 DebugCommandProcessor.prototype.versionRequest_ = function(request, response) { | 1922 DebugCommandProcessor.prototype.versionRequest_ = function(request, response) { |
1921 response.body = { | 1923 response.body = { |
1922 V8Version: %GetV8Version() | 1924 V8Version: %GetV8Version() |
1923 } | 1925 } |
1924 }; | 1926 }; |
1925 | 1927 |
1926 | 1928 |
| 1929 DebugCommandProcessor.prototype.profileRequest_ = function(request, response) { |
| 1930 if (!request.arguments) { |
| 1931 return response.failed('Missing arguments'); |
| 1932 } |
| 1933 var modules = parseInt(request.arguments.modules); |
| 1934 if (isNaN(modules)) { |
| 1935 return response.failed('Modules is not an integer'); |
| 1936 } |
| 1937 if (request.arguments.command == 'resume') { |
| 1938 %ProfilerResume(modules); |
| 1939 } else if (request.arguments.command == 'pause') { |
| 1940 %ProfilerPause(modules); |
| 1941 } else { |
| 1942 return response.failed('Unknown command'); |
| 1943 } |
| 1944 response.body = {}; |
| 1945 }; |
| 1946 |
| 1947 |
1927 // Check whether the previously processed command caused the VM to become | 1948 // Check whether the previously processed command caused the VM to become |
1928 // running. | 1949 // running. |
1929 DebugCommandProcessor.prototype.isRunning = function() { | 1950 DebugCommandProcessor.prototype.isRunning = function() { |
1930 return this.running_; | 1951 return this.running_; |
1931 } | 1952 } |
1932 | 1953 |
1933 | 1954 |
1934 DebugCommandProcessor.prototype.systemBreak = function(cmd, args) { | 1955 DebugCommandProcessor.prototype.systemBreak = function(cmd, args) { |
1935 return %SystemBreak(); | 1956 return %SystemBreak(); |
1936 }; | 1957 }; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2043 case 'string': | 2064 case 'string': |
2044 case 'number': | 2065 case 'number': |
2045 json = value; | 2066 json = value; |
2046 break | 2067 break |
2047 | 2068 |
2048 default: | 2069 default: |
2049 json = null; | 2070 json = null; |
2050 } | 2071 } |
2051 return json; | 2072 return json; |
2052 } | 2073 } |
OLD | NEW |