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

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

Issue 868913002: Add Zone-based handle allocation interface and reduce use of Isolate-based interfaces. (Closed) Base URL: http://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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_BIT_VECTOR_H_ 5 #ifndef VM_BIT_VECTOR_H_
6 #define VM_BIT_VECTOR_H_ 6 #define VM_BIT_VECTOR_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/zone.h" 10 #include "vm/zone.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 friend class BitVector; 44 friend class BitVector;
45 }; 45 };
46 46
47 BitVector(Zone* zone, intptr_t length) 47 BitVector(Zone* zone, intptr_t length)
48 : length_(length), 48 : length_(length),
49 data_length_(SizeFor(length)), 49 data_length_(SizeFor(length)),
50 data_(zone->Alloc<uword>(data_length_)) { 50 data_(zone->Alloc<uword>(data_length_)) {
51 Clear(); 51 Clear();
52 } 52 }
53 53
54 // DEPRECATED: Use Zone version.
55 BitVector(Isolate* isolate, intptr_t length)
56 : length_(length),
57 data_length_(SizeFor(length)),
58 data_(isolate->current_zone()->Alloc<uword>(data_length_)) {
59 Clear();
60 }
61
62 void CopyFrom(const BitVector* other) { 54 void CopyFrom(const BitVector* other) {
63 Clear(); 55 Clear();
64 AddAll(other); 56 AddAll(other);
65 } 57 }
66 58
67 static intptr_t SizeFor(intptr_t length) { 59 static intptr_t SizeFor(intptr_t length) {
68 return 1 + ((length - 1) / kBitsPerWord); 60 return 1 + ((length - 1) / kBitsPerWord);
69 } 61 }
70 62
71 void Add(intptr_t i) { 63 void Add(intptr_t i) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 intptr_t length_; 110 intptr_t length_;
119 intptr_t data_length_; 111 intptr_t data_length_;
120 uword* data_; 112 uword* data_;
121 113
122 DISALLOW_COPY_AND_ASSIGN(BitVector); 114 DISALLOW_COPY_AND_ASSIGN(BitVector);
123 }; 115 };
124 116
125 } // namespace dart 117 } // namespace dart
126 118
127 #endif // VM_BIT_VECTOR_H_ 119 #endif // VM_BIT_VECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698