|
|
Created:
4 years, 7 months ago by pgorszkowski Modified:
4 years, 7 months ago CC:
v8-reviews_googlegroups.com Base URL:
https://chromium.googlesource.com/v8/v8.git@master Target Ref:
refs/pending/heads/master Project:
v8 Visibility:
Public. |
DescriptionInvalidate defaultObjects if timezone changes
In case of calling 'toLocaleString', 'toLocaleTimeString' and
'toLocaleDateString' functions of 'Date' with empty 'locales' and
'options', DateTimeFormat is cached inside 'defaultObjects'.
If we change the timezone the cache is not invalidated.
BUG=v8:5022
TEST=cctest:DateCacheVersion. See the bug
CQ_INCLUDE_TRYBOTS=tryserver.v8:v8_linux_noi18n_rel_ng
Committed: https://crrev.com/7afd712ae01cb40aa233ab80dad1b69a8b72a76c
Cr-Commit-Position: refs/heads/master@{#36420}
Patch Set 1 #Patch Set 2 : added missing checkDateCacheCurrent in cachedOrNewService #Patch Set 3 : added unit test for function DateCacheVersion #
Total comments: 4
Patch Set 4 : fixes after review+DateCacheVersion should be called each time in checkDateCacheCurrent #
Total comments: 6
Patch Set 5 : fixes after review #
Messages
Total messages: 39 (17 generated)
Description was changed from ========== Invalidate defaultObjects if timezone changes In case of calling 'toLocaleString', 'toLocaleTimeString' and 'toLocaleDateString' functions of 'Date' with empty 'locales' and 'options', DateTimeFormat is cached inside 'defaultObjects'. If we change the timezone the cache is not invalidated. BUG=5022 TEST=see: https://bugs.chromium.org/p/v8/issues/detail?id=5022 for more details. ========== to ========== Invalidate defaultObjects if timezone changes In case of calling 'toLocaleString', 'toLocaleTimeString' and 'toLocaleDateString' functions of 'Date' with empty 'locales' and 'options', DateTimeFormat is cached inside 'defaultObjects'. If we change the timezone the cache is not invalidated. BUG=https://bugs.chromium.org/p/v8/issues/detail?id=5022 TEST=see: https://bugs.chromium.org/p/v8/issues/detail?id=5022 for more details. ==========
The CQ bit was checked by littledan@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1985423003/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1985423003/40001
littledan@chromium.org changed reviewers: + jshin@chromium.org
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Thanks. Actually, I was planning to add something similar to this to my WiP CL (to fix this issue and the past/future timezone offset issue : https://bugs.chromium.org/p/v8/issues/detail?id=3547 ). This CL can go in first and I'll rebase my CL ( https://codereview.chromium.org/1973183002 ) LGTM One nit: Please, change BUG= line to BUG=v8:5022
Description was changed from ========== Invalidate defaultObjects if timezone changes In case of calling 'toLocaleString', 'toLocaleTimeString' and 'toLocaleDateString' functions of 'Date' with empty 'locales' and 'options', DateTimeFormat is cached inside 'defaultObjects'. If we change the timezone the cache is not invalidated. BUG=https://bugs.chromium.org/p/v8/issues/detail?id=5022 TEST=see: https://bugs.chromium.org/p/v8/issues/detail?id=5022 for more details. ========== to ========== Invalidate defaultObjects if timezone changes In case of calling 'toLocaleString', 'toLocaleTimeString' and 'toLocaleDateString' functions of 'Date' with empty 'locales' and 'options', DateTimeFormat is cached inside 'defaultObjects'. If we change the timezone the cache is not invalidated. BUG=v8:5022 TEST=see: https://bugs.chromium.org/p/v8/issues/detail?id=5022 for more details. ==========
Description was changed from ========== Invalidate defaultObjects if timezone changes In case of calling 'toLocaleString', 'toLocaleTimeString' and 'toLocaleDateString' functions of 'Date' with empty 'locales' and 'options', DateTimeFormat is cached inside 'defaultObjects'. If we change the timezone the cache is not invalidated. BUG=v8:5022 TEST=see: https://bugs.chromium.org/p/v8/issues/detail?id=5022 for more details. ========== to ========== Invalidate defaultObjects if timezone changes In case of calling 'toLocaleString', 'toLocaleTimeString' and 'toLocaleDateString' functions of 'Date' with empty 'locales' and 'options', DateTimeFormat is cached inside 'defaultObjects'. If we change the timezone the cache is not invalidated. BUG=v8:5022 TEST=see the bug ==========
On 2016/05/18 17:29:42, jshin (jungshik at google) wrote: > Thanks. Actually, I was planning to add something similar to this to my WiP CL > (to fix this issue and the past/future timezone offset issue : > https://bugs.chromium.org/p/v8/issues/detail?id=3547 ). > > This CL can go in first and I'll rebase my CL ( > https://codereview.chromium.org/1973183002 ) > > LGTM > > One nit: Please, change BUG= line to > > BUG=v8:5022 I just did that, myself :-)
Do you have an idea of the performance impact in the normal case where you don't change time zones? https://codereview.chromium.org/1985423003/diff/40001/src/runtime/runtime-dat... File src/runtime/runtime-date.cc (right): https://codereview.chromium.org/1985423003/diff/40001/src/runtime/runtime-dat... src/runtime/runtime-date.cc:39: RUNTIME_FUNCTION(Runtime_DateCacheVersion) { If this is only used by Intl, better to put it in runtime-i18n.cc https://codereview.chromium.org/1985423003/diff/40001/src/runtime/runtime-dat... src/runtime/runtime-date.cc:55: isolate->factory()->NewJSObject(isolate->array_function()); Why is this wrapped in an array, rather than just returning the first element, if that is all that's used?
On 2016/05/18 17:39:57, Dan Ehrenberg wrote: > Do you have an idea of the performance impact in the normal case where you don't > change time zones? Presumably, %DateCacheVersion() is fast enough. Note that Date.prototype.ToString() already does this kind of invalidation in C++. See https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/date.cc&l=25 (ResetDateCache) and https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/api.cc&l=6146 > > https://codereview.chromium.org/1985423003/diff/40001/src/runtime/runtime-dat... > File src/runtime/runtime-date.cc (right): > > https://codereview.chromium.org/1985423003/diff/40001/src/runtime/runtime-dat... > src/runtime/runtime-date.cc:39: RUNTIME_FUNCTION(Runtime_DateCacheVersion) { > If this is only used by Intl, better to put it in runtime-i18n.cc > > https://codereview.chromium.org/1985423003/diff/40001/src/runtime/runtime-dat... > src/runtime/runtime-date.cc:55: > isolate->factory()->NewJSObject(isolate->array_function()); > Why is this wrapped in an array, rather than just returning the first element, > if that is all that's used? I guess that's taken from another place DateCacheVersion is used. I was wondering about that when looking at that code. See https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/api.cc&l=6146
On 2016/05/18 18:06:31, jshin (jungshik at google) wrote: > On 2016/05/18 17:39:57, Dan Ehrenberg wrote: > > Do you have an idea of the performance impact in the normal case where you > don't > > change time zones? > > Presumably, %DateCacheVersion() is fast enough. Note that > Date.prototype.ToString() already does this > kind of invalidation in C++. See > https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/date.cc&l=25 > (ResetDateCache) > and > https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/api.cc&l=6146 Actually, there's a slightly better way. My CL ( https://codereview.chromium.org/1973183002 ; it checks and update timezone everytime, though. My next step was to check DateCacheVersion) ) only updates the timezone instead of invaldating the whole ICU DateTimeFormat object. It's a bit expensive to create a new instance from the ground up. So, what my CL does is just update the timezone (nothing else is changed). We can land this CL and then follow this up by my optimization (with other comments addressed). > > > > > > https://codereview.chromium.org/1985423003/diff/40001/src/runtime/runtime-dat... > > File src/runtime/runtime-date.cc (right): > > > > > https://codereview.chromium.org/1985423003/diff/40001/src/runtime/runtime-dat... > > src/runtime/runtime-date.cc:39: RUNTIME_FUNCTION(Runtime_DateCacheVersion) { > > If this is only used by Intl, better to put it in runtime-i18n.cc > > > > > https://codereview.chromium.org/1985423003/diff/40001/src/runtime/runtime-dat... > > src/runtime/runtime-date.cc:55: > > isolate->factory()->NewJSObject(isolate->array_function()); > > Why is this wrapped in an array, rather than just returning the first element, > > if that is all that's used? > > I guess that's taken from another place DateCacheVersion is used. I was > wondering about that when looking at that code. See > https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/api.cc&l=6146
On 2016/05/18 18:15:46, jshin (jungshik at google) wrote: > On 2016/05/18 18:06:31, jshin (jungshik at google) wrote: > > On 2016/05/18 17:39:57, Dan Ehrenberg wrote: > > > Do you have an idea of the performance impact in the normal case where you > > don't > > > change time zones? > > > > Presumably, %DateCacheVersion() is fast enough. Note that > > Date.prototype.ToString() already does this > > kind of invalidation in C++. See > > https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/date.cc&l=25 > > (ResetDateCache) > > and > > > https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/api.cc&l=6146 > > > Actually, there's a slightly better way. My CL ( > https://codereview.chromium.org/1973183002 ; it checks and update timezone > everytime, though. My next step was to check DateCacheVersion) ) only updates > the timezone instead of > invaldating the whole ICU DateTimeFormat object. It's a bit expensive to create > a new instance from the ground up. So, what my CL does is just > update the timezone (nothing else is changed). > > We can land this CL and then follow this up by my optimization (with other > comments addressed). A clarification: I expect little (if any) perf degradation for normal cases (NO timezone change) with this CL. My optimization ONLY affects when there is a timezone change, which would be rare.
The CQ bit was checked by pgorszkowski@opera.com
The CQ bit was unchecked by pgorszkowski@opera.com
https://codereview.chromium.org/1985423003/diff/40001/src/runtime/runtime-dat... File src/runtime/runtime-date.cc (right): https://codereview.chromium.org/1985423003/diff/40001/src/runtime/runtime-dat... src/runtime/runtime-date.cc:55: isolate->factory()->NewJSObject(isolate->array_function()); On 2016/05/18 17:39:57, Dan Ehrenberg wrote: > Why is this wrapped in an array, rather than just returning the first element, > if that is all that's used? Currently it is kept as FixedArray, should we change it too? What kind of 'Object' should it be - any suggestions?
lgtm In conversation with jshin, sounds like the perf degradation would be insignificant and the array follows patterns elsewhere.
LGTM 2 !
The CQ bit was checked by jshin@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1985423003/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1985423003/60001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: v8_win_nosnap_shared_rel_ng on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_nosnap_shared_rel_ng...) v8_win_nosnap_shared_rel_ng_triggered on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_nosnap_shared_rel_ng...)
On 2016/05/19 20:32:12, commit-bot: I haz the power wrote: > Try jobs failed on following builders: > v8_win_nosnap_shared_rel_ng on tryserver.v8 (JOB_FAILED, > http://build.chromium.org/p/tryserver.v8/builders/v8_win_nosnap_shared_rel_ng...) > v8_win_nosnap_shared_rel_ng_triggered on tryserver.v8 (JOB_FAILED, > http://build.chromium.org/p/tryserver.v8/builders/v8_win_nosnap_shared_rel_ng...) I still need to fix unit tests.
Sorry that I missed one problem. Fortunately, trybot (Asan) caught it. See the comment below. https://codereview.chromium.org/1985423003/diff/60001/test/cctest/test-date.cc File test/cctest/test-date.cc (right): https://codereview.chromium.org/1985423003/diff/60001/test/cctest/test-date.c... test/cctest/test-date.cc:170: TEST(DateCacheVersion) { This test has to be enclosed by #ifdef V8_I18N_SUPPORT #endif because %DateCacheVersion is defined in runtime-i18n.cc which is not compiled when V8_I18N_SUPPORT is not defined. https://codereview.chromium.org/1985423003/diff/60001/test/cctest/test-date.c... test/cctest/test-date.cc:178: v8::Local<v8::Array>::Cast(CompileRun("%DateCacheVersion()")); Asan test failed because DateCacheVersion is changed to return only a version number instead of an array. This test has to be adjusted accordingly.
Description was changed from ========== Invalidate defaultObjects if timezone changes In case of calling 'toLocaleString', 'toLocaleTimeString' and 'toLocaleDateString' functions of 'Date' with empty 'locales' and 'options', DateTimeFormat is cached inside 'defaultObjects'. If we change the timezone the cache is not invalidated. BUG=v8:5022 TEST=see the bug ========== to ========== Invalidate defaultObjects if timezone changes In case of calling 'toLocaleString', 'toLocaleTimeString' and 'toLocaleDateString' functions of 'Date' with empty 'locales' and 'options', DateTimeFormat is cached inside 'defaultObjects'. If we change the timezone the cache is not invalidated. BUG=v8:5022 TEST=cctest:DateCacheVersion. See the bug CQ_INCLUDE_TRYBOTS=tryserver.v8:v8_linux_noi18n_rel_ng ==========
https://codereview.chromium.org/1985423003/diff/60001/src/js/i18n.js File src/js/i18n.js (right): https://codereview.chromium.org/1985423003/diff/60001/src/js/i18n.js#newcode2001 src/js/i18n.js:2001: var date_cache_version_holder = %DateCacheVersion(); nit: What's returned by DateCacheVersion is not a holder any more. How about |new_date_cache_version| instead of |date_cache_version_holder|?
The CQ bit was checked by pgorszkowski@opera.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1985423003/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1985423003/80001
The CQ bit was unchecked by pgorszkowski@opera.com
https://codereview.chromium.org/1985423003/diff/40001/src/runtime/runtime-dat... File src/runtime/runtime-date.cc (right): https://codereview.chromium.org/1985423003/diff/40001/src/runtime/runtime-dat... src/runtime/runtime-date.cc:39: RUNTIME_FUNCTION(Runtime_DateCacheVersion) { On 2016/05/18 17:39:57, Dan Ehrenberg wrote: > If this is only used by Intl, better to put it in runtime-i18n.cc Done.
https://codereview.chromium.org/1985423003/diff/60001/src/js/i18n.js File src/js/i18n.js (right): https://codereview.chromium.org/1985423003/diff/60001/src/js/i18n.js#newcode2001 src/js/i18n.js:2001: var date_cache_version_holder = %DateCacheVersion(); On 2016/05/19 23:11:58, jshin (jungshik at google) wrote: > nit: What's returned by DateCacheVersion is not a holder any more. > > How about |new_date_cache_version| instead of |date_cache_version_holder|? Done. https://codereview.chromium.org/1985423003/diff/60001/test/cctest/test-date.cc File test/cctest/test-date.cc (right): https://codereview.chromium.org/1985423003/diff/60001/test/cctest/test-date.c... test/cctest/test-date.cc:170: TEST(DateCacheVersion) { On 2016/05/19 22:10:31, jshin (jungshik at google) wrote: > This test has to be enclosed by > > #ifdef V8_I18N_SUPPORT > #endif > > because %DateCacheVersion is defined in runtime-i18n.cc which is not compiled > when V8_I18N_SUPPORT is not defined. Done. https://codereview.chromium.org/1985423003/diff/60001/test/cctest/test-date.c... test/cctest/test-date.cc:178: v8::Local<v8::Array>::Cast(CompileRun("%DateCacheVersion()")); On 2016/05/19 22:10:31, jshin (jungshik at google) wrote: > Asan test failed because DateCacheVersion is changed to return only a > version number instead of an array. > > This test has to be adjusted accordingly. Done.
The CQ bit was checked by jshin@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from jshin@chromium.org, littledan@chromium.org Link to the patchset: https://codereview.chromium.org/1985423003/#ps80001 (title: "fixes after review")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1985423003/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1985423003/80001
Message was sent while issue was closed.
Description was changed from ========== Invalidate defaultObjects if timezone changes In case of calling 'toLocaleString', 'toLocaleTimeString' and 'toLocaleDateString' functions of 'Date' with empty 'locales' and 'options', DateTimeFormat is cached inside 'defaultObjects'. If we change the timezone the cache is not invalidated. BUG=v8:5022 TEST=cctest:DateCacheVersion. See the bug CQ_INCLUDE_TRYBOTS=tryserver.v8:v8_linux_noi18n_rel_ng ========== to ========== Invalidate defaultObjects if timezone changes In case of calling 'toLocaleString', 'toLocaleTimeString' and 'toLocaleDateString' functions of 'Date' with empty 'locales' and 'options', DateTimeFormat is cached inside 'defaultObjects'. If we change the timezone the cache is not invalidated. BUG=v8:5022 TEST=cctest:DateCacheVersion. See the bug CQ_INCLUDE_TRYBOTS=tryserver.v8:v8_linux_noi18n_rel_ng ==========
Message was sent while issue was closed.
Committed patchset #5 (id:80001)
Message was sent while issue was closed.
Description was changed from ========== Invalidate defaultObjects if timezone changes In case of calling 'toLocaleString', 'toLocaleTimeString' and 'toLocaleDateString' functions of 'Date' with empty 'locales' and 'options', DateTimeFormat is cached inside 'defaultObjects'. If we change the timezone the cache is not invalidated. BUG=v8:5022 TEST=cctest:DateCacheVersion. See the bug CQ_INCLUDE_TRYBOTS=tryserver.v8:v8_linux_noi18n_rel_ng ========== to ========== Invalidate defaultObjects if timezone changes In case of calling 'toLocaleString', 'toLocaleTimeString' and 'toLocaleDateString' functions of 'Date' with empty 'locales' and 'options', DateTimeFormat is cached inside 'defaultObjects'. If we change the timezone the cache is not invalidated. BUG=v8:5022 TEST=cctest:DateCacheVersion. See the bug CQ_INCLUDE_TRYBOTS=tryserver.v8:v8_linux_noi18n_rel_ng Committed: https://crrev.com/7afd712ae01cb40aa233ab80dad1b69a8b72a76c Cr-Commit-Position: refs/heads/master@{#36420} ==========
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/7afd712ae01cb40aa233ab80dad1b69a8b72a76c Cr-Commit-Position: refs/heads/master@{#36420} |