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

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

Issue 19974002: Reuse the top ApiLocalScope so that we do not allocate and free an ApiLocalScope (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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/zone.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) 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 // Visit all scoped handles. 60 // Visit all scoped handles.
61 block = &first_scoped_block_; 61 block = &first_scoped_block_;
62 do { 62 do {
63 block->Visit(visitor); 63 block->Visit(visitor);
64 block = block->next_block(); 64 block = block->next_block();
65 } while (block != NULL); 65 } while (block != NULL);
66 } 66 }
67 67
68 68
69 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
70 void Handles<kHandleSizeInWords,
71 kHandlesPerChunk,
72 kOffsetOfRawPtr>::Reset() {
73 // Delete all the extra zone handle blocks allocated and reinit the first
74 // zone block.
75 if (zone_blocks_ != NULL) {
76 DeleteHandleBlocks(zone_blocks_->next_block());
77 zone_blocks_->ReInit();
78 }
79
80 // Delete all the extra scoped handle blocks allocated and reinit the first
81 // scoped block.
82 DeleteHandleBlocks(first_scoped_block_.next_block());
83 first_scoped_block_.ReInit();
84 scoped_blocks_ = &first_scoped_block_;
85 }
86
87
69 // Figure out the current handle scope using the current Isolate and 88 // Figure out the current handle scope using the current Isolate and
70 // allocate a handle in that scope. The function assumes that a 89 // allocate a handle in that scope. The function assumes that a
71 // current Isolate, current zone and current handle scope exist. It 90 // current Isolate, current zone and current handle scope exist. It
72 // asserts for this appropriately. 91 // asserts for this appropriately.
73 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> 92 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
74 uword Handles<kHandleSizeInWords, 93 uword Handles<kHandleSizeInWords,
75 kHandlesPerChunk, 94 kHandlesPerChunk,
76 kOffsetOfRawPtr>::AllocateHandle(Isolate* isolate) { 95 kOffsetOfRawPtr>::AllocateHandle(Isolate* isolate) {
77 ASSERT(isolate != NULL); 96 ASSERT(isolate != NULL);
78 ASSERT(isolate->current_zone() != NULL); 97 ASSERT(isolate->current_zone() != NULL);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> 367 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
349 int Handles<kHandleSizeInWords, 368 int Handles<kHandleSizeInWords,
350 kHandlesPerChunk, 369 kHandlesPerChunk,
351 kOffsetOfRawPtr>::HandlesBlock::HandleCount() const { 370 kOffsetOfRawPtr>::HandlesBlock::HandleCount() const {
352 return (next_handle_slot_ / kHandleSizeInWords); 371 return (next_handle_slot_ / kHandleSizeInWords);
353 } 372 }
354 373
355 } // namespace dart 374 } // namespace dart
356 375
357 #endif // VM_HANDLES_IMPL_H_ 376 #endif // VM_HANDLES_IMPL_H_
OLDNEW
« no previous file with comments | « runtime/vm/handles.h ('k') | runtime/vm/zone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698