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

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

Issue 11276022: Avoid integer overflow when computing the size of new space in bytes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/heap.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 (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 PLATFORM_GLOBALS_H_ 5 #ifndef PLATFORM_GLOBALS_H_
6 #define PLATFORM_GLOBALS_H_ 6 #define 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 const int kWordSizeLog2 = 3; 160 const int kWordSizeLog2 = 3;
161 const uword kUwordMax = kMaxUint64; 161 const uword kUwordMax = kMaxUint64;
162 #endif 162 #endif
163 163
164 // Bit sizes. 164 // Bit sizes.
165 const int kBitsPerByte = 8; 165 const int kBitsPerByte = 8;
166 const int kBitsPerByteLog2 = 3; 166 const int kBitsPerByteLog2 = 3;
167 const int kBitsPerWord = kWordSize * kBitsPerByte; 167 const int kBitsPerWord = kWordSize * kBitsPerByte;
168 168
169 // System-wide named constants. 169 // System-wide named constants.
170 const int KB = 1024; 170 const intptr_t KB = 1024;
171 const int MB = KB * KB; 171 const intptr_t MB = KB * KB;
172 const int GB = KB * KB * KB; 172 const intptr_t GB = KB * KB * KB;
173 const intptr_t kIntptrOne = 1; 173 const intptr_t kIntptrOne = 1;
174 const intptr_t kIntptrMin = (kIntptrOne << (kBitsPerWord - 1)); 174 const intptr_t kIntptrMin = (kIntptrOne << (kBitsPerWord - 1));
175 const intptr_t kIntptrMax = ~kIntptrMin; 175 const intptr_t kIntptrMax = ~kIntptrMin;
176 176
177 // Time constants. 177 // Time constants.
178 const int kMillisecondsPerSecond = 1000; 178 const int kMillisecondsPerSecond = 1000;
179 const int kMicrosecondsPerMillisecond = 1000; 179 const int kMicrosecondsPerMillisecond = 1000;
180 const int kMicrosecondsPerSecond = (kMicrosecondsPerMillisecond * 180 const int kMicrosecondsPerSecond = (kMicrosecondsPerMillisecond *
181 kMillisecondsPerSecond); 181 kMillisecondsPerSecond);
182 const int kNanosecondsPerMicrosecond = 1000; 182 const int kNanosecondsPerMicrosecond = 1000;
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // have an implicit 'this' argument, the arguments of such methods 361 // have an implicit 'this' argument, the arguments of such methods
362 // should be counted from two, not one." 362 // should be counted from two, not one."
363 // 363 //
364 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ 364 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \
365 __attribute__((__format__(__printf__, string_index, first_to_check))) 365 __attribute__((__format__(__printf__, string_index, first_to_check)))
366 #else 366 #else
367 #define PRINTF_ATTRIBUTE(string_index, first_to_check) 367 #define PRINTF_ATTRIBUTE(string_index, first_to_check)
368 #endif 368 #endif
369 369
370 #endif // PLATFORM_GLOBALS_H_ 370 #endif // PLATFORM_GLOBALS_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698