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