Index: runtime/vm/snapshot.cc |
=================================================================== |
--- runtime/vm/snapshot.cc (revision 31413) |
+++ runtime/vm/snapshot.cc (working copy) |
@@ -167,12 +167,10 @@ |
RawObject* SnapshotReader::ReadObject() { |
- // Setup for long jump in case there is an exception while reading. |
- LongJump* base = isolate()->long_jump_base(); |
- LongJump jump; |
- isolate()->set_long_jump_base(&jump); |
const Instance& null_object = Instance::Handle(); |
*ErrorHandle() = UnhandledException::New(null_object, null_object); |
+ // Setup for long jump in case there is an exception while reading. |
+ LongJumpScope jump; |
if (setjmp(*jump.Set()) == 0) { |
Object& obj = Object::Handle(ReadObjectImpl()); |
for (intptr_t i = 0; i < backward_references_.length(); i++) { |
@@ -181,13 +179,11 @@ |
backward_references_[i]->set_state(kIsDeserialized); |
} |
} |
- isolate()->set_long_jump_base(base); |
return obj.raw(); |
} else { |
// An error occurred while reading, return the error object. |
const Error& err = Error::Handle(isolate()->object_store()->sticky_error()); |
isolate()->object_store()->clear_sticky_error(); |
- isolate()->set_long_jump_base(base); |
return err.raw(); |
} |
} |
@@ -1082,9 +1078,7 @@ |
// Setup for long jump in case there is an exception while writing |
// the snapshot. |
- LongJump* base = isolate->long_jump_base(); |
- LongJump jump; |
- isolate->set_long_jump_base(&jump); |
+ LongJumpScope jump; |
if (setjmp(*jump.Set()) == 0) { |
NoGCScope no_gc; |
@@ -1101,10 +1095,7 @@ |
FillHeader(kind()); |
UnmarkAll(); |
- |
- isolate->set_long_jump_base(base); |
} else { |
- isolate->set_long_jump_base(base); |
ThrowException(exception_type(), exception_msg()); |
} |
} |
@@ -1475,9 +1466,7 @@ |
// Setup for long jump in case there is an exception while writing |
// the snapshot. |
- LongJump* base = isolate->long_jump_base(); |
- LongJump jump; |
- isolate->set_long_jump_base(&jump); |
+ LongJumpScope jump; |
if (setjmp(*jump.Set()) == 0) { |
// Write out the library object. |
NoGCScope no_gc; |
@@ -1485,9 +1474,7 @@ |
WriteObject(lib.raw()); |
FillHeader(kind()); |
UnmarkAll(); |
- isolate->set_long_jump_base(base); |
} else { |
- isolate->set_long_jump_base(base); |
ThrowException(exception_type(), exception_msg()); |
} |
} |
@@ -1512,16 +1499,12 @@ |
// Setup for long jump in case there is an exception while writing |
// the message. |
- LongJump* base = isolate->long_jump_base(); |
- LongJump jump; |
- isolate->set_long_jump_base(&jump); |
+ LongJumpScope jump; |
if (setjmp(*jump.Set()) == 0) { |
NoGCScope no_gc; |
WriteObject(obj.raw()); |
UnmarkAll(); |
- isolate->set_long_jump_base(base); |
} else { |
- isolate->set_long_jump_base(base); |
ThrowException(exception_type(), exception_msg()); |
siva
2014/01/03 21:18:35
How does this work now for the ThrowException case
zra
2014/01/03 21:52:59
I see two options:
1. Treat this as a special case
siva
2014/01/04 00:04:22
I prefer the first.
We can add an assertion in Th
|
} |
} |