Commit 7cb609d0 authored by Ujjwal Sharma's avatar Ujjwal Sharma Committed by Commit Bot

Reland "[intl] Port collator#resolvedOptions to C++"

This reverts commit dd5ea32a.

Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: Ic902fb239cc4b83563a2d92a2ae2e1569d21f549
Reviewed-on: https://chromium-review.googlesource.com/1217642Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55765}
parent 22b2b34c
......@@ -2982,6 +2982,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
factory->Object_string(),
static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
SimpleInstallFunction(isolate_, prototype, "resolvedOptions",
Builtins::kCollatorPrototypeResolvedOptions, 0,
false);
SimpleInstallGetter(isolate_, prototype,
factory->InternalizeUtf8String("compare"),
Builtins::kCollatorPrototypeCompare, false);
......
......@@ -1336,6 +1336,7 @@ namespace internal {
CPP(CollatorPrototypeCompare) \
/* ecma402 #sec-intl.collator.supportedlocalesof */ \
CPP(CollatorSupportedLocalesOf) \
CPP(CollatorPrototypeResolvedOptions) \
/* ecma402 #sup-date.prototype.tolocaledatestring */ \
CPP(DatePrototypeToLocaleDateString) \
/* ecma402 #sup-date.prototype.tolocalestring */ \
......
......@@ -1150,6 +1150,13 @@ BUILTIN(CollatorConstructor) {
isolate, collator, locales, options));
}
BUILTIN(CollatorPrototypeResolvedOptions) {
HandleScope scope(isolate);
CHECK_RECEIVER(JSCollator, collator_holder,
"Intl.Collator.prototype.resolvedOptions");
return *JSCollator::ResolvedOptions(isolate, collator_holder);
}
BUILTIN(CollatorSupportedLocalesOf) {
HandleScope scope(isolate);
RETURN_RESULT_OR_FAILURE(isolate,
......
......@@ -486,16 +486,6 @@ DEFINE_METHOD(
}
);
/**
* Collator resolvedOptions method.
*/
DEFINE_METHOD(
GlobalIntlCollator.prototype,
resolvedOptions() {
return %CollatorResolvedOptions(this);
}
);
DEFINE_METHOD(
GlobalIntlPluralRules.prototype,
select(value) {
......
......@@ -236,27 +236,6 @@ RUNTIME_FUNCTION(Runtime_NumberFormatResolvedOptions) {
return *JSNumberFormat::ResolvedOptions(isolate, number_format);
}
RUNTIME_FUNCTION(Runtime_CollatorResolvedOptions) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, collator_obj, 0);
// 3. If pr does not have an [[InitializedCollator]] internal
// slot, throw a TypeError exception.
if (!collator_obj->IsJSCollator()) {
Handle<String> method_str = isolate->factory()->NewStringFromStaticChars(
"Intl.Collator.prototype.resolvedOptions");
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kIncompatibleMethodReceiver,
method_str, collator_obj));
}
Handle<JSCollator> collator = Handle<JSCollator>::cast(collator_obj);
return *JSCollator::ResolvedOptions(isolate, collator);
}
RUNTIME_FUNCTION(Runtime_ParseExtension) {
Factory* factory = isolate->factory();
HandleScope scope(isolate);
......
......@@ -202,7 +202,6 @@ namespace internal {
#define FOR_EACH_INTRINSIC_INTL(F) \
F(AvailableLocalesOf, 1, 1) \
F(CanonicalizeLanguageTag, 1, 1) \
F(CollatorResolvedOptions, 1, 1) \
F(CreateDateTimeFormat, 3, 1) \
F(DateCacheVersion, 0, 1) \
F(DateTimeFormatResolvedOptions, 1, 1) \
......
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