OLD | NEW |
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/isolate.h" | 5 #include "vm/isolate.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #include "vm/assert.h" | 9 #include "vm/assert.h" |
10 #include "vm/bigint_store.h" | 10 #include "vm/bigint_store.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 return -1; | 155 return -1; |
156 } else if ((*a)->invocation_counter() < (*b)->invocation_counter()) { | 156 } else if ((*a)->invocation_counter() < (*b)->invocation_counter()) { |
157 return 1; | 157 return 1; |
158 } else { | 158 } else { |
159 return 0; | 159 return 0; |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 | 163 |
164 void Isolate::PrintInvokedFunctions() { | 164 void Isolate::PrintInvokedFunctions() { |
165 Zone zone; | 165 ASSERT(this == Isolate::Current()); |
166 HandleScope handle_scope; | 166 Zone zone(this); |
| 167 HandleScope handle_scope(this); |
167 Library& library = Library::Handle(); | 168 Library& library = Library::Handle(); |
168 library = object_store()->registered_libraries(); | 169 library = object_store()->registered_libraries(); |
169 GrowableArray<const Function*> invoked_functions; | 170 GrowableArray<const Function*> invoked_functions; |
170 while (!library.IsNull()) { | 171 while (!library.IsNull()) { |
171 Class& cls = Class::Handle(); | 172 Class& cls = Class::Handle(); |
172 ClassDictionaryIterator iter(library); | 173 ClassDictionaryIterator iter(library); |
173 while (iter.HasNext()) { | 174 while (iter.HasNext()) { |
174 cls = iter.GetNextClass(); | 175 cls = iter.GetNextClass(); |
175 const Array& functions = Array::Handle(cls.functions()); | 176 const Array& functions = Array::Handle(cls.functions()); |
176 // Class 'Dynamic' is allocated/initialized in a special way, leaving | 177 // Class 'Dynamic' is allocated/initialized in a special way, leaving |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 return init_callback_; | 235 return init_callback_; |
235 } | 236 } |
236 | 237 |
237 | 238 |
238 void Isolate::StandardRunLoop() { | 239 void Isolate::StandardRunLoop() { |
239 ASSERT(long_jump_base() != NULL); | 240 ASSERT(long_jump_base() != NULL); |
240 ASSERT(post_message_callback() == &StandardPostMessageCallback); | 241 ASSERT(post_message_callback() == &StandardPostMessageCallback); |
241 ASSERT(close_port_callback() == &StandardClosePortCallback); | 242 ASSERT(close_port_callback() == &StandardClosePortCallback); |
242 | 243 |
243 while (active_ports() > 0) { | 244 while (active_ports() > 0) { |
244 Zone zone; | 245 ASSERT(this == Isolate::Current()); |
245 HandleScope handle_scope; | 246 Zone zone(this); |
| 247 HandleScope handle_scope(this); |
246 | 248 |
247 PortMessage* message = message_queue()->Dequeue(0); | 249 PortMessage* message = message_queue()->Dequeue(0); |
248 if (message != NULL) { | 250 if (message != NULL) { |
249 Dart_Handle result = Dart_HandleMessage( | 251 Dart_Handle result = Dart_HandleMessage( |
250 message->dest_port(), message->reply_port(), message->data()); | 252 message->dest_port(), message->reply_port(), message->data()); |
251 if (Dart_IsError(result)) { | 253 if (Dart_IsError(result)) { |
252 fprintf(stderr, "%s\n", Dart_GetError(result)); | 254 fprintf(stderr, "%s\n", Dart_GetError(result)); |
253 exit(255); | 255 exit(255); |
254 } | 256 } |
255 delete message; | 257 delete message; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // Visit all objects in the code index table. | 289 // Visit all objects in the code index table. |
288 if (code_index_table() != NULL) { | 290 if (code_index_table() != NULL) { |
289 code_index_table()->VisitObjectPointers(visitor); | 291 code_index_table()->VisitObjectPointers(visitor); |
290 } | 292 } |
291 | 293 |
292 // Visit the top context which is stored in the isolate. | 294 // Visit the top context which is stored in the isolate. |
293 visitor->VisitPointer(reinterpret_cast<RawObject**>(&top_context_)); | 295 visitor->VisitPointer(reinterpret_cast<RawObject**>(&top_context_)); |
294 } | 296 } |
295 | 297 |
296 } // namespace dart | 298 } // namespace dart |
OLD | NEW |