Commit bb5fa039 authored by Marja Hölttä's avatar Marja Hölttä Committed by V8 LUCI CQ

[cleanup] Unify variable names "method" & "method_name"

Bug: v8:12244
Change-Id: I9ec30012f7238f53448b80cf9d657571a37502a5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3180822Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77030}
parent ed10210a
...@@ -125,21 +125,21 @@ Object BigIntToStringImpl(Handle<Object> receiver, Handle<Object> radix, ...@@ -125,21 +125,21 @@ Object BigIntToStringImpl(Handle<Object> receiver, Handle<Object> radix,
BUILTIN(BigIntPrototypeToLocaleString) { BUILTIN(BigIntPrototypeToLocaleString) {
HandleScope scope(isolate); HandleScope scope(isolate);
const char* method = "BigInt.prototype.toLocaleString"; const char* method_name = "BigInt.prototype.toLocaleString";
#ifdef V8_INTL_SUPPORT #ifdef V8_INTL_SUPPORT
// 1. Let x be ? thisBigIntValue(this value). // 1. Let x be ? thisBigIntValue(this value).
Handle<BigInt> x; Handle<BigInt> x;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, x, ThisBigIntValue(isolate, args.receiver(), method)); isolate, x, ThisBigIntValue(isolate, args.receiver(), method_name));
RETURN_RESULT_OR_FAILURE( RETURN_RESULT_OR_FAILURE(
isolate, isolate,
Intl::NumberToLocaleString(isolate, x, args.atOrUndefined(isolate, 1), Intl::NumberToLocaleString(isolate, x, args.atOrUndefined(isolate, 1),
args.atOrUndefined(isolate, 2), method)); args.atOrUndefined(isolate, 2), method_name));
// Fallbacks to old toString implemention if no V8_INTL_SUPPORT // Fallbacks to old toString implemention if no V8_INTL_SUPPORT
#endif // V8_INTL_SUPPORT #endif // V8_INTL_SUPPORT
Handle<Object> radix = isolate->factory()->undefined_value(); Handle<Object> radix = isolate->factory()->undefined_value();
return BigIntToStringImpl(args.receiver(), radix, isolate, method); return BigIntToStringImpl(args.receiver(), radix, isolate, method_name);
} }
BUILTIN(BigIntPrototypeToString) { BUILTIN(BigIntPrototypeToString) {
......
...@@ -775,8 +775,8 @@ BUILTIN(DatePrototypeToLocaleDateString) { ...@@ -775,8 +775,8 @@ BUILTIN(DatePrototypeToLocaleDateString) {
isolate->CountUsage(v8::Isolate::UseCounterFeature::kDateToLocaleDateString); isolate->CountUsage(v8::Isolate::UseCounterFeature::kDateToLocaleDateString);
const char* method = "Date.prototype.toLocaleDateString"; const char* method_name = "Date.prototype.toLocaleDateString";
CHECK_RECEIVER(JSDate, date, method); CHECK_RECEIVER(JSDate, date, method_name);
RETURN_RESULT_OR_FAILURE( RETURN_RESULT_OR_FAILURE(
isolate, JSDateTimeFormat::ToLocaleDateTime( isolate, JSDateTimeFormat::ToLocaleDateTime(
...@@ -786,7 +786,7 @@ BUILTIN(DatePrototypeToLocaleDateString) { ...@@ -786,7 +786,7 @@ BUILTIN(DatePrototypeToLocaleDateString) {
args.atOrUndefined(isolate, 2), // options args.atOrUndefined(isolate, 2), // options
JSDateTimeFormat::RequiredOption::kDate, // required JSDateTimeFormat::RequiredOption::kDate, // required
JSDateTimeFormat::DefaultsOption::kDate, // defaults JSDateTimeFormat::DefaultsOption::kDate, // defaults
method)); // method method_name)); // method_name
} }
// ecma402 #sup-date.prototype.tolocalestring // ecma402 #sup-date.prototype.tolocalestring
...@@ -795,8 +795,8 @@ BUILTIN(DatePrototypeToLocaleString) { ...@@ -795,8 +795,8 @@ BUILTIN(DatePrototypeToLocaleString) {
isolate->CountUsage(v8::Isolate::UseCounterFeature::kDateToLocaleString); isolate->CountUsage(v8::Isolate::UseCounterFeature::kDateToLocaleString);
const char* method = "Date.prototype.toLocaleString"; const char* method_name = "Date.prototype.toLocaleString";
CHECK_RECEIVER(JSDate, date, method); CHECK_RECEIVER(JSDate, date, method_name);
RETURN_RESULT_OR_FAILURE( RETURN_RESULT_OR_FAILURE(
isolate, JSDateTimeFormat::ToLocaleDateTime( isolate, JSDateTimeFormat::ToLocaleDateTime(
...@@ -806,7 +806,7 @@ BUILTIN(DatePrototypeToLocaleString) { ...@@ -806,7 +806,7 @@ BUILTIN(DatePrototypeToLocaleString) {
args.atOrUndefined(isolate, 2), // options args.atOrUndefined(isolate, 2), // options
JSDateTimeFormat::RequiredOption::kAny, // required JSDateTimeFormat::RequiredOption::kAny, // required
JSDateTimeFormat::DefaultsOption::kAll, // defaults JSDateTimeFormat::DefaultsOption::kAll, // defaults
method)); // method method_name)); // method_name
} }
// ecma402 #sup-date.prototype.tolocaletimestring // ecma402 #sup-date.prototype.tolocaletimestring
...@@ -815,8 +815,8 @@ BUILTIN(DatePrototypeToLocaleTimeString) { ...@@ -815,8 +815,8 @@ BUILTIN(DatePrototypeToLocaleTimeString) {
isolate->CountUsage(v8::Isolate::UseCounterFeature::kDateToLocaleTimeString); isolate->CountUsage(v8::Isolate::UseCounterFeature::kDateToLocaleTimeString);
const char* method = "Date.prototype.toLocaleTimeString"; const char* method_name = "Date.prototype.toLocaleTimeString";
CHECK_RECEIVER(JSDate, date, method); CHECK_RECEIVER(JSDate, date, method_name);
RETURN_RESULT_OR_FAILURE( RETURN_RESULT_OR_FAILURE(
isolate, JSDateTimeFormat::ToLocaleDateTime( isolate, JSDateTimeFormat::ToLocaleDateTime(
...@@ -826,7 +826,7 @@ BUILTIN(DatePrototypeToLocaleTimeString) { ...@@ -826,7 +826,7 @@ BUILTIN(DatePrototypeToLocaleTimeString) {
args.atOrUndefined(isolate, 2), // options args.atOrUndefined(isolate, 2), // options
JSDateTimeFormat::RequiredOption::kTime, // required JSDateTimeFormat::RequiredOption::kTime, // required
JSDateTimeFormat::DefaultsOption::kTime, // defaults JSDateTimeFormat::DefaultsOption::kTime, // defaults
method)); // method method_name)); // method_name
} }
#endif // V8_INTL_SUPPORT #endif // V8_INTL_SUPPORT
......
...@@ -79,9 +79,9 @@ BUILTIN(NumberFormatSupportedLocalesOf) { ...@@ -79,9 +79,9 @@ BUILTIN(NumberFormatSupportedLocalesOf) {
} }
BUILTIN(NumberFormatPrototypeFormatToParts) { BUILTIN(NumberFormatPrototypeFormatToParts) {
const char* const method = "Intl.NumberFormat.prototype.formatToParts"; const char* const method_name = "Intl.NumberFormat.prototype.formatToParts";
HandleScope handle_scope(isolate); HandleScope handle_scope(isolate);
CHECK_RECEIVER(JSNumberFormat, number_format, method); CHECK_RECEIVER(JSNumberFormat, number_format, method_name);
Handle<Object> x; Handle<Object> x;
if (args.length() >= 2) { if (args.length() >= 2) {
...@@ -96,9 +96,10 @@ BUILTIN(NumberFormatPrototypeFormatToParts) { ...@@ -96,9 +96,10 @@ BUILTIN(NumberFormatPrototypeFormatToParts) {
} }
BUILTIN(DateTimeFormatPrototypeResolvedOptions) { BUILTIN(DateTimeFormatPrototypeResolvedOptions) {
const char* const method = "Intl.DateTimeFormat.prototype.resolvedOptions"; const char* const method_name =
"Intl.DateTimeFormat.prototype.resolvedOptions";
HandleScope scope(isolate); HandleScope scope(isolate);
CHECK_RECEIVER(JSReceiver, format_holder, method); CHECK_RECEIVER(JSReceiver, format_holder, method_name);
// 3. Let dtf be ? UnwrapDateTimeFormat(dtf). // 3. Let dtf be ? UnwrapDateTimeFormat(dtf).
Handle<JSDateTimeFormat> date_time_format; Handle<JSDateTimeFormat> date_time_format;
...@@ -122,15 +123,15 @@ BUILTIN(DateTimeFormatSupportedLocalesOf) { ...@@ -122,15 +123,15 @@ BUILTIN(DateTimeFormatSupportedLocalesOf) {
} }
BUILTIN(DateTimeFormatPrototypeFormatToParts) { BUILTIN(DateTimeFormatPrototypeFormatToParts) {
const char* const method = "Intl.DateTimeFormat.prototype.formatToParts"; const char* const method_name = "Intl.DateTimeFormat.prototype.formatToParts";
HandleScope handle_scope(isolate); HandleScope handle_scope(isolate);
CHECK_RECEIVER(JSObject, date_format_holder, method); CHECK_RECEIVER(JSObject, date_format_holder, method_name);
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
if (!date_format_holder->IsJSDateTimeFormat()) { if (!date_format_holder->IsJSDateTimeFormat()) {
THROW_NEW_ERROR_RETURN_FAILURE( THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, isolate, NewTypeError(MessageTemplate::kIncompatibleMethodReceiver,
factory->NewStringFromAsciiChecked(method), factory->NewStringFromAsciiChecked(method_name),
date_format_holder)); date_format_holder));
} }
Handle<JSDateTimeFormat> dtf = Handle<JSDateTimeFormat> dtf =
...@@ -157,12 +158,12 @@ BUILTIN(DateTimeFormatPrototypeFormatToParts) { ...@@ -157,12 +158,12 @@ BUILTIN(DateTimeFormatPrototypeFormatToParts) {
// Common code for DateTimeFormatPrototypeFormtRange(|ToParts) // Common code for DateTimeFormatPrototypeFormtRange(|ToParts)
template <class T> template <class T>
V8_WARN_UNUSED_RESULT Object DateTimeFormatRange( V8_WARN_UNUSED_RESULT Object DateTimeFormatRange(
BuiltinArguments args, Isolate* isolate, const char* const method, BuiltinArguments args, Isolate* isolate, const char* const method_name,
MaybeHandle<T> (*format)(Isolate*, Handle<JSDateTimeFormat>, double, MaybeHandle<T> (*format)(Isolate*, Handle<JSDateTimeFormat>, double,
double)) { double)) {
// 1. Let dtf be this value. // 1. Let dtf be this value.
// 2. If Type(dtf) is not Object, throw a TypeError exception. // 2. If Type(dtf) is not Object, throw a TypeError exception.
CHECK_RECEIVER(JSObject, date_format_holder, method); CHECK_RECEIVER(JSObject, date_format_holder, method_name);
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
...@@ -171,7 +172,7 @@ V8_WARN_UNUSED_RESULT Object DateTimeFormatRange( ...@@ -171,7 +172,7 @@ V8_WARN_UNUSED_RESULT Object DateTimeFormatRange(
if (!date_format_holder->IsJSDateTimeFormat()) { if (!date_format_holder->IsJSDateTimeFormat()) {
THROW_NEW_ERROR_RETURN_FAILURE( THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, isolate, NewTypeError(MessageTemplate::kIncompatibleMethodReceiver,
factory->NewStringFromAsciiChecked(method), factory->NewStringFromAsciiChecked(method_name),
date_format_holder)); date_format_holder));
} }
Handle<JSDateTimeFormat> dtf = Handle<JSDateTimeFormat> dtf =
...@@ -207,16 +208,17 @@ V8_WARN_UNUSED_RESULT Object DateTimeFormatRange( ...@@ -207,16 +208,17 @@ V8_WARN_UNUSED_RESULT Object DateTimeFormatRange(
} }
BUILTIN(DateTimeFormatPrototypeFormatRange) { BUILTIN(DateTimeFormatPrototypeFormatRange) {
const char* const method = "Intl.DateTimeFormat.prototype.formatRange"; const char* const method_name = "Intl.DateTimeFormat.prototype.formatRange";
HandleScope handle_scope(isolate); HandleScope handle_scope(isolate);
return DateTimeFormatRange<String>(args, isolate, method, return DateTimeFormatRange<String>(args, isolate, method_name,
JSDateTimeFormat::FormatRange); JSDateTimeFormat::FormatRange);
} }
BUILTIN(DateTimeFormatPrototypeFormatRangeToParts) { BUILTIN(DateTimeFormatPrototypeFormatRangeToParts) {
const char* const method = "Intl.DateTimeFormat.prototype.formatRangeToParts"; const char* const method_name =
"Intl.DateTimeFormat.prototype.formatRangeToParts";
HandleScope handle_scope(isolate); HandleScope handle_scope(isolate);
return DateTimeFormatRange<JSArray>(args, isolate, method, return DateTimeFormatRange<JSArray>(args, isolate, method_name,
JSDateTimeFormat::FormatRangeToParts); JSDateTimeFormat::FormatRangeToParts);
} }
...@@ -252,7 +254,8 @@ Handle<JSFunction> CreateBoundFunction(Isolate* isolate, ...@@ -252,7 +254,8 @@ Handle<JSFunction> CreateBoundFunction(Isolate* isolate,
template <class T> template <class T>
Object LegacyFormatConstructor(BuiltinArguments args, Isolate* isolate, Object LegacyFormatConstructor(BuiltinArguments args, Isolate* isolate,
v8::Isolate::UseCounterFeature feature, v8::Isolate::UseCounterFeature feature,
Handle<Object> constructor, const char* method) { Handle<Object> constructor,
const char* method_name) {
isolate->CountUsage(feature); isolate->CountUsage(feature);
Handle<JSReceiver> new_target; Handle<JSReceiver> new_target;
// 1. If NewTarget is undefined, let newTarget be the active // 1. If NewTarget is undefined, let newTarget be the active
...@@ -277,7 +280,7 @@ Object LegacyFormatConstructor(BuiltinArguments args, Isolate* isolate, ...@@ -277,7 +280,7 @@ Object LegacyFormatConstructor(BuiltinArguments args, Isolate* isolate,
// 3. Perform ? Initialize<T>(Format, locales, options). // 3. Perform ? Initialize<T>(Format, locales, options).
Handle<T> format; Handle<T> format;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, format, T::New(isolate, map, locales, options, method)); isolate, format, T::New(isolate, map, locales, options, method_name));
// 4. Let this be the this value. // 4. Let this be the this value.
if (args.new_target()->IsUndefined(isolate)) { if (args.new_target()->IsUndefined(isolate)) {
Handle<Object> receiver = args.receiver(); Handle<Object> receiver = args.receiver();
...@@ -291,9 +294,9 @@ Object LegacyFormatConstructor(BuiltinArguments args, Isolate* isolate, ...@@ -291,9 +294,9 @@ Object LegacyFormatConstructor(BuiltinArguments args, Isolate* isolate,
if (ordinary_has_instance_obj->BooleanValue(isolate)) { if (ordinary_has_instance_obj->BooleanValue(isolate)) {
if (!receiver->IsJSReceiver()) { if (!receiver->IsJSReceiver()) {
THROW_NEW_ERROR_RETURN_FAILURE( THROW_NEW_ERROR_RETURN_FAILURE(
isolate, isolate, NewTypeError(MessageTemplate::kIncompatibleMethodReceiver,
NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, isolate->factory()->NewStringFromAsciiChecked(
isolate->factory()->NewStringFromAsciiChecked(method), method_name),
receiver)); receiver));
} }
Handle<JSReceiver> rec = Handle<JSReceiver>::cast(receiver); Handle<JSReceiver> rec = Handle<JSReceiver>::cast(receiver);
...@@ -325,15 +328,15 @@ Object LegacyFormatConstructor(BuiltinArguments args, Isolate* isolate, ...@@ -325,15 +328,15 @@ Object LegacyFormatConstructor(BuiltinArguments args, Isolate* isolate,
template <class T> template <class T>
Object DisallowCallConstructor(BuiltinArguments args, Isolate* isolate, Object DisallowCallConstructor(BuiltinArguments args, Isolate* isolate,
v8::Isolate::UseCounterFeature feature, v8::Isolate::UseCounterFeature feature,
const char* method) { const char* method_name) {
isolate->CountUsage(feature); isolate->CountUsage(feature);
// 1. If NewTarget is undefined, throw a TypeError exception. // 1. If NewTarget is undefined, throw a TypeError exception.
if (args.new_target()->IsUndefined(isolate)) { // [[Call]] if (args.new_target()->IsUndefined(isolate)) { // [[Call]]
THROW_NEW_ERROR_RETURN_FAILURE( THROW_NEW_ERROR_RETURN_FAILURE(
isolate, isolate, NewTypeError(MessageTemplate::kConstructorNotFunction,
NewTypeError(MessageTemplate::kConstructorNotFunction, isolate->factory()->NewStringFromAsciiChecked(
isolate->factory()->NewStringFromAsciiChecked(method))); method_name)));
} }
// [[Construct]] // [[Construct]]
Handle<JSFunction> target = args.target(); Handle<JSFunction> target = args.target();
...@@ -357,7 +360,7 @@ Object DisallowCallConstructor(BuiltinArguments args, Isolate* isolate, ...@@ -357,7 +360,7 @@ Object DisallowCallConstructor(BuiltinArguments args, Isolate* isolate,
*/ */
template <class T> template <class T>
Object CallOrConstructConstructor(BuiltinArguments args, Isolate* isolate, Object CallOrConstructConstructor(BuiltinArguments args, Isolate* isolate,
const char* method) { const char* method_name) {
Handle<JSReceiver> new_target; Handle<JSReceiver> new_target;
if (args.new_target()->IsUndefined(isolate)) { if (args.new_target()->IsUndefined(isolate)) {
...@@ -377,7 +380,7 @@ Object CallOrConstructConstructor(BuiltinArguments args, Isolate* isolate, ...@@ -377,7 +380,7 @@ Object CallOrConstructConstructor(BuiltinArguments args, Isolate* isolate,
isolate, map, JSFunction::GetDerivedMap(isolate, target, new_target)); isolate, map, JSFunction::GetDerivedMap(isolate, target, new_target));
RETURN_RESULT_OR_FAILURE(isolate, RETURN_RESULT_OR_FAILURE(isolate,
T::New(isolate, map, locales, options, method)); T::New(isolate, map, locales, options, method_name));
} }
} // namespace } // namespace
...@@ -431,11 +434,11 @@ BUILTIN(NumberFormatConstructor) { ...@@ -431,11 +434,11 @@ BUILTIN(NumberFormatConstructor) {
BUILTIN(NumberFormatPrototypeResolvedOptions) { BUILTIN(NumberFormatPrototypeResolvedOptions) {
HandleScope scope(isolate); HandleScope scope(isolate);
const char* const method = "Intl.NumberFormat.prototype.resolvedOptions"; const char* const method_name = "Intl.NumberFormat.prototype.resolvedOptions";
// 1. Let nf be the this value. // 1. Let nf be the this value.
// 2. If Type(nf) is not Object, throw a TypeError exception. // 2. If Type(nf) is not Object, throw a TypeError exception.
CHECK_RECEIVER(JSReceiver, number_format_holder, method); CHECK_RECEIVER(JSReceiver, number_format_holder, method_name);
// 3. Let nf be ? UnwrapNumberFormat(nf) // 3. Let nf be ? UnwrapNumberFormat(nf)
Handle<JSNumberFormat> number_format; Handle<JSNumberFormat> number_format;
...@@ -447,12 +450,12 @@ BUILTIN(NumberFormatPrototypeResolvedOptions) { ...@@ -447,12 +450,12 @@ BUILTIN(NumberFormatPrototypeResolvedOptions) {
} }
BUILTIN(NumberFormatPrototypeFormatNumber) { BUILTIN(NumberFormatPrototypeFormatNumber) {
const char* const method = "get Intl.NumberFormat.prototype.format"; const char* const method_name = "get Intl.NumberFormat.prototype.format";
HandleScope scope(isolate); HandleScope scope(isolate);
// 1. Let nf be the this value. // 1. Let nf be the this value.
// 2. If Type(nf) is not Object, throw a TypeError exception. // 2. If Type(nf) is not Object, throw a TypeError exception.
CHECK_RECEIVER(JSReceiver, receiver, method); CHECK_RECEIVER(JSReceiver, receiver, method_name);
// 3. Let nf be ? UnwrapNumberFormat(nf). // 3. Let nf be ? UnwrapNumberFormat(nf).
Handle<JSNumberFormat> number_format; Handle<JSNumberFormat> number_format;
...@@ -519,12 +522,12 @@ BUILTIN(DateTimeFormatConstructor) { ...@@ -519,12 +522,12 @@ BUILTIN(DateTimeFormatConstructor) {
} }
BUILTIN(DateTimeFormatPrototypeFormat) { BUILTIN(DateTimeFormatPrototypeFormat) {
const char* const method = "get Intl.DateTimeFormat.prototype.format"; const char* const method_name = "get Intl.DateTimeFormat.prototype.format";
HandleScope scope(isolate); HandleScope scope(isolate);
// 1. Let dtf be this value. // 1. Let dtf be this value.
// 2. If Type(dtf) is not Object, throw a TypeError exception. // 2. If Type(dtf) is not Object, throw a TypeError exception.
CHECK_RECEIVER(JSReceiver, receiver, method); CHECK_RECEIVER(JSReceiver, receiver, method_name);
// 3. Let dtf be ? UnwrapDateTimeFormat(dtf). // 3. Let dtf be ? UnwrapDateTimeFormat(dtf).
Handle<JSDateTimeFormat> format; Handle<JSDateTimeFormat> format;
...@@ -616,12 +619,12 @@ BUILTIN(LocaleConstructor) { ...@@ -616,12 +619,12 @@ BUILTIN(LocaleConstructor) {
isolate->CountUsage(v8::Isolate::UseCounterFeature::kLocale); isolate->CountUsage(v8::Isolate::UseCounterFeature::kLocale);
const char* method = "Intl.Locale"; const char* method_name = "Intl.Locale";
if (args.new_target()->IsUndefined(isolate)) { // [[Call]] if (args.new_target()->IsUndefined(isolate)) { // [[Call]]
THROW_NEW_ERROR_RETURN_FAILURE( THROW_NEW_ERROR_RETURN_FAILURE(
isolate, isolate, NewTypeError(MessageTemplate::kConstructorNotFunction,
NewTypeError(MessageTemplate::kConstructorNotFunction, isolate->factory()->NewStringFromAsciiChecked(
isolate->factory()->NewStringFromAsciiChecked(method))); method_name)));
} }
// [[Construct]] // [[Construct]]
Handle<JSFunction> target = args.target(); Handle<JSFunction> target = args.target();
...@@ -657,7 +660,8 @@ BUILTIN(LocaleConstructor) { ...@@ -657,7 +660,8 @@ BUILTIN(LocaleConstructor) {
// 10. Set options to ? CoerceOptionsToObject(options). // 10. Set options to ? CoerceOptionsToObject(options).
Handle<JSReceiver> options_object; Handle<JSReceiver> options_object;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, options_object, CoerceOptionsToObject(isolate, options, method)); isolate, options_object,
CoerceOptionsToObject(isolate, options, method_name));
RETURN_RESULT_OR_FAILURE( RETURN_RESULT_OR_FAILURE(
isolate, JSLocale::New(isolate, map, locale_string, options_object)); isolate, JSLocale::New(isolate, map, locale_string, options_object));
...@@ -953,14 +957,14 @@ BUILTIN(CollatorSupportedLocalesOf) { ...@@ -953,14 +957,14 @@ BUILTIN(CollatorSupportedLocalesOf) {
} }
BUILTIN(CollatorPrototypeCompare) { BUILTIN(CollatorPrototypeCompare) {
const char* const method = "get Intl.Collator.prototype.compare"; const char* const method_name = "get Intl.Collator.prototype.compare";
HandleScope scope(isolate); HandleScope scope(isolate);
// 1. Let collator be this value. // 1. Let collator be this value.
// 2. If Type(collator) is not Object, throw a TypeError exception. // 2. If Type(collator) is not Object, throw a TypeError exception.
// 3. If collator does not have an [[InitializedCollator]] internal slot, // 3. If collator does not have an [[InitializedCollator]] internal slot,
// throw a TypeError exception. // throw a TypeError exception.
CHECK_RECEIVER(JSCollator, collator, method); CHECK_RECEIVER(JSCollator, collator, method_name);
// 4. If collator.[[BoundCompare]] is undefined, then // 4. If collator.[[BoundCompare]] is undefined, then
Handle<Object> bound_compare(collator->bound_compare(), isolate); Handle<Object> bound_compare(collator->bound_compare(), isolate);
...@@ -1015,9 +1019,9 @@ BUILTIN(CollatorInternalCompare) { ...@@ -1015,9 +1019,9 @@ BUILTIN(CollatorInternalCompare) {
// ecma402 #sec-%segmentiteratorprototype%.next // ecma402 #sec-%segmentiteratorprototype%.next
BUILTIN(SegmentIteratorPrototypeNext) { BUILTIN(SegmentIteratorPrototypeNext) {
const char* const method = "%SegmentIterator.prototype%.next"; const char* const method_name = "%SegmentIterator.prototype%.next";
HandleScope scope(isolate); HandleScope scope(isolate);
CHECK_RECEIVER(JSSegmentIterator, segment_iterator, method); CHECK_RECEIVER(JSSegmentIterator, segment_iterator, method_name);
RETURN_RESULT_OR_FAILURE(isolate, RETURN_RESULT_OR_FAILURE(isolate,
JSSegmentIterator::Next(isolate, segment_iterator)); JSSegmentIterator::Next(isolate, segment_iterator));
...@@ -1069,9 +1073,9 @@ BUILTIN(SegmenterPrototypeSegment) { ...@@ -1069,9 +1073,9 @@ BUILTIN(SegmenterPrototypeSegment) {
// ecma402 #sec-%segmentsprototype%.containing // ecma402 #sec-%segmentsprototype%.containing
BUILTIN(SegmentsPrototypeContaining) { BUILTIN(SegmentsPrototypeContaining) {
const char* const method = "%Segments.prototype%.containing"; const char* const method_name = "%Segments.prototype%.containing";
HandleScope scope(isolate); HandleScope scope(isolate);
CHECK_RECEIVER(JSSegments, segments, method); CHECK_RECEIVER(JSSegments, segments, method_name);
Handle<Object> index = args.atOrUndefined(isolate, 1); Handle<Object> index = args.atOrUndefined(isolate, 1);
// 6. Let n be ? ToInteger(index). // 6. Let n be ? ToInteger(index).
...@@ -1085,9 +1089,9 @@ BUILTIN(SegmentsPrototypeContaining) { ...@@ -1085,9 +1089,9 @@ BUILTIN(SegmentsPrototypeContaining) {
// ecma402 #sec-%segmentsprototype%-@@iterator // ecma402 #sec-%segmentsprototype%-@@iterator
BUILTIN(SegmentsPrototypeIterator) { BUILTIN(SegmentsPrototypeIterator) {
const char* const method = "%SegmentIsPrototype%[@@iterator]"; const char* const method_name = "%SegmentIsPrototype%[@@iterator]";
HandleScope scope(isolate); HandleScope scope(isolate);
CHECK_RECEIVER(JSSegments, segments, method); CHECK_RECEIVER(JSSegments, segments, method_name);
RETURN_RESULT_OR_FAILURE( RETURN_RESULT_OR_FAILURE(
isolate, isolate,
JSSegmentIterator::Create(isolate, segments->icu_break_iterator().raw(), JSSegmentIterator::Create(isolate, segments->icu_break_iterator().raw(),
...@@ -1109,10 +1113,11 @@ BUILTIN(V8BreakIteratorPrototypeResolvedOptions) { ...@@ -1109,10 +1113,11 @@ BUILTIN(V8BreakIteratorPrototypeResolvedOptions) {
} }
BUILTIN(V8BreakIteratorPrototypeAdoptText) { BUILTIN(V8BreakIteratorPrototypeAdoptText) {
const char* const method = "get Intl.v8BreakIterator.prototype.adoptText"; const char* const method_name =
"get Intl.v8BreakIterator.prototype.adoptText";
HandleScope scope(isolate); HandleScope scope(isolate);
CHECK_RECEIVER(JSV8BreakIterator, break_iterator, method); CHECK_RECEIVER(JSV8BreakIterator, break_iterator, method_name);
Handle<Object> bound_adopt_text(break_iterator->bound_adopt_text(), isolate); Handle<Object> bound_adopt_text(break_iterator->bound_adopt_text(), isolate);
if (!bound_adopt_text->IsUndefined(isolate)) { if (!bound_adopt_text->IsUndefined(isolate)) {
...@@ -1145,10 +1150,10 @@ BUILTIN(V8BreakIteratorInternalAdoptText) { ...@@ -1145,10 +1150,10 @@ BUILTIN(V8BreakIteratorInternalAdoptText) {
} }
BUILTIN(V8BreakIteratorPrototypeFirst) { BUILTIN(V8BreakIteratorPrototypeFirst) {
const char* const method = "get Intl.v8BreakIterator.prototype.first"; const char* const method_name = "get Intl.v8BreakIterator.prototype.first";
HandleScope scope(isolate); HandleScope scope(isolate);
CHECK_RECEIVER(JSV8BreakIterator, break_iterator, method); CHECK_RECEIVER(JSV8BreakIterator, break_iterator, method_name);
Handle<Object> bound_first(break_iterator->bound_first(), isolate); Handle<Object> bound_first(break_iterator->bound_first(), isolate);
if (!bound_first->IsUndefined(isolate)) { if (!bound_first->IsUndefined(isolate)) {
...@@ -1175,10 +1180,10 @@ BUILTIN(V8BreakIteratorInternalFirst) { ...@@ -1175,10 +1180,10 @@ BUILTIN(V8BreakIteratorInternalFirst) {
} }
BUILTIN(V8BreakIteratorPrototypeNext) { BUILTIN(V8BreakIteratorPrototypeNext) {
const char* const method = "get Intl.v8BreakIterator.prototype.next"; const char* const method_name = "get Intl.v8BreakIterator.prototype.next";
HandleScope scope(isolate); HandleScope scope(isolate);
CHECK_RECEIVER(JSV8BreakIterator, break_iterator, method); CHECK_RECEIVER(JSV8BreakIterator, break_iterator, method_name);
Handle<Object> bound_next(break_iterator->bound_next(), isolate); Handle<Object> bound_next(break_iterator->bound_next(), isolate);
if (!bound_next->IsUndefined(isolate)) { if (!bound_next->IsUndefined(isolate)) {
...@@ -1204,10 +1209,10 @@ BUILTIN(V8BreakIteratorInternalNext) { ...@@ -1204,10 +1209,10 @@ BUILTIN(V8BreakIteratorInternalNext) {
} }
BUILTIN(V8BreakIteratorPrototypeCurrent) { BUILTIN(V8BreakIteratorPrototypeCurrent) {
const char* const method = "get Intl.v8BreakIterator.prototype.current"; const char* const method_name = "get Intl.v8BreakIterator.prototype.current";
HandleScope scope(isolate); HandleScope scope(isolate);
CHECK_RECEIVER(JSV8BreakIterator, break_iterator, method); CHECK_RECEIVER(JSV8BreakIterator, break_iterator, method_name);
Handle<Object> bound_current(break_iterator->bound_current(), isolate); Handle<Object> bound_current(break_iterator->bound_current(), isolate);
if (!bound_current->IsUndefined(isolate)) { if (!bound_current->IsUndefined(isolate)) {
...@@ -1233,10 +1238,11 @@ BUILTIN(V8BreakIteratorInternalCurrent) { ...@@ -1233,10 +1238,11 @@ BUILTIN(V8BreakIteratorInternalCurrent) {
} }
BUILTIN(V8BreakIteratorPrototypeBreakType) { BUILTIN(V8BreakIteratorPrototypeBreakType) {
const char* const method = "get Intl.v8BreakIterator.prototype.breakType"; const char* const method_name =
"get Intl.v8BreakIterator.prototype.breakType";
HandleScope scope(isolate); HandleScope scope(isolate);
CHECK_RECEIVER(JSV8BreakIterator, break_iterator, method); CHECK_RECEIVER(JSV8BreakIterator, break_iterator, method_name);
Handle<Object> bound_break_type(break_iterator->bound_break_type(), isolate); Handle<Object> bound_break_type(break_iterator->bound_break_type(), isolate);
if (!bound_break_type->IsUndefined(isolate)) { if (!bound_break_type->IsUndefined(isolate)) {
......
...@@ -111,7 +111,7 @@ BUILTIN(NumberPrototypeToFixed) { ...@@ -111,7 +111,7 @@ BUILTIN(NumberPrototypeToFixed) {
// ES6 section 20.1.3.4 Number.prototype.toLocaleString ( [ r1 [ , r2 ] ] ) // ES6 section 20.1.3.4 Number.prototype.toLocaleString ( [ r1 [ , r2 ] ] )
BUILTIN(NumberPrototypeToLocaleString) { BUILTIN(NumberPrototypeToLocaleString) {
HandleScope scope(isolate); HandleScope scope(isolate);
const char* method = "Number.prototype.toLocaleString"; const char* method_name = "Number.prototype.toLocaleString";
isolate->CountUsage(v8::Isolate::UseCounterFeature::kNumberToLocaleString); isolate->CountUsage(v8::Isolate::UseCounterFeature::kNumberToLocaleString);
...@@ -126,7 +126,7 @@ BUILTIN(NumberPrototypeToLocaleString) { ...@@ -126,7 +126,7 @@ BUILTIN(NumberPrototypeToLocaleString) {
THROW_NEW_ERROR_RETURN_FAILURE( THROW_NEW_ERROR_RETURN_FAILURE(
isolate, isolate,
NewTypeError(MessageTemplate::kNotGeneric, NewTypeError(MessageTemplate::kNotGeneric,
isolate->factory()->NewStringFromAsciiChecked(method), isolate->factory()->NewStringFromAsciiChecked(method_name),
isolate->factory()->Number_string())); isolate->factory()->Number_string()));
} }
...@@ -134,7 +134,7 @@ BUILTIN(NumberPrototypeToLocaleString) { ...@@ -134,7 +134,7 @@ BUILTIN(NumberPrototypeToLocaleString) {
RETURN_RESULT_OR_FAILURE( RETURN_RESULT_OR_FAILURE(
isolate, isolate,
Intl::NumberToLocaleString(isolate, value, args.atOrUndefined(isolate, 1), Intl::NumberToLocaleString(isolate, value, args.atOrUndefined(isolate, 1),
args.atOrUndefined(isolate, 2), method)); args.atOrUndefined(isolate, 2), method_name));
#else #else
// Turn the {value} into a String. // Turn the {value} into a String.
return *isolate->factory()->NumberToString(value); return *isolate->factory()->NumberToString(value);
......
...@@ -47,9 +47,10 @@ BUILTIN(TypedArrayPrototypeCopyWithin) { ...@@ -47,9 +47,10 @@ BUILTIN(TypedArrayPrototypeCopyWithin) {
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<JSTypedArray> array; Handle<JSTypedArray> array;
const char* method = "%TypedArray%.prototype.copyWithin"; const char* method_name = "%TypedArray%.prototype.copyWithin";
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, array, JSTypedArray::Validate(isolate, args.receiver(), method)); isolate, array,
JSTypedArray::Validate(isolate, args.receiver(), method_name));
int64_t len = array->GetLength(); int64_t len = array->GetLength();
int64_t to = 0; int64_t to = 0;
...@@ -92,7 +93,7 @@ BUILTIN(TypedArrayPrototypeCopyWithin) { ...@@ -92,7 +93,7 @@ BUILTIN(TypedArrayPrototypeCopyWithin) {
if (out_of_bounds) { if (out_of_bounds) {
const MessageTemplate message = MessageTemplate::kDetachedOperation; const MessageTemplate message = MessageTemplate::kDetachedOperation;
Handle<String> operation = Handle<String> operation =
isolate->factory()->NewStringFromAsciiChecked(method); isolate->factory()->NewStringFromAsciiChecked(method_name);
THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewTypeError(message, operation)); THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewTypeError(message, operation));
} }
if (new_len < len) { if (new_len < len) {
...@@ -137,9 +138,10 @@ BUILTIN(TypedArrayPrototypeFill) { ...@@ -137,9 +138,10 @@ BUILTIN(TypedArrayPrototypeFill) {
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<JSTypedArray> array; Handle<JSTypedArray> array;
const char* method = "%TypedArray%.prototype.fill"; const char* method_name = "%TypedArray%.prototype.fill";
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, array, JSTypedArray::Validate(isolate, args.receiver(), method)); isolate, array,
JSTypedArray::Validate(isolate, args.receiver(), method_name));
ElementsKind kind = array->GetElementsKind(); ElementsKind kind = array->GetElementsKind();
Handle<Object> obj_value = args.atOrUndefined(isolate, 1); Handle<Object> obj_value = args.atOrUndefined(isolate, 1);
...@@ -181,7 +183,7 @@ BUILTIN(TypedArrayPrototypeFill) { ...@@ -181,7 +183,7 @@ BUILTIN(TypedArrayPrototypeFill) {
if (out_of_bounds) { if (out_of_bounds) {
const MessageTemplate message = MessageTemplate::kDetachedOperation; const MessageTemplate message = MessageTemplate::kDetachedOperation;
Handle<String> operation = Handle<String> operation =
isolate->factory()->NewStringFromAsciiChecked(method); isolate->factory()->NewStringFromAsciiChecked(method_name);
THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewTypeError(message, operation)); THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewTypeError(message, operation));
} }
} }
...@@ -204,9 +206,10 @@ BUILTIN(TypedArrayPrototypeIncludes) { ...@@ -204,9 +206,10 @@ BUILTIN(TypedArrayPrototypeIncludes) {
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<JSTypedArray> array; Handle<JSTypedArray> array;
const char* method = "%TypedArray%.prototype.includes"; const char* method_name = "%TypedArray%.prototype.includes";
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, array, JSTypedArray::Validate(isolate, args.receiver(), method)); isolate, array,
JSTypedArray::Validate(isolate, args.receiver(), method_name));
if (args.length() < 2) return ReadOnlyRoots(isolate).false_value(); if (args.length() < 2) return ReadOnlyRoots(isolate).false_value();
...@@ -237,9 +240,10 @@ BUILTIN(TypedArrayPrototypeIndexOf) { ...@@ -237,9 +240,10 @@ BUILTIN(TypedArrayPrototypeIndexOf) {
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<JSTypedArray> array; Handle<JSTypedArray> array;
const char* method = "%TypedArray%.prototype.indexOf"; const char* method_name = "%TypedArray%.prototype.indexOf";
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, array, JSTypedArray::Validate(isolate, args.receiver(), method)); isolate, array,
JSTypedArray::Validate(isolate, args.receiver(), method_name));
int64_t len = array->length(); int64_t len = array->length();
if (len == 0) return Smi::FromInt(-1); if (len == 0) return Smi::FromInt(-1);
...@@ -267,9 +271,10 @@ BUILTIN(TypedArrayPrototypeLastIndexOf) { ...@@ -267,9 +271,10 @@ BUILTIN(TypedArrayPrototypeLastIndexOf) {
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<JSTypedArray> array; Handle<JSTypedArray> array;
const char* method = "%TypedArray%.prototype.lastIndexOf"; const char* method_name = "%TypedArray%.prototype.lastIndexOf";
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, array, JSTypedArray::Validate(isolate, args.receiver(), method)); isolate, array,
JSTypedArray::Validate(isolate, args.receiver(), method_name));
int64_t len = array->length(); int64_t len = array->length();
if (len == 0) return Smi::FromInt(-1); if (len == 0) return Smi::FromInt(-1);
...@@ -301,9 +306,10 @@ BUILTIN(TypedArrayPrototypeReverse) { ...@@ -301,9 +306,10 @@ BUILTIN(TypedArrayPrototypeReverse) {
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<JSTypedArray> array; Handle<JSTypedArray> array;
const char* method = "%TypedArray%.prototype.reverse"; const char* method_name = "%TypedArray%.prototype.reverse";
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, array, JSTypedArray::Validate(isolate, args.receiver(), method)); isolate, array,
JSTypedArray::Validate(isolate, args.receiver(), method_name));
ElementsAccessor* elements = array->GetElementsAccessor(); ElementsAccessor* elements = array->GetElementsAccessor();
elements->Reverse(*array); elements->Reverse(*array);
......
...@@ -183,12 +183,12 @@ const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat, ...@@ -183,12 +183,12 @@ const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat,
template <typename T> template <typename T>
MaybeHandle<T> New(Isolate* isolate, Handle<JSFunction> constructor, MaybeHandle<T> New(Isolate* isolate, Handle<JSFunction> constructor,
Handle<Object> locales, Handle<Object> options, Handle<Object> locales, Handle<Object> options,
const char* method) { const char* method_name) {
Handle<Map> map; Handle<Map> map;
ASSIGN_RETURN_ON_EXCEPTION( ASSIGN_RETURN_ON_EXCEPTION(
isolate, map, isolate, map,
JSFunction::GetDerivedMap(isolate, constructor, constructor), T); JSFunction::GetDerivedMap(isolate, constructor, constructor), T);
return T::New(isolate, map, locales, options, method); return T::New(isolate, map, locales, options, method_name);
} }
} // namespace } // namespace
...@@ -927,7 +927,7 @@ MaybeHandle<String> Intl::StringLocaleConvertCase(Isolate* isolate, ...@@ -927,7 +927,7 @@ MaybeHandle<String> Intl::StringLocaleConvertCase(Isolate* isolate,
base::Optional<int> Intl::StringLocaleCompare( base::Optional<int> Intl::StringLocaleCompare(
Isolate* isolate, Handle<String> string1, Handle<String> string2, Isolate* isolate, Handle<String> string1, Handle<String> string2,
Handle<Object> locales, Handle<Object> options, const char* method) { Handle<Object> locales, Handle<Object> options, const char* method_name) {
// We only cache the instance when locales is a string/undefined and // We only cache the instance when locales is a string/undefined and
// options is undefined, as that is the only case when the specified // options is undefined, as that is the only case when the specified
// side-effects of examining those arguments are unobservable. // side-effects of examining those arguments are unobservable.
...@@ -952,7 +952,7 @@ base::Optional<int> Intl::StringLocaleCompare( ...@@ -952,7 +952,7 @@ base::Optional<int> Intl::StringLocaleCompare(
Handle<JSCollator> collator; Handle<JSCollator> collator;
MaybeHandle<JSCollator> maybe_collator = MaybeHandle<JSCollator> maybe_collator =
New<JSCollator>(isolate, constructor, locales, options, method); New<JSCollator>(isolate, constructor, locales, options, method_name);
if (!maybe_collator.ToHandle(&collator)) return {}; if (!maybe_collator.ToHandle(&collator)) return {};
if (can_cache) { if (can_cache) {
isolate->set_icu_object_in_cache( isolate->set_icu_object_in_cache(
...@@ -1005,7 +1005,7 @@ MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate, ...@@ -1005,7 +1005,7 @@ MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate,
Handle<Object> num, Handle<Object> num,
Handle<Object> locales, Handle<Object> locales,
Handle<Object> options, Handle<Object> options,
const char* method) { const char* method_name) {
Handle<Object> numeric_obj; Handle<Object> numeric_obj;
ASSIGN_RETURN_ON_EXCEPTION(isolate, numeric_obj, ASSIGN_RETURN_ON_EXCEPTION(isolate, numeric_obj,
Object::ToNumeric(isolate, num), String); Object::ToNumeric(isolate, num), String);
...@@ -1035,7 +1035,7 @@ MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate, ...@@ -1035,7 +1035,7 @@ MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate,
// 2. Let numberFormat be ? Construct(%NumberFormat%, « locales, options »). // 2. Let numberFormat be ? Construct(%NumberFormat%, « locales, options »).
ASSIGN_RETURN_ON_EXCEPTION( ASSIGN_RETURN_ON_EXCEPTION(
isolate, number_format, isolate, number_format,
New<JSNumberFormat>(isolate, constructor, locales, options, method), New<JSNumberFormat>(isolate, constructor, locales, options, method_name),
String); String);
if (can_cache) { if (can_cache) {
...@@ -1482,21 +1482,21 @@ MaybeHandle<JSArray> CreateArrayFromList(Isolate* isolate, ...@@ -1482,21 +1482,21 @@ MaybeHandle<JSArray> CreateArrayFromList(Isolate* isolate,
// ECMA 402 9.2.9 SupportedLocales(availableLocales, requestedLocales, options) // ECMA 402 9.2.9 SupportedLocales(availableLocales, requestedLocales, options)
// https://tc39.github.io/ecma402/#sec-supportedlocales // https://tc39.github.io/ecma402/#sec-supportedlocales
MaybeHandle<JSObject> SupportedLocales( MaybeHandle<JSObject> SupportedLocales(
Isolate* isolate, const char* method, Isolate* isolate, const char* method_name,
const std::set<std::string>& available_locales, const std::set<std::string>& available_locales,
const std::vector<std::string>& requested_locales, Handle<Object> options) { const std::vector<std::string>& requested_locales, Handle<Object> options) {
std::vector<std::string> supported_locales; std::vector<std::string> supported_locales;
// 1. Set options to ? CoerceOptionsToObject(options). // 1. Set options to ? CoerceOptionsToObject(options).
Handle<JSReceiver> options_obj; Handle<JSReceiver> options_obj;
ASSIGN_RETURN_ON_EXCEPTION(isolate, options_obj, ASSIGN_RETURN_ON_EXCEPTION(
CoerceOptionsToObject(isolate, options, method), isolate, options_obj,
JSObject); CoerceOptionsToObject(isolate, options, method_name), JSObject);
// 2. Let matcher be ? GetOption(options, "localeMatcher", "string", // 2. Let matcher be ? GetOption(options, "localeMatcher", "string",
// « "lookup", "best fit" », "best fit"). // « "lookup", "best fit" », "best fit").
Maybe<Intl::MatcherOption> maybe_locale_matcher = Maybe<Intl::MatcherOption> maybe_locale_matcher =
Intl::GetLocaleMatcher(isolate, options_obj, method); Intl::GetLocaleMatcher(isolate, options_obj, method_name);
MAYBE_RETURN(maybe_locale_matcher, MaybeHandle<JSObject>()); MAYBE_RETURN(maybe_locale_matcher, MaybeHandle<JSObject>());
Intl::MatcherOption matcher = maybe_locale_matcher.FromJust(); Intl::MatcherOption matcher = maybe_locale_matcher.FromJust();
...@@ -1676,7 +1676,7 @@ MaybeHandle<JSArray> Intl::SupportedValuesOf(Isolate* isolate, ...@@ -1676,7 +1676,7 @@ MaybeHandle<JSArray> Intl::SupportedValuesOf(Isolate* isolate,
// ECMA 402 Intl.*.supportedLocalesOf // ECMA 402 Intl.*.supportedLocalesOf
MaybeHandle<JSObject> Intl::SupportedLocalesOf( MaybeHandle<JSObject> Intl::SupportedLocalesOf(
Isolate* isolate, const char* method, Isolate* isolate, const char* method_name,
const std::set<std::string>& available_locales, Handle<Object> locales, const std::set<std::string>& available_locales, Handle<Object> locales,
Handle<Object> options) { Handle<Object> options) {
// Let availableLocales be %Collator%.[[AvailableLocales]]. // Let availableLocales be %Collator%.[[AvailableLocales]].
...@@ -1687,7 +1687,7 @@ MaybeHandle<JSObject> Intl::SupportedLocalesOf( ...@@ -1687,7 +1687,7 @@ MaybeHandle<JSObject> Intl::SupportedLocalesOf(
MAYBE_RETURN(requested_locales, MaybeHandle<JSObject>()); MAYBE_RETURN(requested_locales, MaybeHandle<JSObject>());
// Return ? SupportedLocales(availableLocales, requestedLocales, options). // Return ? SupportedLocales(availableLocales, requestedLocales, options).
return SupportedLocales(isolate, method, available_locales, return SupportedLocales(isolate, method_name, available_locales,
requested_locales.FromJust(), options); requested_locales.FromJust(), options);
} }
...@@ -2098,20 +2098,20 @@ base::TimezoneCache* Intl::CreateTimeZoneCache() { ...@@ -2098,20 +2098,20 @@ base::TimezoneCache* Intl::CreateTimeZoneCache() {
Maybe<Intl::MatcherOption> Intl::GetLocaleMatcher(Isolate* isolate, Maybe<Intl::MatcherOption> Intl::GetLocaleMatcher(Isolate* isolate,
Handle<JSReceiver> options, Handle<JSReceiver> options,
const char* method) { const char* method_name) {
return GetStringOption<Intl::MatcherOption>( return GetStringOption<Intl::MatcherOption>(
isolate, options, "localeMatcher", method, {"best fit", "lookup"}, isolate, options, "localeMatcher", method_name, {"best fit", "lookup"},
{Intl::MatcherOption::kBestFit, Intl::MatcherOption::kLookup}, {Intl::MatcherOption::kBestFit, Intl::MatcherOption::kLookup},
Intl::MatcherOption::kBestFit); Intl::MatcherOption::kBestFit);
} }
Maybe<bool> Intl::GetNumberingSystem(Isolate* isolate, Maybe<bool> Intl::GetNumberingSystem(Isolate* isolate,
Handle<JSReceiver> options, Handle<JSReceiver> options,
const char* method, const char* method_name,
std::unique_ptr<char[]>* result) { std::unique_ptr<char[]>* result) {
const std::vector<const char*> empty_values = {}; const std::vector<const char*> empty_values = {};
Maybe<bool> maybe = GetStringOption(isolate, options, "numberingSystem", Maybe<bool> maybe = GetStringOption(isolate, options, "numberingSystem",
empty_values, method, result); empty_values, method_name, result);
MAYBE_RETURN(maybe, Nothing<bool>()); MAYBE_RETURN(maybe, Nothing<bool>());
if (maybe.FromJust() && *result != nullptr) { if (maybe.FromJust() && *result != nullptr) {
if (!IsWellFormedNumberingSystem(result->get())) { if (!IsWellFormedNumberingSystem(result->get())) {
......
...@@ -62,7 +62,7 @@ class Intl { ...@@ -62,7 +62,7 @@ class Intl {
static std::string GetNumberingSystem(const icu::Locale& icu_locale); static std::string GetNumberingSystem(const icu::Locale& icu_locale);
static V8_WARN_UNUSED_RESULT MaybeHandle<JSObject> SupportedLocalesOf( static V8_WARN_UNUSED_RESULT MaybeHandle<JSObject> SupportedLocalesOf(
Isolate* isolate, const char* method, Isolate* isolate, const char* method_name,
const std::set<std::string>& available_locales, Handle<Object> locales_in, const std::set<std::string>& available_locales, Handle<Object> locales_in,
Handle<Object> options_in); Handle<Object> options_in);
...@@ -94,7 +94,7 @@ class Intl { ...@@ -94,7 +94,7 @@ class Intl {
V8_WARN_UNUSED_RESULT static base::Optional<int> StringLocaleCompare( V8_WARN_UNUSED_RESULT static base::Optional<int> StringLocaleCompare(
Isolate* isolate, Handle<String> s1, Handle<String> s2, Isolate* isolate, Handle<String> s1, Handle<String> s2,
Handle<Object> locales, Handle<Object> options, const char* method); Handle<Object> locales, Handle<Object> options, const char* method_name);
V8_WARN_UNUSED_RESULT static int CompareStrings(Isolate* isolate, V8_WARN_UNUSED_RESULT static int CompareStrings(Isolate* isolate,
const icu::Collator& collator, const icu::Collator& collator,
...@@ -104,7 +104,7 @@ class Intl { ...@@ -104,7 +104,7 @@ class Intl {
// ecma402/#sup-properties-of-the-number-prototype-object // ecma402/#sup-properties-of-the-number-prototype-object
V8_WARN_UNUSED_RESULT static MaybeHandle<String> NumberToLocaleString( V8_WARN_UNUSED_RESULT static MaybeHandle<String> NumberToLocaleString(
Isolate* isolate, Handle<Object> num, Handle<Object> locales, Isolate* isolate, Handle<Object> num, Handle<Object> locales,
Handle<Object> options, const char* method); Handle<Object> options, const char* method_name);
// ecma402/#sec-setnfdigitoptions // ecma402/#sec-setnfdigitoptions
struct NumberFormatDigitOptions { struct NumberFormatDigitOptions {
...@@ -172,11 +172,11 @@ class Intl { ...@@ -172,11 +172,11 @@ class Intl {
// Shared function to read the "localeMatcher" option. // Shared function to read the "localeMatcher" option.
V8_WARN_UNUSED_RESULT static Maybe<MatcherOption> GetLocaleMatcher( V8_WARN_UNUSED_RESULT static Maybe<MatcherOption> GetLocaleMatcher(
Isolate* isolate, Handle<JSReceiver> options, const char* method); Isolate* isolate, Handle<JSReceiver> options, const char* method_name);
// Shared function to read the "numberingSystem" option. // Shared function to read the "numberingSystem" option.
V8_WARN_UNUSED_RESULT static Maybe<bool> GetNumberingSystem( V8_WARN_UNUSED_RESULT static Maybe<bool> GetNumberingSystem(
Isolate* isolate, Handle<JSReceiver> options, const char* method, Isolate* isolate, Handle<JSReceiver> options, const char* method_name,
std::unique_ptr<char[]>* result); std::unique_ptr<char[]>* result);
// Check the calendar is valid or not for that locale. // Check the calendar is valid or not for that locale.
......
...@@ -44,9 +44,9 @@ enum class Sensitivity { ...@@ -44,9 +44,9 @@ enum class Sensitivity {
enum class CaseFirst { kUndefined, kUpper, kLower, kFalse }; enum class CaseFirst { kUndefined, kUpper, kLower, kFalse };
Maybe<CaseFirst> GetCaseFirst(Isolate* isolate, Handle<JSReceiver> options, Maybe<CaseFirst> GetCaseFirst(Isolate* isolate, Handle<JSReceiver> options,
const char* method) { const char* method_name) {
return GetStringOption<CaseFirst>( return GetStringOption<CaseFirst>(
isolate, options, "caseFirst", method, {"upper", "lower", "false"}, isolate, options, "caseFirst", method_name, {"upper", "lower", "false"},
{CaseFirst::kUpper, CaseFirst::kLower, CaseFirst::kFalse}, {CaseFirst::kUpper, CaseFirst::kLower, CaseFirst::kFalse},
CaseFirst::kUndefined); CaseFirst::kUndefined);
} }
......
...@@ -77,9 +77,9 @@ JSDateTimeFormat::HourCycle ToHourCycle(UDateFormatHourCycle hc) { ...@@ -77,9 +77,9 @@ JSDateTimeFormat::HourCycle ToHourCycle(UDateFormatHourCycle hc) {
Maybe<JSDateTimeFormat::HourCycle> GetHourCycle(Isolate* isolate, Maybe<JSDateTimeFormat::HourCycle> GetHourCycle(Isolate* isolate,
Handle<JSReceiver> options, Handle<JSReceiver> options,
const char* method) { const char* method_name) {
return GetStringOption<JSDateTimeFormat::HourCycle>( return GetStringOption<JSDateTimeFormat::HourCycle>(
isolate, options, "hourCycle", method, {"h11", "h12", "h23", "h24"}, isolate, options, "hourCycle", method_name, {"h11", "h12", "h23", "h24"},
{JSDateTimeFormat::HourCycle::kH11, JSDateTimeFormat::HourCycle::kH12, {JSDateTimeFormat::HourCycle::kH11, JSDateTimeFormat::HourCycle::kH12,
JSDateTimeFormat::HourCycle::kH23, JSDateTimeFormat::HourCycle::kH24}, JSDateTimeFormat::HourCycle::kH23, JSDateTimeFormat::HourCycle::kH24},
JSDateTimeFormat::HourCycle::kUndefined); JSDateTimeFormat::HourCycle::kUndefined);
...@@ -772,7 +772,7 @@ Isolate::ICUObjectCacheType ConvertToCacheType( ...@@ -772,7 +772,7 @@ Isolate::ICUObjectCacheType ConvertToCacheType(
MaybeHandle<String> JSDateTimeFormat::ToLocaleDateTime( MaybeHandle<String> JSDateTimeFormat::ToLocaleDateTime(
Isolate* isolate, Handle<Object> date, Handle<Object> locales, Isolate* isolate, Handle<Object> date, Handle<Object> locales,
Handle<Object> options, RequiredOption required, DefaultsOption defaults, Handle<Object> options, RequiredOption required, DefaultsOption defaults,
const char* method) { const char* method_name) {
Isolate::ICUObjectCacheType cache_type = ConvertToCacheType(defaults); Isolate::ICUObjectCacheType cache_type = ConvertToCacheType(defaults);
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
...@@ -822,7 +822,8 @@ MaybeHandle<String> JSDateTimeFormat::ToLocaleDateTime( ...@@ -822,7 +822,8 @@ MaybeHandle<String> JSDateTimeFormat::ToLocaleDateTime(
Handle<JSDateTimeFormat> date_time_format; Handle<JSDateTimeFormat> date_time_format;
ASSIGN_RETURN_ON_EXCEPTION( ASSIGN_RETURN_ON_EXCEPTION(
isolate, date_time_format, isolate, date_time_format,
JSDateTimeFormat::New(isolate, map, locales, internal_options, method), JSDateTimeFormat::New(isolate, map, locales, internal_options,
method_name),
String); String);
if (can_cache) { if (can_cache) {
......
...@@ -82,7 +82,7 @@ class JSDateTimeFormat ...@@ -82,7 +82,7 @@ class JSDateTimeFormat
V8_WARN_UNUSED_RESULT static MaybeHandle<String> ToLocaleDateTime( V8_WARN_UNUSED_RESULT static MaybeHandle<String> ToLocaleDateTime(
Isolate* isolate, Handle<Object> date, Handle<Object> locales, Isolate* isolate, Handle<Object> date, Handle<Object> locales,
Handle<Object> options, RequiredOption required, DefaultsOption defaults, Handle<Object> options, RequiredOption required, DefaultsOption defaults,
const char* method); const char* method_name);
V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales(); V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales();
......
...@@ -13,7 +13,7 @@ namespace internal { ...@@ -13,7 +13,7 @@ namespace internal {
// ecma402/#sec-getoptionsobject // ecma402/#sec-getoptionsobject
MaybeHandle<JSReceiver> GetOptionsObject(Isolate* isolate, MaybeHandle<JSReceiver> GetOptionsObject(Isolate* isolate,
Handle<Object> options, Handle<Object> options,
const char* method) { const char* method_name) {
// 1. If options is undefined, then // 1. If options is undefined, then
if (options->IsUndefined(isolate)) { if (options->IsUndefined(isolate)) {
// a. Return ! ObjectCreate(null). // a. Return ! ObjectCreate(null).
...@@ -32,21 +32,23 @@ MaybeHandle<JSReceiver> GetOptionsObject(Isolate* isolate, ...@@ -32,21 +32,23 @@ MaybeHandle<JSReceiver> GetOptionsObject(Isolate* isolate,
// ecma402/#sec-coerceoptionstoobject // ecma402/#sec-coerceoptionstoobject
MaybeHandle<JSReceiver> CoerceOptionsToObject(Isolate* isolate, MaybeHandle<JSReceiver> CoerceOptionsToObject(Isolate* isolate,
Handle<Object> options, Handle<Object> options,
const char* method) { const char* method_name) {
// 1. If options is undefined, then // 1. If options is undefined, then
if (options->IsUndefined(isolate)) { if (options->IsUndefined(isolate)) {
// a. Return ! ObjectCreate(null). // a. Return ! ObjectCreate(null).
return isolate->factory()->NewJSObjectWithNullProto(); return isolate->factory()->NewJSObjectWithNullProto();
} }
// 2. Return ? ToObject(options). // 2. Return ? ToObject(options).
ASSIGN_RETURN_ON_EXCEPTION( ASSIGN_RETURN_ON_EXCEPTION(isolate, options,
isolate, options, Object::ToObject(isolate, options, method), JSReceiver); Object::ToObject(isolate, options, method_name),
JSReceiver);
return Handle<JSReceiver>::cast(options); return Handle<JSReceiver>::cast(options);
} }
Maybe<bool> GetStringOption(Isolate* isolate, Handle<JSReceiver> options, Maybe<bool> GetStringOption(Isolate* isolate, Handle<JSReceiver> options,
const char* property, const char* property,
std::vector<const char*> values, const char* method, std::vector<const char*> values,
const char* method_name,
std::unique_ptr<char[]>* result) { std::unique_ptr<char[]>* result) {
Handle<String> property_str = Handle<String> property_str =
isolate->factory()->NewStringFromAsciiChecked(property); isolate->factory()->NewStringFromAsciiChecked(property);
...@@ -81,7 +83,7 @@ Maybe<bool> GetStringOption(Isolate* isolate, Handle<JSReceiver> options, ...@@ -81,7 +83,7 @@ Maybe<bool> GetStringOption(Isolate* isolate, Handle<JSReceiver> options,
} }
Handle<String> method_str = Handle<String> method_str =
isolate->factory()->NewStringFromAsciiChecked(method); isolate->factory()->NewStringFromAsciiChecked(method_name);
THROW_NEW_ERROR_RETURN_VALUE( THROW_NEW_ERROR_RETURN_VALUE(
isolate, isolate,
NewRangeError(MessageTemplate::kValueOutOfRange, value, method_str, NewRangeError(MessageTemplate::kValueOutOfRange, value, method_str,
...@@ -97,7 +99,7 @@ Maybe<bool> GetStringOption(Isolate* isolate, Handle<JSReceiver> options, ...@@ -97,7 +99,7 @@ Maybe<bool> GetStringOption(Isolate* isolate, Handle<JSReceiver> options,
V8_WARN_UNUSED_RESULT Maybe<bool> GetBoolOption(Isolate* isolate, V8_WARN_UNUSED_RESULT Maybe<bool> GetBoolOption(Isolate* isolate,
Handle<JSReceiver> options, Handle<JSReceiver> options,
const char* property, const char* property,
const char* method, const char* method_name,
bool* result) { bool* result) {
Handle<String> property_str = Handle<String> property_str =
isolate->factory()->NewStringFromAsciiChecked(property); isolate->factory()->NewStringFromAsciiChecked(property);
......
...@@ -13,11 +13,11 @@ namespace internal { ...@@ -13,11 +13,11 @@ namespace internal {
// ecma402/#sec-getoptionsobject and temporal/#sec-getoptionsobject // ecma402/#sec-getoptionsobject and temporal/#sec-getoptionsobject
V8_WARN_UNUSED_RESULT MaybeHandle<JSReceiver> GetOptionsObject( V8_WARN_UNUSED_RESULT MaybeHandle<JSReceiver> GetOptionsObject(
Isolate* isolate, Handle<Object> options, const char* method); Isolate* isolate, Handle<Object> options, const char* method_name);
// ecma402/#sec-coerceoptionstoobject // ecma402/#sec-coerceoptionstoobject
V8_WARN_UNUSED_RESULT MaybeHandle<JSReceiver> CoerceOptionsToObject( V8_WARN_UNUSED_RESULT MaybeHandle<JSReceiver> CoerceOptionsToObject(
Isolate* isolate, Handle<Object> options, const char* method); Isolate* isolate, Handle<Object> options, const char* method_name);
// ECMA402 9.2.10. GetOption( options, property, type, values, fallback) // ECMA402 9.2.10. GetOption( options, property, type, values, fallback)
// ecma402/#sec-getoption and temporal/#sec-getoption // ecma402/#sec-getoption and temporal/#sec-getoption
...@@ -32,11 +32,11 @@ V8_WARN_UNUSED_RESULT MaybeHandle<JSReceiver> CoerceOptionsToObject( ...@@ -32,11 +32,11 @@ V8_WARN_UNUSED_RESULT MaybeHandle<JSReceiver> CoerceOptionsToObject(
// caller is required to use fallback value appropriately in this // caller is required to use fallback value appropriately in this
// case. // case.
// //
// method is a string denoting the method the call from; used when // method_name is a string denoting the method the call from; used when
// printing the error message. // printing the error message.
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<bool> GetStringOption( V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<bool> GetStringOption(
Isolate* isolate, Handle<JSReceiver> options, const char* property, Isolate* isolate, Handle<JSReceiver> options, const char* property,
std::vector<const char*> values, const char* method, std::vector<const char*> values, const char* method_name,
std::unique_ptr<char[]>* result); std::unique_ptr<char[]>* result);
// A helper template to get string from option into a enum. // A helper template to get string from option into a enum.
...@@ -46,12 +46,12 @@ V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<bool> GetStringOption( ...@@ -46,12 +46,12 @@ V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<bool> GetStringOption(
template <typename T> template <typename T>
V8_WARN_UNUSED_RESULT static Maybe<T> GetStringOption( V8_WARN_UNUSED_RESULT static Maybe<T> GetStringOption(
Isolate* isolate, Handle<JSReceiver> options, const char* name, Isolate* isolate, Handle<JSReceiver> options, const char* name,
const char* method, const std::vector<const char*>& str_values, const char* method_name, const std::vector<const char*>& str_values,
const std::vector<T>& enum_values, T default_value) { const std::vector<T>& enum_values, T default_value) {
DCHECK_EQ(str_values.size(), enum_values.size()); DCHECK_EQ(str_values.size(), enum_values.size());
std::unique_ptr<char[]> cstr; std::unique_ptr<char[]> cstr;
Maybe<bool> found = Maybe<bool> found =
GetStringOption(isolate, options, name, str_values, method, &cstr); GetStringOption(isolate, options, name, str_values, method_name, &cstr);
MAYBE_RETURN(found, Nothing<T>()); MAYBE_RETURN(found, Nothing<T>());
if (found.FromJust()) { if (found.FromJust()) {
DCHECK_NOT_NULL(cstr.get()); DCHECK_NOT_NULL(cstr.get());
...@@ -75,11 +75,11 @@ V8_WARN_UNUSED_RESULT static Maybe<T> GetStringOption( ...@@ -75,11 +75,11 @@ V8_WARN_UNUSED_RESULT static Maybe<T> GetStringOption(
// caller is required to use fallback value appropriately in this // caller is required to use fallback value appropriately in this
// case. // case.
// //
// method is a string denoting the method it called from; used when // method_name is a string denoting the method it called from; used when
// printing the error message. // printing the error message.
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<bool> GetBoolOption( V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<bool> GetBoolOption(
Isolate* isolate, Handle<JSReceiver> options, const char* property, Isolate* isolate, Handle<JSReceiver> options, const char* property,
const char* method, bool* result); const char* method_name, bool* result);
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<int> GetNumberOption( V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<int> GetNumberOption(
Isolate* isolate, Handle<JSReceiver> options, Handle<String> property, Isolate* isolate, Handle<JSReceiver> options, Handle<String> property,
......
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