WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
146828
Integrate automatic microtask draining into JSC framework and re-enable Promise
https://bugs.webkit.org/show_bug.cgi?id=146828
Summary
Integrate automatic microtask draining into JSC framework and re-enable Promise
Yusuke Suzuki
Reported
2015-07-10 01:53:59 PDT
https://lists.webkit.org/pipermail/webkit-dev/2015-July/027531.html
Add default microtask system to JSC framework and draining the tasks when apilock depth becomes 0.
Attachments
Patch
(18.23 KB, patch)
2015-07-13 05:44 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(18.27 KB, patch)
2015-07-13 07:53 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(18.27 KB, patch)
2015-07-13 08:01 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(18.25 KB, patch)
2015-07-13 08:11 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(18.55 KB, patch)
2015-07-14 10:17 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(18.55 KB, patch)
2015-07-14 10:31 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(18.48 KB, patch)
2015-07-16 09:06 PDT
,
Yusuke Suzuki
sam
: review+
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Yusuke Suzuki
Comment 1
2015-07-13 05:44:22 PDT
Created
attachment 256694
[details]
Patch
Saam Barati
Comment 2
2015-07-13 07:10:39 PDT
Comment on
attachment 256694
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=256694&action=review
Looks good to me.
> Source/JavaScriptCore/API/tests/testapi.c:1862 > + JSStringRef undefined = JSStringCreateWithUTF8CString("function");
This should be renamed to "function" or something like that.
Saam Barati
Comment 3
2015-07-13 07:24:02 PDT
Comment on
attachment 256694
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=256694&action=review
> Source/JavaScriptCore/jsc.cpp:1404 > + globalObject->vm().drainMicrotasks();
Will this handle the nested queuing of microtasks?
Yusuke Suzuki
Comment 4
2015-07-13 07:47:18 PDT
Comment on
attachment 256694
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=256694&action=review
I'll update the patch to pass the build in OSX (adding export macro to the specific method).
>> Source/JavaScriptCore/jsc.cpp:1404 >> + globalObject->vm().drainMicrotasks(); > > Will this handle the nested queuing of microtasks?
Yes. In drainMicrotasks, we consumes the microtasks like the following, while (!m_microtaskQueue.isEmpty()) m_microtaskQueue.takeFirst()->run(); During the microtask execution, the new microtask may be enqueued. In that case, the queue becomes non empty and we'll drain it in the next loop iteration. I added the test for this case in js/promise-nested-microtasks :)
Yusuke Suzuki
Comment 5
2015-07-13 07:53:23 PDT
Created
attachment 256697
[details]
Patch
Yusuke Suzuki
Comment 6
2015-07-13 08:01:05 PDT
Created
attachment 256699
[details]
Patch
Yusuke Suzuki
Comment 7
2015-07-13 08:11:37 PDT
Created
attachment 256700
[details]
Patch
Yusuke Suzuki
Comment 8
2015-07-13 08:13:09 PDT
Currently I'm checking GTK port environment. I'll check it in OSX to pass the build.
Yusuke Suzuki
Comment 9
2015-07-14 02:46:37 PDT
OK, could you take a look?
Saam Barati
Comment 10
2015-07-14 09:23:54 PDT
Comment on
attachment 256700
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=256700&action=review
Looks good to me. I'd r+ if I could.
> Source/JavaScriptCore/API/tests/testapi.c:1862 > + JSStringRef undefined = JSStringCreateWithUTF8CString("function");
Name this variable "function" or something similar
> LayoutTests/js/script-tests/promise-nested-microtasks.js:26 > +debug('The promise is not fulfilled now.');
Maybe call this: "The promise is not fulfilled until after this function call executes"
Yusuke Suzuki
Comment 11
2015-07-14 10:13:35 PDT
Comment on
attachment 256700
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=256700&action=review
Thanks!
>> Source/JavaScriptCore/API/tests/testapi.c:1862 >> + JSStringRef undefined = JSStringCreateWithUTF8CString("function"); > > Name this variable "function" or something similar
Oops! Thanks, nice catch. I'll fix it :D
>> LayoutTests/js/script-tests/promise-nested-microtasks.js:26 >> +debug('The promise is not fulfilled now.'); > > Maybe call this: > "The promise is not fulfilled until after this function call executes"
Looks nice. Fixed.
Yusuke Suzuki
Comment 12
2015-07-14 10:17:55 PDT
Created
attachment 256775
[details]
Patch
Yusuke Suzuki
Comment 13
2015-07-14 10:31:32 PDT
Created
attachment 256777
[details]
Patch
Yusuke Suzuki
Comment 14
2015-07-16 09:06:19 PDT
Created
attachment 256902
[details]
Patch
Yusuke Suzuki
Comment 15
2015-07-16 09:07:19 PDT
Hi, could anyone take a look?
Sam Weinig
Comment 16
2015-07-17 15:33:02 PDT
Comment on
attachment 256902
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=256902&action=review
> Source/JavaScriptCore/runtime/VM.h:615 > + WTF::Deque<std::unique_ptr<QueuedTask>> m_microtaskQueue;
I don't think the WTF is needed here.
Yusuke Suzuki
Comment 17
2015-07-17 15:41:14 PDT
Comment on
attachment 256902
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=256902&action=review
Thank you for your review!
>> Source/JavaScriptCore/runtime/VM.h:615 >> + WTF::Deque<std::unique_ptr<QueuedTask>> m_microtaskQueue; > > I don't think the WTF is needed here.
Dropped `WTF::`.
Yusuke Suzuki
Comment 18
2015-07-17 15:41:58 PDT
Committed
r186966
: <
http://trac.webkit.org/changeset/186966
>
Yusuke Suzuki
Comment 19
2015-07-17 15:58:16 PDT
I'm now creating the follow up patch.
Yusuke Suzuki
Comment 20
2015-07-17 16:20:06 PDT
Committed
r186970
: <
http://trac.webkit.org/changeset/186970
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug