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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 // ---------------------------------------------------------------------------- | 216 // ---------------------------------------------------------------------------- |
217 // Hash function. | 217 // Hash function. |
218 | 218 |
219 uint32_t ComputeIntegerHash(uint32_t key); | 219 uint32_t ComputeIntegerHash(uint32_t key); |
220 | 220 |
221 | 221 |
222 // ---------------------------------------------------------------------------- | 222 // ---------------------------------------------------------------------------- |
223 // I/O support. | 223 // I/O support. |
224 | 224 |
225 #if __GNUC__ >= 4 | 225 // Our version of printf(). Avoids compilation errors that we get |
226 // On gcc we can ask the compiler to check the types of %d-style format | 226 // with standard printf when attempting to print pointers, etc. |
227 // specifiers and their associated arguments. TODO(erikcorry) fix this | 227 // (the errors are due to the extra compilation flags, which we |
228 // so it works on MacOSX. | 228 // want elsewhere). |
229 #if defined(__MACH__) && defined(__APPLE__) | 229 void PrintF(const char* format, ...); |
230 #define PRINTF_CHECKING | |
231 #else // MacOsX. | |
232 #define PRINTF_CHECKING __attribute__ ((format (printf, 1, 2))) | |
233 #endif | |
234 #else | |
235 #define PRINTF_CHECKING | |
236 #endif | |
237 | |
238 // Our version of printf(). | |
239 void PRINTF_CHECKING PrintF(const char* format, ...); | |
240 | 230 |
241 // Our version of fflush. | 231 // Our version of fflush. |
242 void Flush(); | 232 void Flush(); |
243 | 233 |
244 | 234 |
245 // Read a line of characters after printing the prompt to stdout. The resulting | 235 // Read a line of characters after printing the prompt to stdout. The resulting |
246 // char* needs to be disposed off with DeleteArray by the caller. | 236 // char* needs to be disposed off with DeleteArray by the caller. |
247 char* ReadLine(const char* prompt); | 237 char* ReadLine(const char* prompt); |
248 | 238 |
249 | 239 |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 } | 953 } |
964 | 954 |
965 template <class Dest, class Source> | 955 template <class Dest, class Source> |
966 inline Dest BitCast(Source* source) { | 956 inline Dest BitCast(Source* source) { |
967 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); | 957 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); |
968 } | 958 } |
969 | 959 |
970 } } // namespace v8::internal | 960 } } // namespace v8::internal |
971 | 961 |
972 #endif // V8_UTILS_H_ | 962 #endif // V8_UTILS_H_ |
OLD | NEW |