Commit 31142ba4 authored by Ujjwal Sharma's avatar Ujjwal Sharma Committed by Commit Bot

[intl] Port pluralrules#resolvedOptions to C++

Bug: v8:5751
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I7b126a318480c0d35d6440aa7aea109529ea8ee2
Reviewed-on: https://chromium-review.googlesource.com/1208651
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55665}
parent 16f8417b
......@@ -3055,6 +3055,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
isolate_, prototype, factory->to_string_tag_symbol(),
factory->Object_string(),
static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
SimpleInstallFunction(isolate_, prototype, "resolvedOptions",
Builtins::kPluralRulesPrototypeResolvedOptions, 0,
false);
}
}
#endif // V8_INTL_SUPPORT
......
......@@ -1391,6 +1391,7 @@ namespace internal {
CPP(NumberFormatSupportedLocalesOf) \
/* ecma402 #sec-intl.pluralrules */ \
CPP(PluralRulesConstructor) \
CPP(PluralRulesPrototypeResolvedOptions) \
/* ecma402 #sec-intl.pluralrules.supportedlocalesof */ \
CPP(PluralRulesSupportedLocalesOf) \
/* ecma402 #sec-intl.RelativeTimeFormat.constructor */ \
......
......@@ -1108,6 +1108,13 @@ BUILTIN(PluralRulesConstructor) {
locales, options));
}
BUILTIN(PluralRulesPrototypeResolvedOptions) {
HandleScope scope(isolate);
CHECK_RECEIVER(JSPluralRules, plural_rules_holder,
"Intl.PluralRules.prototype.resolvedOptions");
return *JSPluralRules::ResolvedOptions(isolate, plural_rules_holder);
}
BUILTIN(PluralRulesSupportedLocalesOf) {
HandleScope scope(isolate);
RETURN_RESULT_OR_FAILURE(
......
......@@ -496,14 +496,6 @@ DEFINE_METHOD(
}
);
DEFINE_METHOD(
GlobalIntlPluralRules.prototype,
resolvedOptions() {
return %PluralRulesResolvedOptions(this);
}
);
DEFINE_METHOD(
GlobalIntlPluralRules.prototype,
select(value) {
......
......@@ -257,28 +257,6 @@ RUNTIME_FUNCTION(Runtime_CollatorResolvedOptions) {
return *JSCollator::ResolvedOptions(isolate, collator);
}
RUNTIME_FUNCTION(Runtime_PluralRulesResolvedOptions) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, plural_rules_obj, 0);
// 3. If pr does not have an [[InitializedPluralRules]] internal
// slot, throw a TypeError exception.
if (!plural_rules_obj->IsJSPluralRules()) {
Handle<String> method_str = isolate->factory()->NewStringFromStaticChars(
"Intl.PluralRules.prototype.resolvedOptions");
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kIncompatibleMethodReceiver,
method_str, plural_rules_obj));
}
Handle<JSPluralRules> plural_rules =
Handle<JSPluralRules>::cast(plural_rules_obj);
return *JSPluralRules::ResolvedOptions(isolate, plural_rules);
}
RUNTIME_FUNCTION(Runtime_ParseExtension) {
Factory* factory = isolate->factory();
HandleScope scope(isolate);
......
......@@ -215,7 +215,6 @@ namespace internal {
F(MarkAsInitializedIntlObjectOfType, 2, 1) \
F(ParseExtension, 1, 1) \
F(NumberFormatResolvedOptions, 1, 1) \
F(PluralRulesResolvedOptions, 1, 1) \
F(PluralRulesSelect, 2, 1) \
F(ToDateTimeOptions, 3, 1) \
F(StringToLowerCaseIntl, 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