Commit c7cbf911 authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

Simplified Segmenter remove unused method.

Bug: v8:6891
Change-Id: I3552afff9cd6f065aba82eddcf3f4719ee1283e9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2353414Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69407}
parent c084bd93
......@@ -1044,7 +1044,9 @@ BUILTIN(SegmentsPrototypeIterator) {
HandleScope scope(isolate);
CHECK_RECEIVER(JSSegments, segments, method);
RETURN_RESULT_OR_FAILURE(
isolate, JSSegments::CreateSegmentIterator(isolate, segments));
isolate,
JSSegmentIterator::Create(isolate, segments->icu_break_iterator().raw(),
segments->granularity()));
}
BUILTIN(V8BreakIteratorConstructor) {
......
......@@ -32,6 +32,11 @@ Handle<String> JSSegmentIterator::GranularityAsString(Isolate* isolate) const {
MaybeHandle<JSSegmentIterator> JSSegmentIterator::Create(
Isolate* isolate, icu::BreakIterator* break_iterator,
JSSegmenter::Granularity granularity) {
// Clone a copy for both the ownership and not sharing with containing and
// other calls to the iterator because icu::BreakIterator keep the iteration
// position internally and cannot be shared across multiple calls to
// JSSegmentIterator::Create and JSSegments::Containing.
break_iterator = break_iterator->clone();
DCHECK_NOT_NULL(break_iterator);
Handle<Map> map = Handle<Map>(
isolate->native_context()->intl_segment_iterator_map(), isolate);
......
......@@ -57,14 +57,6 @@ MaybeHandle<JSSegments> JSSegments::Create(Isolate* isolate,
return segments;
}
// ecma402 #sec-createsegmentiterator
MaybeHandle<Object> JSSegments::CreateSegmentIterator(
Isolate* isolate, Handle<JSSegments> segments) {
return JSSegmentIterator::Create(
isolate, segments->icu_break_iterator().raw()->clone(),
segments->granularity());
}
// ecma402 #sec-%segmentsprototype%.containing
MaybeHandle<Object> JSSegments::Containing(Isolate* isolate,
Handle<JSSegments> segments,
......
......@@ -37,14 +37,6 @@ class JSSegments : public TorqueGeneratedJSSegments<JSSegments, JSObject> {
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> Containing(
Isolate* isolate, Handle<JSSegments> segments_holder, int32_t index);
// ecma402 #sec-%segmentsprototype%-@@iterator
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> CreateSegmentIterator(
Isolate* isolate, Handle<JSSegments> segments_holder);
// ecma402 #sec-get-%segmentsprototype%.string
V8_WARN_UNUSED_RESULT static MaybeHandle<String> GetString(
Isolate* isolate, Handle<JSSegments> segments_holder);
// ecma402 #sec-createsegmentdataobject
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> CreateSegmentDataObject(
Isolate* isolate, JSSegmenter::Granularity granularity,
......
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