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

Side by Side Diff: src/utils.h

Issue 10824079: Use a special EnumLength field to indicate number of valid enum cache values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/x64/full-codegen-x64.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // ---------------------------------------------------------------------------- 241 // ----------------------------------------------------------------------------
242 // BitField is a help template for encoding and decode bitfield with 242 // BitField is a help template for encoding and decode bitfield with
243 // unsigned content. 243 // unsigned content.
244 template<class T, int shift, int size> 244 template<class T, int shift, int size>
245 class BitField { 245 class BitField {
246 public: 246 public:
247 // A uint32_t mask of bit field. To use all bits of a uint32 in a 247 // A uint32_t mask of bit field. To use all bits of a uint32 in a
248 // bitfield without compiler warnings we have to compute 2^32 without 248 // bitfield without compiler warnings we have to compute 2^32 without
249 // using a shift count of 32. 249 // using a shift count of 32.
250 static const uint32_t kMask = ((1U << shift) << size) - (1U << shift); 250 static const uint32_t kMask = ((1U << shift) << size) - (1U << shift);
251 static const uint32_t kShift = shift;
251 252
252 // Value for the field with all bits set. 253 // Value for the field with all bits set.
253 static const T kMax = static_cast<T>((1U << size) - 1); 254 static const T kMax = static_cast<T>((1U << size) - 1);
254 255
255 // Tells whether the provided value fits into the bit field. 256 // Tells whether the provided value fits into the bit field.
256 static bool is_valid(T value) { 257 static bool is_valid(T value) {
257 return (static_cast<uint32_t>(value) & ~static_cast<uint32_t>(kMax)) == 0; 258 return (static_cast<uint32_t>(value) & ~static_cast<uint32_t>(kMax)) == 0;
258 } 259 }
259 260
260 // Returns a uint32_t with the bit field value encoded. 261 // Returns a uint32_t with the bit field value encoded.
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 1023
1023 // Ever FunctionState starts with this id. 1024 // Ever FunctionState starts with this id.
1024 static const int kFirstUsableId = 4; 1025 static const int kFirstUsableId = 4;
1025 1026
1026 int id_; 1027 int id_;
1027 }; 1028 };
1028 1029
1029 } } // namespace v8::internal 1030 } } // namespace v8::internal
1030 1031
1031 #endif // V8_UTILS_H_ 1032 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698