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

Side by Side Diff: runtime/vm/handles.cc

Issue 269023005: - Ensure that BaseIsolate is only used to break the header include cycles. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 #include "vm/handles.h" 5 #include "vm/handles.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 74
75 int VMHandles::ZoneHandleCount() { 75 int VMHandles::ZoneHandleCount() {
76 Isolate* isolate = Isolate::Current(); 76 Isolate* isolate = Isolate::Current();
77 ASSERT(isolate->current_zone() != NULL); 77 ASSERT(isolate->current_zone() != NULL);
78 VMHandles* handles = isolate->current_zone()->handles(); 78 VMHandles* handles = isolate->current_zone()->handles();
79 return handles->CountZoneHandles(); 79 return handles->CountZoneHandles();
80 } 80 }
81 81
82 82
83 HandleScope::HandleScope(BaseIsolate* isolate) : StackResource(isolate) { 83 HandleScope::HandleScope(Isolate* isolate) : StackResource(isolate) {
84 ASSERT(isolate->no_handle_scope_depth() == 0); 84 ASSERT(isolate->no_handle_scope_depth() == 0);
85 VMHandles* handles = isolate->current_zone()->handles(); 85 VMHandles* handles = isolate->current_zone()->handles();
86 ASSERT(handles != NULL); 86 ASSERT(handles != NULL);
87 saved_handle_block_ = handles->scoped_blocks_; 87 saved_handle_block_ = handles->scoped_blocks_;
88 saved_handle_slot_ = handles->scoped_blocks_->next_handle_slot(); 88 saved_handle_slot_ = handles->scoped_blocks_->next_handle_slot();
89 #if defined(DEBUG) 89 #if defined(DEBUG)
90 link_ = isolate->top_handle_scope(); 90 link_ = isolate->top_handle_scope();
91 isolate->set_top_handle_scope(this); 91 isolate->set_top_handle_scope(this);
92 #endif 92 #endif
93 } 93 }
94 94
95 95
96 HandleScope::~HandleScope() { 96 HandleScope::~HandleScope() {
97 ASSERT(isolate()->current_zone() != NULL); 97 ASSERT(isolate()->current_zone() != NULL);
98 VMHandles* handles = isolate()->current_zone()->handles(); 98 VMHandles* handles = isolate()->current_zone()->handles();
99 ASSERT(handles != NULL); 99 ASSERT(handles != NULL);
100 handles->scoped_blocks_ = saved_handle_block_; 100 handles->scoped_blocks_ = saved_handle_block_;
101 handles->scoped_blocks_->set_next_handle_slot(saved_handle_slot_); 101 handles->scoped_blocks_->set_next_handle_slot(saved_handle_slot_);
102 #if defined(DEBUG) 102 #if defined(DEBUG)
103 handles->VerifyScopedHandleState(); 103 handles->VerifyScopedHandleState();
104 handles->ZapFreeScopedHandles(); 104 handles->ZapFreeScopedHandles();
105 ASSERT(isolate()->top_handle_scope() == this); 105 ASSERT(isolate()->top_handle_scope() == this);
106 isolate()->set_top_handle_scope(link_); 106 isolate()->set_top_handle_scope(link_);
107 #endif 107 #endif
108 } 108 }
109 109
110 110
111 #if defined(DEBUG) 111 #if defined(DEBUG)
112 NoHandleScope::NoHandleScope(BaseIsolate* isolate) : StackResource(isolate) { 112 NoHandleScope::NoHandleScope(Isolate* isolate) : StackResource(isolate) {
113 isolate->IncrementNoHandleScopeDepth(); 113 isolate->IncrementNoHandleScopeDepth();
114 } 114 }
115 115
116 116
117 NoHandleScope::NoHandleScope() : StackResource(Isolate::Current()) { 117 NoHandleScope::NoHandleScope() : StackResource(Isolate::Current()) {
118 isolate()->IncrementNoHandleScopeDepth(); 118 isolate()->IncrementNoHandleScopeDepth();
119 } 119 }
120 120
121 121
122 NoHandleScope::~NoHandleScope() { 122 NoHandleScope::~NoHandleScope() {
123 isolate()->DecrementNoHandleScopeDepth(); 123 isolate()->DecrementNoHandleScopeDepth();
124 } 124 }
125 #endif // defined(DEBUG) 125 #endif // defined(DEBUG)
126 126
127 } // namespace dart 127 } // namespace dart
OLDNEW
« runtime/vm/allocation.h ('K') | « runtime/vm/handles.h ('k') | runtime/vm/timer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698