Reland "[Temporal] Fix Calendar.prototype.fields CSA"
This is a reland of commit 8960031432
Changes since revert: None, reverted wrong suspect CL
Original change's description:
> [Temporal] Fix Calendar.prototype.fields CSA
>
> Use LoadAndUntagToWord32ObjectField instead of LoadObjectField<Uint32T>
> to load the flag since it is defined as
> flags: SmiTagged<JSTemporalCalendarFlags>;
>
> Otherwise LoadObjectField<Uint32T> will load the zero part when
> v8_enable_pointer_compression = false
>
> Add unit tests to intl (because the problem only show up on calendar
> other than non iso8601.
>
> Cq-Include-Trybots: luci.v8.try:v8_linux_mipsel_compile_rel,v8_linux_mips64el_compile_rel
>
>
> Bug: v8:12848
> Change-Id: I44b685af99dc9820dfa228447e2b42ae0a82464c
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3617388
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Commit-Queue: Frank Tang <ftang@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#80314}
Bug: v8:12848
Change-Id: I423ea5f0a4a30fc73546df208d24aec84db76eb4
Cq-Include-Trybots: luci.v8.try:v8_linux_mipsel_compile_rel,v8_linux_mips64el_compile_rel
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3620838
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80319}
This commit is contained in:
parent
61be01e9ce
commit
4776aee651
@ -106,8 +106,8 @@ TNode<JSArray> TemporalBuiltinsAssembler::CalendarFieldsArrayFromIterable(
|
||||
// Notice this spec text is in the Chapter 15 of the #sup part not #sec
|
||||
// part.
|
||||
// 7. If calendar.[[Identifier]] is "iso8601", then
|
||||
const TNode<Uint32T> flags =
|
||||
LoadObjectField<Uint32T>(calendar, JSTemporalCalendar::kFlagsOffset);
|
||||
const TNode<Int32T> flags = LoadAndUntagToWord32ObjectField(
|
||||
calendar, JSTemporalCalendar::kFlagsOffset);
|
||||
// calendar is "iso8601" while the index of calendar is 0
|
||||
const TNode<IntPtrT> index = Signed(
|
||||
DecodeWordFromWord32<JSTemporalCalendar::CalendarIndexBits>(flags));
|
||||
|
24
test/intl/temporal/calendar/fields.js
Normal file
24
test/intl/temporal/calendar/fields.js
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright 2022 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// Flags: --harmony-temporal
|
||||
|
||||
assertEquals(["year"],
|
||||
(new Temporal.Calendar("iso8601")).fields(["year"]));
|
||||
|
||||
assertEquals(["month", "year"],
|
||||
(new Temporal.Calendar("iso8601")).fields(["month", "year"]));
|
||||
|
||||
assertEquals(["year", "era", "eraYear"],
|
||||
(new Temporal.Calendar("japanese")).fields(["year"]));
|
||||
|
||||
assertEquals(["month", "year", "era", "eraYear"],
|
||||
(new Temporal.Calendar("japanese")).fields(["month", "year"]));
|
||||
|
||||
assertEquals(["year", "era", "eraYear"],
|
||||
(new Temporal.Calendar("roc")).fields(["year"]));
|
||||
|
||||
assertThrows(
|
||||
() => (new Temporal.Calendar("japanese")).fields(["hello", "world"]),
|
||||
RangeError);
|
Loading…
Reference in New Issue
Block a user