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

Unified Diff: runtime/vm/object.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: 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
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 38227)
+++ runtime/vm/object.cc (working copy)
@@ -12693,6 +12693,23 @@
}
+RawUnhandledException* UnhandledException::New(Heap::Space space) {
+ ASSERT(Object::unhandled_exception_class() != Class::null());
+ UnhandledException& result = UnhandledException::Handle();
+ {
+ RawObject* raw = Object::Allocate(UnhandledException::kClassId,
+ UnhandledException::InstanceSize(),
+ space);
+ NoGCScope no_gc;
+ result ^= raw;
+ }
+ const Instance& null_object = Instance::Handle();
+ result.set_exception(null_object);
+ result.set_stacktrace(null_object);
siva 2014/07/16 01:00:13 Can we use Object::null_instance() here instead of
Florian Schneider 2014/07/16 11:15:42 Done.
+ return result.raw();
+}
+
+
void UnhandledException::set_exception(const Instance& exception) const {
StorePointer(&raw_ptr()->exception_, exception.raw());
}

Powered by Google App Engine
This is Rietveld 408576698