Add support for DateTimeFormat.formatToParts
Spec discussion: https://github.com/tc39/ecma402/issues/30
It's in stage 4 and Firefox has already implemented it.
For now, it's added to HARMONY_IN_PROGRESS bucket behind
'--datetime-format-to-parts' flag.
BUG=v8:5244
TEST=intl/date-format/date-format-to-parts.js
TEST=test262/intl402/DateTimeFormat/prototype/formatToParts/*
Committed: https://crrev.com/a3db819c9e438b3e735a7c9ca659c540ddc003bc
Cr-Commit-Position: refs/heads/master@{#39225}
Dan, can you take a look? It works, but may not be idomatic v8. So, ...
4 years, 4 months ago
(2016-08-24 21:52:06 UTC)
#2
Dan, can you take a look?
It works, but may not be idomatic v8. So, it may need a few iterations.
I also wonder if there's a way to represent 'atomic' strings in v8.
jungshik at Google
https://codereview.chromium.org/2273953003/diff/20001/src/runtime/runtime-i18n.cc File src/runtime/runtime-i18n.cc (right): https://codereview.chromium.org/2273953003/diff/20001/src/runtime/runtime-i18n.cc#newcode448 src/runtime/runtime-i18n.cc:448: Isolate* isolate) { I guess it can be converted ...
4 years, 4 months ago
(2016-08-24 23:03:35 UTC)
#3
Description was changed from ========== Add support for DateTimeFormat.formatToParts BUG=v8:5244 ========== to ========== Add support ...
4 years, 4 months ago
(2016-08-24 23:50:25 UTC)
#4
Description was changed from
==========
Add support for DateTimeFormat.formatToParts
BUG=v8:5244
==========
to
==========
Add support for DateTimeFormat.formatToParts
Spec discussion: https://github.com/tc39/ecma402/issues/30
BUG=v8:5244
==========
Dan Ehrenberg
A couple initial comments, but I didn't do a fully detailed review. https://codereview.chromium.org/2273953003/diff/20001/src/runtime/runtime-i18n.cc File src/runtime/runtime-i18n.cc ...
4 years, 3 months ago
(2016-08-25 16:54:46 UTC)
#5
On 2016/08/25 16:54:46, Dan Ehrenberg wrote: > A couple initial comments, but I didn't do ...
4 years, 3 months ago
(2016-08-25 17:49:47 UTC)
#6
On 2016/08/25 16:54:46, Dan Ehrenberg wrote:
> A couple initial comments, but I didn't do a fully detailed review.
>
>
https://codereview.chromium.org/2273953003/diff/20001/src/runtime/runtime-i18...
> File src/runtime/runtime-i18n.cc (right):
>
>
https://codereview.chromium.org/2273953003/diff/20001/src/runtime/runtime-i18...
> src/runtime/runtime-i18n.cc:448: Isolate* isolate) {
> On 2016/08/24 at 23:03:35, jungshik at google wrote:
> > I guess it can be converted to lambda function if desired.
>
> What do you mean?
Instead of passing some variables, I thought of capturing them in lambda, but
with two arguments gone (thanks to
INTERNALIZED_STRING_LIST), it's not worth tinkering, I think.
>
https://codereview.chromium.org/2273953003/diff/20001/src/runtime/runtime-i18...
> src/runtime/runtime-i18n.cc:495: Handle<Name> value_literal =
> factory->NewStringFromStaticChars("value");
> On 2016/08/24 at 23:03:35, jungshik at google wrote:
> > Is there a better way to represent the above two constant static strings?
>
> Yes, you can add them to the INTERNALIZED_STRING_LIST in src/heap-symbols.h
Thanks ! 'value' is already there. I'll add 'type'.
>
>
https://codereview.chromium.org/2273953003/diff/40001/src/runtime/runtime-i18...
> File src/runtime/runtime-i18n.cc (right):
>
>
https://codereview.chromium.org/2273953003/diff/40001/src/runtime/runtime-i18...
> src/runtime/runtime-i18n.cc:407: "year", // UDAT_YEAR_FIELD = 1,
> Nit: Maybe use the '[UDAT] = "year",' syntax for clarity and maintainability?
Thanks. What do you think of adding 'year', 'weekday', etc to the above
INTERNALIZED_STRING_LIST as well?
Then, I can have
const DateTimePartEnum kIcuDateFieldIdToDateTimePartName[] = {
[UDAT_YEAR_FIELD] = DateTimePartYear,
[UDAT_HOUR_FIELD] = DateTimePartHour,
....
};
Handle<String> IcuDateFieldIdToDateTimePartName (int32_t field_id, Isolate*
isolate) {
switch (kICuDateFieldIdToDateTimePartName[field_id]) {
case: DateTimePartYear:
return isolate->factory()->year_string();
....
}
Or, we can just skip the indirection via kIcuDateFieldIdToDateTimePartName and
use switch-case directly (it's 37 cases vs 10 cases).
switch(field_id) {
case: UDAT_YEAR_FILED:
case UDAT_EXTENDED_YEAR_FIELD:
case UDAT_YEAR_NAME_FIELD:
return isolate->factory()->year_string();
case: UDAT_HOUR1_FIELD:
case: UDAT_HOUR0_FIELD:
...
return isolate->factory()->hour_string();
.....
>
https://codereview.chromium.org/2273953003/diff/40001/src/runtime/runtime-i18...
> src/runtime/runtime-i18n.cc:504: if (type == nullptr) {
> Omitting these fields seems like strange behavior. I wonder if we should
pursue
> spec changes to make it so that we don't have these null fields in the above
> array, or so we can use an "other" type.
The current DateTimeFormat does not support those fields (e.g. fractional
second, quarter, milliseconds in day, etc).
In the output of format() and formatToParts(), those fields will not show up
because there's no way to request them in |options| of DateTimeFormat. If we
want to support them, DateTimeFormat spec has to be revised to add options for
them.
jungshik at Google
Dan, can you take another look?
4 years, 3 months ago
(2016-08-25 22:08:38 UTC)
#7
Dan, can you take another look?
Dan Ehrenberg
On 2016/08/25 at 17:49:47, jshin wrote: > On 2016/08/25 16:54:46, Dan Ehrenberg wrote: > > ...
4 years, 3 months ago
(2016-08-25 23:37:29 UTC)
#8
On 2016/08/25 at 17:49:47, jshin wrote:
> On 2016/08/25 16:54:46, Dan Ehrenberg wrote:
> > A couple initial comments, but I didn't do a fully detailed review.
> >
> >
https://codereview.chromium.org/2273953003/diff/20001/src/runtime/runtime-i18...
> > File src/runtime/runtime-i18n.cc (right):
> >
> >
https://codereview.chromium.org/2273953003/diff/20001/src/runtime/runtime-i18...
> > src/runtime/runtime-i18n.cc:448: Isolate* isolate) {
> > On 2016/08/24 at 23:03:35, jungshik at google wrote:
> > > I guess it can be converted to lambda function if desired.
> >
> > What do you mean?
>
> Instead of passing some variables, I thought of capturing them in lambda, but
with two arguments gone (thanks to
> INTERNALIZED_STRING_LIST), it's not worth tinkering, I think.
>
> >
https://codereview.chromium.org/2273953003/diff/20001/src/runtime/runtime-i18...
> > src/runtime/runtime-i18n.cc:495: Handle<Name> value_literal =
> > factory->NewStringFromStaticChars("value");
> > On 2016/08/24 at 23:03:35, jungshik at google wrote:
> > > Is there a better way to represent the above two constant static strings?
> >
> > Yes, you can add them to the INTERNALIZED_STRING_LIST in src/heap-symbols.h
>
> Thanks ! 'value' is already there. I'll add 'type'.
> >
> >
https://codereview.chromium.org/2273953003/diff/40001/src/runtime/runtime-i18...
> > File src/runtime/runtime-i18n.cc (right):
> >
> >
https://codereview.chromium.org/2273953003/diff/40001/src/runtime/runtime-i18...
> > src/runtime/runtime-i18n.cc:407: "year", // UDAT_YEAR_FIELD = 1,
> > Nit: Maybe use the '[UDAT] = "year",' syntax for clarity and
maintainability?
>
> Thanks. What do you think of adding 'year', 'weekday', etc to the above
INTERNALIZED_STRING_LIST as well?
>
> Then, I can have
>
> const DateTimePartEnum kIcuDateFieldIdToDateTimePartName[] = {
>
> [UDAT_YEAR_FIELD] = DateTimePartYear,
> [UDAT_HOUR_FIELD] = DateTimePartHour,
> ....
> };
>
> Handle<String> IcuDateFieldIdToDateTimePartName (int32_t field_id, Isolate*
isolate) {
> switch (kICuDateFieldIdToDateTimePartName[field_id]) {
> case: DateTimePartYear:
> return isolate->factory()->year_string();
> ....
> }
>
> Or, we can just skip the indirection via kIcuDateFieldIdToDateTimePartName and
use switch-case directly (it's 37 cases vs 10 cases).
>
> switch(field_id) {
> case: UDAT_YEAR_FILED:
> case UDAT_EXTENDED_YEAR_FIELD:
> case UDAT_YEAR_NAME_FIELD:
> return isolate->factory()->year_string();
> case: UDAT_HOUR1_FIELD:
> case: UDAT_HOUR0_FIELD:
> ...
> return isolate->factory()->hour_string();
> .....
>
>
I like this last variant!
> >
https://codereview.chromium.org/2273953003/diff/40001/src/runtime/runtime-i18...
> > src/runtime/runtime-i18n.cc:504: if (type == nullptr) {
> > Omitting these fields seems like strange behavior. I wonder if we should
pursue
> > spec changes to make it so that we don't have these null fields in the above
> > array, or so we can use an "other" type.
>
> The current DateTimeFormat does not support those fields (e.g. fractional
second, quarter, milliseconds in day, etc).
> In the output of format() and formatToParts(), those fields will not show up
because there's no way to request them in |options| of DateTimeFormat. If we
want to support them, DateTimeFormat spec has to be revised to add options for
them.
In that case, how about adding UNREACHABLE() then, rather than continue?
Dry run: Try jobs failed on following builders: v8_android_arm_compile_rel on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_android_arm_compile_rel/builds/23679) v8_linux64_asan_rel_ng on ...
4 years, 3 months ago
(2016-09-01 00:10:24 UTC)
#17
Dry run: Try jobs failed on following builders: v8_win_compile_dbg on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_compile_dbg/builds/23527) v8_win_rel_ng on ...
4 years, 3 months ago
(2016-09-01 05:07:04 UTC)
#21
Dry run: Try jobs failed on following builders: v8_linux64_asan_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_asan_rel_ng/builds/8007) v8_linux64_avx2_rel_ng on ...
4 years, 3 months ago
(2016-09-01 17:07:51 UTC)
#25
Dry run: Try jobs failed on following builders: v8_android_arm_compile_rel on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_android_arm_compile_rel/builds/23758) v8_linux64_asan_rel_ng on ...
4 years, 3 months ago
(2016-09-01 17:13:11 UTC)
#29
Description was changed from ========== Add support for DateTimeFormat.formatToParts Spec discussion: https://github.com/tc39/ecma402/issues/30 BUG=v8:5244 ========== to ...
4 years, 3 months ago
(2016-09-01 17:13:26 UTC)
#30
Description was changed from
==========
Add support for DateTimeFormat.formatToParts
Spec discussion: https://github.com/tc39/ecma402/issues/30
BUG=v8:5244
==========
to
==========
Add support for DateTimeFormat.formatToParts
Spec discussion: https://github.com/tc39/ecma402/issues/30
BUG=v8:5244
TEST=intl/date-format/date-format-to-parts.js
==========
jungshik at Google
Description was changed from ========== Add support for DateTimeFormat.formatToParts Spec discussion: https://github.com/tc39/ecma402/issues/30 BUG=v8:5244 TEST=intl/date-format/date-format-to-parts.js ========== ...
4 years, 3 months ago
(2016-09-01 17:14:01 UTC)
#31
Description was changed from
==========
Add support for DateTimeFormat.formatToParts
Spec discussion: https://github.com/tc39/ecma402/issues/30
BUG=v8:5244
TEST=intl/date-format/date-format-to-parts.js
==========
to
==========
Add support for DateTimeFormat.formatToParts
Spec discussion: https://github.com/tc39/ecma402/issues/30
It's in stage 4 and Firefox has already implemented it.
BUG=v8:5244
TEST=intl/date-format/date-format-to-parts.js
==========
jungshik at Google
The CQ bit was checked by jshin@chromium.org to run a CQ dry run
4 years, 3 months ago
(2016-09-01 17:19:53 UTC)
#32
Dry run: Try jobs failed on following builders: v8_android_arm_compile_rel on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_android_arm_compile_rel/builds/23761) v8_linux_mipsel_compile_rel on ...
4 years, 3 months ago
(2016-09-01 17:24:32 UTC)
#35
On 2016/08/29 21:05:30, Dan Ehrenberg wrote: > Did you run the test262 tests against this ...
4 years, 3 months ago
(2016-09-01 17:27:39 UTC)
#36
On 2016/08/29 21:05:30, Dan Ehrenberg wrote:
> Did you run the test262 tests against this patch?
I was wondering if there's any test for this in test262, but couldn't find it.
Where is it? I updated to the trunk and run gclient sync to pull test262, but
intl402/DateTimeFormat/* does not have any for formatToParts.
So, I've just added my own simple test to intl/date-format.
jungshik at Google
The CQ bit was checked by jshin@chromium.org to run a CQ dry run
4 years, 3 months ago
(2016-09-01 17:34:09 UTC)
#37
4 years, 3 months ago
(2016-09-01 18:14:22 UTC)
#40
Dry run: This issue passed the CQ dry run.
jungshik at Google
Description was changed from ========== Add support for DateTimeFormat.formatToParts Spec discussion: https://github.com/tc39/ecma402/issues/30 It's in stage ...
4 years, 3 months ago
(2016-09-02 09:31:23 UTC)
#41
Description was changed from
==========
Add support for DateTimeFormat.formatToParts
Spec discussion: https://github.com/tc39/ecma402/issues/30
It's in stage 4 and Firefox has already implemented it.
BUG=v8:5244
TEST=intl/date-format/date-format-to-parts.js
==========
to
==========
Add support for DateTimeFormat.formatToParts
Spec discussion: https://github.com/tc39/ecma402/issues/30
It's in stage 4 and Firefox has already implemented it.
BUG=v8:5244
TEST=intl/date-format/date-format-to-parts.js
TEST=test262/intl402/DateTimeFormat/prototype/formatToParts/*
==========
jungshik at Google
In release build, all the test262 tests pass (except for one minor issue with two ...
4 years, 3 months ago
(2016-09-02 09:40:50 UTC)
#42
In release build, all the test262 tests pass (except for one minor issue with
two very unusual combination of fields - year and day without month).
In debug build, the following code snippet is executed. Returning false from
here triggers CHECK().
#ifdef DEBUG
if (map() != (is_strict(shared()->language_mode())
? native_context->strict_function_map()
: native_context->sloppy_function_map())) {
return false;
}
#endif
jungshik at Google
The CQ bit was checked by jshin@chromium.org to run a CQ dry run
4 years, 3 months ago
(2016-09-02 17:00:21 UTC)
#43
Dry run: Try jobs failed on following builders: v8_mac_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_mac_rel_ng/builds/8149) v8_mac_rel_ng_triggered on ...
4 years, 3 months ago
(2016-09-02 17:18:00 UTC)
#46
Dry run: Try jobs failed on following builders: v8_linux64_avx2_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_avx2_rel_ng/builds/8004) v8_linux64_avx2_rel_ng_triggered on ...
4 years, 3 months ago
(2016-09-02 18:23:27 UTC)
#50
Dry run: Try jobs failed on following builders: v8_mac_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_mac_rel_ng/builds/8325)
4 years, 3 months ago
(2016-09-06 17:09:12 UTC)
#54
On 2016/09/02 09:40:50, jungshik at google wrote: > In release build, all the test262 tests ...
4 years, 3 months ago
(2016-09-06 18:03:19 UTC)
#57
On 2016/09/02 09:40:50, jungshik at google wrote:
> In release build, all the test262 tests pass (except for one minor issue with
> two very unusual combination of fields - year and day without month).
>
> In debug build, the following code snippet is executed. Returning false from
> here triggers CHECK().
>
> #ifdef DEBUG
> if (map() != (is_strict(shared()->language_mode())
> ? native_context->strict_function_map()
> : native_context->sloppy_function_map())) {
> return false;
> }
> #endif
I should have called RemovePrototype for formatDateToParts (in i18n.js) that I'm
adding behind flag in datetime-format-to-parts.js. That will also fix half a
dozen test failures in Promise* (PS #17). They all come from
JSFunction::RemovePrototype (#ifdef DEBUG section).
Dan, can you take another look?
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
4 years, 3 months ago
(2016-09-06 18:28:56 UTC)
#58
Description was changed from ========== Add support for DateTimeFormat.formatToParts Spec discussion: https://github.com/tc39/ecma402/issues/30 It's in stage ...
4 years, 3 months ago
(2016-09-06 22:05:02 UTC)
#69
Description was changed from
==========
Add support for DateTimeFormat.formatToParts
Spec discussion: https://github.com/tc39/ecma402/issues/30
It's in stage 4 and Firefox has already implemented it.
BUG=v8:5244
TEST=intl/date-format/date-format-to-parts.js
TEST=test262/intl402/DateTimeFormat/prototype/formatToParts/*
==========
to
==========
Add support for DateTimeFormat.formatToParts
Spec discussion: https://github.com/tc39/ecma402/issues/30
It's in stage 4 and Firefox has already implemented it.
For now, it's added to HARMONY_IN_PROGRESS bucket behind
'--datetime-format-to-parts' flag.
BUG=v8:5244
TEST=intl/date-format/date-format-to-parts.js
TEST=test262/intl402/DateTimeFormat/prototype/formatToParts/*
==========
jungshik at Google
On 2016/09/06 21:55:19, Dan Ehrenberg wrote: > lgtm > > LGTM modulo a one-line fix ...
4 years, 3 months ago
(2016-09-06 22:05:39 UTC)
#70
4 years, 3 months ago
(2016-09-06 22:56:57 UTC)
#78
Message was sent while issue was closed.
Committed patchset #22 (id:420001)
commit-bot: I haz the power
Description was changed from ========== Add support for DateTimeFormat.formatToParts Spec discussion: https://github.com/tc39/ecma402/issues/30 It's in stage ...
4 years, 3 months ago
(2016-09-06 22:57:18 UTC)
#79
Message was sent while issue was closed.
Description was changed from
==========
Add support for DateTimeFormat.formatToParts
Spec discussion: https://github.com/tc39/ecma402/issues/30
It's in stage 4 and Firefox has already implemented it.
For now, it's added to HARMONY_IN_PROGRESS bucket behind
'--datetime-format-to-parts' flag.
BUG=v8:5244
TEST=intl/date-format/date-format-to-parts.js
TEST=test262/intl402/DateTimeFormat/prototype/formatToParts/*
==========
to
==========
Add support for DateTimeFormat.formatToParts
Spec discussion: https://github.com/tc39/ecma402/issues/30
It's in stage 4 and Firefox has already implemented it.
For now, it's added to HARMONY_IN_PROGRESS bucket behind
'--datetime-format-to-parts' flag.
BUG=v8:5244
TEST=intl/date-format/date-format-to-parts.js
TEST=test262/intl402/DateTimeFormat/prototype/formatToParts/*
Committed: https://crrev.com/a3db819c9e438b3e735a7c9ca659c540ddc003bc
Cr-Commit-Position: refs/heads/master@{#39225}
==========
commit-bot: I haz the power
Patchset 22 (id:??) landed as https://crrev.com/a3db819c9e438b3e735a7c9ca659c540ddc003bc Cr-Commit-Position: refs/heads/master@{#39225}
4 years, 3 months ago
(2016-09-06 22:57:19 UTC)
#80
Issue 2273953003: Add support for DateTimeFormat.formatToParts
(Closed)
Created 4 years, 4 months ago by jungshik at Google
Modified 4 years, 3 months ago
Reviewers: Dan Ehrenberg, Michael Lippautz
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Comments: 24