| OLD | NEW |
| 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 "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/bootstrap_natives.h" | 6 #include "vm/bootstrap_natives.h" |
| 7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/dart.h" | 8 #include "vm/dart.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 isolate->set_spawn_data(NULL); | 114 isolate->set_spawn_data(NULL); |
| 115 char* library_url = data->library_url_; | 115 char* library_url = data->library_url_; |
| 116 char* class_name = data->class_name_; | 116 char* class_name = data->class_name_; |
| 117 intptr_t port_id = data->port_id_; | 117 intptr_t port_id = data->port_id_; |
| 118 delete data; | 118 delete data; |
| 119 | 119 |
| 120 { | 120 { |
| 121 StartIsolateScope start_scope(isolate); | 121 StartIsolateScope start_scope(isolate); |
| 122 Zone zone(isolate); | 122 Zone zone(isolate); |
| 123 HandleScope handle_scope(isolate); | 123 HandleScope handle_scope(isolate); |
| 124 ASSERT(ClassFinalizer::FinalizePendingClasses()); | 124 ASSERT(ClassFinalizer::AllClassesFinalized()); |
| 125 // Lookup the target class by name, create an instance and call the run | 125 // Lookup the target class by name, create an instance and call the run |
| 126 // method. | 126 // method. |
| 127 const String& lib_name = String::Handle(String::NewSymbol(library_url)); | 127 const String& lib_name = String::Handle(String::NewSymbol(library_url)); |
| 128 free(library_url); | 128 free(library_url); |
| 129 const Library& lib = Library::Handle(Library::LookupLibrary(lib_name)); | 129 const Library& lib = Library::Handle(Library::LookupLibrary(lib_name)); |
| 130 ASSERT(!lib.IsNull()); | 130 ASSERT(!lib.IsNull()); |
| 131 const String& cls_name = String::Handle(String::NewSymbol(class_name)); | 131 const String& cls_name = String::Handle(String::NewSymbol(class_name)); |
| 132 free(class_name); | 132 free(class_name); |
| 133 const Class& target_class = Class::Handle(lib.LookupClass(cls_name)); | 133 const Class& target_class = Class::Handle(lib.LookupClass(cls_name)); |
| 134 // TODO(iposva): Deserialize or call the constructor after allocating. | 134 // TODO(iposva): Deserialize or call the constructor after allocating. |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 | 542 |
| 543 | 543 |
| 544 static bool RunIsolate2(uword parameter) { | 544 static bool RunIsolate2(uword parameter) { |
| 545 Isolate* isolate = reinterpret_cast<Isolate*>(parameter); | 545 Isolate* isolate = reinterpret_cast<Isolate*>(parameter); |
| 546 SpawnState* state = reinterpret_cast<SpawnState*>(isolate->spawn_data()); | 546 SpawnState* state = reinterpret_cast<SpawnState*>(isolate->spawn_data()); |
| 547 isolate->set_spawn_data(NULL); | 547 isolate->set_spawn_data(NULL); |
| 548 { | 548 { |
| 549 StartIsolateScope start_scope(isolate); | 549 StartIsolateScope start_scope(isolate); |
| 550 Zone zone(isolate); | 550 Zone zone(isolate); |
| 551 HandleScope handle_scope(isolate); | 551 HandleScope handle_scope(isolate); |
| 552 ASSERT(ClassFinalizer::FinalizePendingClasses()); | 552 if (!ClassFinalizer::FinalizePendingClasses()) { |
| 553 // Error is in sticky error already. |
| 554 return false; |
| 555 } |
| 553 Object& result = Object::Handle(); | 556 Object& result = Object::Handle(); |
| 554 | 557 |
| 555 result = state->ResolveFunction(); | 558 result = state->ResolveFunction(); |
| 556 delete state; | 559 delete state; |
| 557 state = NULL; | 560 state = NULL; |
| 558 if (result.IsError()) { | 561 if (result.IsError()) { |
| 559 StoreError(isolate, result); | 562 StoreError(isolate, result); |
| 560 return false; | 563 return false; |
| 561 } | 564 } |
| 562 ASSERT(result.IsFunction()); | 565 ASSERT(result.IsFunction()); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 | 647 |
| 645 DEFINE_NATIVE_ENTRY(isolate_getPortInternal, 0) { | 648 DEFINE_NATIVE_ENTRY(isolate_getPortInternal, 0) { |
| 646 const Object& port = Object::Handle(ReceivePortCreate(isolate->main_port())); | 649 const Object& port = Object::Handle(ReceivePortCreate(isolate->main_port())); |
| 647 if (port.IsError()) { | 650 if (port.IsError()) { |
| 648 Exceptions::PropagateError(port); | 651 Exceptions::PropagateError(port); |
| 649 } | 652 } |
| 650 arguments->SetReturn(port); | 653 arguments->SetReturn(port); |
| 651 } | 654 } |
| 652 | 655 |
| 653 } // namespace dart | 656 } // namespace dart |
| OLD | NEW |