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

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

Issue 9169102: Add Dart_PropagateError. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Removed some unneeded includes Created 8 years, 10 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/isolate.h" 5 #include "vm/isolate.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/bigint_store.h" 9 #include "vm/bigint_store.h"
10 #include "vm/code_index_table.h" 10 #include "vm/code_index_table.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // main thread. 135 // main thread.
136 // TODO(5411455): Need to figure out how to set the stack limit for the 136 // TODO(5411455): Need to figure out how to set the stack limit for the
137 // main thread. 137 // main thread.
138 result->SetStackLimitFromCurrentTOS(reinterpret_cast<uword>(&result)); 138 result->SetStackLimitFromCurrentTOS(reinterpret_cast<uword>(&result));
139 result->set_main_port(PortMap::CreatePort()); 139 result->set_main_port(PortMap::CreatePort());
140 result->BuildName(name_prefix); 140 result->BuildName(name_prefix);
141 141
142 result->debugger_ = new Debugger(); 142 result->debugger_ = new Debugger();
143 result->debugger_->Initialize(result); 143 result->debugger_->Initialize(result);
144 if (FLAG_trace_isolates) { 144 if (FLAG_trace_isolates) {
145 if (strcmp(name_prefix, "vm-isolate") != 0) { 145 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) {
146 OS::Print("[+] Starting isolate:\n" 146 OS::Print("[+] Starting isolate:\n"
147 "\tisolate: %s\n", result->name()); 147 "\tisolate: %s\n", result->name());
148 } 148 }
149 } 149 }
150 return result; 150 return result;
151 } 151 }
152 152
153 153
154 void Isolate::BuildName(const char* name_prefix) { 154 void Isolate::BuildName(const char* name_prefix) {
155 ASSERT(name_ == NULL); 155 ASSERT(name_ == NULL);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 319
320 // Read object back from the snapshot. 320 // Read object back from the snapshot.
321 SnapshotReader reader(snapshot, Isolate::Current()); 321 SnapshotReader reader(snapshot, Isolate::Current());
322 Instance& instance = Instance::Handle(); 322 Instance& instance = Instance::Handle();
323 instance ^= reader.ReadObject(); 323 instance ^= reader.ReadObject();
324 return instance.raw(); 324 return instance.raw();
325 } 325 }
326 326
327 327
328 328
329 RawObject* Isolate::StandardRunLoop() { 329 RawError* Isolate::StandardRunLoop() {
330 ASSERT(long_jump_base() != NULL);
331 ASSERT(post_message_callback() == &StandardPostMessageCallback); 330 ASSERT(post_message_callback() == &StandardPostMessageCallback);
332 ASSERT(close_port_callback() == &StandardClosePortCallback); 331 ASSERT(close_port_callback() == &StandardClosePortCallback);
333 332
334 while (live_ports() > 0) { 333 while (live_ports() > 0) {
335 ASSERT(this == Isolate::Current()); 334 ASSERT(this == Isolate::Current());
336 Zone zone(this); 335 Zone zone(this);
337 HandleScope handle_scope(this); 336 HandleScope handle_scope(this);
338 337
339 PortMessage* message = message_queue()->Dequeue(0); 338 PortMessage* message = message_queue()->Dequeue(0);
340 if (message != NULL) { 339 if (message != NULL) {
341 const Instance& msg = 340 const Instance& msg =
342 Instance::Handle(DeserializeMessage(message->data())); 341 Instance::Handle(DeserializeMessage(message->data()));
343 const Object& result = Object::Handle( 342 const Object& result = Object::Handle(
344 DartLibraryCalls::HandleMessage( 343 DartLibraryCalls::HandleMessage(
345 message->dest_port(), message->reply_port(), msg)); 344 message->dest_port(), message->reply_port(), msg));
346 delete message; 345 delete message;
347 if (result.IsUnhandledException()) { 346 if (result.IsError()) {
348 return result.raw(); 347 Error& error = Error::Handle();
348 error ^= result.raw();
349 return error.raw();
349 } 350 }
350 } 351 }
351 } 352 }
352 353
353 // Indicates success. 354 // Indicates success.
354 return Object::null(); 355 return Error::null();
355 } 356 }
356 357
357 358
358 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, 359 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor,
359 bool validate_frames) { 360 bool validate_frames) {
360 ASSERT(visitor != NULL); 361 ASSERT(visitor != NULL);
361 362
362 // Visit objects in the object store. 363 // Visit objects in the object store.
363 object_store()->VisitObjectPointers(visitor); 364 object_store()->VisitObjectPointers(visitor);
364 365
(...skipping 29 matching lines...) Expand all
394 } 395 }
395 396
396 397
397 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) { 398 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) {
398 if (api_state() != NULL) { 399 if (api_state() != NULL) {
399 api_state()->VisitWeakHandles(visitor); 400 api_state()->VisitWeakHandles(visitor);
400 } 401 }
401 } 402 }
402 403
403 } // namespace dart 404 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698