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

Unified Diff: runtime/vm/snapshot.cc

Issue 388963003: Avoid allocating an exception object in the snapshot reader. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comments Created 6 years, 5 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
« no previous file with comments | « runtime/vm/snapshot.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot.cc
===================================================================
--- runtime/vm/snapshot.cc (revision 38227)
+++ runtime/vm/snapshot.cc (working copy)
@@ -167,8 +167,6 @@
RawObject* SnapshotReader::ReadObject() {
- 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) {
@@ -676,6 +674,11 @@
}
+RawUnhandledException* SnapshotReader::NewUnhandledException() {
+ ALLOC_NEW_OBJECT(UnhandledException, Object::unhandled_exception_class());
+}
+
+
RawObject* SnapshotReader::NewInteger(int64_t value) {
ASSERT((value & kSmiTagMask) == kSmiTag);
value = value >> kSmiTagShift;
@@ -724,10 +727,9 @@
// into dart code or allocating any code.
// We do a longjmp at this point to unwind out of the entire
// read part and return the error object back.
- const Instance& exception =
- Instance::Handle(object_store()->out_of_memory());
- ErrorHandle()->set_exception(exception);
- Isolate::Current()->long_jump_base()->Jump(1, *ErrorHandle());
+ const UnhandledException& error = UnhandledException::Handle(
+ object_store()->preallocated_unhandled_exception());
+ Isolate::Current()->long_jump_base()->Jump(1, error);
}
#if defined(DEBUG)
// Zap the uninitialized memory area.
« no previous file with comments | « runtime/vm/snapshot.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698