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

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

Issue 8528010: Changes to pass the current isolate to all runtime and native calls. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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/handles_test.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) 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 #include "vm/handles.h" 5 #include "vm/handles.h"
6 6
7 #include "vm/assert.h" 7 #include "vm/assert.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 63
64 int VMHandles::ZoneHandleCount() { 64 int VMHandles::ZoneHandleCount() {
65 Isolate* isolate = Isolate::Current(); 65 Isolate* isolate = Isolate::Current();
66 ASSERT(isolate->current_zone() != NULL); 66 ASSERT(isolate->current_zone() != NULL);
67 VMHandles* handles = isolate->current_zone()->handles(); 67 VMHandles* handles = isolate->current_zone()->handles();
68 return handles->CountZoneHandles(); 68 return handles->CountZoneHandles();
69 } 69 }
70 70
71 71
72 HandleScope::HandleScope() : StackResource() { 72 HandleScope::HandleScope(Isolate* isolate) : StackResource(isolate) {
73 ASSERT(isolate()->no_handle_scope_depth() == 0); 73 ASSERT(isolate->no_handle_scope_depth() == 0);
74 VMHandles* handles = isolate()->current_zone()->handles(); 74 VMHandles* handles = isolate->current_zone()->handles();
75 ASSERT(handles != NULL); 75 ASSERT(handles != NULL);
76 saved_handle_block_ = handles->scoped_blocks_; 76 saved_handle_block_ = handles->scoped_blocks_;
77 saved_handle_slot_ = handles->scoped_blocks_->next_handle_slot(); 77 saved_handle_slot_ = handles->scoped_blocks_->next_handle_slot();
78 #if defined(DEBUG) 78 #if defined(DEBUG)
79 link_ = isolate()->top_handle_scope(); 79 link_ = isolate->top_handle_scope();
80 isolate()->set_top_handle_scope(this); 80 isolate->set_top_handle_scope(this);
81 #endif 81 #endif
82 } 82 }
83 83
84 84
85 HandleScope::~HandleScope() { 85 HandleScope::~HandleScope() {
86 ASSERT(isolate()->current_zone() != NULL); 86 ASSERT(isolate()->current_zone() != NULL);
87 VMHandles* handles = isolate()->current_zone()->handles(); 87 VMHandles* handles = isolate()->current_zone()->handles();
88 ASSERT(handles != NULL); 88 ASSERT(handles != NULL);
89 handles->scoped_blocks_ = saved_handle_block_; 89 handles->scoped_blocks_ = saved_handle_block_;
90 handles->scoped_blocks_->set_next_handle_slot(saved_handle_slot_); 90 handles->scoped_blocks_->set_next_handle_slot(saved_handle_slot_);
91 #if defined(DEBUG) 91 #if defined(DEBUG)
92 handles->VerifyScopedHandleState(); 92 handles->VerifyScopedHandleState();
93 handles->ZapFreeScopedHandles(); 93 handles->ZapFreeScopedHandles();
94 ASSERT(isolate()->top_handle_scope() == this); 94 ASSERT(isolate()->top_handle_scope() == this);
95 isolate()->set_top_handle_scope(link_); 95 isolate()->set_top_handle_scope(link_);
96 #endif 96 #endif
97 } 97 }
98 98
99 99
100 #if defined(DEBUG) 100 #if defined(DEBUG)
101 NoHandleScope::NoHandleScope() : StackResource() { 101 NoHandleScope::NoHandleScope(Isolate* isolate) : StackResource(isolate) {
102 isolate()->IncrementNoHandleScopeDepth(); 102 isolate->IncrementNoHandleScopeDepth();
103 } 103 }
104 104
105 105
106 NoHandleScope::~NoHandleScope() { 106 NoHandleScope::~NoHandleScope() {
107 isolate()->DecrementNoHandleScopeDepth(); 107 isolate()->DecrementNoHandleScopeDepth();
108 } 108 }
109 #endif // defined(DEBUG) 109 #endif // defined(DEBUG)
110 110
111 } // namespace dart 111 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/handles.h ('k') | runtime/vm/handles_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698