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

Side by Side Diff: runtime/vm/bitfield.h

Issue 868283002: Fix LoadOptimizer's handling of load/stores with constant indices for TypedData. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 | « no previous file | runtime/vm/flow_graph_optimizer.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 VM_BITFIELD_H_ 5 #ifndef VM_BITFIELD_H_
6 #define VM_BITFIELD_H_ 6 #define VM_BITFIELD_H_
7 7
8 namespace dart { 8 namespace dart {
9 9
10 static const uword kUwordOne = 1U; 10 static const uword kUwordOne = 1U;
11 11
12 // BitField is a template for encoding and decoding a bit field inside 12 // BitField is a template for encoding and decoding a bit field inside
13 // an unsigned machine word. 13 // an unsigned machine word.
14 template<typename T, int position, int size> 14 template<typename T, int position, int size>
15 class BitField { 15 class BitField {
16 public: 16 public:
17 static const intptr_t kNextBit = position + size;
18
17 // Tells whether the provided value fits into the bit field. 19 // Tells whether the provided value fits into the bit field.
18 static bool is_valid(T value) { 20 static bool is_valid(T value) {
19 return (static_cast<uword>(value) & ~((kUwordOne << size) - 1)) == 0; 21 return (static_cast<uword>(value) & ~((kUwordOne << size) - 1)) == 0;
20 } 22 }
21 23
22 // Returns a uword mask of the bit field. 24 // Returns a uword mask of the bit field.
23 static uword mask() { 25 static uword mask() {
24 return (kUwordOne << size) - 1; 26 return (kUwordOne << size) - 1;
25 } 27 }
26 28
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 static uword update(T value, uword original) { 60 static uword update(T value, uword original) {
59 ASSERT(is_valid(value)); 61 ASSERT(is_valid(value));
60 return (static_cast<uword>(value) << position) | 62 return (static_cast<uword>(value) << position) |
61 (~mask_in_place() & original); 63 (~mask_in_place() & original);
62 } 64 }
63 }; 65 };
64 66
65 } // namespace dart 67 } // namespace dart
66 68
67 #endif // VM_BITFIELD_H_ 69 #endif // VM_BITFIELD_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698