| 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/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
| 6 | 6 |
| 7 #include "vm/assert.h" | 7 #include "vm/assert.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/dart.h" | 9 #include "vm/dart.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 Isolate::SetCurrent(isolate); | 141 Isolate::SetCurrent(isolate); |
| 142 // Intialize stack limit in case we are running isolate in a | 142 // Intialize stack limit in case we are running isolate in a |
| 143 // different thread than in which it was initialized. | 143 // different thread than in which it was initialized. |
| 144 isolate->SetStackLimitFromCurrentTOS(reinterpret_cast<uword>(&isolate)); | 144 isolate->SetStackLimitFromCurrentTOS(reinterpret_cast<uword>(&isolate)); |
| 145 LongJump* base = isolate->long_jump_base(); | 145 LongJump* base = isolate->long_jump_base(); |
| 146 LongJump jump; | 146 LongJump jump; |
| 147 isolate->set_long_jump_base(&jump); | 147 isolate->set_long_jump_base(&jump); |
| 148 if (setjmp(*jump.Set()) == 0) { | 148 if (setjmp(*jump.Set()) == 0) { |
| 149 Zone zone; | 149 Zone zone; |
| 150 HandleScope handle_scope; | 150 HandleScope handle_scope; |
| 151 ASSERT(ClassFinalizer::AllClassesFinalized()); | 151 ASSERT(ClassFinalizer::FinalizePendingClasses()); |
| 152 // Lookup the target class by name, create an instance and call the run | 152 // Lookup the target class by name, create an instance and call the run |
| 153 // method. | 153 // method. |
| 154 const String& lib_name = String::Handle(String::NewSymbol(library_url)); | 154 const String& lib_name = String::Handle(String::NewSymbol(library_url)); |
| 155 const Library& lib = Library::Handle(Library::LookupLibrary(lib_name)); | 155 const Library& lib = Library::Handle(Library::LookupLibrary(lib_name)); |
| 156 ASSERT(!lib.IsNull()); | 156 ASSERT(!lib.IsNull()); |
| 157 const String& cls_name = String::Handle(String::NewSymbol(class_name)); | 157 const String& cls_name = String::Handle(String::NewSymbol(class_name)); |
| 158 const Class& target_class = Class::Handle(lib.LookupClass(cls_name)); | 158 const Class& target_class = Class::Handle(lib.LookupClass(cls_name)); |
| 159 // TODO(iposva): Deserialize or call the constructor after allocating. | 159 // TODO(iposva): Deserialize or call the constructor after allocating. |
| 160 // For now, we only support a non-parameterized or raw target class. | 160 // For now, we only support a non-parameterized or raw target class. |
| 161 const Instance& target = Instance::Handle(Instance::New(target_class)); | 161 const Instance& target = Instance::Handle(Instance::New(target_class)); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 216 } |
| 217 isolate->set_long_jump_base(base); | 217 isolate->set_long_jump_base(base); |
| 218 Dart::ShutdownIsolate(); | 218 Dart::ShutdownIsolate(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 | 221 |
| 222 static bool CheckArguments(const char* library_url, const char* class_name) { | 222 static bool CheckArguments(const char* library_url, const char* class_name) { |
| 223 Zone zone; | 223 Zone zone; |
| 224 HandleScope handle_scope; | 224 HandleScope handle_scope; |
| 225 String& name = String::Handle(); | 225 String& name = String::Handle(); |
| 226 if (!ClassFinalizer::FinalizeAllClasses()) { | 226 if (!ClassFinalizer::FinalizePendingClasses()) { |
| 227 return false; | 227 return false; |
| 228 } | 228 } |
| 229 // Lookup the target class by name, create an instance and call the run | 229 // Lookup the target class by name, create an instance and call the run |
| 230 // method. | 230 // method. |
| 231 name ^= String::NewSymbol(library_url); | 231 name ^= String::NewSymbol(library_url); |
| 232 const Library& lib = Library::Handle(Library::LookupLibrary(name)); | 232 const Library& lib = Library::Handle(Library::LookupLibrary(name)); |
| 233 if (lib.IsNull()) { | 233 if (lib.IsNull()) { |
| 234 const String& error = String::Handle( | 234 const String& error = String::Handle( |
| 235 String::New("Error starting Isolate, library not loaded : ")); | 235 String::New("Error starting Isolate, library not loaded : ")); |
| 236 Isolate::Current()->object_store()->set_sticky_error(error); | 236 Isolate::Current()->object_store()->set_sticky_error(error); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 intptr_t send_id = Smi::CheckedHandle(arguments->At(0)).Value(); | 346 intptr_t send_id = Smi::CheckedHandle(arguments->At(0)).Value(); |
| 347 intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value(); | 347 intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value(); |
| 348 // TODO(iposva): Allow for arbitrary messages to be sent. | 348 // TODO(iposva): Allow for arbitrary messages to be sent. |
| 349 void* data = SerializeObject(Instance::CheckedHandle(arguments->At(2))); | 349 void* data = SerializeObject(Instance::CheckedHandle(arguments->At(2))); |
| 350 | 350 |
| 351 // TODO(turnidge): Throw an exception when the return value is false? | 351 // TODO(turnidge): Throw an exception when the return value is false? |
| 352 PortMap::PostMessage(send_id, reply_id, data); | 352 PortMap::PostMessage(send_id, reply_id, data); |
| 353 } | 353 } |
| 354 | 354 |
| 355 } // namespace dart | 355 } // namespace dart |
| OLD | NEW |