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

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

Issue 15950010: Inline handle allocation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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.cc ('k') | no next file » | 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) 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_HANDLES_IMPL_H_ 5 #ifndef VM_HANDLES_IMPL_H_
6 #define VM_HANDLES_IMPL_H_ 6 #define VM_HANDLES_IMPL_H_
7 7
8 #include "vm/heap.h" 8 #include "vm/heap.h"
9 #include "vm/visitor.h" 9 #include "vm/visitor.h"
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 block = block->next_block(); 81 block = block->next_block();
82 } while (block != NULL); 82 } while (block != NULL);
83 } 83 }
84 84
85 85
86 // Figure out the current handle scope using the current Isolate and 86 // Figure out the current handle scope using the current Isolate and
87 // allocate a handle in that scope. The function assumes that a 87 // allocate a handle in that scope. The function assumes that a
88 // current Isolate, current zone and current handle scope exist. It 88 // current Isolate, current zone and current handle scope exist. It
89 // asserts for this appropriately. 89 // asserts for this appropriately.
90 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> 90 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
91 uword Handles<kHandleSizeInWords, 91 inline uword Handles<kHandleSizeInWords,
92 kHandlesPerChunk, 92 kHandlesPerChunk,
93 kOffsetOfRawPtr>::AllocateHandle(Isolate* isolate) { 93 kOffsetOfRawPtr>::AllocateHandle(Isolate* isolate) {
94 ASSERT(isolate != NULL); 94 ASSERT(isolate != NULL);
95 ASSERT(isolate->current_zone() != NULL); 95 ASSERT(isolate->current_zone() != NULL);
96 ASSERT(isolate->top_handle_scope() != NULL); 96 ASSERT(isolate->top_handle_scope() != NULL);
97 ASSERT(isolate->no_handle_scope_depth() == 0); 97 ASSERT(isolate->no_handle_scope_depth() == 0);
98 Handles* handles = isolate->current_zone()->handles(); 98 Handles* handles = isolate->current_zone()->handles();
99 ASSERT(handles != NULL); 99 ASSERT(handles != NULL);
100 return handles->AllocateScopedHandle(); 100 return handles->AllocateScopedHandle();
101 } 101 }
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 #endif 380 #endif
381 381
382 382
383 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> 383 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
384 int Handles<kHandleSizeInWords, 384 int Handles<kHandleSizeInWords,
385 kHandlesPerChunk, 385 kHandlesPerChunk,
386 kOffsetOfRawPtr>::HandlesBlock::HandleCount() const { 386 kOffsetOfRawPtr>::HandlesBlock::HandleCount() const {
387 return (next_handle_slot_ / kHandleSizeInWords); 387 return (next_handle_slot_ / kHandleSizeInWords);
388 } 388 }
389 389
390
391 inline uword VMHandles::AllocateHandle(Isolate* isolate) {
392 return Handles<kVMHandleSizeInWords,
393 kVMHandlesPerChunk,
394 kOffsetOfRawPtr>::AllocateHandle(isolate);
395 }
396
390 } // namespace dart 397 } // namespace dart
391 398
392 #endif // VM_HANDLES_IMPL_H_ 399 #endif // VM_HANDLES_IMPL_H_
OLDNEW
« no previous file with comments | « runtime/vm/handles.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698