Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Side by Side Diff: src/v8utils.h

Issue 20734002: Implement correct OS and CC detection. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Reverted changes to atomicops*.h Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/strtod.cc ('k') | test/cctest/test-assembler-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 19 matching lines...) Expand all
30 30
31 #include "utils.h" 31 #include "utils.h"
32 #include "platform.h" // For va_list on Solaris. 32 #include "platform.h" // For va_list on Solaris.
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 // ---------------------------------------------------------------------------- 37 // ----------------------------------------------------------------------------
38 // I/O support. 38 // I/O support.
39 39
40 #if __GNUC__ >= 4 40 #if V8_GNUC_PREREQ(4, 0)
41 // On gcc we can ask the compiler to check the types of %d-style format 41 // On gcc we can ask the compiler to check the types of %d-style format
42 // specifiers and their associated arguments. TODO(erikcorry) fix this 42 // specifiers and their associated arguments. TODO(erikcorry) fix this
43 // so it works on MacOSX. 43 // so it works on MacOSX.
44 #if defined(__MACH__) && defined(__APPLE__) 44 #if V8_OS_DARWIN
45 #define PRINTF_CHECKING 45 #define PRINTF_CHECKING
46 #define FPRINTF_CHECKING 46 #define FPRINTF_CHECKING
47 #else // MacOsX. 47 #else // MacOsX.
48 #define PRINTF_CHECKING __attribute__ ((format (printf, 1, 2))) 48 #define PRINTF_CHECKING __attribute__ ((format (printf, 1, 2)))
49 #define FPRINTF_CHECKING __attribute__ ((format (printf, 2, 3))) 49 #define FPRINTF_CHECKING __attribute__ ((format (printf, 2, 3)))
50 #endif 50 #endif
51 #else 51 #else
52 #define PRINTF_CHECKING 52 #define PRINTF_CHECKING
53 #define FPRINTF_CHECKING 53 #define FPRINTF_CHECKING
54 #endif 54 #endif
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 T* a = NULL; 255 T* a = NULL;
256 U* b = NULL; 256 U* b = NULL;
257 a = b; // Fake assignment to check assignability. 257 a = b; // Fake assignment to check assignability.
258 USE(a); 258 USE(a);
259 #endif // DEBUG 259 #endif // DEBUG
260 #if V8_HOST_ARCH_IA32 260 #if V8_HOST_ARCH_IA32
261 #define STOS "stosl" 261 #define STOS "stosl"
262 #elif V8_HOST_ARCH_X64 262 #elif V8_HOST_ARCH_X64
263 #define STOS "stosq" 263 #define STOS "stosq"
264 #endif 264 #endif
265 #if defined(__native_client__) 265 #if V8_OS_NACL
266 // This STOS sequence does not validate for x86_64 Native Client. 266 // This STOS sequence does not validate for x86_64 Native Client.
267 // Here we #undef STOS to force use of the slower C version. 267 // Here we #undef STOS to force use of the slower C version.
268 // TODO(bradchen): Profile V8 and implement a faster REP STOS 268 // TODO(bradchen): Profile V8 and implement a faster REP STOS
269 // here if the profile indicates it matters. 269 // here if the profile indicates it matters.
270 #undef STOS 270 #undef STOS
271 #endif 271 #endif
272 272
273 #if defined(__GNUC__) && defined(STOS) 273 #if V8_CC_GNU && defined(STOS)
274 asm volatile( 274 asm volatile(
275 "cld;" 275 "cld;"
276 "rep ; " STOS 276 "rep ; " STOS
277 : "+&c" (counter), "+&D" (dest) 277 : "+&c" (counter), "+&D" (dest)
278 : "a" (value) 278 : "a" (value)
279 : "memory", "cc"); 279 : "memory", "cc");
280 #else 280 #else
281 for (int i = 0; i < counter; i++) { 281 for (int i = 0; i < counter; i++) {
282 dest[i] = value; 282 dest[i] = value;
283 } 283 }
(...skipping 26 matching lines...) Expand all
310 bool verbose = true); 310 bool verbose = true);
311 Vector<const char> ReadFile(FILE* file, 311 Vector<const char> ReadFile(FILE* file,
312 bool* exists, 312 bool* exists,
313 bool verbose = true); 313 bool verbose = true);
314 314
315 315
316 template <typename sourcechar, typename sinkchar> 316 template <typename sourcechar, typename sinkchar>
317 INLINE(static void CopyCharsUnsigned(sinkchar* dest, 317 INLINE(static void CopyCharsUnsigned(sinkchar* dest,
318 const sourcechar* src, 318 const sourcechar* src,
319 int chars)); 319 int chars));
320 #if defined(V8_HOST_ARCH_ARM) 320 #if V8_HOST_ARCH_ARM
321 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, int chars)); 321 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, int chars));
322 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint8_t* src, int chars)); 322 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint8_t* src, int chars));
323 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, int chars)); 323 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, int chars));
324 #endif 324 #endif
325 325
326 // Copy from ASCII/16bit chars to ASCII/16bit chars. 326 // Copy from ASCII/16bit chars to ASCII/16bit chars.
327 template <typename sourcechar, typename sinkchar> 327 template <typename sourcechar, typename sinkchar>
328 INLINE(void CopyChars(sinkchar* dest, const sourcechar* src, int chars)); 328 INLINE(void CopyChars(sinkchar* dest, const sourcechar* src, int chars));
329 329
330 template<typename sourcechar, typename sinkchar> 330 template<typename sourcechar, typename sinkchar>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 src += kStepSize; 373 src += kStepSize;
374 } 374 }
375 } 375 }
376 #endif 376 #endif
377 while (dest < limit) { 377 while (dest < limit) {
378 *dest++ = static_cast<sinkchar>(*src++); 378 *dest++ = static_cast<sinkchar>(*src++);
379 } 379 }
380 } 380 }
381 381
382 382
383 #if defined(V8_HOST_ARCH_ARM) 383 #if V8_HOST_ARCH_ARM
384 void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, int chars) { 384 void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, int chars) {
385 switch (static_cast<unsigned>(chars)) { 385 switch (static_cast<unsigned>(chars)) {
386 case 0: 386 case 0:
387 break; 387 break;
388 case 1: 388 case 1:
389 *dest = *src; 389 *dest = *src;
390 break; 390 break;
391 case 2: 391 case 2:
392 memcpy(dest, src, 2); 392 memcpy(dest, src, 2);
393 break; 393 break;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 489
490 // Add formatted contents like printf based on a va_list. 490 // Add formatted contents like printf based on a va_list.
491 void AddFormattedList(const char* format, va_list list); 491 void AddFormattedList(const char* format, va_list list);
492 private: 492 private:
493 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); 493 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder);
494 }; 494 };
495 495
496 } } // namespace v8::internal 496 } } // namespace v8::internal
497 497
498 #endif // V8_V8UTILS_H_ 498 #endif // V8_V8UTILS_H_
OLDNEW
« no previous file with comments | « src/strtod.cc ('k') | test/cctest/test-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698