| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #define _WIN32_WINNT 0x500 | 54 #define _WIN32_WINNT 0x500 |
| 55 #endif | 55 #endif |
| 56 | 56 |
| 57 #include <windows.h> | 57 #include <windows.h> |
| 58 | 58 |
| 59 #include <time.h> // For LocalOffset() implementation. | 59 #include <time.h> // For LocalOffset() implementation. |
| 60 #include <mmsystem.h> // For timeGetTime(). | 60 #include <mmsystem.h> // For timeGetTime(). |
| 61 #include <dbghelp.h> // For SymLoadModule64 and al. | 61 #include <dbghelp.h> // For SymLoadModule64 and al. |
| 62 #include <tlhelp32.h> // For Module32First and al. | 62 #include <tlhelp32.h> // For Module32First and al. |
| 63 | 63 |
| 64 // These aditional WIN32 includes have to be right here as the #undef's below | 64 // These additional WIN32 includes have to be right here as the #undef's below |
| 65 // makes it impossible to have them elsewhere. | 65 // makes it impossible to have them elsewhere. |
| 66 #include <winsock2.h> | 66 #include <winsock2.h> |
| 67 #include <process.h> // for _beginthreadex() | 67 #include <process.h> // for _beginthreadex() |
| 68 #include <stdlib.h> | 68 #include <stdlib.h> |
| 69 | 69 |
| 70 #pragma comment(lib, "winmm.lib") // force linkage with winmm. | 70 #pragma comment(lib, "winmm.lib") // force linkage with winmm. |
| 71 | 71 |
| 72 #undef VOID | 72 #undef VOID |
| 73 #undef DELETE | 73 #undef DELETE |
| 74 #undef IN | 74 #undef IN |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 | 483 |
| 484 // If the local time offset equals the timezone bias plus the daylight | 484 // If the local time offset equals the timezone bias plus the daylight |
| 485 // bias then DST is in effect. | 485 // bias then DST is in effect. |
| 486 in_dst = offset == dstofs; | 486 in_dst = offset == dstofs; |
| 487 } | 487 } |
| 488 | 488 |
| 489 return in_dst; | 489 return in_dst; |
| 490 } | 490 } |
| 491 | 491 |
| 492 | 492 |
| 493 // Return the dalight savings time offset for this time. | 493 // Return the daylight savings time offset for this time. |
| 494 int64_t Time::DaylightSavingsOffset() { | 494 int64_t Time::DaylightSavingsOffset() { |
| 495 return InDST() ? 60 * kMsPerMinute : 0; | 495 return InDST() ? 60 * kMsPerMinute : 0; |
| 496 } | 496 } |
| 497 | 497 |
| 498 | 498 |
| 499 // Returns a string identifying the current timezone for the | 499 // Returns a string identifying the current timezone for the |
| 500 // timestamp taking into account daylight saving. | 500 // timestamp taking into account daylight saving. |
| 501 char* Time::LocalTimezone() { | 501 char* Time::LocalTimezone() { |
| 502 // Return the standard or DST time zone name based on whether daylight | 502 // Return the standard or DST time zone name based on whether daylight |
| 503 // saving is in effect at the given time. | 503 // saving is in effect at the given time. |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 | 852 |
| 853 Win32MemoryMappedFile::~Win32MemoryMappedFile() { | 853 Win32MemoryMappedFile::~Win32MemoryMappedFile() { |
| 854 if (memory_ != NULL) | 854 if (memory_ != NULL) |
| 855 UnmapViewOfFile(memory_); | 855 UnmapViewOfFile(memory_); |
| 856 CloseHandle(file_mapping_); | 856 CloseHandle(file_mapping_); |
| 857 CloseHandle(file_); | 857 CloseHandle(file_); |
| 858 } | 858 } |
| 859 | 859 |
| 860 | 860 |
| 861 // The following code loads functions defined in DbhHelp.h and TlHelp32.h | 861 // The following code loads functions defined in DbhHelp.h and TlHelp32.h |
| 862 // dynamically. This is to avoid beeing depending on dbghelp.dll and | 862 // dynamically. This is to avoid being depending on dbghelp.dll and |
| 863 // tlhelp32.dll when running (the functions in tlhelp32.dll have been moved to | 863 // tlhelp32.dll when running (the functions in tlhelp32.dll have been moved to |
| 864 // kernel32.dll at some point so loading functions defines in TlHelp32.h | 864 // kernel32.dll at some point so loading functions defines in TlHelp32.h |
| 865 // dynamically might not be necessary any more - for some versions of Windows?). | 865 // dynamically might not be necessary any more - for some versions of Windows?). |
| 866 | 866 |
| 867 // Function pointers to functions dynamically loaded from dbghelp.dll. | 867 // Function pointers to functions dynamically loaded from dbghelp.dll. |
| 868 #define DBGHELP_FUNCTION_LIST(V) \ | 868 #define DBGHELP_FUNCTION_LIST(V) \ |
| 869 V(SymInitialize) \ | 869 V(SymInitialize) \ |
| 870 V(SymGetOptions) \ | 870 V(SymGetOptions) \ |
| 871 V(SymSetOptions) \ | 871 V(SymSetOptions) \ |
| 872 V(SymGetSearchPath) \ | 872 V(SymGetSearchPath) \ |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 #define DLL_FUNC_LOADED(name) (DLL_FUNC_VAR(name) != NULL) && | 1006 #define DLL_FUNC_LOADED(name) (DLL_FUNC_VAR(name) != NULL) && |
| 1007 | 1007 |
| 1008 DBGHELP_FUNCTION_LIST(DLL_FUNC_LOADED) | 1008 DBGHELP_FUNCTION_LIST(DLL_FUNC_LOADED) |
| 1009 TLHELP32_FUNCTION_LIST(DLL_FUNC_LOADED) | 1009 TLHELP32_FUNCTION_LIST(DLL_FUNC_LOADED) |
| 1010 | 1010 |
| 1011 #undef DLL_FUNC_LOADED | 1011 #undef DLL_FUNC_LOADED |
| 1012 true; | 1012 true; |
| 1013 | 1013 |
| 1014 dbghelp_loaded = result; | 1014 dbghelp_loaded = result; |
| 1015 return result; | 1015 return result; |
| 1016 // NOTE: The modules are never unloaded and will stay arround until the | 1016 // NOTE: The modules are never unloaded and will stay around until the |
| 1017 // application is closed. | 1017 // application is closed. |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 | 1020 |
| 1021 // Load the symbols for generating stack traces. | 1021 // Load the symbols for generating stack traces. |
| 1022 static bool LoadSymbols(HANDLE process_handle) { | 1022 static bool LoadSymbols(HANDLE process_handle) { |
| 1023 static bool symbols_loaded = false; | 1023 static bool symbols_loaded = false; |
| 1024 | 1024 |
| 1025 if (symbols_loaded) return true; | 1025 if (symbols_loaded) return true; |
| 1026 | 1026 |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 | 1593 |
| 1594 // Release the thread handles | 1594 // Release the thread handles |
| 1595 CloseHandle(data_->sampler_thread_); | 1595 CloseHandle(data_->sampler_thread_); |
| 1596 CloseHandle(data_->profiled_thread_); | 1596 CloseHandle(data_->profiled_thread_); |
| 1597 } | 1597 } |
| 1598 | 1598 |
| 1599 | 1599 |
| 1600 #endif // ENABLE_LOGGING_AND_PROFILING | 1600 #endif // ENABLE_LOGGING_AND_PROFILING |
| 1601 | 1601 |
| 1602 } } // namespace v8::internal | 1602 } } // namespace v8::internal |
| OLD | NEW |