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 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Handle id counters. | 5 // Handle id counters. |
6 var next_handle_ = 0; | 6 var next_handle_ = 0; |
7 var next_transient_handle_ = -1; | 7 var next_transient_handle_ = -1; |
8 | 8 |
9 // Mirror cache. | 9 // Mirror cache. |
10 var mirror_cache_ = []; | 10 var mirror_cache_ = []; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 | 187 |
188 // Different attributes for a property. | 188 // Different attributes for a property. |
189 var PropertyAttribute = {}; | 189 var PropertyAttribute = {}; |
190 PropertyAttribute.None = NONE; | 190 PropertyAttribute.None = NONE; |
191 PropertyAttribute.ReadOnly = READ_ONLY; | 191 PropertyAttribute.ReadOnly = READ_ONLY; |
192 PropertyAttribute.DontEnum = DONT_ENUM; | 192 PropertyAttribute.DontEnum = DONT_ENUM; |
193 PropertyAttribute.DontDelete = DONT_DELETE; | 193 PropertyAttribute.DontDelete = DONT_DELETE; |
194 | 194 |
195 | 195 |
196 // A copy of the scope types from runtime.cc. | 196 // A copy of the scope types from runtime-debug.cc. |
| 197 // NOTE: these constants should be backward-compatible, so |
| 198 // add new ones to the end of this list. |
197 var ScopeType = { Global: 0, | 199 var ScopeType = { Global: 0, |
198 Local: 1, | 200 Local: 1, |
199 With: 2, | 201 With: 2, |
200 Closure: 3, | 202 Closure: 3, |
201 Catch: 4, | 203 Catch: 4, |
202 Block: 5 }; | 204 Block: 5, |
| 205 Script: 6 }; |
203 | 206 |
204 | 207 |
205 // Mirror hierarchy: | 208 // Mirror hierarchy: |
206 // - Mirror | 209 // - Mirror |
207 // - ValueMirror | 210 // - ValueMirror |
208 // - UndefinedMirror | 211 // - UndefinedMirror |
209 // - NullMirror | 212 // - NullMirror |
210 // - NumberMirror | 213 // - NumberMirror |
211 // - StringMirror | 214 // - StringMirror |
212 // - SymbolMirror | 215 // - SymbolMirror |
(...skipping 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2286 return this.scope_index_; | 2289 return this.scope_index_; |
2287 }; | 2290 }; |
2288 | 2291 |
2289 | 2292 |
2290 ScopeMirror.prototype.scopeType = function() { | 2293 ScopeMirror.prototype.scopeType = function() { |
2291 return this.details_.type(); | 2294 return this.details_.type(); |
2292 }; | 2295 }; |
2293 | 2296 |
2294 | 2297 |
2295 ScopeMirror.prototype.scopeObject = function() { | 2298 ScopeMirror.prototype.scopeObject = function() { |
2296 // For local and closure scopes create a transient mirror as these objects are | 2299 // For local, closure and script scopes create a transient mirror |
2297 // created on the fly materializing the local or closure scopes and | 2300 // as these objects are created on the fly materializing the local |
2298 // therefore will not preserve identity. | 2301 // or closure scopes and therefore will not preserve identity. |
2299 var transient = this.scopeType() == ScopeType.Local || | 2302 var transient = this.scopeType() == ScopeType.Local || |
2300 this.scopeType() == ScopeType.Closure; | 2303 this.scopeType() == ScopeType.Closure || |
| 2304 this.scopeType() == ScopeType.Script; |
2301 return MakeMirror(this.details_.object(), transient); | 2305 return MakeMirror(this.details_.object(), transient); |
2302 }; | 2306 }; |
2303 | 2307 |
2304 | 2308 |
2305 ScopeMirror.prototype.setVariableValue = function(name, new_value) { | 2309 ScopeMirror.prototype.setVariableValue = function(name, new_value) { |
2306 this.details_.setVariableValueImpl(name, new_value); | 2310 this.details_.setVariableValueImpl(name, new_value); |
2307 }; | 2311 }; |
2308 | 2312 |
2309 | 2313 |
2310 /** | 2314 /** |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3014 } | 3018 } |
3015 if (!NUMBER_IS_FINITE(value)) { | 3019 if (!NUMBER_IS_FINITE(value)) { |
3016 if (value > 0) { | 3020 if (value > 0) { |
3017 return 'Infinity'; | 3021 return 'Infinity'; |
3018 } else { | 3022 } else { |
3019 return '-Infinity'; | 3023 return '-Infinity'; |
3020 } | 3024 } |
3021 } | 3025 } |
3022 return value; | 3026 return value; |
3023 } | 3027 } |
OLD | NEW |