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

Side by Side Diff: src/utils.h

Issue 5987005: Refactor MemoryAllocator to allow big normal pages (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: remove rogue printf Created 10 years 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/spaces-inl.h ('k') | src/v8globals.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 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 template <typename T> 164 template <typename T>
165 static inline bool IsAligned(T value, T alignment) { 165 static inline bool IsAligned(T value, T alignment) {
166 ASSERT(IsPowerOf2(alignment)); 166 ASSERT(IsPowerOf2(alignment));
167 return (value & (alignment - 1)) == 0; 167 return (value & (alignment - 1)) == 0;
168 } 168 }
169 169
170 170
171 // Returns true if (addr + offset) is aligned. 171 // Returns true if (addr + offset) is aligned.
172 static inline bool IsAddressAligned(Address addr, 172 static inline bool IsAddressAligned(Address addr,
173 intptr_t alignment, 173 intptr_t alignment,
174 int offset) { 174 int offset = 0) {
175 intptr_t offs = OffsetFrom(addr + offset); 175 intptr_t offs = OffsetFrom(addr + offset);
176 return IsAligned(offs, alignment); 176 return IsAligned(offs, alignment);
177 } 177 }
178 178
179 179
180 // Returns the maximum of the two parameters. 180 // Returns the maximum of the two parameters.
181 template <typename T> 181 template <typename T>
182 static T Max(T a, T b) { 182 static T Max(T a, T b) {
183 return a < b ? b : a; 183 return a < b ? b : a;
184 } 184 }
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 } 754 }
755 755
756 template <class Dest, class Source> 756 template <class Dest, class Source>
757 inline Dest BitCast(Source* source) { 757 inline Dest BitCast(Source* source) {
758 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); 758 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source));
759 } 759 }
760 760
761 } } // namespace v8::internal 761 } } // namespace v8::internal
762 762
763 #endif // V8_UTILS_H_ 763 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/spaces-inl.h ('k') | src/v8globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698