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

Side by Side Diff: src/debug/mirrors.js

Issue 2521723003: [promises] Remove IsPromise (Closed)
Patch Set: rebase again Created 4 years 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
« no previous file with comments | « src/builtins/builtins-promise.cc ('k') | src/js/async-await.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 ClearMirrorCache(); 99 ClearMirrorCache();
100 } 100 }
101 101
102 102
103 function ClearMirrorCache(value) { 103 function ClearMirrorCache(value) {
104 next_handle_ = 0; 104 next_handle_ = 0;
105 mirror_cache_ = []; 105 mirror_cache_ = [];
106 } 106 }
107 107
108 108
109 function ObjectIsPromise(value) {
110 return IS_RECEIVER(value) &&
111 !IS_UNDEFINED(%DebugGetProperty(value, promiseStateSymbol));
112 }
113
114
115 /** 109 /**
116 * Returns the mirror for a specified value or object. 110 * Returns the mirror for a specified value or object.
117 * 111 *
118 * @param {value or Object} value the value or object to retrieve the mirror for 112 * @param {value or Object} value the value or object to retrieve the mirror for
119 * @param {boolean} transient indicate whether this object is transient and 113 * @param {boolean} transient indicate whether this object is transient and
120 * should not be added to the mirror cache. The default is not transient. 114 * should not be added to the mirror cache. The default is not transient.
121 * @returns {Mirror} the mirror reflects the passed value or object 115 * @returns {Mirror} the mirror reflects the passed value or object
122 */ 116 */
123 function MakeMirror(value, opt_transient) { 117 function MakeMirror(value, opt_transient) {
124 var mirror; 118 var mirror;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } else if (IS_ERROR(value)) { 155 } else if (IS_ERROR(value)) {
162 mirror = new ErrorMirror(value); 156 mirror = new ErrorMirror(value);
163 } else if (IS_SCRIPT(value)) { 157 } else if (IS_SCRIPT(value)) {
164 mirror = new ScriptMirror(value); 158 mirror = new ScriptMirror(value);
165 } else if (IS_MAP(value) || IS_WEAKMAP(value)) { 159 } else if (IS_MAP(value) || IS_WEAKMAP(value)) {
166 mirror = new MapMirror(value); 160 mirror = new MapMirror(value);
167 } else if (IS_SET(value) || IS_WEAKSET(value)) { 161 } else if (IS_SET(value) || IS_WEAKSET(value)) {
168 mirror = new SetMirror(value); 162 mirror = new SetMirror(value);
169 } else if (IS_MAP_ITERATOR(value) || IS_SET_ITERATOR(value)) { 163 } else if (IS_MAP_ITERATOR(value) || IS_SET_ITERATOR(value)) {
170 mirror = new IteratorMirror(value); 164 mirror = new IteratorMirror(value);
171 } else if (ObjectIsPromise(value)) { 165 } else if (%is_promise(value)) {
172 mirror = new PromiseMirror(value); 166 mirror = new PromiseMirror(value);
173 } else if (IS_GENERATOR(value)) { 167 } else if (IS_GENERATOR(value)) {
174 mirror = new GeneratorMirror(value); 168 mirror = new GeneratorMirror(value);
175 } else { 169 } else {
176 mirror = new ObjectMirror(value, MirrorType.OBJECT_TYPE, opt_transient); 170 mirror = new ObjectMirror(value, MirrorType.OBJECT_TYPE, opt_transient);
177 } 171 }
178 172
179 if (mirror_cache_enabled_) mirror_cache_[mirror.handle()] = mirror; 173 if (mirror_cache_enabled_) mirror_cache_[mirror.handle()] = mirror;
180 return mirror; 174 return mirror;
181 } 175 }
(...skipping 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after
3086 // Functions needed by the debugger runtime. 3080 // Functions needed by the debugger runtime.
3087 utils.InstallFunctions(utils, DONT_ENUM, [ 3081 utils.InstallFunctions(utils, DONT_ENUM, [
3088 "ClearMirrorCache", ClearMirrorCache 3082 "ClearMirrorCache", ClearMirrorCache
3089 ]); 3083 ]);
3090 3084
3091 // Export to debug.js 3085 // Export to debug.js
3092 utils.Export(function(to) { 3086 utils.Export(function(to) {
3093 to.MirrorType = MirrorType; 3087 to.MirrorType = MirrorType;
3094 }); 3088 });
3095 }) 3089 })
OLDNEW
« no previous file with comments | « src/builtins/builtins-promise.cc ('k') | src/js/async-await.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698