| 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 30 matching lines...) Expand all Loading... |
| 41 #endif | 41 #endif |
| 42 #ifndef NOSERVICE | 42 #ifndef NOSERVICE |
| 43 #define NOSERVICE | 43 #define NOSERVICE |
| 44 #endif | 44 #endif |
| 45 #ifndef NOSOUND | 45 #ifndef NOSOUND |
| 46 #define NOSOUND | 46 #define NOSOUND |
| 47 #endif | 47 #endif |
| 48 #ifndef NOMCX | 48 #ifndef NOMCX |
| 49 #define NOMCX | 49 #define NOMCX |
| 50 #endif | 50 #endif |
| 51 // Require Windows 2000 or higher (this is required for the IsDebuggerPresent |
| 52 // function to be present). |
| 53 #ifndef _WIN32_WINNT |
| 54 #define _WIN32_WINNT 0x500 |
| 55 #endif |
| 51 | 56 |
| 52 #include <windows.h> | 57 #include <windows.h> |
| 53 | 58 |
| 54 #include <mmsystem.h> // For timeGetTime(). | 59 #include <mmsystem.h> // For timeGetTime(). |
| 55 #include <dbghelp.h> // For SymLoadModule64 and al. | 60 #include <dbghelp.h> // For SymLoadModule64 and al. |
| 56 #include <tlhelp32.h> // For Module32First and al. | 61 #include <tlhelp32.h> // For Module32First and al. |
| 57 | 62 |
| 58 // These aditional WIN32 includes have to be right here as the #undef's below | 63 // These aditional WIN32 includes have to be right here as the #undef's below |
| 59 // makes it impossible to have them elsewhere. | 64 // makes it impossible to have them elsewhere. |
| 60 #include <winsock2.h> | 65 #include <winsock2.h> |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 } | 678 } |
| 674 | 679 |
| 675 | 680 |
| 676 void OS::StrNCpy(Vector<char> dest, const char* src, size_t n) { | 681 void OS::StrNCpy(Vector<char> dest, const char* src, size_t n) { |
| 677 int result = strncpy_s(dest.start(), dest.length(), src, n); | 682 int result = strncpy_s(dest.start(), dest.length(), src, n); |
| 678 USE(result); | 683 USE(result); |
| 679 ASSERT(result == 0); | 684 ASSERT(result == 0); |
| 680 } | 685 } |
| 681 | 686 |
| 682 | 687 |
| 683 void OS::WcsCpy(Vector<wchar_t> dest, const wchar_t* src) { | |
| 684 int result = wcscpy_s(dest.start(), dest.length(), src); | |
| 685 USE(result); | |
| 686 ASSERT(result == 0); | |
| 687 } | |
| 688 | |
| 689 | |
| 690 char *OS::StrDup(const char* str) { | 688 char *OS::StrDup(const char* str) { |
| 691 return _strdup(str); | 689 return _strdup(str); |
| 692 } | 690 } |
| 693 | 691 |
| 694 | 692 |
| 695 // We keep the lowest and highest addresses mapped as a quick way of | 693 // We keep the lowest and highest addresses mapped as a quick way of |
| 696 // determining that pointers are outside the heap (used mostly in assertions | 694 // determining that pointers are outside the heap (used mostly in assertions |
| 697 // and verification). The estimate is conservative, ie, not all addresses in | 695 // and verification). The estimate is conservative, ie, not all addresses in |
| 698 // 'allocated' space are actually allocated to our heap. The range is | 696 // 'allocated' space are actually allocated to our heap. The range is |
| 699 // [lowest, highest), inclusive on the low and and exclusive on the high end. | 697 // [lowest, highest), inclusive on the low and and exclusive on the high end. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 USE(length); | 772 USE(length); |
| 775 } | 773 } |
| 776 | 774 |
| 777 | 775 |
| 778 void OS::Sleep(int milliseconds) { | 776 void OS::Sleep(int milliseconds) { |
| 779 ::Sleep(milliseconds); | 777 ::Sleep(milliseconds); |
| 780 } | 778 } |
| 781 | 779 |
| 782 | 780 |
| 783 void OS::Abort() { | 781 void OS::Abort() { |
| 784 // Make the MSVCRT do a silent abort. | 782 if (!IsDebuggerPresent()) { |
| 785 _set_abort_behavior(0, _WRITE_ABORT_MSG); | 783 // Make the MSVCRT do a silent abort. |
| 786 _set_abort_behavior(0, _CALL_REPORTFAULT); | 784 _set_abort_behavior(0, _WRITE_ABORT_MSG); |
| 787 abort(); | 785 _set_abort_behavior(0, _CALL_REPORTFAULT); |
| 786 abort(); |
| 787 } else { |
| 788 DebugBreak(); |
| 789 } |
| 788 } | 790 } |
| 789 | 791 |
| 790 | 792 |
| 791 void OS::DebugBreak() { | 793 void OS::DebugBreak() { |
| 792 __debugbreak(); | 794 __debugbreak(); |
| 793 } | 795 } |
| 794 | 796 |
| 795 | 797 |
| 796 class Win32MemoryMappedFile : public OS::MemoryMappedFile { | 798 class Win32MemoryMappedFile : public OS::MemoryMappedFile { |
| 797 public: | 799 public: |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 | 1568 |
| 1567 // Release the thread handles | 1569 // Release the thread handles |
| 1568 CloseHandle(data_->sampler_thread_); | 1570 CloseHandle(data_->sampler_thread_); |
| 1569 CloseHandle(data_->profiled_thread_); | 1571 CloseHandle(data_->profiled_thread_); |
| 1570 } | 1572 } |
| 1571 | 1573 |
| 1572 | 1574 |
| 1573 #endif // ENABLE_LOGGING_AND_PROFILING | 1575 #endif // ENABLE_LOGGING_AND_PROFILING |
| 1574 | 1576 |
| 1575 } } // namespace v8::internal | 1577 } } // namespace v8::internal |
| OLD | NEW |