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 |
11 var GlobalArray = global.Array; | 11 var GlobalArray = global.Array; |
12 var IsNaN = global.isNaN; | 12 var IsNaN = global.isNaN; |
13 var JSONStringify = global.JSON.stringify; | 13 var JSONStringify = global.JSON.stringify; |
14 var MapEntries; | 14 var MapEntries; |
15 var MapIteratorNext; | 15 var MapIteratorNext; |
16 var promiseStateSymbol = utils.ImportNow("promise_state_symbol"); | |
17 var promiseResultSymbol = utils.ImportNow("promise_result_symbol"); | |
18 var SetIteratorNext; | 16 var SetIteratorNext; |
19 var SetValues; | 17 var SetValues; |
20 | 18 |
21 utils.Import(function(from) { | 19 utils.Import(function(from) { |
22 MapEntries = from.MapEntries; | 20 MapEntries = from.MapEntries; |
23 MapIteratorNext = from.MapIteratorNext; | 21 MapIteratorNext = from.MapIteratorNext; |
24 SetIteratorNext = from.SetIteratorNext; | 22 SetIteratorNext = from.SetIteratorNext; |
25 SetValues = from.SetValues; | 23 SetValues = from.SetValues; |
26 }); | 24 }); |
27 | 25 |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 * @constructor | 1258 * @constructor |
1261 * @extends ObjectMirror | 1259 * @extends ObjectMirror |
1262 */ | 1260 */ |
1263 function PromiseMirror(value) { | 1261 function PromiseMirror(value) { |
1264 %_Call(ObjectMirror, this, value, MirrorType.PROMISE_TYPE); | 1262 %_Call(ObjectMirror, this, value, MirrorType.PROMISE_TYPE); |
1265 } | 1263 } |
1266 inherits(PromiseMirror, ObjectMirror); | 1264 inherits(PromiseMirror, ObjectMirror); |
1267 | 1265 |
1268 | 1266 |
1269 function PromiseGetStatus_(value) { | 1267 function PromiseGetStatus_(value) { |
1270 var status = %DebugGetProperty(value, promiseStateSymbol); | 1268 var status = %PromiseStatus(value); |
1271 if (status == 0) return "pending"; | 1269 if (status == 0) return "pending"; |
1272 if (status == 1) return "resolved"; | 1270 if (status == 1) return "resolved"; |
1273 return "rejected"; | 1271 return "rejected"; |
1274 } | 1272 } |
1275 | 1273 |
1276 | 1274 |
1277 function PromiseGetValue_(value) { | 1275 function PromiseGetValue_(value) { |
1278 return %DebugGetProperty(value, promiseResultSymbol); | 1276 return %PromiseResult(value); |
1279 } | 1277 } |
1280 | 1278 |
1281 | 1279 |
1282 PromiseMirror.prototype.status = function() { | 1280 PromiseMirror.prototype.status = function() { |
1283 return PromiseGetStatus_(this.value_); | 1281 return PromiseGetStatus_(this.value_); |
1284 }; | 1282 }; |
1285 | 1283 |
1286 | 1284 |
1287 PromiseMirror.prototype.promiseValue = function() { | 1285 PromiseMirror.prototype.promiseValue = function() { |
1288 return MakeMirror(PromiseGetValue_(this.value_)); | 1286 return MakeMirror(PromiseGetValue_(this.value_)); |
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3080 // Functions needed by the debugger runtime. | 3078 // Functions needed by the debugger runtime. |
3081 utils.InstallFunctions(utils, DONT_ENUM, [ | 3079 utils.InstallFunctions(utils, DONT_ENUM, [ |
3082 "ClearMirrorCache", ClearMirrorCache | 3080 "ClearMirrorCache", ClearMirrorCache |
3083 ]); | 3081 ]); |
3084 | 3082 |
3085 // Export to debug.js | 3083 // Export to debug.js |
3086 utils.Export(function(to) { | 3084 utils.Export(function(to) { |
3087 to.MirrorType = MirrorType; | 3085 to.MirrorType = MirrorType; |
3088 }); | 3086 }); |
3089 }) | 3087 }) |
OLD | NEW |