| 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 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1668 FrameMirror.prototype.scopeCount = function() { | 1668 FrameMirror.prototype.scopeCount = function() { |
| 1669 return this.details_.scopeCount(); | 1669 return this.details_.scopeCount(); |
| 1670 }; | 1670 }; |
| 1671 | 1671 |
| 1672 | 1672 |
| 1673 FrameMirror.prototype.scope = function(index) { | 1673 FrameMirror.prototype.scope = function(index) { |
| 1674 return new ScopeMirror(this, UNDEFINED, index); | 1674 return new ScopeMirror(this, UNDEFINED, index); |
| 1675 }; | 1675 }; |
| 1676 | 1676 |
| 1677 | 1677 |
| 1678 FrameMirror.prototype.allScopes = function() { |
| 1679 var scopeDetails = %GetAllScopesDetails(this.break_id_, |
| 1680 this.details_.frameId(), |
| 1681 this.details_.inlinedFrameIndex()); |
| 1682 var result = []; |
| 1683 for (var i = 0; i < scopeDetails.length; ++i) { |
| 1684 result.push(new ScopeMirror(this, UNDEFINED, i, scopeDetails[i])); |
| 1685 } |
| 1686 return result; |
| 1687 }; |
| 1688 |
| 1689 |
| 1678 FrameMirror.prototype.stepInPositions = function() { | 1690 FrameMirror.prototype.stepInPositions = function() { |
| 1679 var script = this.func().script(); | 1691 var script = this.func().script(); |
| 1680 var funcOffset = this.func().sourcePosition_(); | 1692 var funcOffset = this.func().sourcePosition_(); |
| 1681 | 1693 |
| 1682 var stepInRaw = this.details_.stepInPositionsImpl(); | 1694 var stepInRaw = this.details_.stepInPositionsImpl(); |
| 1683 var result = []; | 1695 var result = []; |
| 1684 if (stepInRaw) { | 1696 if (stepInRaw) { |
| 1685 for (var i = 0; i < stepInRaw.length; i++) { | 1697 for (var i = 0; i < stepInRaw.length; i++) { |
| 1686 var posStruct = {}; | 1698 var posStruct = {}; |
| 1687 var offset = script.locationFromPosition(funcOffset + stepInRaw[i], | 1699 var offset = script.locationFromPosition(funcOffset + stepInRaw[i], |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 result += '\n'; | 1870 result += '\n'; |
| 1859 result += this.localsText(); | 1871 result += this.localsText(); |
| 1860 } | 1872 } |
| 1861 return result; | 1873 return result; |
| 1862 }; | 1874 }; |
| 1863 | 1875 |
| 1864 | 1876 |
| 1865 var kScopeDetailsTypeIndex = 0; | 1877 var kScopeDetailsTypeIndex = 0; |
| 1866 var kScopeDetailsObjectIndex = 1; | 1878 var kScopeDetailsObjectIndex = 1; |
| 1867 | 1879 |
| 1868 function ScopeDetails(frame, fun, index) { | 1880 function ScopeDetails(frame, fun, index, opt_details) { |
| 1869 if (frame) { | 1881 if (frame) { |
| 1870 this.break_id_ = frame.break_id_; | 1882 this.break_id_ = frame.break_id_; |
| 1871 this.details_ = %GetScopeDetails(frame.break_id_, | 1883 this.details_ = opt_details || |
| 1884 %GetScopeDetails(frame.break_id_, |
| 1872 frame.details_.frameId(), | 1885 frame.details_.frameId(), |
| 1873 frame.details_.inlinedFrameIndex(), | 1886 frame.details_.inlinedFrameIndex(), |
| 1874 index); | 1887 index); |
| 1875 this.frame_id_ = frame.details_.frameId(); | 1888 this.frame_id_ = frame.details_.frameId(); |
| 1876 this.inlined_frame_id_ = frame.details_.inlinedFrameIndex(); | 1889 this.inlined_frame_id_ = frame.details_.inlinedFrameIndex(); |
| 1877 } else { | 1890 } else { |
| 1878 this.details_ = %GetFunctionScopeDetails(fun.value(), index); | 1891 this.details_ = opt_details || %GetFunctionScopeDetails(fun.value(), index); |
| 1879 this.fun_value_ = fun.value(); | 1892 this.fun_value_ = fun.value(); |
| 1880 this.break_id_ = undefined; | 1893 this.break_id_ = undefined; |
| 1881 } | 1894 } |
| 1882 this.index_ = index; | 1895 this.index_ = index; |
| 1883 } | 1896 } |
| 1884 | 1897 |
| 1885 | 1898 |
| 1886 ScopeDetails.prototype.type = function() { | 1899 ScopeDetails.prototype.type = function() { |
| 1887 if (!IS_UNDEFINED(this.break_id_)) { | 1900 if (!IS_UNDEFINED(this.break_id_)) { |
| 1888 %CheckExecutionState(this.break_id_); | 1901 %CheckExecutionState(this.break_id_); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1914 } | 1927 } |
| 1915 }; | 1928 }; |
| 1916 | 1929 |
| 1917 | 1930 |
| 1918 /** | 1931 /** |
| 1919 * Mirror object for scope of frame or function. Either frame or function must | 1932 * Mirror object for scope of frame or function. Either frame or function must |
| 1920 * be specified. | 1933 * be specified. |
| 1921 * @param {FrameMirror} frame The frame this scope is a part of | 1934 * @param {FrameMirror} frame The frame this scope is a part of |
| 1922 * @param {FunctionMirror} function The function this scope is a part of | 1935 * @param {FunctionMirror} function The function this scope is a part of |
| 1923 * @param {number} index The scope index in the frame | 1936 * @param {number} index The scope index in the frame |
| 1937 * @param {Array=} opt_details Raw scope details data |
| 1924 * @constructor | 1938 * @constructor |
| 1925 * @extends Mirror | 1939 * @extends Mirror |
| 1926 */ | 1940 */ |
| 1927 function ScopeMirror(frame, function, index) { | 1941 function ScopeMirror(frame, function, index, opt_details) { |
| 1928 %_CallFunction(this, SCOPE_TYPE, Mirror); | 1942 %_CallFunction(this, SCOPE_TYPE, Mirror); |
| 1929 if (frame) { | 1943 if (frame) { |
| 1930 this.frame_index_ = frame.index_; | 1944 this.frame_index_ = frame.index_; |
| 1931 } else { | 1945 } else { |
| 1932 this.frame_index_ = undefined; | 1946 this.frame_index_ = undefined; |
| 1933 } | 1947 } |
| 1934 this.scope_index_ = index; | 1948 this.scope_index_ = index; |
| 1935 this.details_ = new ScopeDetails(frame, function, index); | 1949 this.details_ = new ScopeDetails(frame, function, index, opt_details); |
| 1936 } | 1950 } |
| 1937 inherits(ScopeMirror, Mirror); | 1951 inherits(ScopeMirror, Mirror); |
| 1938 | 1952 |
| 1939 | 1953 |
| 1940 ScopeMirror.prototype.frameIndex = function() { | 1954 ScopeMirror.prototype.frameIndex = function() { |
| 1941 return this.frame_index_; | 1955 return this.frame_index_; |
| 1942 }; | 1956 }; |
| 1943 | 1957 |
| 1944 | 1958 |
| 1945 ScopeMirror.prototype.scopeIndex = function() { | 1959 ScopeMirror.prototype.scopeIndex = function() { |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2645 } | 2659 } |
| 2646 if (!NUMBER_IS_FINITE(value)) { | 2660 if (!NUMBER_IS_FINITE(value)) { |
| 2647 if (value > 0) { | 2661 if (value > 0) { |
| 2648 return 'Infinity'; | 2662 return 'Infinity'; |
| 2649 } else { | 2663 } else { |
| 2650 return '-Infinity'; | 2664 return '-Infinity'; |
| 2651 } | 2665 } |
| 2652 } | 2666 } |
| 2653 return value; | 2667 return value; |
| 2654 } | 2668 } |
| OLD | NEW |