OLD | NEW |
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 RUNTIME_VM_CLASS_TABLE_H_ | 5 #ifndef RUNTIME_VM_CLASS_TABLE_H_ |
6 #define RUNTIME_VM_CLASS_TABLE_H_ | 6 #define RUNTIME_VM_CLASS_TABLE_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/atomic.h" |
9 #include "vm/bitfield.h" | 10 #include "vm/bitfield.h" |
10 #include "vm/globals.h" | 11 #include "vm/globals.h" |
11 | 12 |
12 namespace dart { | 13 namespace dart { |
13 | 14 |
14 class Class; | 15 class Class; |
15 class ClassStats; | 16 class ClassStats; |
16 class JSONArray; | 17 class JSONArray; |
17 class JSONObject; | 18 class JSONObject; |
18 class JSONStream; | 19 class JSONStream; |
(...skipping 10 matching lines...) Expand all Loading... |
29 T new_size; | 30 T new_size; |
30 T old_count; | 31 T old_count; |
31 T old_size; | 32 T old_size; |
32 | 33 |
33 void ResetNew() { | 34 void ResetNew() { |
34 new_count = 0; | 35 new_count = 0; |
35 new_size = 0; | 36 new_size = 0; |
36 } | 37 } |
37 | 38 |
38 void AddNew(T size) { | 39 void AddNew(T size) { |
39 new_count++; | 40 AtomicOperations::IncrementBy(&new_count, 1); |
40 new_size += size; | 41 AtomicOperations::IncrementBy(&new_size, size); |
41 } | 42 } |
42 | 43 |
43 void ResetOld() { | 44 void ResetOld() { |
44 old_count = 0; | 45 old_count = 0; |
45 old_size = 0; | 46 old_size = 0; |
46 } | 47 } |
47 | 48 |
48 void AddOld(T size, T count = 1) { | 49 void AddOld(T size, T count = 1) { |
49 old_count += count; | 50 AtomicOperations::IncrementBy(&old_count, count); |
50 old_size += size; | 51 AtomicOperations::IncrementBy(&old_size, size); |
51 } | 52 } |
52 | 53 |
53 void Reset() { | 54 void Reset() { |
54 new_count = 0; | 55 new_count = 0; |
55 new_size = 0; | 56 new_size = 0; |
56 old_count = 0; | 57 old_count = 0; |
57 old_size = 0; | 58 old_size = 0; |
58 } | 59 } |
59 | 60 |
60 // For classes with fixed instance size we do not emit code to update | 61 // For classes with fixed instance size we do not emit code to update |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 void UpdateLiveOld(intptr_t cid, intptr_t size, intptr_t count = 1); | 266 void UpdateLiveOld(intptr_t cid, intptr_t size, intptr_t count = 1); |
266 void UpdateLiveNew(intptr_t cid, intptr_t size); | 267 void UpdateLiveNew(intptr_t cid, intptr_t size); |
267 #endif // !PRODUCT | 268 #endif // !PRODUCT |
268 | 269 |
269 DISALLOW_COPY_AND_ASSIGN(ClassTable); | 270 DISALLOW_COPY_AND_ASSIGN(ClassTable); |
270 }; | 271 }; |
271 | 272 |
272 } // namespace dart | 273 } // namespace dart |
273 | 274 |
274 #endif // RUNTIME_VM_CLASS_TABLE_H_ | 275 #endif // RUNTIME_VM_CLASS_TABLE_H_ |
OLD | NEW |