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

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

Issue 9148051: Provide API support for weak handles and post-mortem finalization. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments Created 8 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 | « runtime/vm/handles.h ('k') | runtime/vm/isolate.h » ('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_HANDLES_IMPL_H_ 5 #ifndef VM_HANDLES_IMPL_H_
6 #define VM_HANDLES_IMPL_H_ 6 #define VM_HANDLES_IMPL_H_
7 7
8 namespace dart { 8 namespace dart {
9 9
10 DECLARE_DEBUG_FLAG(bool, trace_handles_count); 10 DECLARE_DEBUG_FLAG(bool, trace_handles_count);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 296 }
297 } 297 }
298 298
299 299
300 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> 300 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
301 void Handles<kHandleSizeInWords, 301 void Handles<kHandleSizeInWords,
302 kHandlesPerChunk, 302 kHandlesPerChunk,
303 kOffsetOfRawPtr>::HandlesBlock::Visit(HandleVisitor* visitor) { 303 kOffsetOfRawPtr>::HandlesBlock::Visit(HandleVisitor* visitor) {
304 ASSERT(visitor != NULL); 304 ASSERT(visitor != NULL);
305 for (intptr_t i = 0; i < next_handle_slot_; i += kHandleSizeInWords) { 305 for (intptr_t i = 0; i < next_handle_slot_; i += kHandleSizeInWords) {
306 visitor->Visit(&data_[i + kOffsetOfRawPtr/kWordSize]); 306 visitor->VisitHandle(reinterpret_cast<uword>(&data_[i]));
307 } 307 }
308 } 308 }
309 309
310 310
311 #if defined(DEBUG) 311 #if defined(DEBUG)
312 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> 312 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
313 void Handles<kHandleSizeInWords, 313 void Handles<kHandleSizeInWords,
314 kHandlesPerChunk, 314 kHandlesPerChunk,
315 kOffsetOfRawPtr>::HandlesBlock::ZapFreeHandles() { 315 kOffsetOfRawPtr>::HandlesBlock::ZapFreeHandles() {
316 // Reinitialize the handle area to some uninitialized value. 316 // Reinitialize the handle area to some uninitialized value.
317 for (intptr_t i = next_handle_slot_; 317 for (intptr_t i = next_handle_slot_;
318 i < (kHandleSizeInWords * kHandlesPerChunk); 318 i < (kHandleSizeInWords * kHandlesPerChunk);
319 i++) { 319 i++) {
320 data_[i] = kZapUninitializedWord; 320 data_[i] = kZapUninitializedWord;
321 } 321 }
322 } 322 }
323 #endif 323 #endif
324 324
325 325
326 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> 326 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
327 int Handles<kHandleSizeInWords, 327 int Handles<kHandleSizeInWords,
328 kHandlesPerChunk, 328 kHandlesPerChunk,
329 kOffsetOfRawPtr>::HandlesBlock::HandleCount() const { 329 kOffsetOfRawPtr>::HandlesBlock::HandleCount() const {
330 return (next_handle_slot_ / kHandleSizeInWords); 330 return (next_handle_slot_ / kHandleSizeInWords);
331 } 331 }
332 332
333 } // namespace dart 333 } // namespace dart
334 334
335 #endif // VM_HANDLES_IMPL_H_ 335 #endif // VM_HANDLES_IMPL_H_
OLDNEW
« no previous file with comments | « runtime/vm/handles.h ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698