summaryrefslogtreecommitdiff
path: root/runtime/mirror/class-inl.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/mirror/class-inl.h')
-rw-r--r--runtime/mirror/class-inl.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index 7f3a302768..406ab1bbb3 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -357,14 +357,23 @@ inline void Class::CheckObjectAlloc() {
DCHECK_GE(this->object_size_, sizeof(Object));
}
-inline Object* Class::AllocObjectInstrumented(Thread* self) {
+template <bool kIsMovable, bool kIsInstrumented>
+inline Object* Class::Alloc(Thread* self) {
CheckObjectAlloc();
- return Runtime::Current()->GetHeap()->AllocObjectInstrumented(self, this, this->object_size_);
-}
-
-inline Object* Class::AllocObjectUninstrumented(Thread* self) {
- CheckObjectAlloc();
- return Runtime::Current()->GetHeap()->AllocObjectUninstrumented(self, this, this->object_size_);
+ gc::Heap* heap = Runtime::Current()->GetHeap();
+ if (kIsMovable) {
+ if (kIsInstrumented) {
+ return heap->AllocMovableObjectInstrumented(self, this, this->object_size_);
+ } else {
+ return heap->AllocMovableObjectUninstrumented(self, this, this->object_size_);
+ }
+ } else {
+ if (kIsInstrumented) {
+ return heap->AllocNonMovableObjectInstrumented(self, this, this->object_size_);
+ } else {
+ return heap->AllocNonMovableObjectUninstrumented(self, this, this->object_size_);
+ }
+ }
}
} // namespace mirror