Chromium Code Reviews| 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_, this.inline d_frame_id_, this.index_, name, new_value); | |
|
Yang
2012/11/19 17:00:55
80 char limit
Peter Rybin
2012/11/20 22:27:21
Done.
| |
| 1879 } else { | |
| 1880 raw_res = %SetScopeVariableValue(this.fun_value_, null, null, this.index_, n ame, new_value); | |
| 1881 } | |
| 1882 if (!raw_res) { | |
| 1883 throw new Error("Failed to set variable value"); | |
| 1884 } | |
| 1885 }; | |
| 1886 | |
| 1887 | |
| 1870 /** | 1888 /** |
| 1871 * Mirror object for scope of frame or function. Either frame or function must | 1889 * Mirror object for scope of frame or function. Either frame or function must |
| 1872 * be specified. | 1890 * be specified. |
| 1873 * @param {FrameMirror} frame The frame this scope is a part of | 1891 * @param {FrameMirror} frame The frame this scope is a part of |
| 1874 * @param {FunctionMirror} function The function this scope is a part of | 1892 * @param {FunctionMirror} function The function this scope is a part of |
| 1875 * @param {number} index The scope index in the frame | 1893 * @param {number} index The scope index in the frame |
| 1876 * @constructor | 1894 * @constructor |
| 1877 * @extends Mirror | 1895 * @extends Mirror |
| 1878 */ | 1896 */ |
| 1879 function ScopeMirror(frame, function, index) { | 1897 function ScopeMirror(frame, function, index) { |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 1907 ScopeMirror.prototype.scopeObject = function() { | 1925 ScopeMirror.prototype.scopeObject = function() { |
| 1908 // For local and closure scopes create a transient mirror as these objects are | 1926 // 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 | 1927 // created on the fly materializing the local or closure scopes and |
| 1910 // therefore will not preserve identity. | 1928 // therefore will not preserve identity. |
| 1911 var transient = this.scopeType() == ScopeType.Local || | 1929 var transient = this.scopeType() == ScopeType.Local || |
| 1912 this.scopeType() == ScopeType.Closure; | 1930 this.scopeType() == ScopeType.Closure; |
| 1913 return MakeMirror(this.details_.object(), transient); | 1931 return MakeMirror(this.details_.object(), transient); |
| 1914 }; | 1932 }; |
| 1915 | 1933 |
| 1916 | 1934 |
| 1935 ScopeMirror.prototype.setVariableValue = function(name, new_value) { | |
| 1936 this.details_.setVariableValueImpl(name, new_value); | |
| 1937 }; | |
| 1938 | |
| 1939 | |
| 1917 /** | 1940 /** |
| 1918 * Mirror object for script source. | 1941 * Mirror object for script source. |
| 1919 * @param {Script} script The script object | 1942 * @param {Script} script The script object |
| 1920 * @constructor | 1943 * @constructor |
| 1921 * @extends Mirror | 1944 * @extends Mirror |
| 1922 */ | 1945 */ |
| 1923 function ScriptMirror(script) { | 1946 function ScriptMirror(script) { |
| 1924 %_CallFunction(this, SCRIPT_TYPE, Mirror); | 1947 %_CallFunction(this, SCRIPT_TYPE, Mirror); |
| 1925 this.script_ = script; | 1948 this.script_ = script; |
| 1926 this.context_ = new ContextMirror(script.context_data); | 1949 this.context_ = new ContextMirror(script.context_data); |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2592 } | 2615 } |
| 2593 if (!NUMBER_IS_FINITE(value)) { | 2616 if (!NUMBER_IS_FINITE(value)) { |
| 2594 if (value > 0) { | 2617 if (value > 0) { |
| 2595 return 'Infinity'; | 2618 return 'Infinity'; |
| 2596 } else { | 2619 } else { |
| 2597 return '-Infinity'; | 2620 return '-Infinity'; |
| 2598 } | 2621 } |
| 2599 } | 2622 } |
| 2600 return value; | 2623 return value; |
| 2601 } | 2624 } |
| OLD | NEW |