Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: src/icu_util.cc

Issue 18899002: Initialize ICU data files in d8 and disable i18n for other code samples (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/icu_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/icu_util.cc
diff --git a/src/hydrogen-dce.h b/src/icu_util.cc
similarity index 68%
copy from src/hydrogen-dce.h
copy to src/icu_util.cc
index 19749f279a2e1cb632ba5a300033e5a9f038638f..1505d3014afeecb59b2cb279fbfbe9b393dac131 100644
--- a/src/hydrogen-dce.h
+++ b/src/icu_util.cc
@@ -25,32 +25,38 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef V8_HYDROGEN_DCE_H_
-#define V8_HYDROGEN_DCE_H_
+#include "icu_util.h"
-#include "hydrogen.h"
+#if defined(_WIN32)
+#include <windows.h>
-namespace v8 {
-namespace internal {
-
-
-class HDeadCodeEliminationPhase : public HPhase {
- public:
- explicit HDeadCodeEliminationPhase(HGraph* graph)
- : HPhase("H_Dead code elimination", graph) { }
+#include "unicode/putil.h"
+#include "unicode/udata.h"
- void Run() {
- MarkLiveInstructions();
- RemoveDeadInstructions();
- }
+#define ICU_UTIL_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat"
+#define ICU_UTIL_DATA_SHARED_MODULE_NAME "icudt.dll"
+#endif
- private:
- bool MarkLive(HValue* ref, HValue* instr);
- void MarkLiveInstructions();
- void RemoveDeadInstructions();
-};
-
-
-} } // namespace v8::internal
+namespace v8 {
-#endif // V8_HYDROGEN_DCE_H_
+bool InitializeICU() {
+#if defined(_WIN32)
+ // We expect to find the ICU data module alongside the current module.
+ HMODULE module = LoadLibraryA(ICU_UTIL_DATA_SHARED_MODULE_NAME);
+ if (!module)
Jakob Kummerow 2013/07/09 12:24:41 nit: V8 style prefers to either have the then-clau
+ return false;
+
+ FARPROC addr = GetProcAddress(module, ICU_UTIL_DATA_SYMBOL);
+ if (!addr)
+ return false;
+
+ UErrorCode err = U_ZERO_ERROR;
+ udata_setCommonData(reinterpret_cast<void*>(addr), &err);
+ return err == U_ZERO_ERROR;
+#else
+ // Mac/Linux bundle the ICU data in.
+ return true;
+#endif
+}
+
+} // namespace v8
« no previous file with comments | « src/icu_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698