Revision: 15618
Author: [email protected]
Date: Thu Jul 11 02:58:54 2013
Log: Move InitializeICU() to the V8 API and use it.
I can't get rid of the enable_i18n flag yet, as we need to be able to
turn off all extensions for creating the snapshot.
BUG=v8:2745
[email protected]
Review URL: https://codereview.chromium.org/18860007
http://code.google.com/p/v8/source/detail?r=15618
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/samples/lineprocessor.cc
/branches/bleeding_edge/samples/process.cc
/branches/bleeding_edge/samples/samples.gyp
/branches/bleeding_edge/samples/shell.cc
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/d8.cc
/branches/bleeding_edge/src/d8.gyp
/branches/bleeding_edge/src/icu_util.cc
/branches/bleeding_edge/src/icu_util.h
/branches/bleeding_edge/src/mksnapshot.cc
/branches/bleeding_edge/tools/gyp/v8.gyp
=======================================
--- /branches/bleeding_edge/include/v8.h Mon Jul 8 03:02:16 2013
+++ /branches/bleeding_edge/include/v8.h Thu Jul 11 02:58:54 2013
@@ -4699,6 +4699,12 @@
*/
static int ContextDisposedNotification();
+ /**
+ * Initialize the ICU library bundled with V8. The embedder should only
+ * invoke this method when using the bundled ICU. Returns true on
success.
+ */
+ static bool InitializeICU();
+
private:
V8();
=======================================
--- /branches/bleeding_edge/samples/lineprocessor.cc Tue Jul 9 05:26:07
2013
+++ /branches/bleeding_edge/samples/lineprocessor.cc Thu Jul 11 02:58:54
2013
@@ -137,8 +137,6 @@
int RunMain(int argc, char* argv[]) {
v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
- v8::V8::SetFlagsFromString("--noenable_i18n",
- static_cast<int>(strlen("--noenable_i18n")));
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope handle_scope(isolate);
@@ -326,6 +324,7 @@
int main(int argc, char* argv[]) {
+ v8::V8::InitializeICU();
int result = RunMain(argc, argv);
v8::V8::Dispose();
return result;
=======================================
--- /branches/bleeding_edge/samples/process.cc Tue Jul 9 05:26:07 2013
+++ /branches/bleeding_edge/samples/process.cc Thu Jul 11 02:58:54 2013
@@ -27,7 +27,6 @@
#include <v8.h>
-#include <cstring>
#include <string>
#include <map>
@@ -628,6 +627,7 @@
int main(int argc, char* argv[]) {
+ v8::V8::InitializeICU();
map<string, string> options;
string file;
ParseOptions(argc, argv, options, &file);
@@ -635,8 +635,6 @@
fprintf(stderr, "No script was specified.\n");
return 1;
}
- V8::SetFlagsFromString("--noenable_i18n",
- static_cast<int>(strlen("--noenable_i18n")));
Isolate* isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
Handle<String> source = ReadFile(file);
=======================================
--- /branches/bleeding_edge/samples/samples.gyp Wed Jul 10 04:15:16 2013
+++ /branches/bleeding_edge/samples/samples.gyp Thu Jul 11 02:58:54 2013
@@ -28,6 +28,7 @@
{
'variables': {
'v8_code': 1,
+ 'v8_enable_i18n_support%': 0,
},
'includes': ['../build/toolchain.gypi', '../build/features.gypi'],
'target_defaults': {
@@ -38,6 +39,13 @@
'include_dirs': [
'../include',
],
+ 'conditions': [
+ ['v8_enable_i18n_support==1', {
+ 'dependencies': [
+ '<(DEPTH)/third_party/icu/icu.gyp:*',
+ ],
+ }],
+ ],
},
'targets': [
{
=======================================
--- /branches/bleeding_edge/samples/shell.cc Tue Jul 9 05:26:07 2013
+++ /branches/bleeding_edge/samples/shell.cc Thu Jul 11 02:58:54 2013
@@ -66,9 +66,8 @@
int main(int argc, char* argv[]) {
+ v8::V8::InitializeICU();
v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
- v8::V8::SetFlagsFromString("--noenable_i18n",
- static_cast<int>(strlen("--noenable_i18n")));
v8::Isolate* isolate = v8::Isolate::GetCurrent();
run_shell = (argc == 1);
int result;
=======================================
--- /branches/bleeding_edge/src/api.cc Mon Jul 8 08:28:25 2013
+++ /branches/bleeding_edge/src/api.cc Thu Jul 11 02:58:54 2013
@@ -45,6 +45,7 @@
#include "global-handles.h"
#include "heap-profiler.h"
#include "heap-snapshot-generator-inl.h"
+#include "icu_util.h"
#include "messages.h"
#ifdef COMPRESS_STARTUP_DATA_BZ2
#include "natives.h"
@@ -5424,6 +5425,11 @@
if (!isolate->IsInitialized()) return 0;
return isolate->heap()->NotifyContextDisposed();
}
+
+
+bool v8::V8::InitializeICU() {
+ return i::InitializeICU();
+}
const char* v8::V8::GetVersion() {
=======================================
--- /branches/bleeding_edge/src/d8.cc Tue Jul 9 05:26:07 2013
+++ /branches/bleeding_edge/src/d8.cc Thu Jul 11 02:58:54 2013
@@ -68,10 +68,6 @@
#include "v8.h"
#endif // V8_SHARED
-#if defined(V8_I18N_SUPPORT)
-#include "icu_util.h"
-#endif
-
#if !defined(_WIN32) && !defined(_WIN64)
#include <unistd.h> // NOLINT
#endif
@@ -1586,9 +1582,7 @@
int Shell::Main(int argc, char* argv[]) {
if (!SetOptions(argc, argv)) return 1;
-#if defined(V8_I18N_SUPPORT)
- InitializeICU();
-#endif
+ v8::V8::InitializeICU();
#ifndef V8_SHARED
i::FLAG_harmony_array_buffer = true;
i::FLAG_harmony_typed_arrays = true;
=======================================
--- /branches/bleeding_edge/src/d8.gyp Wed Jul 10 04:15:16 2013
+++ /branches/bleeding_edge/src/d8.gyp Thu Jul 11 02:58:54 2013
@@ -80,10 +80,6 @@
],
}],
['v8_enable_i18n_support==1', {
- 'sources': [
- 'icu_util.cc',
- 'icu_util.h',
- ],
'dependencies': [
'<(DEPTH)/third_party/icu/icu.gyp:*',
],
=======================================
--- /branches/bleeding_edge/src/icu_util.cc Tue Jul 9 05:26:07 2013
+++ /branches/bleeding_edge/src/icu_util.cc Thu Jul 11 02:58:54 2013
@@ -27,7 +27,7 @@
#include "icu_util.h"
-#if defined(_WIN32)
+#if defined(_WIN32) && defined(ENABLE_I18N_SUPPORT)
#include <windows.h>
#include "unicode/putil.h"
@@ -39,8 +39,10 @@
namespace v8 {
+namespace internal {
+
bool InitializeICU() {
-#if defined(_WIN32)
+#if defined(_WIN32) && defined(ENABLE_I18N_SUPPORT)
// We expect to find the ICU data module alongside the current module.
HMODULE module = LoadLibraryA(ICU_UTIL_DATA_SHARED_MODULE_NAME);
if (!module) return false;
@@ -57,4 +59,4 @@
#endif
}
-} // namespace v8
+} } // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/icu_util.h Tue Jul 9 05:26:07 2013
+++ /branches/bleeding_edge/src/icu_util.h Thu Jul 11 02:58:54 2013
@@ -31,10 +31,12 @@
namespace v8 {
+namespace internal {
+
// Call this function to load ICU's data tables for the current process.
This
// function should be called before ICU is used.
bool InitializeICU();
-} // namespace v8
+} } // namespace v8::internal
#endif // V8_ICU_UTIL_H_
=======================================
--- /branches/bleeding_edge/src/mksnapshot.cc Wed Jul 3 04:22:29 2013
+++ /branches/bleeding_edge/src/mksnapshot.cc Thu Jul 11 02:58:54 2013
@@ -309,6 +309,8 @@
int main(int argc, char** argv) {
+ V8::InitializeICU();
+
// By default, log code create information in the snapshot.
i::FLAG_log_code = true;
=======================================
--- /branches/bleeding_edge/tools/gyp/v8.gyp Thu Jul 11 01:21:50 2013
+++ /branches/bleeding_edge/tools/gyp/v8.gyp Thu Jul 11 02:58:54 2013
@@ -371,6 +371,8 @@
'../../src/hydrogen-uint32-analysis.h',
'../../src/hydrogen-osr.cc',
'../../src/hydrogen-osr.h',
+ '../../src/icu_util.cc',
+ '../../src/icu_util.h',
'../../src/ic-inl.h',
'../../src/ic.cc',
'../../src/ic.h',
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.