OLD | NEW |
1 // Copyright 2006-2012 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2012 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 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1837 var kScopeDetailsTypeIndex = 0; | 1837 var kScopeDetailsTypeIndex = 0; |
1838 var kScopeDetailsObjectIndex = 1; | 1838 var kScopeDetailsObjectIndex = 1; |
1839 | 1839 |
1840 function ScopeDetails(frame, fun, index) { | 1840 function ScopeDetails(frame, fun, index) { |
1841 if (frame) { | 1841 if (frame) { |
1842 this.break_id_ = frame.break_id_; | 1842 this.break_id_ = frame.break_id_; |
1843 this.details_ = %GetScopeDetails(frame.break_id_, | 1843 this.details_ = %GetScopeDetails(frame.break_id_, |
1844 frame.details_.frameId(), | 1844 frame.details_.frameId(), |
1845 frame.details_.inlinedFrameIndex(), | 1845 frame.details_.inlinedFrameIndex(), |
1846 index); | 1846 index); |
| 1847 this.frame_id_ = frame.details_.frameId(); |
| 1848 this.inlined_frame_id_ = frame.details_.inlinedFrameIndex(); |
1847 } else { | 1849 } else { |
1848 this.details_ = %GetFunctionScopeDetails(fun.value(), index); | 1850 this.details_ = %GetFunctionScopeDetails(fun.value(), index); |
| 1851 this.fun_value_ = fun.value(); |
1849 this.break_id_ = undefined; | 1852 this.break_id_ = undefined; |
1850 } | 1853 } |
| 1854 this.index_ = index; |
1851 } | 1855 } |
1852 | 1856 |
1853 | 1857 |
1854 ScopeDetails.prototype.type = function() { | 1858 ScopeDetails.prototype.type = function() { |
1855 if (!IS_UNDEFINED(this.break_id_)) { | 1859 if (!IS_UNDEFINED(this.break_id_)) { |
1856 %CheckExecutionState(this.break_id_); | 1860 %CheckExecutionState(this.break_id_); |
1857 } | 1861 } |
1858 return this.details_[kScopeDetailsTypeIndex]; | 1862 return this.details_[kScopeDetailsTypeIndex]; |
1859 }; | 1863 }; |
1860 | 1864 |
1861 | 1865 |
1862 ScopeDetails.prototype.object = function() { | 1866 ScopeDetails.prototype.object = function() { |
1863 if (!IS_UNDEFINED(this.break_id_)) { | 1867 if (!IS_UNDEFINED(this.break_id_)) { |
1864 %CheckExecutionState(this.break_id_); | 1868 %CheckExecutionState(this.break_id_); |
1865 } | 1869 } |
1866 return this.details_[kScopeDetailsObjectIndex]; | 1870 return this.details_[kScopeDetailsObjectIndex]; |
1867 }; | 1871 }; |
1868 | 1872 |
1869 | 1873 |
| 1874 ScopeDetails.prototype.setVariableValueImpl = function(name, new_value) { |
| 1875 var raw_res; |
| 1876 if (!IS_UNDEFINED(this.break_id_)) { |
| 1877 %CheckExecutionState(this.break_id_); |
| 1878 raw_res = %SetScopeVariableValue(this.break_id_, this.frame_id_, |
| 1879 this.inlined_frame_id_, this.index_, name, new_value); |
| 1880 } else { |
| 1881 raw_res = %SetScopeVariableValue(this.fun_value_, null, null, this.index_, |
| 1882 name, new_value); |
| 1883 } |
| 1884 if (!raw_res) { |
| 1885 throw new Error("Failed to set variable value"); |
| 1886 } |
| 1887 }; |
| 1888 |
| 1889 |
1870 /** | 1890 /** |
1871 * Mirror object for scope of frame or function. Either frame or function must | 1891 * Mirror object for scope of frame or function. Either frame or function must |
1872 * be specified. | 1892 * be specified. |
1873 * @param {FrameMirror} frame The frame this scope is a part of | 1893 * @param {FrameMirror} frame The frame this scope is a part of |
1874 * @param {FunctionMirror} function The function this scope is a part of | 1894 * @param {FunctionMirror} function The function this scope is a part of |
1875 * @param {number} index The scope index in the frame | 1895 * @param {number} index The scope index in the frame |
1876 * @constructor | 1896 * @constructor |
1877 * @extends Mirror | 1897 * @extends Mirror |
1878 */ | 1898 */ |
1879 function ScopeMirror(frame, function, index) { | 1899 function ScopeMirror(frame, function, index) { |
(...skipping 27 matching lines...) Expand all Loading... |
1907 ScopeMirror.prototype.scopeObject = function() { | 1927 ScopeMirror.prototype.scopeObject = function() { |
1908 // For local and closure scopes create a transient mirror as these objects are | 1928 // For local and closure scopes create a transient mirror as these objects are |
1909 // created on the fly materializing the local or closure scopes and | 1929 // created on the fly materializing the local or closure scopes and |
1910 // therefore will not preserve identity. | 1930 // therefore will not preserve identity. |
1911 var transient = this.scopeType() == ScopeType.Local || | 1931 var transient = this.scopeType() == ScopeType.Local || |
1912 this.scopeType() == ScopeType.Closure; | 1932 this.scopeType() == ScopeType.Closure; |
1913 return MakeMirror(this.details_.object(), transient); | 1933 return MakeMirror(this.details_.object(), transient); |
1914 }; | 1934 }; |
1915 | 1935 |
1916 | 1936 |
| 1937 ScopeMirror.prototype.setVariableValue = function(name, new_value) { |
| 1938 this.details_.setVariableValueImpl(name, new_value); |
| 1939 }; |
| 1940 |
| 1941 |
1917 /** | 1942 /** |
1918 * Mirror object for script source. | 1943 * Mirror object for script source. |
1919 * @param {Script} script The script object | 1944 * @param {Script} script The script object |
1920 * @constructor | 1945 * @constructor |
1921 * @extends Mirror | 1946 * @extends Mirror |
1922 */ | 1947 */ |
1923 function ScriptMirror(script) { | 1948 function ScriptMirror(script) { |
1924 %_CallFunction(this, SCRIPT_TYPE, Mirror); | 1949 %_CallFunction(this, SCRIPT_TYPE, Mirror); |
1925 this.script_ = script; | 1950 this.script_ = script; |
1926 this.context_ = new ContextMirror(script.context_data); | 1951 this.context_ = new ContextMirror(script.context_data); |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2592 } | 2617 } |
2593 if (!NUMBER_IS_FINITE(value)) { | 2618 if (!NUMBER_IS_FINITE(value)) { |
2594 if (value > 0) { | 2619 if (value > 0) { |
2595 return 'Infinity'; | 2620 return 'Infinity'; |
2596 } else { | 2621 } else { |
2597 return '-Infinity'; | 2622 return '-Infinity'; |
2598 } | 2623 } |
2599 } | 2624 } |
2600 return value; | 2625 return value; |
2601 } | 2626 } |
OLD | NEW |