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

Side by Side Diff: src/utils.h

Issue 2887053003: MIPS[64]: Reland of `Fix unaligned arguments storage in Wasm-to-interpreter entry` (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_UTILS_H_ 5 #ifndef V8_UTILS_H_
6 #define V8_UTILS_H_ 6 #define V8_UTILS_H_
7 7
8 #include <limits.h> 8 #include <limits.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 179
180 // Returns true if (addr + offset) is aligned. 180 // Returns true if (addr + offset) is aligned.
181 inline bool IsAddressAligned(Address addr, 181 inline bool IsAddressAligned(Address addr,
182 intptr_t alignment, 182 intptr_t alignment,
183 int offset = 0) { 183 int offset = 0) {
184 intptr_t offs = OffsetFrom(addr + offset); 184 intptr_t offs = OffsetFrom(addr + offset);
185 return IsAligned(offs, alignment); 185 return IsAligned(offs, alignment);
186 } 186 }
187 187
188 template <typename T, typename U>
189 inline T RoundUpToMultipleOfPowOf2(T value, U multiple) {
190 DCHECK(multiple && ((multiple & (multiple - 1)) == 0));
Clemens Hammacher 2017/05/18 11:52:05 There is base::bits::IsPowerOfTwo64.
ivica.bogosavljevic 2017/05/18 12:21:43 Acknowledged.
191 return (value + multiple - 1) & ~(multiple - 1);
192 }
188 193
189 // Returns the maximum of the two parameters. 194 // Returns the maximum of the two parameters.
190 template <typename T> 195 template <typename T>
191 T Max(T a, T b) { 196 T Max(T a, T b) {
192 return a < b ? b : a; 197 return a < b ? b : a;
193 } 198 }
194 199
195 200
196 // Returns the minimum of the two parameters. 201 // Returns the minimum of the two parameters.
197 template <typename T> 202 template <typename T>
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 private: 1717 private:
1713 T value_; 1718 T value_;
1714 ThreadedListZoneEntry<T>* next_; 1719 ThreadedListZoneEntry<T>* next_;
1715 DISALLOW_COPY_AND_ASSIGN(ThreadedListZoneEntry); 1720 DISALLOW_COPY_AND_ASSIGN(ThreadedListZoneEntry);
1716 }; 1721 };
1717 1722
1718 } // namespace internal 1723 } // namespace internal
1719 } // namespace v8 1724 } // namespace v8
1720 1725
1721 #endif // V8_UTILS_H_ 1726 #endif // V8_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698