| 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 (function(global, utils) { | 5 (function(global, utils) { |
| 6 "use strict"; | 6 "use strict"; |
| 7 | 7 |
| 8 // ---------------------------------------------------------------------------- | 8 // ---------------------------------------------------------------------------- |
| 9 // Imports | 9 // Imports |
| 10 | 10 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 ClearMirrorCache(); | 100 ClearMirrorCache(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 | 103 |
| 104 function ClearMirrorCache(value) { | 104 function ClearMirrorCache(value) { |
| 105 next_handle_ = 0; | 105 next_handle_ = 0; |
| 106 mirror_cache_ = []; | 106 mirror_cache_ = []; |
| 107 } | 107 } |
| 108 | 108 |
| 109 | 109 |
| 110 // Wrapper to check whether an object is a Promise. The call may not work | |
| 111 // if promises are not enabled. | |
| 112 // TODO(yangguo): remove try-catch once promises are enabled by default. | |
| 113 function ObjectIsPromise(value) { | 110 function ObjectIsPromise(value) { |
| 114 try { | 111 return IS_SPEC_OBJECT(value) && |
| 115 return IS_SPEC_OBJECT(value) && | 112 !IS_UNDEFINED(%DebugGetProperty(value, promiseStatusSymbol)); |
| 116 !IS_UNDEFINED(%DebugGetProperty(value, promiseStatusSymbol)); | |
| 117 } catch (e) { | |
| 118 return false; | |
| 119 } | |
| 120 } | 113 } |
| 121 | 114 |
| 122 | 115 |
| 123 /** | 116 /** |
| 124 * Returns the mirror for a specified value or object. | 117 * Returns the mirror for a specified value or object. |
| 125 * | 118 * |
| 126 * @param {value or Object} value the value or object to retreive the mirror for | 119 * @param {value or Object} value the value or object to retreive the mirror for |
| 127 * @param {boolean} transient indicate whether this object is transient and | 120 * @param {boolean} transient indicate whether this object is transient and |
| 128 * should not be added to the mirror cache. The default is not transient. | 121 * should not be added to the mirror cache. The default is not transient. |
| 129 * @returns {Mirror} the mirror reflects the passed value or object | 122 * @returns {Mirror} the mirror reflects the passed value or object |
| (...skipping 2981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3111 // Functions needed by the debugger runtime. | 3104 // Functions needed by the debugger runtime. |
| 3112 utils.InstallFunctions(utils, DONT_ENUM, [ | 3105 utils.InstallFunctions(utils, DONT_ENUM, [ |
| 3113 "ClearMirrorCache", ClearMirrorCache | 3106 "ClearMirrorCache", ClearMirrorCache |
| 3114 ]); | 3107 ]); |
| 3115 | 3108 |
| 3116 // Export to debug.js | 3109 // Export to debug.js |
| 3117 utils.Export(function(to) { | 3110 utils.Export(function(to) { |
| 3118 to.MirrorType = MirrorType; | 3111 to.MirrorType = MirrorType; |
| 3119 }); | 3112 }); |
| 3120 }) | 3113 }) |
| OLD | NEW |