Commit 89600314 authored by Frank Tang's avatar Frank Tang Committed by V8 LUCI CQ

[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/+/3617388Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80314}
parent c4281cd9
......@@ -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));
......
// 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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment