V8 Project
v8::internal::Collator Class Reference

#include <i18n.h>

+ Collaboration diagram for v8::internal::Collator:

Static Public Member Functions

static icu::Collator * InitializeCollator (Isolate *isolate, Handle< String > locale, Handle< JSObject > options, Handle< JSObject > resolved)
 
static icu::Collator * UnpackCollator (Isolate *isolate, Handle< JSObject > obj)
 
static void DeleteCollator (const v8::WeakCallbackData< v8::Value, void > &data)
 

Private Member Functions

 Collator ()
 

Detailed Description

Definition at line 83 of file i18n.h.

Constructor & Destructor Documentation

◆ Collator()

v8::internal::Collator::Collator ( )
private

Member Function Documentation

◆ DeleteCollator()

void v8::internal::Collator::DeleteCollator ( const v8::WeakCallbackData< v8::Value, void > &  data)
static

Definition at line 864 of file i18n.cc.

865  {
866  DeleteNativeObjectAt<icu::Collator>(data, 0);
867  DestroyGlobalHandle(data);
868 }
static void DestroyGlobalHandle(const v8::WeakCallbackData< v8::Value, void > &data)
Definition: i18n.cc:740

References v8::internal::DestroyGlobalHandle().

+ Here is the call graph for this function:

◆ InitializeCollator()

icu::Collator * v8::internal::Collator::InitializeCollator ( Isolate isolate,
Handle< String locale,
Handle< JSObject options,
Handle< JSObject resolved 
)
static

Definition at line 814 of file i18n.cc.

818  {
819  // Convert BCP47 into ICU locale format.
820  UErrorCode status = U_ZERO_ERROR;
821  icu::Locale icu_locale;
822  char icu_result[ULOC_FULLNAME_CAPACITY];
823  int icu_length = 0;
824  v8::String::Utf8Value bcp47_locale(v8::Utils::ToLocal(locale));
825  if (bcp47_locale.length() != 0) {
826  uloc_forLanguageTag(*bcp47_locale, icu_result, ULOC_FULLNAME_CAPACITY,
827  &icu_length, &status);
828  if (U_FAILURE(status) || icu_length == 0) {
829  return NULL;
830  }
831  icu_locale = icu::Locale(icu_result);
832  }
833 
834  icu::Collator* collator = CreateICUCollator(isolate, icu_locale, options);
835  if (!collator) {
836  // Remove extensions and try again.
837  icu::Locale no_extension_locale(icu_locale.getBaseName());
838  collator = CreateICUCollator(isolate, no_extension_locale, options);
839 
840  // Set resolved settings (pattern, numbering system).
842  isolate, no_extension_locale, collator, resolved);
843  } else {
844  SetResolvedCollatorSettings(isolate, icu_locale, collator, resolved);
845  }
846 
847  return collator;
848 }
Converts an object to a UTF-8-encoded character array.
Definition: v8.h:2048
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
void SetResolvedCollatorSettings(Isolate *isolate, const icu::Locale &icu_locale, icu::Collator *collator, Handle< JSObject > resolved)
Definition: i18n.cc:498
icu::Collator * CreateICUCollator(Isolate *isolate, const icu::Locale &icu_locale, Handle< JSObject > options)
Definition: i18n.cc:434

References v8::internal::anonymous_namespace{i18n.cc}::CreateICUCollator(), v8::String::Utf8Value::length(), NULL, v8::internal::anonymous_namespace{i18n.cc}::SetResolvedCollatorSettings(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ UnpackCollator()

icu::Collator * v8::internal::Collator::UnpackCollator ( Isolate isolate,
Handle< JSObject obj 
)
static

Definition at line 851 of file i18n.cc.

852  {
853  Handle<String> key = isolate->factory()->NewStringFromStaticChars("collator");
854  Maybe<bool> maybe = JSReceiver::HasOwnProperty(obj, key);
855  CHECK(maybe.has_value);
856  if (maybe.value) {
857  return reinterpret_cast<icu::Collator*>(obj->GetInternalField(0));
858  }
859 
860  return NULL;
861 }
static MUST_USE_RESULT Maybe< bool > HasOwnProperty(Handle< JSReceiver >, Handle< Name > name)
Definition: objects-inl.h:6658
#define CHECK(condition)
Definition: logging.h:36
Maybe< T > maybe(T t)
Definition: v8.h:902

References CHECK, v8::internal::Isolate::factory(), v8::internal::JSReceiver::HasOwnProperty(), v8::maybe(), and NULL.

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: