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

Unified Diff: runtime/vm/isolate.cc

Issue 27215002: Very simple version of Isolates. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update spawnUri description. Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index d8ab9a53852f0d8d4789fda623e5a59226beacad..0b740c4ea1645c289944b4b0894a3de4ea9d8d14 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -510,6 +510,7 @@ static bool RunIsolate(uword parameter) {
Object& result = Object::Handle();
result = state->ResolveFunction();
+ bool is_function_spawn = state->library_url() != NULL;
delete state;
state = NULL;
if (result.IsError()) {
@@ -519,7 +520,19 @@ static bool RunIsolate(uword parameter) {
ASSERT(result.IsFunction());
Function& func = Function::Handle(isolate);
func ^= result.raw();
- result = DartEntry::InvokeFunction(func, Object::empty_array());
+ func = func.ImplicitClosureFunction();
+
+ const Array& args = Array::Handle(Array::New(2));
+ args.SetAt(0, Instance::Handle(func.ImplicitStaticClosure()));
+ args.SetAt(1, is_function_spawn ? Bool::True() : Bool::False());
+
+ const Library& lib = Library::Handle(Library::IsolateLibrary());
+ const String& entry_name = String::Handle(String::New("_startIsolate"));
+ const Function& entry_point =
+ Function::Handle(lib.LookupLocalFunction(entry_name));
+ ASSERT(entry_point.IsFunction() && !entry_point.IsNull());
+
+ result = DartEntry::InvokeFunction(entry_point, args);
if (result.IsError()) {
StoreError(isolate, result);
return false;
@@ -977,8 +990,7 @@ static char* GetRootScriptUri(Isolate* isolate) {
}
-IsolateSpawnState::IsolateSpawnState(const Function& func,
- const Function& callback_func)
+IsolateSpawnState::IsolateSpawnState(const Function& func)
: isolate_(NULL),
script_url_(NULL),
library_url_(NULL),
@@ -993,12 +1005,7 @@ IsolateSpawnState::IsolateSpawnState(const Function& func,
const String& func_name = String::Handle(func.name());
function_name_ = strdup(func_name.ToCString());
- if (!callback_func.IsNull()) {
- const String& callback_name = String::Handle(callback_func.name());
- exception_callback_name_ = strdup(callback_name.ToCString());
- } else {
- exception_callback_name_ = strdup("_unhandledExceptionCallback");
- }
+ exception_callback_name_ = strdup("_unhandledExceptionCallback");
}

Powered by Google App Engine
This is Rietveld 408576698