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

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

Issue 6580038: [Isolates] Merge from bleeding_edge, revisions 5934-6100. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 10 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 | « src/debug.cc ('k') | src/deoptimizer.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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 Debug.scripts = function() { 851 Debug.scripts = function() {
852 // Collect all scripts in the heap. 852 // Collect all scripts in the heap.
853 return %DebugGetLoadedScripts(); 853 return %DebugGetLoadedScripts();
854 }; 854 };
855 855
856 856
857 Debug.debuggerFlags = function() { 857 Debug.debuggerFlags = function() {
858 return debugger_flags; 858 return debugger_flags;
859 }; 859 };
860 860
861 Debug.MakeMirror = MakeMirror;
861 862
862 function MakeExecutionState(break_id) { 863 function MakeExecutionState(break_id) {
863 return new ExecutionState(break_id); 864 return new ExecutionState(break_id);
864 } 865 }
865 866
866 function ExecutionState(break_id) { 867 function ExecutionState(break_id) {
867 this.break_id = break_id; 868 this.break_id = break_id;
868 this.selected_frame = 0; 869 this.selected_frame = 0;
869 } 870 }
870 871
871 ExecutionState.prototype.prepareStep = function(opt_action, opt_count) { 872 ExecutionState.prototype.prepareStep = function(opt_action, opt_count) {
872 var action = Debug.StepAction.StepIn; 873 var action = Debug.StepAction.StepIn;
873 if (!IS_UNDEFINED(opt_action)) action = %ToNumber(opt_action); 874 if (!IS_UNDEFINED(opt_action)) action = %ToNumber(opt_action);
874 var count = opt_count ? %ToNumber(opt_count) : 1; 875 var count = opt_count ? %ToNumber(opt_count) : 1;
875 876
876 return %PrepareStep(this.break_id, action, count); 877 return %PrepareStep(this.break_id, action, count);
877 } 878 }
878 879
879 ExecutionState.prototype.evaluateGlobal = function(source, disable_break) { 880 ExecutionState.prototype.evaluateGlobal = function(source, disable_break,
880 return MakeMirror( 881 opt_additional_context) {
881 %DebugEvaluateGlobal(this.break_id, source, Boolean(disable_break))); 882 return MakeMirror(%DebugEvaluateGlobal(this.break_id, source,
883 Boolean(disable_break),
884 opt_additional_context));
882 }; 885 };
883 886
884 ExecutionState.prototype.frameCount = function() { 887 ExecutionState.prototype.frameCount = function() {
885 return %GetFrameCount(this.break_id); 888 return %GetFrameCount(this.break_id);
886 }; 889 };
887 890
888 ExecutionState.prototype.threadCount = function() { 891 ExecutionState.prototype.threadCount = function() {
889 return %GetThreadCount(this.break_id); 892 return %GetThreadCount(this.break_id);
890 }; 893 };
891 894
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { 1833 DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) {
1831 if (!request.arguments) { 1834 if (!request.arguments) {
1832 return response.failed('Missing arguments'); 1835 return response.failed('Missing arguments');
1833 } 1836 }
1834 1837
1835 // Pull out arguments. 1838 // Pull out arguments.
1836 var expression = request.arguments.expression; 1839 var expression = request.arguments.expression;
1837 var frame = request.arguments.frame; 1840 var frame = request.arguments.frame;
1838 var global = request.arguments.global; 1841 var global = request.arguments.global;
1839 var disable_break = request.arguments.disable_break; 1842 var disable_break = request.arguments.disable_break;
1843 var additional_context = request.arguments.additional_context;
1840 1844
1841 // The expression argument could be an integer so we convert it to a 1845 // The expression argument could be an integer so we convert it to a
1842 // string. 1846 // string.
1843 try { 1847 try {
1844 expression = String(expression); 1848 expression = String(expression);
1845 } catch(e) { 1849 } catch(e) {
1846 return response.failed('Failed to convert expression argument to string'); 1850 return response.failed('Failed to convert expression argument to string');
1847 } 1851 }
1848 1852
1849 // Check for legal arguments. 1853 // Check for legal arguments.
1850 if (!IS_UNDEFINED(frame) && global) { 1854 if (!IS_UNDEFINED(frame) && global) {
1851 return response.failed('Arguments "frame" and "global" are exclusive'); 1855 return response.failed('Arguments "frame" and "global" are exclusive');
1852 } 1856 }
1857
1858 var additional_context_object;
1859 if (additional_context) {
1860 additional_context_object = {};
1861 for (var i = 0; i < additional_context.length; i++) {
1862 var mapping = additional_context[i];
1863 if (!IS_STRING(mapping.name) || !IS_NUMBER(mapping.handle)) {
1864 return response.failed("Context element #" + i +
1865 " must contain name:string and handle:number");
1866 }
1867 var context_value_mirror = LookupMirror(mapping.handle);
1868 if (!context_value_mirror) {
1869 return response.failed("Context object '" + mapping.name +
1870 "' #" + mapping.handle + "# not found");
1871 }
1872 additional_context_object[mapping.name] = context_value_mirror.value();
1873 }
1874 }
1853 1875
1854 // Global evaluate. 1876 // Global evaluate.
1855 if (global) { 1877 if (global) {
1856 // Evaluate in the global context. 1878 // Evaluate in the global context.
1857 response.body = 1879 response.body = this.exec_state_.evaluateGlobal(
1858 this.exec_state_.evaluateGlobal(expression, Boolean(disable_break)); 1880 expression, Boolean(disable_break), additional_context_object);
1859 return; 1881 return;
1860 } 1882 }
1861 1883
1862 // Default value for disable_break is true. 1884 // Default value for disable_break is true.
1863 if (IS_UNDEFINED(disable_break)) { 1885 if (IS_UNDEFINED(disable_break)) {
1864 disable_break = true; 1886 disable_break = true;
1865 } 1887 }
1866 1888
1867 // No frames no evaluate in frame. 1889 // No frames no evaluate in frame.
1868 if (this.exec_state_.frameCount() == 0) { 1890 if (this.exec_state_.frameCount() == 0) {
1869 return response.failed('No frames'); 1891 return response.failed('No frames');
1870 } 1892 }
1871 1893
1872 // Check whether a frame was specified. 1894 // Check whether a frame was specified.
1873 if (!IS_UNDEFINED(frame)) { 1895 if (!IS_UNDEFINED(frame)) {
1874 var frame_number = %ToNumber(frame); 1896 var frame_number = %ToNumber(frame);
1875 if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { 1897 if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) {
1876 return response.failed('Invalid frame "' + frame + '"'); 1898 return response.failed('Invalid frame "' + frame + '"');
1877 } 1899 }
1878 // Evaluate in the specified frame. 1900 // Evaluate in the specified frame.
1879 response.body = this.exec_state_.frame(frame_number).evaluate( 1901 response.body = this.exec_state_.frame(frame_number).evaluate(
1880 expression, Boolean(disable_break)); 1902 expression, Boolean(disable_break), additional_context_object);
1881 return; 1903 return;
1882 } else { 1904 } else {
1883 // Evaluate in the selected frame. 1905 // Evaluate in the selected frame.
1884 response.body = this.exec_state_.frame().evaluate( 1906 response.body = this.exec_state_.frame().evaluate(
1885 expression, Boolean(disable_break)); 1907 expression, Boolean(disable_break), additional_context_object);
1886 return; 1908 return;
1887 } 1909 }
1888 }; 1910 };
1889 1911
1890 1912
1891 DebugCommandProcessor.prototype.lookupRequest_ = function(request, response) { 1913 DebugCommandProcessor.prototype.lookupRequest_ = function(request, response) {
1892 if (!request.arguments) { 1914 if (!request.arguments) {
1893 return response.failed('Missing arguments'); 1915 return response.failed('Missing arguments');
1894 } 1916 }
1895 1917
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 case 'string': 2292 case 'string':
2271 case 'number': 2293 case 'number':
2272 json = value; 2294 json = value;
2273 break 2295 break
2274 2296
2275 default: 2297 default:
2276 json = null; 2298 json = null;
2277 } 2299 }
2278 return json; 2300 return json;
2279 } 2301 }
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/deoptimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698