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

Unified Diff: runtime/vm/isolate.cc

Issue 297413002: Ensure that failure to start an isolate all end up in the future. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Make test file be named *_test.dart Created 6 years, 7 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 1fcf7e48a10ae17d7bb08484dcd84ac8330cf6ac..37af7ce31714028f55e34b024eefc7f724654a15 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -591,14 +591,24 @@ static bool RunIsolate(uword parameter) {
Object& result = Object::Handle();
result = state->ResolveFunction();
bool is_spawn_uri = state->is_spawn_uri();
+
+ Instance& entryFunc = Instance::Handle(isolate);
if (result.IsError()) {
- StoreError(isolate, result);
- return false;
+ if (is_spawn_uri) {
+ // Report failure to look up "main" in isolate when we have a
+ // port to reply it to.
+ entryFunc ^= Object::null_instance().raw();
+ } else {
+ StoreError(isolate, result);
+ return false;
+ }
+ } else {
+ ASSERT(result.IsFunction());
+ Function& function = Function::Handle(isolate);
+ function ^= result.raw();
+ function = function.ImplicitClosureFunction();
+ entryFunc ^= function.ImplicitStaticClosure();
}
- ASSERT(result.IsFunction());
- Function& func = Function::Handle(isolate);
- func ^= result.raw();
- func = func.ImplicitClosureFunction();
// Instead of directly invoking the entry point we call '_startIsolate' with
// the entry point as argument. The '_startIsolate' function will
@@ -609,7 +619,7 @@ static bool RunIsolate(uword parameter) {
// "_startIsolate" function can act corresponding to how the isolate was
// created.
const Array& args = Array::Handle(Array::New(2));
- args.SetAt(0, Instance::Handle(func.ImplicitStaticClosure()));
+ args.SetAt(0, entryFunc);
args.SetAt(1, is_spawn_uri ? Bool::True() : Bool::False());
const Library& lib = Library::Handle(Library::IsolateLibrary());

Powered by Google App Engine
This is Rietveld 408576698