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

Unified Diff: runtime/vm/object.cc

Issue 575663002: Eliminate 99% of allocated ExceptionHandler objects (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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 40287)
+++ runtime/vm/object.cc (working copy)
@@ -99,6 +99,7 @@
Array* Object::zero_array_ = NULL;
PcDescriptors* Object::empty_descriptors_ = NULL;
LocalVarDescriptors* Object::empty_var_descriptors_ = NULL;
+ExceptionHandlers* Object::empty_exception_handlers_ = NULL;
Instance* Object::sentinel_ = NULL;
Instance* Object::transition_sentinel_ = NULL;
Instance* Object::unknown_constant_ = NULL;
@@ -437,6 +438,7 @@
zero_array_ = Array::ReadOnlyHandle();
empty_descriptors_ = PcDescriptors::ReadOnlyHandle();
empty_var_descriptors_ = LocalVarDescriptors::ReadOnlyHandle();
+ empty_exception_handlers_ = ExceptionHandlers::ReadOnlyHandle();
sentinel_ = Instance::ReadOnlyHandle();
transition_sentinel_ = Instance::ReadOnlyHandle();
unknown_constant_ = Instance::ReadOnlyHandle();
@@ -680,6 +682,21 @@
empty_var_descriptors_->raw_ptr()->num_entries_ = 0;
}
+ // Allocate and initialize the canonical empty exception handler info object.
+ // The vast majority of all functions do not contain an exception handler
+ // and can share this cononical descriptor.
srdjan 2014/09/15 23:47:14 s/cononical/cananical/ ;-)
hausner 2014/09/16 00:28:41 Dro Chonoson mot dom Kontroboss, sosson of dor Str
+ {
+ uword address =
+ heap->Allocate(ExceptionHandlers::InstanceSize(0), Heap::kOld);
+ InitializeObject(address,
+ kExceptionHandlersCid,
+ ExceptionHandlers::InstanceSize(0));
+ ExceptionHandlers::initializeHandle(
+ empty_exception_handlers_,
+ reinterpret_cast<RawExceptionHandlers*>(address + kHeapObjectTag));
+ empty_exception_handlers_->raw_ptr()->num_entries_ = 0;
+ }
+
cls = Class::New<Instance>(kDynamicCid);
cls.set_is_abstract();
cls.set_num_type_arguments(0);
@@ -10991,7 +11008,7 @@
intptr_t ExceptionHandlers::Length() const {
srdjan 2014/09/15 23:47:15 s/Length/num_entries/
hausner 2014/09/16 00:28:41 Done. (But what's the point of having accessors i
- return raw_ptr()->length_;
+ return raw_ptr()->num_entries_;
}
@@ -11078,7 +11095,7 @@
Heap::kOld);
NoGCScope no_gc;
result ^= raw;
- result.raw_ptr()->length_ = num_handlers;
+ result.raw_ptr()->num_entries_ = num_handlers;
}
const Array& handled_types_data = (num_handlers == 0) ?
Object::empty_array() :

Powered by Google App Engine
This is Rietveld 408576698