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

Side by Side Diff: runtime/platform/globals.h

Issue 2470663006: Add .clang-format and run clang-format on runtime/platform. (Closed)
Patch Set: Remove default override for short functions Created 4 years, 1 month 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
« no previous file with comments | « runtime/platform/floating_point_win.cc ('k') | runtime/platform/hashmap.h » ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef RUNTIME_PLATFORM_GLOBALS_H_ 5 #ifndef RUNTIME_PLATFORM_GLOBALS_H_
6 #define RUNTIME_PLATFORM_GLOBALS_H_ 6 #define RUNTIME_PLATFORM_GLOBALS_H_
7 7
8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to 8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to
9 // enable platform independent printf format specifiers. 9 // enable platform independent printf format specifiers.
10 #ifndef __STDC_FORMAT_MACROS 10 #ifndef __STDC_FORMAT_MACROS
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 void writeTo(int32_t* v) { 188 void writeTo(int32_t* v) {
189 v[0] = int_storage[0]; 189 v[0] = int_storage[0];
190 v[1] = int_storage[1]; 190 v[1] = int_storage[1];
191 v[2] = int_storage[2]; 191 v[2] = int_storage[2];
192 v[3] = int_storage[3]; 192 v[3] = int_storage[3];
193 } 193 }
194 void writeTo(double* v) { 194 void writeTo(double* v) {
195 v[0] = double_storage[0]; 195 v[0] = double_storage[0];
196 v[1] = double_storage[1]; 196 v[1] = double_storage[1];
197 } 197 }
198 void writeTo(simd128_value_t* v) { 198 void writeTo(simd128_value_t* v) { *v = *this; }
199 *v = *this;
200 }
201 }; 199 };
202 200
203 // Processor architecture detection. For more info on what's defined, see: 201 // Processor architecture detection. For more info on what's defined, see:
204 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx 202 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx
205 // http://www.agner.org/optimize/calling_conventions.pdf 203 // http://www.agner.org/optimize/calling_conventions.pdf
206 // or with gcc, run: "echo | gcc -E -dM -" 204 // or with gcc, run: "echo | gcc -E -dM -"
207 #if defined(_M_X64) || defined(__x86_64__) 205 #if defined(_M_X64) || defined(__x86_64__)
208 #define HOST_ARCH_X64 1 206 #define HOST_ARCH_X64 1
209 #define ARCH_IS_64_BIT 1 207 #define ARCH_IS_64_BIT 1
210 #define kFpuRegisterSize 16 208 #define kFpuRegisterSize 16
(...skipping 10 matching lines...) Expand all
221 #endif 219 #endif
222 #elif defined(__ARMEL__) 220 #elif defined(__ARMEL__)
223 #define HOST_ARCH_ARM 1 221 #define HOST_ARCH_ARM 1
224 #define ARCH_IS_32_BIT 1 222 #define ARCH_IS_32_BIT 1
225 #define kFpuRegisterSize 16 223 #define kFpuRegisterSize 16
226 // Mark the fact that we have defined simd_value_t. 224 // Mark the fact that we have defined simd_value_t.
227 #define SIMD_VALUE_T_ 225 #define SIMD_VALUE_T_
228 typedef struct { 226 typedef struct {
229 union { 227 union {
230 uint32_t u; 228 uint32_t u;
231 float f; 229 float f;
232 } data_[4]; 230 } data_[4];
233 } simd_value_t; 231 } simd_value_t;
234 typedef simd_value_t fpu_register_t; 232 typedef simd_value_t fpu_register_t;
235 #define simd_value_safe_load(addr) \ 233 #define simd_value_safe_load(addr) (*reinterpret_cast<simd_value_t*>(addr))
236 (*reinterpret_cast<simd_value_t *>(addr))
237 #define simd_value_safe_store(addr, value) \ 234 #define simd_value_safe_store(addr, value) \
238 do { \ 235 do { \
239 reinterpret_cast<simd_value_t *>(addr)->data_[0] = value.data_[0]; \ 236 reinterpret_cast<simd_value_t*>(addr)->data_[0] = value.data_[0]; \
240 reinterpret_cast<simd_value_t *>(addr)->data_[1] = value.data_[1]; \ 237 reinterpret_cast<simd_value_t*>(addr)->data_[1] = value.data_[1]; \
241 reinterpret_cast<simd_value_t *>(addr)->data_[2] = value.data_[2]; \ 238 reinterpret_cast<simd_value_t*>(addr)->data_[2] = value.data_[2]; \
242 reinterpret_cast<simd_value_t *>(addr)->data_[3] = value.data_[3]; \ 239 reinterpret_cast<simd_value_t*>(addr)->data_[3] = value.data_[3]; \
243 } while (0) 240 } while (0)
244 241
245 #elif defined(__MIPSEL__) 242 #elif defined(__MIPSEL__)
246 #define HOST_ARCH_MIPS 1 243 #define HOST_ARCH_MIPS 1
247 #define ARCH_IS_32_BIT 1 244 #define ARCH_IS_32_BIT 1
248 #define kFpuRegisterSize 8 245 #define kFpuRegisterSize 8
249 typedef double fpu_register_t; 246 typedef double fpu_register_t;
250 #elif defined(__aarch64__) 247 #elif defined(__aarch64__)
251 #define HOST_ARCH_ARM64 1 248 #define HOST_ARCH_ARM64 1
252 #define ARCH_IS_64_BIT 1 249 #define ARCH_IS_64_BIT 1
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 #endif 325 #endif
329 #endif 326 #endif
330 #endif 327 #endif
331 #endif 328 #endif
332 #endif 329 #endif
333 #endif 330 #endif
334 #endif 331 #endif
335 332
336 // Verify that host and target architectures match, we cannot 333 // Verify that host and target architectures match, we cannot
337 // have a 64 bit Dart VM generating 32 bit code or vice-versa. 334 // have a 64 bit Dart VM generating 32 bit code or vice-versa.
338 #if defined(TARGET_ARCH_X64) || \ 335 #if defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_ARM64)
339 defined(TARGET_ARCH_ARM64)
340 #if !defined(ARCH_IS_64_BIT) 336 #if !defined(ARCH_IS_64_BIT)
341 #error Mismatched Host/Target architectures. 337 #error Mismatched Host/Target architectures.
342 #endif 338 #endif
343 #elif defined(TARGET_ARCH_IA32) || \ 339 #elif defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_ARM) || \
344 defined(TARGET_ARCH_ARM) || \ 340 defined(TARGET_ARCH_MIPS)
345 defined(TARGET_ARCH_MIPS)
346 #if !defined(ARCH_IS_32_BIT) 341 #if !defined(ARCH_IS_32_BIT)
347 #error Mismatched Host/Target architectures. 342 #error Mismatched Host/Target architectures.
348 #endif 343 #endif
349 #endif 344 #endif
350 345
351 // Determine whether we will be using the simulator. 346 // Determine whether we will be using the simulator.
352 #if defined(TARGET_ARCH_IA32) 347 #if defined(TARGET_ARCH_IA32)
353 // No simulator used. 348 // No simulator used.
354 #elif defined(TARGET_ARCH_X64) 349 #elif defined(TARGET_ARCH_X64)
355 // No simulator used. 350 // No simulator used.
356 #elif defined(TARGET_ARCH_ARM) 351 #elif defined(TARGET_ARCH_ARM)
357 #if !defined(HOST_ARCH_ARM) 352 #if !defined(HOST_ARCH_ARM)
358 #define USING_SIMULATOR 1 353 #define USING_SIMULATOR 1
359 #endif 354 #endif
360 355
361 #elif defined(TARGET_ARCH_ARM64) 356 #elif defined(TARGET_ARCH_ARM64)
362 #if !defined(HOST_ARCH_ARM64) 357 #if !defined(HOST_ARCH_ARM64)
363 #define USING_SIMULATOR 1 358 #define USING_SIMULATOR 1
364 #endif 359 #endif
365 360
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 417
423 // Replace calls to strtoll with _strtoi64 on Windows. 418 // Replace calls to strtoll with _strtoi64 on Windows.
424 #ifdef _MSC_VER 419 #ifdef _MSC_VER
425 #define strtoll _strtoi64 420 #define strtoll _strtoi64
426 #endif 421 #endif
427 422
428 // The following macro works on both 32 and 64-bit platforms. 423 // The following macro works on both 32 and 64-bit platforms.
429 // Usage: instead of writing 0x1234567890123456ULL 424 // Usage: instead of writing 0x1234567890123456ULL
430 // write DART_2PART_UINT64_C(0x12345678,90123456); 425 // write DART_2PART_UINT64_C(0x12345678,90123456);
431 #define DART_2PART_UINT64_C(a, b) \ 426 #define DART_2PART_UINT64_C(a, b) \
432 (((static_cast<uint64_t>(a) << 32) + 0x##b##u)) 427 (((static_cast<uint64_t>(a) << 32) + 0x##b##u))
433 428
434 // Integer constants. 429 // Integer constants.
435 const int32_t kMinInt32 = 0x80000000; 430 const int32_t kMinInt32 = 0x80000000;
436 const int32_t kMaxInt32 = 0x7FFFFFFF; 431 const int32_t kMaxInt32 = 0x7FFFFFFF;
437 const uint32_t kMaxUint32 = 0xFFFFFFFF; 432 const uint32_t kMaxUint32 = 0xFFFFFFFF;
438 const int64_t kMinInt64 = DART_INT64_C(0x8000000000000000); 433 const int64_t kMinInt64 = DART_INT64_C(0x8000000000000000);
439 const int64_t kMaxInt64 = DART_INT64_C(0x7FFFFFFFFFFFFFFF); 434 const int64_t kMaxInt64 = DART_INT64_C(0x7FFFFFFFFFFFFFFF);
440 const uint64_t kMaxUint64 = DART_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF); 435 const uint64_t kMaxUint64 = DART_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF);
441 const int64_t kSignBitDouble = DART_INT64_C(0x8000000000000000); 436 const int64_t kSignBitDouble = DART_INT64_C(0x8000000000000000);
442 437
443 // Types for native machine words. Guaranteed to be able to hold pointers and 438 // Types for native machine words. Guaranteed to be able to hold pointers and
444 // integers. 439 // integers.
445 typedef intptr_t word; 440 typedef intptr_t word;
446 typedef uintptr_t uword; 441 typedef uintptr_t uword;
447 442
448 // Size of a class id. 443 // Size of a class id.
449 #if defined(ARCH_IS_32_BIT) 444 #if defined(ARCH_IS_32_BIT)
450 typedef uint16_t classid_t; 445 typedef uint16_t classid_t;
451 #elif defined(ARCH_IS_64_BIT) 446 #elif defined(ARCH_IS_64_BIT)
452 typedef uint32_t classid_t; 447 typedef uint32_t classid_t;
453 #else 448 #else
454 #error Unexpected architecture word size 449 #error Unexpected architecture word size
455 #endif 450 #endif
456 451
457 // Byte sizes. 452 // Byte sizes.
458 const int kWordSize = sizeof(word); 453 const int kWordSize = sizeof(word);
459 const int kDoubleSize = sizeof(double); // NOLINT 454 const int kDoubleSize = sizeof(double); // NOLINT
460 const int kFloatSize = sizeof(float); // NOLINT 455 const int kFloatSize = sizeof(float); // NOLINT
461 const int kQuadSize = 4 * kFloatSize; 456 const int kQuadSize = 4 * kFloatSize;
462 const int kSimd128Size = sizeof(simd128_value_t); // NOLINT 457 const int kSimd128Size = sizeof(simd128_value_t); // NOLINT
463 const int kInt32Size = sizeof(int32_t); // NOLINT 458 const int kInt32Size = sizeof(int32_t); // NOLINT
464 const int kInt16Size = sizeof(int16_t); // NOLINT 459 const int kInt16Size = sizeof(int16_t); // NOLINT
465 #ifdef ARCH_IS_32_BIT 460 #ifdef ARCH_IS_32_BIT
466 const int kWordSizeLog2 = 2; 461 const int kWordSizeLog2 = 2;
467 const uword kUwordMax = kMaxUint32; 462 const uword kUwordMax = kMaxUint32;
468 #else 463 #else
469 const int kWordSizeLog2 = 3; 464 const int kWordSizeLog2 = 3;
470 const uword kUwordMax = kMaxUint64; 465 const uword kUwordMax = kMaxUint64;
471 #endif 466 #endif
472 467
473 // Bit sizes. 468 // Bit sizes.
474 const int kBitsPerByte = 8; 469 const int kBitsPerByte = 8;
(...skipping 28 matching lines...) Expand all
503 return (size_in_words + (GBInWords >> 1)) >> GBInWordsLog2; 498 return (size_in_words + (GBInWords >> 1)) >> GBInWordsLog2;
504 } 499 }
505 500
506 const intptr_t kIntptrOne = 1; 501 const intptr_t kIntptrOne = 1;
507 const intptr_t kIntptrMin = (kIntptrOne << (kBitsPerWord - 1)); 502 const intptr_t kIntptrMin = (kIntptrOne << (kBitsPerWord - 1));
508 const intptr_t kIntptrMax = ~kIntptrMin; 503 const intptr_t kIntptrMax = ~kIntptrMin;
509 504
510 // Time constants. 505 // Time constants.
511 const int kMillisecondsPerSecond = 1000; 506 const int kMillisecondsPerSecond = 1000;
512 const int kMicrosecondsPerMillisecond = 1000; 507 const int kMicrosecondsPerMillisecond = 1000;
513 const int kMicrosecondsPerSecond = (kMicrosecondsPerMillisecond * 508 const int kMicrosecondsPerSecond =
514 kMillisecondsPerSecond); 509 (kMicrosecondsPerMillisecond * kMillisecondsPerSecond);
515 const int kNanosecondsPerMicrosecond = 1000; 510 const int kNanosecondsPerMicrosecond = 1000;
516 const int kNanosecondsPerMillisecond = (kNanosecondsPerMicrosecond * 511 const int kNanosecondsPerMillisecond =
517 kMicrosecondsPerMillisecond); 512 (kNanosecondsPerMicrosecond * kMicrosecondsPerMillisecond);
518 const int kNanosecondsPerSecond = (kNanosecondsPerMicrosecond * 513 const int kNanosecondsPerSecond =
519 kMicrosecondsPerSecond); 514 (kNanosecondsPerMicrosecond * kMicrosecondsPerSecond);
520 515
521 // Helpers to scale micro second times to human understandable values. 516 // Helpers to scale micro second times to human understandable values.
522 inline double MicrosecondsToSeconds(int64_t micros) { 517 inline double MicrosecondsToSeconds(int64_t micros) {
523 return static_cast<double>(micros) / kMicrosecondsPerSecond; 518 return static_cast<double>(micros) / kMicrosecondsPerSecond;
524 } 519 }
525 inline double MicrosecondsToMilliseconds(int64_t micros) { 520 inline double MicrosecondsToMilliseconds(int64_t micros) {
526 return static_cast<double>(micros) / kMicrosecondsPerMillisecond; 521 return static_cast<double>(micros) / kMicrosecondsPerMillisecond;
527 } 522 }
528 523
529 // A macro to disallow the copy constructor and operator= functions. 524 // A macro to disallow the copy constructor and operator= functions.
530 // This should be used in the private: declarations for a class. 525 // This should be used in the private: declarations for a class.
531 #if !defined(DISALLOW_COPY_AND_ASSIGN) 526 #if !defined(DISALLOW_COPY_AND_ASSIGN)
532 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ 527 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
533 private: \ 528 private: \
534 TypeName(const TypeName&); \ 529 TypeName(const TypeName&); \
535 void operator=(const TypeName&) 530 void operator=(const TypeName&)
536 #endif // !defined(DISALLOW_COPY_AND_ASSIGN) 531 #endif // !defined(DISALLOW_COPY_AND_ASSIGN)
537 532
538 // A macro to disallow all the implicit constructors, namely the default 533 // A macro to disallow all the implicit constructors, namely the default
539 // constructor, copy constructor and operator= functions. This should be 534 // constructor, copy constructor and operator= functions. This should be
540 // used in the private: declarations for a class that wants to prevent 535 // used in the private: declarations for a class that wants to prevent
541 // anyone from instantiating it. This is especially useful for classes 536 // anyone from instantiating it. This is especially useful for classes
542 // containing only static methods. 537 // containing only static methods.
543 #if !defined(DISALLOW_IMPLICIT_CONSTRUCTORS) 538 #if !defined(DISALLOW_IMPLICIT_CONSTRUCTORS)
544 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ 539 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
545 private: \ 540 private: \
546 TypeName(); \ 541 TypeName(); \
547 DISALLOW_COPY_AND_ASSIGN(TypeName) 542 DISALLOW_COPY_AND_ASSIGN(TypeName)
548 #endif // !defined(DISALLOW_IMPLICIT_CONSTRUCTORS) 543 #endif // !defined(DISALLOW_IMPLICIT_CONSTRUCTORS)
549 544
550 // Macro to disallow allocation in the C++ heap. This should be used 545 // Macro to disallow allocation in the C++ heap. This should be used
551 // in the private section for a class. Don't use UNREACHABLE here to 546 // in the private section for a class. Don't use UNREACHABLE here to
552 // avoid circular dependencies between platform/globals.h and 547 // avoid circular dependencies between platform/globals.h and
553 // platform/assert.h. 548 // platform/assert.h.
554 #if !defined(DISALLOW_ALLOCATION) 549 #if !defined(DISALLOW_ALLOCATION)
555 #define DISALLOW_ALLOCATION() \ 550 #define DISALLOW_ALLOCATION() \
556 public: \ 551 public: \
557 void operator delete(void* pointer) { \ 552 void operator delete(void* pointer) { \
558 fprintf(stderr, "unreachable code\n"); \ 553 fprintf(stderr, "unreachable code\n"); \
559 abort(); \ 554 abort(); \
560 } \ 555 } \
561 private: \ 556 \
557 private: \
562 void* operator new(size_t size); 558 void* operator new(size_t size);
563 #endif // !defined(DISALLOW_ALLOCATION) 559 #endif // !defined(DISALLOW_ALLOCATION)
564 560
565 // The USE(x) template is used to silence C++ compiler warnings issued 561 // The USE(x) template is used to silence C++ compiler warnings issued
566 // for unused variables. 562 // for unused variables.
567 template <typename T> 563 template <typename T>
568 static inline void USE(T) { } 564 static inline void USE(T) {}
569 565
570 566
571 // Use implicit_cast as a safe version of static_cast or const_cast 567 // Use implicit_cast as a safe version of static_cast or const_cast
572 // for upcasting in the type hierarchy (i.e. casting a pointer to Foo 568 // for upcasting in the type hierarchy (i.e. casting a pointer to Foo
573 // to a pointer to SuperclassOfFoo or casting a pointer to Foo to 569 // to a pointer to SuperclassOfFoo or casting a pointer to Foo to
574 // a const pointer to Foo). 570 // a const pointer to Foo).
575 // When you use implicit_cast, the compiler checks that the cast is safe. 571 // When you use implicit_cast, the compiler checks that the cast is safe.
576 // Such explicit implicit_casts are necessary in surprisingly many 572 // Such explicit implicit_casts are necessary in surprisingly many
577 // situations where C++ demands an exact type match instead of an 573 // situations where C++ demands an exact type match instead of an
578 // argument type convertable to a target type. 574 // argument type convertable to a target type.
579 // 575 //
580 // The From type can be inferred, so the preferred syntax for using 576 // The From type can be inferred, so the preferred syntax for using
581 // implicit_cast is the same as for static_cast etc.: 577 // implicit_cast is the same as for static_cast etc.:
582 // 578 //
583 // implicit_cast<ToType>(expr) 579 // implicit_cast<ToType>(expr)
584 // 580 //
585 // implicit_cast would have been part of the C++ standard library, 581 // implicit_cast would have been part of the C++ standard library,
586 // but the proposal was submitted too late. It will probably make 582 // but the proposal was submitted too late. It will probably make
587 // its way into the language in the future. 583 // its way into the language in the future.
588 template<typename To, typename From> 584 template <typename To, typename From>
589 inline To implicit_cast(From const &f) { 585 inline To implicit_cast(From const& f) {
590 return f; 586 return f;
591 } 587 }
592 588
593 589
594 // Use like this: down_cast<T*>(foo); 590 // Use like this: down_cast<T*>(foo);
595 template<typename To, typename From> // use like this: down_cast<T*>(foo); 591 template <typename To, typename From> // use like this: down_cast<T*>(foo);
596 inline To down_cast(From* f) { // so we only accept pointers 592 inline To down_cast(From* f) { // so we only accept pointers
597 // Ensures that To is a sub-type of From *. This test is here only 593 // Ensures that To is a sub-type of From *. This test is here only
598 // for compile-time type checking, and has no overhead in an 594 // for compile-time type checking, and has no overhead in an
599 // optimized build at run-time, as it will be optimized away completely. 595 // optimized build at run-time, as it will be optimized away completely.
600 if (false) { 596 if (false) {
601 implicit_cast<From, To>(0); 597 implicit_cast<From, To>(0);
602 } 598 }
603 return static_cast<To>(f); 599 return static_cast<To>(f);
604 } 600 }
605 601
606 602
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 memcpy(&destination, &source, sizeof(destination)); 636 memcpy(&destination, &source, sizeof(destination));
641 return destination; 637 return destination;
642 } 638 }
643 639
644 640
645 // Similar to bit_cast, but allows copying from types of unrelated 641 // Similar to bit_cast, but allows copying from types of unrelated
646 // sizes. This method was introduced to enable the strict aliasing 642 // sizes. This method was introduced to enable the strict aliasing
647 // optimizations of GCC 4.4. Basically, GCC mindlessly relies on 643 // optimizations of GCC 4.4. Basically, GCC mindlessly relies on
648 // obscure details in the C++ standard that make reinterpret_cast 644 // obscure details in the C++ standard that make reinterpret_cast
649 // virtually useless. 645 // virtually useless.
650 template<class D, class S> 646 template <class D, class S>
651 inline D bit_copy(const S& source) { 647 inline D bit_copy(const S& source) {
652 D destination; 648 D destination;
653 // This use of memcpy is safe: source and destination cannot overlap. 649 // This use of memcpy is safe: source and destination cannot overlap.
654 memcpy(&destination, 650 memcpy(&destination, reinterpret_cast<const void*>(&source),
655 reinterpret_cast<const void*>(&source),
656 sizeof(destination)); 651 sizeof(destination));
657 return destination; 652 return destination;
658 } 653 }
659 654
660 655
661 // Similar to bit_copy and bit_cast, but does take the type from the argument. 656 // Similar to bit_copy and bit_cast, but does take the type from the argument.
662 template <typename T> 657 template <typename T>
663 static inline T ReadUnaligned(const T* ptr) { 658 static inline T ReadUnaligned(const T* ptr) {
664 T value; 659 T value;
665 memcpy(&value, ptr, sizeof(value)); 660 memcpy(&value, ptr, sizeof(value));
(...skipping 18 matching lines...) Expand all
684 #endif // !defined(TARGET_OS_WINDOWS) 679 #endif // !defined(TARGET_OS_WINDOWS)
685 680
686 #if defined(TARGET_OS_LINUX) || defined(TARGET_OS_MACOS) 681 #if defined(TARGET_OS_LINUX) || defined(TARGET_OS_MACOS)
687 // Tell the compiler to do printf format string checking if the 682 // Tell the compiler to do printf format string checking if the
688 // compiler supports it; see the 'format' attribute in 683 // compiler supports it; see the 'format' attribute in
689 // <http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Function-Attributes.html>. 684 // <http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Function-Attributes.html>.
690 // 685 //
691 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods 686 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods
692 // have an implicit 'this' argument, the arguments of such methods 687 // have an implicit 'this' argument, the arguments of such methods
693 // should be counted from two, not one." 688 // should be counted from two, not one."
694 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ 689 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \
695 __attribute__((__format__(__printf__, string_index, first_to_check))) 690 __attribute__((__format__(__printf__, string_index, first_to_check)))
696 #else 691 #else
697 #define PRINTF_ATTRIBUTE(string_index, first_to_check) 692 #define PRINTF_ATTRIBUTE(string_index, first_to_check)
698 #endif 693 #endif
699 694
700 #if defined(_WIN32) 695 #if defined(_WIN32)
701 #define STDIN_FILENO 0 696 #define STDIN_FILENO 0
702 #define STDOUT_FILENO 1 697 #define STDOUT_FILENO 1
703 #define STDERR_FILENO 2 698 #define STDERR_FILENO 2
704 #endif 699 #endif
705 700
706 // For checking deterministic graph generation, we can store instruction 701 // For checking deterministic graph generation, we can store instruction
707 // tag in the ICData and check it when recreating the flow graph in 702 // tag in the ICData and check it when recreating the flow graph in
708 // optimizing compiler. Enable it for other modes (product, release) if needed 703 // optimizing compiler. Enable it for other modes (product, release) if needed
709 // for debugging. 704 // for debugging.
710 #if defined(DEBUG) 705 #if defined(DEBUG)
711 #define TAG_IC_DATA 706 #define TAG_IC_DATA
712 #endif 707 #endif
713 708
714 } // namespace dart 709 } // namespace dart
715 710
716 #endif // RUNTIME_PLATFORM_GLOBALS_H_ 711 #endif // RUNTIME_PLATFORM_GLOBALS_H_
OLDNEW
« no previous file with comments | « runtime/platform/floating_point_win.cc ('k') | runtime/platform/hashmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698