Lines Matching defs:isolate

19 #include "src/execution/isolate.h"
20 #include "src/execution/local-isolate.h"
186 MaybeHandle<T> New(Isolate* isolate, Handle<JSFunction> constructor,
191 isolate, map,
192 JSFunction::GetDerivedMap(isolate, constructor, constructor), T);
193 return T::New(isolate, map, locales, options, method_name);
199 icu::UnicodeString Intl::ToICUUnicodeString(Isolate* isolate,
223 icu::StringPiece ToICUStringPiece(Isolate* isolate, Handle<String> string,
242 MaybeHandle<String> LocaleConvertCase(Isolate* isolate, Handle<String> s,
251 if (dest_length == 0) return ReadOnlyRoots(isolate).empty_string_handle();
259 isolate, result, isolate->factory()->NewRawTwoByteString(dest_length),
336 MaybeHandle<String> Intl::ConvertToLower(Isolate* isolate, Handle<String> s) {
339 return LocaleConvertCase(isolate, s, false, "");
362 isolate->factory()->NewRawOneByteString(length).ToHandleChecked();
364 return Handle<String>(Intl::ConvertOneByteToLower(*s, *result), isolate);
367 MaybeHandle<String> Intl::ConvertToUpper(Isolate* isolate, Handle<String> s) {
371 isolate->factory()->NewRawOneByteString(length).ToHandleChecked();
406 return LocaleConvertCase(isolate, s, true, "");
414 isolate, result,
415 isolate->factory()->NewRawOneByteString(length + sharp_s_count),
428 return LocaleConvertCase(isolate, s, true, "");
465 MaybeHandle<String> Intl::ToString(Isolate* isolate,
467 return isolate->factory()->NewStringFromTwoByte(base::Vector<const uint16_t>(
471 MaybeHandle<String> Intl::ToString(Isolate* isolate,
474 return Intl::ToString(isolate, string.tempSubStringBetween(begin, end));
479 Handle<JSObject> InnerAddElement(Isolate* isolate, Handle<JSArray> array,
487 Factory* factory = isolate->factory();
488 Handle<JSObject> element = factory->NewJSObject(isolate->object_function());
489 JSObject::AddProperty(isolate, element, factory->type_string(),
492 JSObject::AddProperty(isolate, element, factory->value_string(), value, NONE);
504 void Intl::AddElement(Isolate* isolate, Handle<JSArray> array, int index,
507 InnerAddElement(isolate, array, index, field_type_string, value);
510 void Intl::AddElement(Isolate* isolate, Handle<JSArray> array, int index,
519 InnerAddElement(isolate, array, index, field_type_string, value);
520 JSObject::AddProperty(isolate, element, additional_property_name,
618 MaybeHandle<Object> Intl::LegacyUnwrapReceiver(Isolate* isolate,
624 isolate, obj_ordinary_has_instance,
625 Object::OrdinaryHasInstance(isolate, constructor, receiver), Object);
626 bool ordinary_has_instance = obj_ordinary_has_instance->BooleanValue(isolate);
634 isolate, new_receiver,
635 JSReceiver::GetProperty(isolate, receiver,
636 isolate->factory()->intl_fallback_symbol()),
667 Maybe<std::string> CanonicalizeLanguageTag(Isolate* isolate,
674 isolate,
677 isolate->factory()->NewStringFromAsciiChecked(locale.c_str())),
711 isolate,
714 isolate->factory()->NewStringFromAsciiChecked(locale.c_str())),
723 isolate,
726 isolate->factory()->NewStringFromAsciiChecked(locale.c_str())),
732 isolate,
735 isolate->factory()->NewStringFromAsciiChecked(locale.c_str())),
742 Maybe<std::string> CanonicalizeLanguageTag(Isolate* isolate,
755 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, locale_str,
756 Object::ToString(isolate, locale_in),
759 THROW_NEW_ERROR_RETURN_VALUE(isolate,
767 isolate, NewRangeError(MessageTemplate::kLocaleBadParameters),
770 return CanonicalizeLanguageTag(isolate, locale);
776 Isolate* isolate, Handle<Object> locales, bool only_return_one_result) {
778 if (locales->IsUndefined(isolate)) {
798 if (!CanonicalizeLanguageTag(isolate, locales).To(&canonicalized_tag)) {
807 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, o,
808 Object::ToObject(isolate, locales),
812 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, length_obj,
813 Object::GetLengthFromArrayLike(isolate, o),
827 LookupIterator it(isolate, o, k);
834 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, k_value, Object::GetProperty(&it),
850 if (!CanonicalizeLanguageTag(isolate, k_value).To(&canonicalized_tag)) {
869 MaybeHandle<String> Intl::StringLocaleConvertCase(Isolate* isolate,
874 if (!CanonicalizeLocaleList(isolate, locales, true).To(&requested_locales)) {
878 ? isolate->DefaultLocale()
888 s = String::Flatten(isolate, s);
896 return ConvertToUpper(isolate, s);
898 return ConvertToLower(isolate, s);
906 return LocaleConvertCase(isolate, s, to_upper, requested_locale.c_str());
909 return ConvertToUpper(isolate, s);
911 return ConvertToLower(isolate, s);
918 IsolateT* isolate, Handle<Object> locales, Handle<Object> options) {
919 if (!options->IsUndefined(isolate)) {
937 if (locales->IsUndefined(isolate)) {
938 const std::string& default_locale = isolate->DefaultLocale();
952 if (locales_string->IsEqualTo(base::CStrVector(fast_locale), isolate)) {
967 Isolate* isolate, Handle<String> string1, Handle<String> string2,
973 (locales->IsString() || locales->IsUndefined(isolate)) &&
974 options->IsUndefined(isolate);
978 CompareStringsOptionsFor(isolate, locales, options);
982 static_cast<icu::Collator*>(isolate->get_cached_icu_object(
986 return Intl::CompareStrings(isolate, *cached_icu_collator, string1,
993 isolate->context().native_context().intl_collator_function()),
994 isolate);
998 New<JSCollator>(isolate, constructor, locales, options, method_name);
1001 isolate->set_icu_object_in_cache(
1006 return Intl::CompareStrings(isolate, *icu_collator, string1, string2,
1335 Isolate* isolate, const icu::Collator& icu_collator, Handle<String> string1,
1412 int Intl::CompareStrings(Isolate* isolate, const icu::Collator& icu_collator,
1425 string1 = String::Flatten(isolate, string1);
1426 string2 = String::Flatten(isolate, string2);
1431 isolate, icu_collator, string1, string2, &processed_until);
1438 ToICUStringPiece(isolate, string1, processed_until);
1441 ToICUStringPiece(isolate, string2, processed_until);
1450 Intl::ToICUUnicodeString(isolate, string1, processed_until);
1452 Intl::ToICUUnicodeString(isolate, string2, processed_until);
1459 MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate,
1465 ASSIGN_RETURN_ON_EXCEPTION(isolate, numeric_obj,
1466 Object::ToNumeric(isolate, num), String);
1471 bool can_cache = (locales->IsString() || locales->IsUndefined(isolate)) &&
1472 options->IsUndefined(isolate);
1476 isolate->get_cached_icu_object(
1480 return JSNumberFormat::FormatNumeric(isolate, *cached_number_format,
1487 isolate->context().native_context().intl_number_format_function()),
1488 isolate);
1492 isolate, number_format,
1493 New<JSNumberFormat>(isolate, constructor, locales, options, method_name),
1497 isolate->set_icu_object_in_cache(
1506 return JSNumberFormat::FormatNumeric(isolate, *icu_number_format,
1511 Isolate* isolate, Handle<JSReceiver> options, int mnfd_default,
1513 Factory* factory = isolate->factory();
1519 if (!GetNumberOption(isolate, options, factory->minimumIntegerDigits_string(),
1528 isolate, mnfd_obj,
1529 JSReceiver::GetProperty(isolate, options,
1536 isolate, mxfd_obj,
1537 JSReceiver::GetProperty(isolate, options,
1544 isolate, mnsd_obj,
1545 JSReceiver::GetProperty(isolate, options,
1552 isolate, mxsd_obj,
1553 JSReceiver::GetProperty(isolate, options,
1570 isolate, options, "roundingPriority", "SetNumberFormatDigitOptions",
1584 (!mnsd_obj->IsUndefined(isolate)) || (!mxsd_obj->IsUndefined(isolate));
1591 (!mnfd_obj->IsUndefined(isolate)) || (!mxfd_obj->IsUndefined(isolate));
1611 if (!DefaultNumberOption(isolate, mnsd_obj, 1, 21, 1,
1618 if (!DefaultNumberOption(isolate, mxsd_obj, mnsd, 21, 21,
1644 if (!DefaultNumberOption(isolate, mnfd_obj, 0, 20, -1, mnfd_str)
1650 if (!DefaultNumberOption(isolate, mxfd_obj, 0, 20, -1, mxfd_str)
1655 if (mnfd_obj->IsUndefined(isolate)) {
1657 } else if (mxfd_obj->IsUndefined(isolate)) {
1665 isolate,
1849 Isolate* isolate, const std::set<std::string>& available_locales,
1852 icu::Locale::forLanguageTag(isolate->DefaultLocale(), *status);
1909 std::string BestFitMatcher(Isolate* isolate,
1914 std::string bestfit = BuildLocaleMatcher(isolate, available_locales, &status)
1925 Isolate* isolate, const std::set<std::string>& available_locales,
1929 BuildLocaleMatcher(isolate, available_locales, &status);
1955 MaybeHandle<JSArray> CreateArrayFromList(Isolate* isolate,
1958 Factory* factory = isolate->factory();
1981 Isolate* isolate, const char* method_name,
1989 isolate, options_obj,
1990 CoerceOptionsToObject(isolate, options, method_name), JSObject);
1995 Intl::GetLocaleMatcher(isolate, options_obj, method_name);
2005 BestFitSupportedLocales(isolate, available_locales, requested_locales);
2015 return CreateArrayFromList(isolate, supported_locales,
2022 MaybeHandle<JSArray> Intl::GetCanonicalLocales(Isolate* isolate,
2026 CanonicalizeLocaleList(isolate, locales, false);
2030 return CreateArrayFromList(isolate, maybe_ll.FromJust(),
2036 MaybeHandle<JSArray> AvailableCollations(Isolate* isolate) {
2041 THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kIcuError),
2044 return Intl::ToJSArray(isolate, "co", enumeration.get(),
2048 MaybeHandle<JSArray> VectorToJSArray(Isolate* isolate,
2050 Factory* factory = isolate->factory();
2114 MaybeHandle<JSArray> AvailableCurrencies(Isolate* isolate) {
2115 return VectorToJSArray(isolate, GetAvailableCurrencies());
2118 MaybeHandle<JSArray> AvailableNumberingSystems(Isolate* isolate) {
2123 THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kIcuError),
2128 isolate, "nu", enumeration.get(),
2139 MaybeHandle<JSArray> AvailableTimeZones(Isolate* isolate) {
2145 THROW_NEW_ERROR(isolate, NewRangeError(MessageTemplate::kIcuError),
2148 return Intl::ToJSArray(isolate, nullptr, enumeration.get(), nullptr, true);
2151 MaybeHandle<JSArray> AvailableUnits(Isolate* isolate) {
2152 Factory* factory = isolate->factory();
2167 MaybeHandle<JSArray> Intl::SupportedValuesOf(Isolate* isolate,
2169 Factory* factory = isolate->factory();
2172 ASSIGN_RETURN_ON_EXCEPTION(isolate, key_str,
2173 Object::ToString(isolate, key_obj), JSArray);
2177 return Intl::AvailableCalendars(isolate);
2182 return AvailableCollations(isolate);
2187 return AvailableCurrencies(isolate);
2192 return AvailableNumberingSystems(isolate);
2197 return AvailableTimeZones(isolate);
2202 return AvailableUnits(isolate);
2209 isolate,
2217 Isolate* isolate, const char* method_name,
2224 CanonicalizeLocaleList(isolate, locales, false);
2228 return SupportedLocales(isolate, method_name, available_locales,
2378 std::string LookupMatcher(Isolate* isolate,
2422 return isolate->DefaultLocale();
2438 Isolate* isolate, const std::set<std::string>& available_locales,
2444 locale = BestFitMatcher(isolate, available_locales, requested_locales);
2446 locale = LookupMatcher(isolate, available_locales, requested_locales);
2464 Isolate* isolate, Handle<String> text, icu::BreakIterator* break_iterator) {
2465 text = String::Flatten(isolate, text);
2467 Intl::ToICUUnicodeString(isolate, text).clone());
2470 Managed<icu::UnicodeString>::FromRawPtr(isolate, 0, u_text);
2477 MaybeHandle<String> Intl::Normalize(Isolate* isolate, Handle<String> string,
2481 if (form_input->IsUndefined(isolate)) {
2487 ASSIGN_RETURN_ON_EXCEPTION(isolate, form,
2488 Object::ToString(isolate, form_input), String);
2490 if (String::Equals(isolate, form, isolate->factory()->NFC_string())) {
2493 } else if (String::Equals(isolate, form,
2494 isolate->factory()->NFD_string())) {
2497 } else if (String::Equals(isolate, form,
2498 isolate->factory()->NFKC_string())) {
2501 } else if (String::Equals(isolate, form,
2502 isolate->factory()->NFKD_string())) {
2507 isolate->factory()->NewStringFromStaticChars("NFC, NFD, NFKC, NFKD");
2509 isolate,
2516 string = String::Flatten(isolate, string);
2520 icu::UnicodeString input = ToICUUnicodeString(isolate, string);
2538 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kIcuError), String);
2541 return Intl::ToString(isolate, result);
2638 Maybe<Intl::MatcherOption> Intl::GetLocaleMatcher(Isolate* isolate,
2642 isolate, options, "localeMatcher", method_name, {"best fit", "lookup"},
2647 Maybe<bool> Intl::GetNumberingSystem(Isolate* isolate,
2652 Maybe<bool> maybe = GetStringOption(isolate, options, "numberingSystem",
2658 isolate,
2661 isolate->factory()->numberingSystem_string(),
2662 isolate->factory()->NewStringFromAsciiChecked(result->get())),
2693 Handle<String> Intl::NumberFieldToType(Isolate* isolate,
2699 if (is_nan) return isolate->factory()->nan_string();
2704 return isolate->factory()->infinity_string();
2706 return isolate->factory()->integer_string();
2708 return isolate->factory()->fraction_string();
2710 return isolate->factory()->decimal_string();
2712 return isolate->factory()->group_string();
2714 return isolate->factory()->currency_string();
2716 return isolate->factory()->percentSign_string();
2719 ? isolate->factory()->plusSign_string()
2720 : isolate->factory()->minusSign_string();
2722 return isolate->factory()->exponentSeparator_string();
2725 return isolate->factory()->exponentMinusSign_string();
2728 return isolate->factory()->exponentInteger_string();
2736 return isolate->factory()->compact_string();
2738 return isolate->factory()->unit_string();
2747 Isolate* isolate, const icu::FormattedValue& formatted) {
2751 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kIcuError), String);
2753 return Intl::ToString(isolate, result);
2757 Isolate* isolate, const char* unicode_key,
2776 return VectorToJSArray(isolate, array);
2814 MaybeHandle<String> Intl::CanonicalizeTimeZoneName(Isolate* isolate,
2826 return isolate->factory()->UTC_string();
2828 return Intl::ToString(isolate, canonical);
2831 bool Intl::IsValidTimeZoneName(Isolate* isolate, Handle<String> id) {
2864 Maybe<bool> Intl::GetTimeZoneIndex(Isolate* isolate, Handle<String> identifier,
2866 if (identifier->Equals(*isolate->factory()->UTC_string())) {
2899 Isolate* isolate, Handle<Object> input) {
2904 return Oddball::ToNumber(isolate, Handle<Oddball>::cast(input));
2907 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kSymbolToNumber),
2911 isolate, input,
2912 JSReceiver::ToPrimitive(isolate, Handle<JSReceiver>::cast(input),
2948 Handle<String> Intl::SourceString(Isolate* isolate, FormatRangeSource source) {
2951 return ReadOnlyRoots(isolate).shared_string_handle();
2953 return ReadOnlyRoots(isolate).startRange_string_handle();
2955 return ReadOnlyRoots(isolate).endRange_string_handle();