Revert "[intl] Clean up intl_segmenter flag"
This reverts commit c9c3ec4c14
.
Reason for revert: Speculative revert for https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20GC%20Stress%20-%20custom%20snapshot/34616/overview (looks unrelated, but fails consistently since this CL)
Original change's description:
> [intl] Clean up intl_segmenter flag
>
> Intl.Segmenter shipped in m87 and launched.
>
> Bug: v8:11225
> Change-Id: I4213e261e1aea717c1281f19785a8c29ff1bbd8b
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2570461
> Commit-Queue: Frank Tang <ftang@chromium.org>
> Reviewed-by: Shu-yu Guo <syg@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#71653}
TBR=jkummerow@chromium.org,ftang@chromium.org,syg@chromium.org
Change-Id: Ic1d1b02abb9ae7faa41307eee694bb7e40d0fae2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:11225
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2578979
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71657}
This commit is contained in:
parent
45fd31f808
commit
371d7dbcc3
@ -287,7 +287,9 @@ DEFINE_IMPLICATION(harmony_weak_refs_with_cleanup_some, harmony_weak_refs)
|
||||
V(harmony_relative_indexing_methods, "harmony relative indexing methods")
|
||||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
#define HARMONY_SHIPPING(V) HARMONY_SHIPPING_BASE(V)
|
||||
#define HARMONY_SHIPPING(V) \
|
||||
HARMONY_SHIPPING_BASE(V) \
|
||||
V(harmony_intl_segmenter, "Intl.Segmenter")
|
||||
#else
|
||||
#define HARMONY_SHIPPING(V) HARMONY_SHIPPING_BASE(V)
|
||||
#endif
|
||||
|
@ -3182,87 +3182,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
Builtins::kDisplayNamesPrototypeOf, 1, false);
|
||||
}
|
||||
}
|
||||
|
||||
{ // -- S e g m e n t e r
|
||||
Handle<JSFunction> segmenter_fun = InstallFunction(
|
||||
isolate(), intl, "Segmenter", JS_SEGMENTER_TYPE,
|
||||
JSSegmenter::kHeaderSize, 0, factory->the_hole_value(),
|
||||
Builtins::kSegmenterConstructor);
|
||||
segmenter_fun->shared().set_length(0);
|
||||
segmenter_fun->shared().DontAdaptArguments();
|
||||
InstallWithIntrinsicDefaultProto(isolate_, segmenter_fun,
|
||||
Context::INTL_SEGMENTER_FUNCTION_INDEX);
|
||||
SimpleInstallFunction(isolate(), segmenter_fun, "supportedLocalesOf",
|
||||
Builtins::kSegmenterSupportedLocalesOf, 1, false);
|
||||
{
|
||||
// Setup %SegmenterPrototype%.
|
||||
Handle<JSObject> prototype(
|
||||
JSObject::cast(segmenter_fun->instance_prototype()), isolate());
|
||||
// #sec-intl.segmenter.prototype-@@tostringtag
|
||||
//
|
||||
// Intl.Segmenter.prototype [ @@toStringTag ]
|
||||
//
|
||||
// The initial value of the @@toStringTag property is the String value
|
||||
// "Intl.Segmenter".
|
||||
InstallToStringTag(isolate(), prototype, "Intl.Segmenter");
|
||||
SimpleInstallFunction(isolate(), prototype, "resolvedOptions",
|
||||
Builtins::kSegmenterPrototypeResolvedOptions, 0,
|
||||
false);
|
||||
SimpleInstallFunction(isolate(), prototype, "segment",
|
||||
Builtins::kSegmenterPrototypeSegment, 1, false);
|
||||
}
|
||||
{
|
||||
// Setup %SegmentsPrototype%.
|
||||
Handle<JSObject> prototype = factory->NewJSObject(
|
||||
isolate()->object_function(), AllocationType::kOld);
|
||||
Handle<String> name_string =
|
||||
Name::ToFunctionName(isolate(), factory->Segments_string())
|
||||
.ToHandleChecked();
|
||||
Handle<JSFunction> segments_fun = CreateFunction(
|
||||
isolate(), name_string, JS_SEGMENTS_TYPE, JSSegments::kHeaderSize,
|
||||
0, prototype, Builtins::kIllegal);
|
||||
segments_fun->shared().set_native(false);
|
||||
segments_fun->shared().set_length(0);
|
||||
segments_fun->shared().DontAdaptArguments();
|
||||
SimpleInstallFunction(isolate(), prototype, "containing",
|
||||
Builtins::kSegmentsPrototypeContaining, 1, false);
|
||||
InstallFunctionAtSymbol(isolate_, prototype, factory->iterator_symbol(),
|
||||
"[Symbol.iterator]",
|
||||
Builtins::kSegmentsPrototypeIterator, 0, true,
|
||||
DONT_ENUM);
|
||||
Handle<Map> segments_map(segments_fun->initial_map(), isolate());
|
||||
native_context()->set_intl_segments_map(*segments_map);
|
||||
}
|
||||
{
|
||||
// Setup %SegmentIteratorPrototype%.
|
||||
Handle<JSObject> iterator_prototype(
|
||||
native_context()->initial_iterator_prototype(), isolate());
|
||||
Handle<JSObject> prototype = factory->NewJSObject(
|
||||
isolate()->object_function(), AllocationType::kOld);
|
||||
JSObject::ForceSetPrototype(prototype, iterator_prototype);
|
||||
// #sec-%segmentiteratorprototype%.@@tostringtag
|
||||
//
|
||||
// %SegmentIteratorPrototype% [ @@toStringTag ]
|
||||
//
|
||||
// The initial value of the @@toStringTag property is the String value
|
||||
// "Segmenter String Iterator".
|
||||
InstallToStringTag(isolate(), prototype, "Segmenter String Iterator");
|
||||
SimpleInstallFunction(isolate(), prototype, "next",
|
||||
Builtins::kSegmentIteratorPrototypeNext, 0,
|
||||
false);
|
||||
// Setup SegmentIterator constructor.
|
||||
Handle<String> name_string =
|
||||
Name::ToFunctionName(isolate(), factory->SegmentIterator_string())
|
||||
.ToHandleChecked();
|
||||
Handle<JSFunction> segment_iterator_fun = CreateFunction(
|
||||
isolate(), name_string, JS_SEGMENT_ITERATOR_TYPE,
|
||||
JSSegmentIterator::kHeaderSize, 0, prototype, Builtins::kIllegal);
|
||||
segment_iterator_fun->shared().set_native(false);
|
||||
Handle<Map> segment_iterator_map(segment_iterator_fun->initial_map(),
|
||||
isolate());
|
||||
native_context()->set_intl_segment_iterator_map(*segment_iterator_map);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // V8_INTL_SUPPORT
|
||||
|
||||
@ -4517,6 +4436,113 @@ void Genesis::InitializeGlobal_harmony_relative_indexing_methods() {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
|
||||
void Genesis::InitializeGlobal_harmony_intl_segmenter() {
|
||||
if (!FLAG_harmony_intl_segmenter) return;
|
||||
Handle<JSObject> intl = Handle<JSObject>::cast(
|
||||
JSReceiver::GetProperty(
|
||||
isolate(),
|
||||
Handle<JSReceiver>(native_context()->global_object(), isolate()),
|
||||
factory()->InternalizeUtf8String("Intl"))
|
||||
.ToHandleChecked());
|
||||
|
||||
Handle<JSFunction> segmenter_fun = InstallFunction(
|
||||
isolate(), intl, "Segmenter", JS_SEGMENTER_TYPE, JSSegmenter::kHeaderSize,
|
||||
0, factory()->the_hole_value(), Builtins::kSegmenterConstructor);
|
||||
segmenter_fun->shared().set_length(0);
|
||||
segmenter_fun->shared().DontAdaptArguments();
|
||||
InstallWithIntrinsicDefaultProto(isolate_, segmenter_fun,
|
||||
Context::INTL_SEGMENTER_FUNCTION_INDEX);
|
||||
|
||||
SimpleInstallFunction(isolate(), segmenter_fun, "supportedLocalesOf",
|
||||
Builtins::kSegmenterSupportedLocalesOf, 1, false);
|
||||
|
||||
{
|
||||
// Setup %SegmenterPrototype%.
|
||||
Handle<JSObject> prototype(
|
||||
JSObject::cast(segmenter_fun->instance_prototype()), isolate());
|
||||
|
||||
// #sec-intl.segmenter.prototype-@@tostringtag
|
||||
//
|
||||
// Intl.Segmenter.prototype [ @@toStringTag ]
|
||||
//
|
||||
// The initial value of the @@toStringTag property is the String value
|
||||
// "Intl.Segmenter".
|
||||
InstallToStringTag(isolate(), prototype, "Intl.Segmenter");
|
||||
|
||||
SimpleInstallFunction(isolate(), prototype, "resolvedOptions",
|
||||
Builtins::kSegmenterPrototypeResolvedOptions, 0,
|
||||
false);
|
||||
|
||||
SimpleInstallFunction(isolate(), prototype, "segment",
|
||||
Builtins::kSegmenterPrototypeSegment, 1, false);
|
||||
}
|
||||
|
||||
{
|
||||
// Setup %SegmentsPrototype%.
|
||||
Handle<JSObject> prototype = factory()->NewJSObject(
|
||||
isolate()->object_function(), AllocationType::kOld);
|
||||
|
||||
Handle<String> name_string =
|
||||
Name::ToFunctionName(isolate(), isolate()->factory()->Segments_string())
|
||||
.ToHandleChecked();
|
||||
Handle<JSFunction> segments_fun = CreateFunction(
|
||||
isolate(), name_string, JS_SEGMENTS_TYPE, JSSegments::kHeaderSize, 0,
|
||||
prototype, Builtins::kIllegal);
|
||||
segments_fun->shared().set_native(false);
|
||||
segments_fun->shared().set_length(0);
|
||||
segments_fun->shared().DontAdaptArguments();
|
||||
|
||||
SimpleInstallFunction(isolate(), prototype, "containing",
|
||||
Builtins::kSegmentsPrototypeContaining, 1, false);
|
||||
|
||||
InstallFunctionAtSymbol(
|
||||
isolate_, prototype, factory()->iterator_symbol(), "[Symbol.iterator]",
|
||||
Builtins::kSegmentsPrototypeIterator, 0, true, DONT_ENUM);
|
||||
|
||||
Handle<Map> segments_map(segments_fun->initial_map(), isolate());
|
||||
native_context()->set_intl_segments_map(*segments_map);
|
||||
}
|
||||
|
||||
{
|
||||
// Setup %SegmentIteratorPrototype%.
|
||||
Handle<JSObject> iterator_prototype(
|
||||
native_context()->initial_iterator_prototype(), isolate());
|
||||
|
||||
Handle<JSObject> prototype = factory()->NewJSObject(
|
||||
isolate()->object_function(), AllocationType::kOld);
|
||||
JSObject::ForceSetPrototype(prototype, iterator_prototype);
|
||||
|
||||
// #sec-%segmentiteratorprototype%.@@tostringtag
|
||||
//
|
||||
// %SegmentIteratorPrototype% [ @@toStringTag ]
|
||||
//
|
||||
// The initial value of the @@toStringTag property is the String value
|
||||
// "Segmenter String Iterator".
|
||||
InstallToStringTag(isolate(), prototype, "Segmenter String Iterator");
|
||||
|
||||
SimpleInstallFunction(isolate(), prototype, "next",
|
||||
Builtins::kSegmentIteratorPrototypeNext, 0, false);
|
||||
|
||||
// Setup SegmentIterator constructor.
|
||||
Handle<String> name_string =
|
||||
Name::ToFunctionName(isolate(),
|
||||
isolate()->factory()->SegmentIterator_string())
|
||||
.ToHandleChecked();
|
||||
Handle<JSFunction> segment_iterator_fun = CreateFunction(
|
||||
isolate(), name_string, JS_SEGMENT_ITERATOR_TYPE,
|
||||
JSSegmentIterator::kHeaderSize, 0, prototype, Builtins::kIllegal);
|
||||
segment_iterator_fun->shared().set_native(false);
|
||||
|
||||
Handle<Map> segment_iterator_map(segment_iterator_fun->initial_map(),
|
||||
isolate());
|
||||
native_context()->set_intl_segment_iterator_map(*segment_iterator_map);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // V8_INTL_SUPPORT
|
||||
|
||||
Handle<JSFunction> Genesis::CreateArrayBuffer(
|
||||
Handle<String> name, ArrayBufferKind array_buffer_kind) {
|
||||
// Create the %ArrayBufferPrototype%
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
// Tests supportedLocalesOf method.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
var services = [
|
||||
Intl.Collator,
|
||||
Intl.DateTimeFormat,
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-gc
|
||||
// Flags: --harmony-intl-segmenter --expose-gc
|
||||
|
||||
let segmenter = new Intl.Segmenter();
|
||||
let segments = segmenter.segment(undefined);
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
// Regression test to ensure no Intl["SegmentIterator"]
|
||||
|
||||
assertThrows(() => new Intl["SegmentIterator"](), TypeError);
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
let invalid_lb = [
|
||||
"invalid",
|
||||
"abce",
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
// Throws only once during construction.
|
||||
// Check for all getters to prevent regression.
|
||||
// Preserve the order of getter initialization.
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
// Segmenter constructor can't be called as function.
|
||||
assertThrows(() => Intl.Segmenter(["sr"]), TypeError);
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
const segmenter = new Intl.Segmenter();
|
||||
const waving_hand_light_skin_tone = "\uD83D\uDC4B\uD83C\uDFFB";
|
||||
const man_light_skin_tone_red_hair =
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
// Test to ensure the nested calling of the next method won't caused
|
||||
// confusion to each other.
|
||||
const segmenter = new Intl.Segmenter();
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
// Test to ensure the calling of containing() won't impact the calling of
|
||||
// the next() method.
|
||||
const segmenter = new Intl.Segmenter();
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
const seg = new Intl.Segmenter([], {granularity: "grapheme"})
|
||||
for (const text of [
|
||||
"Hello world!", // English
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
let seg = new Intl.Segmenter();
|
||||
let descriptor = Object.getOwnPropertyDescriptor(
|
||||
Intl.Segmenter, "supportedLocalesOf");
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
const seg = new Intl.Segmenter([], {granularity: "sentence"})
|
||||
for (const text of [
|
||||
"Hello world!", // English
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
const seg = new Intl.Segmenter([], {granularity: "word"})
|
||||
for (const text of [
|
||||
"Hello world!", // English
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
assertEquals("function", typeof Intl.Segmenter.prototype.segment);
|
||||
assertEquals(1, Intl.Segmenter.prototype.segment.length);
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
// Test subclassing of Segmenter
|
||||
class CustomSegmenter extends Intl.Segmenter {
|
||||
constructor(locales, options) {
|
||||
|
@ -1,6 +1,8 @@
|
||||
// Copyright 2018 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-intl-segmenter
|
||||
assertEquals(
|
||||
typeof Intl.Segmenter.supportedLocalesOf,
|
||||
"function",
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
const segmenter = new Intl.Segmenter(undefined, {granularity: 'word'});
|
||||
const waving_hand_light_skin_tone = "\uD83D\uDC4B\uD83C\uDFFB";
|
||||
const man_light_skin_tone_red_hair =
|
||||
|
@ -44,7 +44,9 @@ from testrunner.outproc import test262
|
||||
|
||||
# TODO(littledan): move the flag mapping into the status file
|
||||
FEATURE_FLAGS = {
|
||||
'Intl.Segmenter': '--harmony-intl-segmenter',
|
||||
'Intl.DateTimeFormat-dayPeriod': '--harmony-intl-dateformat-day-period',
|
||||
'Intl.DateTimeFormat-quarter': '--harmony-intl-dateformat-quarter',
|
||||
'String.prototype.replaceAll': '--harmony_string_replaceall',
|
||||
'Symbol.prototype.description': '--harmony-symbol-description',
|
||||
'FinalizationRegistry': '--harmony-weak-refs-with-cleanup-some',
|
||||
|
Loading…
Reference in New Issue
Block a user