diff --git a/atom/browser/javascript_environment.cc b/atom/browser/javascript_environment.cc index 3cdd2c771e..44d76a4ded 100644 --- a/atom/browser/javascript_environment.cc +++ b/atom/browser/javascript_environment.cc @@ -7,6 +7,7 @@ #include #include "base/command_line.h" +#include "base/i18n/icu_util.h" #include "base/message_loop/message_loop.h" #include "content/public/common/content_switches.h" #include "gin/array_buffer.h" @@ -40,6 +41,10 @@ bool JavascriptEnvironment::Initialize() { if (!js_flags.empty()) v8::V8::SetFlagsFromString(js_flags.c_str(), js_flags.size()); + base::i18n::InitializeICU(); + + gin::V8Initializer::LoadV8Snapshot(); + gin::V8Initializer::LoadV8Natives(); gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, gin::IsolateHolder::kStableV8Extras, gin::ArrayBufferAllocator::SharedInstance()); diff --git a/build/node/node.gypi b/build/node/node.gypi index 4c88b930a9..4a440a9e19 100644 --- a/build/node/node.gypi +++ b/build/node/node.gypi @@ -32,10 +32,10 @@ 'uv_use_dtrace': 'false', 'V8_BASE': '', 'v8_postmortem_support': 'false', - 'v8_enable_i18n_support': 0, 'v8_inspector': 'false', 'library': 'static_library', 'msvs_use_common_release': 0, + 'icu_small': 'false', }, 'target_defaults': { 'default_configuration': 'Release', diff --git a/build/node/v8.gypi b/build/node/v8.gypi index 3b28244055..5effaf7644 100644 --- a/build/node/v8.gypi +++ b/build/node/v8.gypi @@ -1,14 +1,14 @@ { 'variables': { 'icu_path': '../../../third_party/icu', + 'icu_use_data_file_flag': 1, # Using libc++ requires building for >= 10.7. 'mac_deployment_target': '10.8', # Use the standard way of linking with msvc runtime. 'win_use_allocator_shim': 0, + 'v8_enable_i18n_support': 1, # The V8 libraries. 'v8_libraries': '["v8", "v8_snapshot", "v8_nosnapshot", "v8_external_snapshot", "v8_base", "v8_libbase", "v8_libplatform"]', - # The icu libraries. - 'icu_libraries': '["icui18n", "icuuc"]', 'v8_use_snapshot': 'true', 'v8_use_external_startup_data': 1, }, @@ -37,15 +37,6 @@ # Use C++11 library. 'CLANG_CXX_LIBRARY': 'libc++', # -stdlib=libc++ }, - # Force exporting icu's symbols. - 'defines': [ - 'U_COMBINED_IMPLEMENTATION', - # Defining "U_COMBINED_IMPLEMENTATION" will add "explicit" for some - # constructors, make sure it doesn' happen. - 'UNISTR_FROM_CHAR_EXPLICIT=', - 'UNISTR_FROM_STRING_EXPLICIT=', - 'U_NO_DEFAULT_INCLUDE_UTF_HEADERS=0', - ], 'defines!': [ 'U_STATIC_IMPLEMENTATION', ], @@ -53,7 +44,7 @@ ['_type=="static_library" and _toolset=="target" and OS=="linux"', { 'standalone_static_library': 1, }], - ['_target_name in <(v8_libraries) + <(icu_libraries)', { + ['_target_name in <(v8_libraries)', { 'xcode_settings': { 'DEAD_CODE_STRIPPING': 'NO', # -Wl,-dead_strip 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO', @@ -80,4 +71,4 @@ }], ], }, -} \ No newline at end of file +} diff --git a/patches/v8/filter.patch b/patches/v8/filter.patch index 8ab5b1997b..5c9aa33bd4 100644 --- a/patches/v8/filter.patch +++ b/patches/v8/filter.patch @@ -1,5 +1,5 @@ diff --git a/BUILD.gn b/BUILD.gn -index dcefe3706b84c1f726256a6053e60134953a014d..8cb4535042c80783aa592827869a4d7c2c6e026d 100644 +index dcefe3706b84c1f726256a6053e60134953a014d..794abe164d911861a1a91180f1ec33cf405790bd 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -45,7 +45,7 @@ declare_args() { @@ -55,6 +55,30 @@ index dcefe3706b84c1f726256a6053e60134953a014d..8cb4535042c80783aa592827869a4d7c include_dirs = [ "include" ] libs = [] if (is_android && current_toolchain != host_toolchain) { +@@ -149,9 +166,9 @@ config("external_config") { + # This config should only be applied to code that needs to be explicitly + # aware of whether we are using startup data or not. + config("external_startup_data") { +- if (v8_use_external_startup_data) { ++# if (v8_use_external_startup_data) { + defines = [ "V8_USE_EXTERNAL_STARTUP_DATA" ] +- } ++# } + } + + config("features") { +@@ -186,9 +203,9 @@ config("features") { + if (v8_enable_handle_zapping) { + defines += [ "ENABLE_HANDLE_ZAPPING" ] + } +- if (v8_use_external_startup_data) { ++# if (v8_use_external_startup_data) { + defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ] +- } ++# } + } + + config("toolchain") { @@ -726,6 +743,9 @@ source_set("v8_maybe_snapshot") { }