| 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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 | 697 |
| 698 char* OS::StrDup(const char* str) { | 698 char* OS::StrDup(const char* str) { |
| 699 return _strdup(str); | 699 return _strdup(str); |
| 700 } | 700 } |
| 701 | 701 |
| 702 | 702 |
| 703 char* OS::StrNDup(const char* str, size_t n) { | 703 char* OS::StrNDup(const char* str, size_t n) { |
| 704 // Stupid implementation of strndup since windows isn't born with | 704 // Stupid implementation of strndup since windows isn't born with |
| 705 // one. | 705 // one. |
| 706 size_t len = strlen(str); | 706 size_t len = strlen(str); |
| 707 if (len <= n) | 707 if (len <= n) { |
| 708 return StrDup(str); | 708 return StrDup(str); |
| 709 } |
| 709 char* result = new char[n+1]; | 710 char* result = new char[n+1]; |
| 710 size_t i; | 711 size_t i; |
| 711 for (i = 0; i <= n; i++) | 712 for (i = 0; i <= n; i++) { |
| 712 result[i] = str[i]; | 713 result[i] = str[i]; |
| 714 } |
| 713 result[i] = '\0'; | 715 result[i] = '\0'; |
| 714 return result; | 716 return result; |
| 715 } | 717 } |
| 716 | 718 |
| 717 | 719 |
| 718 // We keep the lowest and highest addresses mapped as a quick way of | 720 // We keep the lowest and highest addresses mapped as a quick way of |
| 719 // determining that pointers are outside the heap (used mostly in assertions | 721 // determining that pointers are outside the heap (used mostly in assertions |
| 720 // and verification). The estimate is conservative, ie, not all addresses in | 722 // and verification). The estimate is conservative, ie, not all addresses in |
| 721 // 'allocated' space are actually allocated to our heap. The range is | 723 // 'allocated' space are actually allocated to our heap. The range is |
| 722 // [lowest, highest), inclusive on the low and and exclusive on the high end. | 724 // [lowest, highest), inclusive on the low and and exclusive on the high end. |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 | 1595 |
| 1594 // Release the thread handles | 1596 // Release the thread handles |
| 1595 CloseHandle(data_->sampler_thread_); | 1597 CloseHandle(data_->sampler_thread_); |
| 1596 CloseHandle(data_->profiled_thread_); | 1598 CloseHandle(data_->profiled_thread_); |
| 1597 } | 1599 } |
| 1598 | 1600 |
| 1599 | 1601 |
| 1600 #endif // ENABLE_LOGGING_AND_PROFILING | 1602 #endif // ENABLE_LOGGING_AND_PROFILING |
| 1601 | 1603 |
| 1602 } } // namespace v8::internal | 1604 } } // namespace v8::internal |
| OLD | NEW |