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

Side by Side Diff: src/utils.h

Issue 947153002: [turbofan] encode instruction operand as uint64_t (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « src/compiler/instruction.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // A type U mask of bit field. To use all bits of a type U of x bits 201 // A type U mask of bit field. To use all bits of a type U of x bits
202 // in a bitfield without compiler warnings we have to compute 2^x 202 // in a bitfield without compiler warnings we have to compute 2^x
203 // without using a shift count of x in the computation. 203 // without using a shift count of x in the computation.
204 static const U kOne = static_cast<U>(1U); 204 static const U kOne = static_cast<U>(1U);
205 static const U kMask = ((kOne << shift) << size) - (kOne << shift); 205 static const U kMask = ((kOne << shift) << size) - (kOne << shift);
206 static const U kShift = shift; 206 static const U kShift = shift;
207 static const U kSize = size; 207 static const U kSize = size;
208 static const U kNext = kShift + kSize; 208 static const U kNext = kShift + kSize;
209 209
210 // Value for the field with all bits set. 210 // Value for the field with all bits set.
211 static const T kMax = static_cast<T>((1U << size) - 1); 211 static const T kMax = static_cast<T>((kOne << size) - 1);
Benedikt Meurer 2015/02/23 18:33:49 The looks a lot like undefined behavior for signed
dcarney 2015/02/23 18:56:08 this doesn't change the current behaviour, just ma
212 212
213 // Tells whether the provided value fits into the bit field. 213 // Tells whether the provided value fits into the bit field.
214 static bool is_valid(T value) { 214 static bool is_valid(T value) {
215 return (static_cast<U>(value) & ~static_cast<U>(kMax)) == 0; 215 return (static_cast<U>(value) & ~static_cast<U>(kMax)) == 0;
216 } 216 }
217 217
218 // Returns a type U with the bit field value encoded. 218 // Returns a type U with the bit field value encoded.
219 static U encode(T value) { 219 static U encode(T value) {
220 DCHECK(is_valid(value)); 220 DCHECK(is_valid(value));
221 return static_cast<U>(value) << shift; 221 return static_cast<U>(value) << shift;
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 // Takes the address of the limit variable in order to find out where 1675 // Takes the address of the limit variable in order to find out where
1676 // the top of stack is right now. 1676 // the top of stack is right now.
1677 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit); 1677 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit);
1678 return limit; 1678 return limit;
1679 } 1679 }
1680 1680
1681 } // namespace internal 1681 } // namespace internal
1682 } // namespace v8 1682 } // namespace v8
1683 1683
1684 #endif // V8_UTILS_H_ 1684 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/compiler/instruction.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698