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

Unified Diff: runtime/vm/object.h

Issue 10540045: - Get handle vtable from a static table for predefined classes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« no previous file with comments | « runtime/vm/class_table.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 8348)
+++ runtime/vm/object.h (working copy)
@@ -379,6 +379,7 @@
}
static cpp_vtable handle_vtable_;
+ static cpp_vtable builtin_vtables_[kNumPredefinedKinds];
// The static values below are singletons shared between the different
// isolates. They are all allocated in the non-GC'd Dart::vm_isolate_.
@@ -418,6 +419,7 @@
static RawClass* unhandled_exception_class_; // Class of UnhandledException.
static RawClass* unwind_error_class_; // Class of UnwindError.
+ friend void ClassTable::Register(const Class& cls);
friend void RawObject::Validate(Isolate* isolate) const;
friend class SnapshotReader;
@@ -4901,8 +4903,9 @@
set_vtable(Smi::handle_vtable_);
return;
}
-#ifdef DEBUG
- Heap* isolate_heap = Isolate::Current()->heap();
+#if defined(DEBUG)
+ Isolate* isolate = Isolate::Current();
+ Heap* isolate_heap = isolate->heap();
Heap* vm_isolate_heap = Dart::vm_isolate()->heap();
ASSERT(isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr())) ||
vm_isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr())));
@@ -4910,9 +4913,18 @@
if (raw_ == null_) {
set_vtable(handle_vtable_);
siva 2012/06/07 17:32:25 I am wondering if we should pull the "if (raw_ ==
Ivan Posva 2012/06/07 20:00:56 Done. https://chromiumcodereview.appspot.com/10541
} else {
- RawClass* raw_class =
- Isolate::Current()->class_table()->At(raw_->GetClassId());
- set_vtable(raw_class->ptr()->handle_vtable_);
+ intptr_t cid = raw_->GetClassId();
+ if (cid < kNumPredefinedKinds) {
+ ASSERT(builtin_vtables_[cid] ==
+ isolate->class_table()->At(cid)->ptr()->handle_vtable_);
+ set_vtable(builtin_vtables_[cid]);
+ } else {
+#if !defined(DEBUG)
+ Isolate* isolate = Isolate::Current();
+#endif
+ RawClass* raw_class = isolate->class_table()->At(cid);
+ set_vtable(raw_class->ptr()->handle_vtable_);
+ }
}
}
« no previous file with comments | « runtime/vm/class_table.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698