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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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
« no previous file with comments | « runtime/vm/gdb_helpers.cc ('k') | runtime/vm/growable_array.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_VM_GLOBALS_H_ 5 #ifndef RUNTIME_VM_GLOBALS_H_
6 #define RUNTIME_VM_GLOBALS_H_ 6 #define RUNTIME_VM_GLOBALS_H_
7 7
8 // This file contains global definitions for the VM library only. Anything that 8 // This file contains global definitions for the VM library only. Anything that
9 // is more globally useful should be added to 'vm/globals.h'. 9 // is more globally useful should be added to 'vm/globals.h'.
10 10
(...skipping 25 matching lines...) Expand all
36 #define kNegInfinity bit_cast<double>(DART_UINT64_C(0xfff0000000000000)) 36 #define kNegInfinity bit_cast<double>(DART_UINT64_C(0xfff0000000000000))
37 37
38 // The expression ARRAY_SIZE(array) is a compile-time constant of type 38 // The expression ARRAY_SIZE(array) is a compile-time constant of type
39 // size_t which represents the number of elements of the given 39 // size_t which represents the number of elements of the given
40 // array. You should only use ARRAY_SIZE on statically allocated 40 // array. You should only use ARRAY_SIZE on statically allocated
41 // arrays. 41 // arrays.
42 #define ARRAY_SIZE(array) \ 42 #define ARRAY_SIZE(array) \
43 ((sizeof(array) / sizeof(*(array))) / \ 43 ((sizeof(array) / sizeof(*(array))) / \
44 static_cast<intptr_t>(!(sizeof(array) % sizeof(*(array))))) // NOLINT 44 static_cast<intptr_t>(!(sizeof(array) % sizeof(*(array))))) // NOLINT
45 45
46
47 #if defined(ARCH_IS_64_BIT) 46 #if defined(ARCH_IS_64_BIT)
48 #define HASH_IN_OBJECT_HEADER 1 47 #define HASH_IN_OBJECT_HEADER 1
49 #endif 48 #endif
50 49
51 // The expression OFFSET_OF(type, field) computes the byte-offset of 50 // The expression OFFSET_OF(type, field) computes the byte-offset of
52 // the specified field relative to the containing type. 51 // the specified field relative to the containing type.
53 // 52 //
54 // The expression OFFSET_OF_RETURNED_VALUE(type, accessor) computes the 53 // The expression OFFSET_OF_RETURNED_VALUE(type, accessor) computes the
55 // byte-offset of the return value of the accessor to the containing type. 54 // byte-offset of the return value of the accessor to the containing type.
56 // 55 //
(...skipping 12 matching lines...) Expand all
69 (reinterpret_cast<type*>(kOffsetOfPtr)->accessor())) - \ 68 (reinterpret_cast<type*>(kOffsetOfPtr)->accessor())) - \
70 kOffsetOfPtr) // NOLINT 69 kOffsetOfPtr) // NOLINT
71 70
72 #define OPEN_ARRAY_START(type, align) \ 71 #define OPEN_ARRAY_START(type, align) \
73 do { \ 72 do { \
74 const uword result = reinterpret_cast<uword>(this) + sizeof(*this); \ 73 const uword result = reinterpret_cast<uword>(this) + sizeof(*this); \
75 ASSERT(Utils::IsAligned(result, sizeof(align))); \ 74 ASSERT(Utils::IsAligned(result, sizeof(align))); \
76 return reinterpret_cast<type*>(result); \ 75 return reinterpret_cast<type*>(result); \
77 } while (0) 76 } while (0)
78 77
79
80 // A type large enough to contain the value of the C++ vtable. This is needed 78 // A type large enough to contain the value of the C++ vtable. This is needed
81 // to support the handle operations. 79 // to support the handle operations.
82 typedef uword cpp_vtable; 80 typedef uword cpp_vtable;
83 81
84
85 // When using GCC we can use GCC attributes to ensure that certain 82 // When using GCC we can use GCC attributes to ensure that certain
86 // constants are 8 or 16 byte aligned. 83 // constants are 8 or 16 byte aligned.
87 #if defined(HOST_OS_WINDOWS) 84 #if defined(HOST_OS_WINDOWS)
88 #define ALIGN8 __declspec(align(8)) 85 #define ALIGN8 __declspec(align(8))
89 #define ALIGN16 __declspec(align(16)) 86 #define ALIGN16 __declspec(align(16))
90 #else 87 #else
91 #define ALIGN8 __attribute__((aligned(8))) 88 #define ALIGN8 __attribute__((aligned(8)))
92 #define ALIGN16 __attribute__((aligned(16))) 89 #define ALIGN16 __attribute__((aligned(16)))
93 #endif 90 #endif
94 91
95
96 // Zap value used to indicate uninitialized handle area (debug purposes). 92 // Zap value used to indicate uninitialized handle area (debug purposes).
97 #if defined(ARCH_IS_32_BIT) 93 #if defined(ARCH_IS_32_BIT)
98 static const uword kZapUninitializedWord = 0xabababab; 94 static const uword kZapUninitializedWord = 0xabababab;
99 #else 95 #else
100 static const uword kZapUninitializedWord = 0xabababababababab; 96 static const uword kZapUninitializedWord = 0xabababababababab;
101 #endif 97 #endif
102 98
103
104 // Macros to get the contents of the fp register. 99 // Macros to get the contents of the fp register.
105 #if defined(HOST_OS_WINDOWS) 100 #if defined(HOST_OS_WINDOWS)
106 101
107 // clang-format off 102 // clang-format off
108 #if defined(HOST_ARCH_IA32) 103 #if defined(HOST_ARCH_IA32)
109 #define COPY_FP_REGISTER(fp) \ 104 #define COPY_FP_REGISTER(fp) \
110 __asm { mov fp, ebp} \ 105 __asm { mov fp, ebp} \
111 ; // NOLINT 106 ; // NOLINT
112 // clang-format on 107 // clang-format on
113 #elif defined(HOST_ARCH_X64) 108 #elif defined(HOST_ARCH_X64)
114 // We don't have the asm equivalent to get at the frame pointer on 109 // We don't have the asm equivalent to get at the frame pointer on
115 // windows x64, return the stack pointer instead. 110 // windows x64, return the stack pointer instead.
116 #define COPY_FP_REGISTER(fp) fp = Thread::GetCurrentStackPointer(); 111 #define COPY_FP_REGISTER(fp) fp = Thread::GetCurrentStackPointer();
117 #else 112 #else
118 #error Unknown host architecture. 113 #error Unknown host architecture.
119 #endif 114 #endif
120 115
121 #else // !defined(HOST_OS_WINDOWS)) 116 #else // !defined(HOST_OS_WINDOWS))
122 117
123 // Assume GCC-compatible builtins. 118 // Assume GCC-compatible builtins.
124 #define COPY_FP_REGISTER(fp) \ 119 #define COPY_FP_REGISTER(fp) \
125 fp = reinterpret_cast<uintptr_t>(__builtin_frame_address(0)); 120 fp = reinterpret_cast<uintptr_t>(__builtin_frame_address(0));
126 121
127 #endif // !defined(HOST_OS_WINDOWS)) 122 #endif // !defined(HOST_OS_WINDOWS))
128 123
129 } // namespace dart 124 } // namespace dart
130 125
131 #endif // RUNTIME_VM_GLOBALS_H_ 126 #endif // RUNTIME_VM_GLOBALS_H_
OLDNEW
« no previous file with comments | « runtime/vm/gdb_helpers.cc ('k') | runtime/vm/growable_array.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698