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 |