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

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

Issue 9415010: Make built-ins strict mode conforming, and support a --use-strict flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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
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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
Yang 2012/02/17 08:22:55 Why new empty line?
rossberg 2012/02/17 09:20:17 Because I had a "use strict" in here at some point
28
28 // Handle id counters. 29 // Handle id counters.
29 var next_handle_ = 0; 30 var next_handle_ = 0;
30 var next_transient_handle_ = -1; 31 var next_transient_handle_ = -1;
31 32
32 // Mirror cache. 33 // Mirror cache.
33 var mirror_cache_ = []; 34 var mirror_cache_ = [];
34 35
35 36
36 /** 37 /**
37 * Clear the mirror handle cache. 38 * Clear the mirror handle cache.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 function inherits(ctor, superCtor) { 138 function inherits(ctor, superCtor) {
138 var tempCtor = function(){}; 139 var tempCtor = function(){};
139 tempCtor.prototype = superCtor.prototype; 140 tempCtor.prototype = superCtor.prototype;
140 ctor.super_ = superCtor.prototype; 141 ctor.super_ = superCtor.prototype;
141 ctor.prototype = new tempCtor(); 142 ctor.prototype = new tempCtor();
142 ctor.prototype.constructor = ctor; 143 ctor.prototype.constructor = ctor;
143 } 144 }
144 145
145 146
146 // Type names of the different mirrors. 147 // Type names of the different mirrors.
147 const UNDEFINED_TYPE = 'undefined'; 148 var UNDEFINED_TYPE = 'undefined';
148 const NULL_TYPE = 'null'; 149 var NULL_TYPE = 'null';
149 const BOOLEAN_TYPE = 'boolean'; 150 var BOOLEAN_TYPE = 'boolean';
150 const NUMBER_TYPE = 'number'; 151 var NUMBER_TYPE = 'number';
151 const STRING_TYPE = 'string'; 152 var STRING_TYPE = 'string';
152 const OBJECT_TYPE = 'object'; 153 var OBJECT_TYPE = 'object';
153 const FUNCTION_TYPE = 'function'; 154 var FUNCTION_TYPE = 'function';
154 const REGEXP_TYPE = 'regexp'; 155 var REGEXP_TYPE = 'regexp';
155 const ERROR_TYPE = 'error'; 156 var ERROR_TYPE = 'error';
156 const PROPERTY_TYPE = 'property'; 157 var PROPERTY_TYPE = 'property';
157 const FRAME_TYPE = 'frame'; 158 var FRAME_TYPE = 'frame';
158 const SCRIPT_TYPE = 'script'; 159 var SCRIPT_TYPE = 'script';
159 const CONTEXT_TYPE = 'context'; 160 var CONTEXT_TYPE = 'context';
160 const SCOPE_TYPE = 'scope'; 161 var SCOPE_TYPE = 'scope';
161 162
162 // Maximum length when sending strings through the JSON protocol. 163 // Maximum length when sending strings through the JSON protocol.
163 const kMaxProtocolStringLength = 80; 164 var kMaxProtocolStringLength = 80;
164 165
165 // Different kind of properties. 166 // Different kind of properties.
166 PropertyKind = {}; 167 var PropertyKind = {};
167 PropertyKind.Named = 1; 168 PropertyKind.Named = 1;
168 PropertyKind.Indexed = 2; 169 PropertyKind.Indexed = 2;
169 170
170 171
171 // A copy of the PropertyType enum from global.h 172 // A copy of the PropertyType enum from global.h
172 PropertyType = {}; 173 var PropertyType = {};
173 PropertyType.Normal = 0; 174 PropertyType.Normal = 0;
174 PropertyType.Field = 1; 175 PropertyType.Field = 1;
175 PropertyType.ConstantFunction = 2; 176 PropertyType.ConstantFunction = 2;
176 PropertyType.Callbacks = 3; 177 PropertyType.Callbacks = 3;
177 PropertyType.Handler = 4; 178 PropertyType.Handler = 4;
178 PropertyType.Interceptor = 5; 179 PropertyType.Interceptor = 5;
179 PropertyType.MapTransition = 6; 180 PropertyType.MapTransition = 6;
180 PropertyType.ExternalArrayTransition = 7; 181 PropertyType.ExternalArrayTransition = 7;
181 PropertyType.ConstantTransition = 8; 182 PropertyType.ConstantTransition = 8;
182 PropertyType.NullDescriptor = 9; 183 PropertyType.NullDescriptor = 9;
183 184
184 185
185 // Different attributes for a property. 186 // Different attributes for a property.
186 PropertyAttribute = {}; 187 var PropertyAttribute = {};
187 PropertyAttribute.None = NONE; 188 PropertyAttribute.None = NONE;
188 PropertyAttribute.ReadOnly = READ_ONLY; 189 PropertyAttribute.ReadOnly = READ_ONLY;
189 PropertyAttribute.DontEnum = DONT_ENUM; 190 PropertyAttribute.DontEnum = DONT_ENUM;
190 PropertyAttribute.DontDelete = DONT_DELETE; 191 PropertyAttribute.DontDelete = DONT_DELETE;
191 192
192 193
193 // A copy of the scope types from runtime.cc. 194 // A copy of the scope types from runtime.cc.
194 ScopeType = { Global: 0, 195 var ScopeType = { Global: 0,
195 Local: 1, 196 Local: 1,
196 With: 2, 197 With: 2,
197 Closure: 3, 198 Closure: 3,
198 Catch: 4, 199 Catch: 4,
199 Block: 5 }; 200 Block: 5 };
200 201
201 202
202 // Mirror hierarchy: 203 // Mirror hierarchy:
203 // - Mirror 204 // - Mirror
204 // - ValueMirror 205 // - ValueMirror
205 // - UndefinedMirror 206 // - UndefinedMirror
206 // - NullMirror 207 // - NullMirror
207 // - NumberMirror 208 // - NumberMirror
208 // - StringMirror 209 // - StringMirror
209 // - ObjectMirror 210 // - ObjectMirror
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 * @return {boolean} True if the property is 1231 * @return {boolean} True if the property is
1231 * UndefinedMirror if there is no setter for this property 1232 * UndefinedMirror if there is no setter for this property
1232 */ 1233 */
1233 PropertyMirror.prototype.isNative = function() { 1234 PropertyMirror.prototype.isNative = function() {
1234 return (this.propertyType() == PropertyType.Interceptor) || 1235 return (this.propertyType() == PropertyType.Interceptor) ||
1235 ((this.propertyType() == PropertyType.Callbacks) && 1236 ((this.propertyType() == PropertyType.Callbacks) &&
1236 !this.hasGetter() && !this.hasSetter()); 1237 !this.hasGetter() && !this.hasSetter());
1237 }; 1238 };
1238 1239
1239 1240
1240 const kFrameDetailsFrameIdIndex = 0; 1241 var kFrameDetailsFrameIdIndex = 0;
1241 const kFrameDetailsReceiverIndex = 1; 1242 var kFrameDetailsReceiverIndex = 1;
1242 const kFrameDetailsFunctionIndex = 2; 1243 var kFrameDetailsFunctionIndex = 2;
1243 const kFrameDetailsArgumentCountIndex = 3; 1244 var kFrameDetailsArgumentCountIndex = 3;
1244 const kFrameDetailsLocalCountIndex = 4; 1245 var kFrameDetailsLocalCountIndex = 4;
1245 const kFrameDetailsSourcePositionIndex = 5; 1246 var kFrameDetailsSourcePositionIndex = 5;
1246 const kFrameDetailsConstructCallIndex = 6; 1247 var kFrameDetailsConstructCallIndex = 6;
1247 const kFrameDetailsAtReturnIndex = 7; 1248 var kFrameDetailsAtReturnIndex = 7;
1248 const kFrameDetailsFlagsIndex = 8; 1249 var kFrameDetailsFlagsIndex = 8;
1249 const kFrameDetailsFirstDynamicIndex = 9; 1250 var kFrameDetailsFirstDynamicIndex = 9;
1250 1251
1251 const kFrameDetailsNameIndex = 0; 1252 var kFrameDetailsNameIndex = 0;
1252 const kFrameDetailsValueIndex = 1; 1253 var kFrameDetailsValueIndex = 1;
1253 const kFrameDetailsNameValueSize = 2; 1254 var kFrameDetailsNameValueSize = 2;
1254 1255
1255 const kFrameDetailsFlagDebuggerFrameMask = 1 << 0; 1256 var kFrameDetailsFlagDebuggerFrameMask = 1 << 0;
1256 const kFrameDetailsFlagOptimizedFrameMask = 1 << 1; 1257 var kFrameDetailsFlagOptimizedFrameMask = 1 << 1;
1257 const kFrameDetailsFlagInlinedFrameIndexMask = 7 << 2; 1258 var kFrameDetailsFlagInlinedFrameIndexMask = 7 << 2;
1258 1259
1259 /** 1260 /**
1260 * Wrapper for the frame details information retreived from the VM. The frame 1261 * Wrapper for the frame details information retreived from the VM. The frame
1261 * details from the VM is an array with the following content. See runtime.cc 1262 * details from the VM is an array with the following content. See runtime.cc
1262 * Runtime_GetFrameDetails. 1263 * Runtime_GetFrameDetails.
1263 * 0: Id 1264 * 0: Id
1264 * 1: Receiver 1265 * 1: Receiver
1265 * 2: Function 1266 * 2: Function
1266 * 3: Argument count 1267 * 3: Argument count
1267 * 4: Local count 1268 * 4: Local count
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 result += ' '; 1726 result += ' ';
1726 result += this.sourceAndPositionText(); 1727 result += this.sourceAndPositionText();
1727 if (opt_locals) { 1728 if (opt_locals) {
1728 result += '\n'; 1729 result += '\n';
1729 result += this.localsText(); 1730 result += this.localsText();
1730 } 1731 }
1731 return result; 1732 return result;
1732 }; 1733 };
1733 1734
1734 1735
1735 const kScopeDetailsTypeIndex = 0; 1736 var kScopeDetailsTypeIndex = 0;
1736 const kScopeDetailsObjectIndex = 1; 1737 var kScopeDetailsObjectIndex = 1;
1737 1738
1738 function ScopeDetails(frame, index) { 1739 function ScopeDetails(frame, index) {
1739 this.break_id_ = frame.break_id_; 1740 this.break_id_ = frame.break_id_;
1740 this.details_ = %GetScopeDetails(frame.break_id_, 1741 this.details_ = %GetScopeDetails(frame.break_id_,
1741 frame.details_.frameId(), 1742 frame.details_.frameId(),
1742 frame.details_.inlinedFrameIndex(), 1743 frame.details_.inlinedFrameIndex(),
1743 index); 1744 index);
1744 } 1745 }
1745 1746
1746 1747
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
2423 } 2424 }
2424 if (!NUMBER_IS_FINITE(value)) { 2425 if (!NUMBER_IS_FINITE(value)) {
2425 if (value > 0) { 2426 if (value > 0) {
2426 return 'Infinity'; 2427 return 'Infinity';
2427 } else { 2428 } else {
2428 return '-Infinity'; 2429 return '-Infinity';
2429 } 2430 }
2430 } 2431 }
2431 return value; 2432 return value;
2432 } 2433 }
OLDNEW
« src/collection.js ('K') | « src/messages.js ('k') | src/proxy.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698