The problem with runMicrotasks is that it violates the asynchronicity invariant and the handler ordering semantics of the language. Worse, it makes running the microtask queue reentrant all of a sudden. It's unclear to me what the implications of this are, and I can't immediately convince myself that it doesn't have the potential to break stuff (both implementation-side and in user code).
On 17 May 2016 at 01:01, Caitlin Potter <[email protected]> wrote: > As part of the async functions runtime implementation, I had implemented a > function in d8.cc which would call isolate->RunMicrotasks() --- but was > talked down from doing this because of a worry that it might interfere with > certain uses of d8 out in the wild. > > So, I went with using the existing %RunMicrotasks runtime function --- but > of course this requires a flag to be present, so the mjsunit helpers which > rely on this can't be present in mjsunit.js (which means either a lot of > code duplication, or worse). > > What I'd like to do is get a feel for just how dangerous something like > `runMicrotasks()` in d8.cc, or if we could get away with adding it as a > method of a `TestUtils` or `Utils` object instead. Something that would > allow tests which rely on being able to drain the microtask queue (in order > to execute quickly, predictably, and synchronously, while still verifying > the correct async behaviours), without requiring a --allow-natives-syntax > just to parse the script. > > I don't think there's a huge risk in adding these to d8.cc, and they > aren't exposed in v8 itself (or Chromium) --- if you're a user of d8 and > you think a global variable named "Utils", "TestUtils", "runMicrotasks", or > whatever, would interfere with your uses of d8, I'd like to hear why and > how. > > Hopefully, there's consensus that it's not dangerous to add such a method > or object to d8's global object. > > -- > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to the Google Groups > "v8-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
