OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 (function(global, utils, extrasUtils) { |
| 6 |
| 7 "use strict"; |
| 8 |
| 9 %CheckIsBootstrapping(); |
| 10 |
| 11 // ---------------------------------------------------------- |
| 12 // Imports |
| 13 |
| 14 let InternalArray = utils.InternalArray; |
| 15 |
| 16 // ------------------------------------------------------------------- |
| 17 |
| 18 let microtaskQ = [] |
| 19 |
| 20 function MicrotaskEnq(task) { |
| 21 microtaskQ.push(task); |
| 22 } |
| 23 |
| 24 function MicrotaskRun() { |
| 25 for( var i = 0; i < microtaskQ.length; i ++) { |
| 26 try { |
| 27 microtaskQ[i](); |
| 28 } catch (e) {} |
| 29 } |
| 30 |
| 31 microtaskQ = []; |
| 32 } |
| 33 |
| 34 // ------------------------------------------------------------------- |
| 35 // Install exported functions. |
| 36 |
| 37 utils.Export(function(to) { |
| 38 to.MicrotaskEnq = MicrotaskEnq; |
| 39 }); |
| 40 |
| 41 %InstallToContext([ |
| 42 "microtask_run", MicrotaskRun, |
| 43 "microtask_enq", MicrotaskEnq |
| 44 ]); |
| 45 }) |
OLD | NEW |