| 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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 | 749 |
| 750 | 750 |
| 751 char* OS::StrChr(char* str, int c) { | 751 char* OS::StrChr(char* str, int c) { |
| 752 return const_cast<char*>(strchr(str, c)); | 752 return const_cast<char*>(strchr(str, c)); |
| 753 } | 753 } |
| 754 | 754 |
| 755 | 755 |
| 756 void OS::StrNCpy(Vector<char> dest, const char* src, size_t n) { | 756 void OS::StrNCpy(Vector<char> dest, const char* src, size_t n) { |
| 757 // Use _TRUNCATE or strncpy_s crashes (by design) if buffer is too small. | 757 // Use _TRUNCATE or strncpy_s crashes (by design) if buffer is too small. |
| 758 size_t buffer_size = static_cast<size_t>(dest.length()); | 758 size_t buffer_size = static_cast<size_t>(dest.length()); |
| 759 if (n + 1 > buffer_size) // count for trailing '\0' | 759 if (n + 1 > buffer_size) // count for trailing '\0' |
| 760 n = _TRUNCATE; | 760 n = _TRUNCATE; |
| 761 int result = strncpy_s(dest.start(), dest.length(), src, n); | 761 int result = strncpy_s(dest.start(), dest.length(), src, n); |
| 762 USE(result); | 762 USE(result); |
| 763 ASSERT(result == 0 || (n == _TRUNCATE && result == STRUNCATE)); | 763 ASSERT(result == 0 || (n == _TRUNCATE && result == STRUNCATE)); |
| 764 } | 764 } |
| 765 | 765 |
| 766 | 766 |
| 767 // We keep the lowest and highest addresses mapped as a quick way of | 767 // We keep the lowest and highest addresses mapped as a quick way of |
| 768 // determining that pointers are outside the heap (used mostly in assertions | 768 // determining that pointers are outside the heap (used mostly in assertions |
| 769 // and verification). The estimate is conservative, ie, not all addresses in | 769 // and verification). The estimate is conservative, ie, not all addresses in |
| (...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2029 | 2029 |
| 2030 void Sampler::Stop() { | 2030 void Sampler::Stop() { |
| 2031 ASSERT(IsActive()); | 2031 ASSERT(IsActive()); |
| 2032 SamplerThread::RemoveActiveSampler(this); | 2032 SamplerThread::RemoveActiveSampler(this); |
| 2033 SetActive(false); | 2033 SetActive(false); |
| 2034 } | 2034 } |
| 2035 | 2035 |
| 2036 #endif // ENABLE_LOGGING_AND_PROFILING | 2036 #endif // ENABLE_LOGGING_AND_PROFILING |
| 2037 | 2037 |
| 2038 } } // namespace v8::internal | 2038 } } // namespace v8::internal |
| OLD | NEW |