summaryrefslogtreecommitdiff
path: root/compiler/optimizing/code_generator.cc
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2017-01-23 22:50:24 +0000
committerNicolas Geoffray <ngeoffray@google.com>2017-01-26 09:56:36 +0000
commitb048cb74b742b03eb6dd5f1d6dd49e559f730b36 (patch)
treeb1f663cbb343488a548cce4db352dbc4af720a89 /compiler/optimizing/code_generator.cc
parentf34077c96af3389e8eae65252d4c5d51cf630039 (diff)
Add per array size allocation entrypoints.
- Update architectures that have fast paths for array allocation to use it. - Will add more fast paths in follow-up CLs. Test: test-art-target test-art-host. Change-Id: I138cccd16464a85de22a8ed31c915f876e78fb04
Diffstat (limited to 'compiler/optimizing/code_generator.cc')
-rw-r--r--compiler/optimizing/code_generator.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc
index 99427f05da..d68aa51b1b 100644
--- a/compiler/optimizing/code_generator.cc
+++ b/compiler/optimizing/code_generator.cc
@@ -1417,4 +1417,22 @@ void CodeGenerator::EmitJitRoots(uint8_t* code,
EmitJitRootPatches(code, roots_data);
}
+QuickEntrypointEnum CodeGenerator::GetArrayAllocationEntrypoint(Handle<mirror::Class> array_klass) {
+ ScopedObjectAccess soa(Thread::Current());
+ if (array_klass.Get() == nullptr) {
+ // This can only happen for non-primitive arrays, as primitive arrays can always
+ // be resolved.
+ return kQuickAllocArrayResolved32;
+ }
+
+ switch (array_klass->GetComponentSize()) {
+ case 1: return kQuickAllocArrayResolved8;
+ case 2: return kQuickAllocArrayResolved16;
+ case 4: return kQuickAllocArrayResolved32;
+ case 8: return kQuickAllocArrayResolved64;
+ }
+ LOG(FATAL) << "Unreachable";
+ return kQuickAllocArrayResolved;
+}
+
} // namespace art