34 #if defined(V8_I18N_SUPPORT)
38 #include "unicode/putil.h"
39 #include "unicode/udata.h"
41 #define ICU_UTIL_DATA_FILE 0
42 #define ICU_UTIL_DATA_SHARED 1
43 #define ICU_UTIL_DATA_STATIC 2
45 #define ICU_UTIL_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat"
46 #define ICU_UTIL_DATA_SHARED_MODULE_NAME "icudt.dll"
53 #if defined(V8_I18N_SUPPORT) && (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE)
55 char* g_icu_data_ptr =
NULL;
57 void free_icu_data_ptr() {
58 delete[] g_icu_data_ptr;
65 #if !defined(V8_I18N_SUPPORT)
68 #if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED
70 HMODULE module = LoadLibraryA(ICU_UTIL_DATA_SHARED_MODULE_NAME);
71 if (!module)
return false;
73 FARPROC addr = GetProcAddress(module, ICU_UTIL_DATA_SYMBOL);
74 if (!addr)
return false;
76 UErrorCode err = U_ZERO_ERROR;
77 udata_setCommonData(reinterpret_cast<void*>(addr), &err);
78 return err == U_ZERO_ERROR;
79 #elif ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_STATIC
82 #elif ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE
83 if (!icu_data_file)
return false;
85 if (g_icu_data_ptr)
return true;
87 FILE* inf = fopen(icu_data_file,
"rb");
88 if (!inf)
return false;
90 fseek(inf, 0, SEEK_END);
91 size_t size = ftell(inf);
94 g_icu_data_ptr =
new char[
size];
95 if (fread(g_icu_data_ptr, 1, size, inf) != size) {
96 delete[] g_icu_data_ptr;
97 g_icu_data_ptr =
NULL;
103 atexit(free_icu_data_ptr);
105 UErrorCode err = U_ZERO_ERROR;
106 udata_setCommonData(reinterpret_cast<void*>(g_icu_data_ptr), &err);
107 return err == U_ZERO_ERROR;
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
bool InitializeICU(const char *icu_data_file)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object size