| 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 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 VPrint(format, args); | 686 VPrint(format, args); |
| 687 va_end(args); | 687 va_end(args); |
| 688 } | 688 } |
| 689 | 689 |
| 690 | 690 |
| 691 void OS::VPrint(const char* format, va_list args) { | 691 void OS::VPrint(const char* format, va_list args) { |
| 692 VPrintHelper(stdout, format, args); | 692 VPrintHelper(stdout, format, args); |
| 693 } | 693 } |
| 694 | 694 |
| 695 | 695 |
| 696 void OS::FPrint(FILE* out, const char* format, ...) { |
| 697 va_list args; |
| 698 va_start(args, format); |
| 699 VFPrint(out, format, args); |
| 700 va_end(args); |
| 701 } |
| 702 |
| 703 |
| 704 void OS::VFPrint(FILE* out, const char* format, va_list args) { |
| 705 VPrintHelper(out, format, args); |
| 706 } |
| 707 |
| 708 |
| 696 // Print error message to console. | 709 // Print error message to console. |
| 697 void OS::PrintError(const char* format, ...) { | 710 void OS::PrintError(const char* format, ...) { |
| 698 va_list args; | 711 va_list args; |
| 699 va_start(args, format); | 712 va_start(args, format); |
| 700 VPrintError(format, args); | 713 VPrintError(format, args); |
| 701 va_end(args); | 714 va_end(args); |
| 702 } | 715 } |
| 703 | 716 |
| 704 | 717 |
| 705 void OS::VPrintError(const char* format, va_list args) { | 718 void OS::VPrintError(const char* format, va_list args) { |
| 706 VPrintHelper(stderr, format, args); | 719 VPrintHelper(stderr, format, args); |
| 707 } | 720 } |
| 708 | 721 |
| 709 | 722 |
| 710 int OS::SNPrintF(Vector<char> str, const char* format, ...) { | 723 int OS::SNPrintF(Vector<char> str, const char* format, ...) { |
| 711 va_list args; | 724 va_list args; |
| 712 va_start(args, format); | 725 va_start(args, format); |
| 713 int result = VSNPrintF(str, format, args); | 726 int result = VSNPrintF(str, format, args); |
| 714 va_end(args); | 727 va_end(args); |
| 715 return result; | 728 return result; |
| 716 } | 729 } |
| 717 | 730 |
| 718 | 731 |
| 719 int OS::VSNPrintF(Vector<char> str, const char* format, va_list args) { | 732 int OS::VSNPrintF(Vector<char> str, const char* format, va_list args) { |
| 720 int n = _vsnprintf_s(str.start(), str.length(), _TRUNCATE, format, args); | 733 int n = _vsnprintf_s(str.start(), str.length(), _TRUNCATE, format, args); |
| 721 // Make sure to zero-terminate the string if the output was | 734 // Make sure to zero-terminate the string if the output was |
| 722 // truncated or if there was an error. | 735 // truncated or if there was an error. |
| 723 if (n < 0 || n >= str.length()) { | 736 if (n < 0 || n >= str.length()) { |
| 724 str[str.length() - 1] = '\0'; | 737 if (str.length() > 0) |
| 738 str[str.length() - 1] = '\0'; |
| 725 return -1; | 739 return -1; |
| 726 } else { | 740 } else { |
| 727 return n; | 741 return n; |
| 728 } | 742 } |
| 729 } | 743 } |
| 730 | 744 |
| 731 | 745 |
| 732 char* OS::StrChr(char* str, int c) { | 746 char* OS::StrChr(char* str, int c) { |
| 733 return const_cast<char*>(strchr(str, c)); | 747 return const_cast<char*>(strchr(str, c)); |
| 734 } | 748 } |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1957 | 1971 |
| 1958 void Sampler::Stop() { | 1972 void Sampler::Stop() { |
| 1959 ASSERT(IsActive()); | 1973 ASSERT(IsActive()); |
| 1960 SamplerThread::RemoveActiveSampler(this); | 1974 SamplerThread::RemoveActiveSampler(this); |
| 1961 SetActive(false); | 1975 SetActive(false); |
| 1962 } | 1976 } |
| 1963 | 1977 |
| 1964 #endif // ENABLE_LOGGING_AND_PROFILING | 1978 #endif // ENABLE_LOGGING_AND_PROFILING |
| 1965 | 1979 |
| 1966 } } // namespace v8::internal | 1980 } } // namespace v8::internal |
| OLD | NEW |