| 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_ = []; |
| 11 var mirror_cache_enabled_ = true; | 11 var mirror_cache_enabled_ = true; |
| 12 | 12 |
| 13 | 13 |
| 14 function ToggleMirrorCache(value) { | 14 function ToggleMirrorCache(value) { |
| 15 mirror_cache_enabled_ = value; | 15 mirror_cache_enabled_ = value; |
| 16 next_handle_ = 0; | 16 next_handle_ = 0; |
| 17 mirror_cache_ = []; | 17 mirror_cache_ = []; |
| 18 } | 18 } |
| 19 | 19 |
| 20 | 20 |
| 21 /** | |
| 22 * Clear the mirror handle cache. | |
| 23 */ | |
| 24 function ClearMirrorCache() { | |
| 25 next_handle_ = 0; | |
| 26 mirror_cache_ = []; | |
| 27 } | |
| 28 | |
| 29 | |
| 30 // Wrapper to check whether an object is a Promise. The call may not work | 21 // Wrapper to check whether an object is a Promise. The call may not work |
| 31 // if promises are not enabled. | 22 // if promises are not enabled. |
| 32 // TODO(yangguo): remove try-catch once promises are enabled by default. | 23 // TODO(yangguo): remove try-catch once promises are enabled by default. |
| 33 function ObjectIsPromise(value) { | 24 function ObjectIsPromise(value) { |
| 34 try { | 25 try { |
| 35 return IS_SPEC_OBJECT(value) && | 26 return IS_SPEC_OBJECT(value) && |
| 36 !IS_UNDEFINED(%DebugGetProperty(value, builtins.promiseStatus)); | 27 !IS_UNDEFINED(%DebugGetProperty(value, builtins.promiseStatus)); |
| 37 } catch (e) { | 28 } catch (e) { |
| 38 return false; | 29 return false; |
| 39 } | 30 } |
| (...skipping 2746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2786 } | 2777 } |
| 2787 if (!NUMBER_IS_FINITE(value)) { | 2778 if (!NUMBER_IS_FINITE(value)) { |
| 2788 if (value > 0) { | 2779 if (value > 0) { |
| 2789 return 'Infinity'; | 2780 return 'Infinity'; |
| 2790 } else { | 2781 } else { |
| 2791 return '-Infinity'; | 2782 return '-Infinity'; |
| 2792 } | 2783 } |
| 2793 } | 2784 } |
| 2794 return value; | 2785 return value; |
| 2795 } | 2786 } |
| OLD | NEW |