V8 Project
v8::internal::DateFormat Class Reference

#include <i18n.h>

+ Collaboration diagram for v8::internal::DateFormat:

Static Public Member Functions

static icu::SimpleDateFormat * InitializeDateTimeFormat (Isolate *isolate, Handle< String > locale, Handle< JSObject > options, Handle< JSObject > resolved)
 
static icu::SimpleDateFormat * UnpackDateFormat (Isolate *isolate, Handle< JSObject > obj)
 
static void DeleteDateFormat (const v8::WeakCallbackData< v8::Value, void > &data)
 

Private Member Functions

 DateFormat ()
 

Detailed Description

Definition at line 35 of file i18n.h.

Constructor & Destructor Documentation

◆ DateFormat()

v8::internal::DateFormat::DateFormat ( )
private

Member Function Documentation

◆ DeleteDateFormat()

void v8::internal::DateFormat::DeleteDateFormat ( const v8::WeakCallbackData< v8::Value, void > &  data)
static

Definition at line 746 of file i18n.cc.

747  {
748  DeleteNativeObjectAt<icu::SimpleDateFormat>(data, 0);
749  DestroyGlobalHandle(data);
750 }
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:

◆ InitializeDateTimeFormat()

icu::SimpleDateFormat * v8::internal::DateFormat::InitializeDateTimeFormat ( Isolate isolate,
Handle< String locale,
Handle< JSObject options,
Handle< JSObject resolved 
)
static

Definition at line 678 of file i18n.cc.

682  {
683  // Convert BCP47 into ICU locale format.
684  UErrorCode status = U_ZERO_ERROR;
685  icu::Locale icu_locale;
686  char icu_result[ULOC_FULLNAME_CAPACITY];
687  int icu_length = 0;
688  v8::String::Utf8Value bcp47_locale(v8::Utils::ToLocal(locale));
689  if (bcp47_locale.length() != 0) {
690  uloc_forLanguageTag(*bcp47_locale, icu_result, ULOC_FULLNAME_CAPACITY,
691  &icu_length, &status);
692  if (U_FAILURE(status) || icu_length == 0) {
693  return NULL;
694  }
695  icu_locale = icu::Locale(icu_result);
696  }
697 
698  icu::SimpleDateFormat* date_format = CreateICUDateFormat(
699  isolate, icu_locale, options);
700  if (!date_format) {
701  // Remove extensions and try again.
702  icu::Locale no_extension_locale(icu_locale.getBaseName());
703  date_format = CreateICUDateFormat(isolate, no_extension_locale, options);
704 
705  // Set resolved settings (pattern, numbering system, calendar).
707  isolate, no_extension_locale, date_format, resolved);
708  } else {
709  SetResolvedDateSettings(isolate, icu_locale, date_format, resolved);
710  }
711 
712  return date_format;
713 }
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 SetResolvedDateSettings(Isolate *isolate, const icu::Locale &icu_locale, icu::SimpleDateFormat *date_format, Handle< JSObject > resolved)
Definition: i18n.cc:125
icu::SimpleDateFormat * CreateICUDateFormat(Isolate *isolate, const icu::Locale &icu_locale, Handle< JSObject > options)
Definition: i18n.cc:77

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

+ Here is the call graph for this function:

◆ UnpackDateFormat()

icu::SimpleDateFormat * v8::internal::DateFormat::UnpackDateFormat ( Isolate isolate,
Handle< JSObject obj 
)
static

Definition at line 716 of file i18n.cc.

718  {
719  Handle<String> key =
720  isolate->factory()->NewStringFromStaticChars("dateFormat");
721  Maybe<bool> maybe = JSReceiver::HasOwnProperty(obj, key);
722  CHECK(maybe.has_value);
723  if (maybe.value) {
724  return reinterpret_cast<icu::SimpleDateFormat*>(
725  obj->GetInternalField(0));
726  }
727 
728  return NULL;
729 }
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: