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

Unified Diff: runtime/vm/isolate.cc

Issue 16174008: - Create isolate specific resuable handles and use them in the hot lookup paths. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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
===================================================================
--- runtime/vm/isolate.cc (revision 24200)
+++ runtime/vm/isolate.cc (working copy)
@@ -371,6 +371,9 @@
}
+#define REUSABLE_HANDLE_INITIALIZERS(object) \
+ object##_handle_(NULL),
+
Isolate::Isolate()
: store_buffer_(),
message_notify_callback_(NULL),
@@ -409,11 +412,14 @@
deferred_objects_(NULL),
stacktrace_(NULL),
stack_frame_index_(-1),
- object_histogram_(NULL) {
+ object_histogram_(NULL),
+ REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS)
+ handles_() {
if (FLAG_print_object_histogram && (Dart::vm_isolate() != NULL)) {
object_histogram_ = new ObjectHistogram(this);
}
}
+#undef REUSABLE_HANDLE_INITIALIZERS
Isolate::~Isolate() {
@@ -461,6 +467,13 @@
// the current isolate.
SetCurrent(result);
+ // Setup the isolate specific resuable handles.
+#define REUSABLE_HANDLE_ALLOCATION(object) \
+ result->object##_handle_ = result->AllocateReusableHandle<object>(); \
+
+ REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION)
+#undef REUSABLE_HANDLE_ALLOCATION
+
// Setup the isolate message handler.
MessageHandler* handler = new IsolateMessageHandler(result);
ASSERT(handler != NULL);
@@ -825,6 +838,9 @@
// Visit objects in zones.
current_zone()->VisitObjectPointers(visitor);
+ // Visit objects in isolate specific handles area.
+ handles_.VisitObjectPointers(visitor);
+
// Iterate over all the stack frames and visit objects on the stack.
StackFrameIterator frames_iterator(validate_frames);
StackFrame* frame = frames_iterator.NextFrame();
@@ -1050,6 +1066,14 @@
}
+template<class T>
+T* Isolate::AllocateReusableHandle() {
+ T* handle = reinterpret_cast<T*>(handles_.AllocateScopedHandle());
+ T::initializeHandle(handle, T::null());
+ return handle;
+}
+
+
static void FillDeferredSlots(DeferredSlot** slot_list) {
DeferredSlot* slot = *slot_list;
*slot_list = NULL;

Powered by Google App Engine
This is Rietveld 408576698