Exception support for object allocation.

Strengthen asserts, no extra unit tests as expect good coverage on this
already.

Change-Id: Ie8786932667b70d20c0cdf69b4b6b721b6244ded
diff --git a/src/runtime_support.S b/src/runtime_support.S
index 9cfb3ab..4a50344 100644
--- a/src/runtime_support.S
+++ b/src/runtime_support.S
@@ -219,6 +219,28 @@
     mov    r1, sp                             @ pass SP
     b      artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
 
+    .global art_alloc_object_from_code
+    .extern artAllocObjectFromCode
+    /*
+     * Called by managed code to allocate an object
+     */
+art_alloc_object_from_code:
+    str    sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET]    @ record top of stack and pc in case of
+    str    lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
+    stmdb  sp!, {lr}               @ Save LR
+    sub    sp, #12                 @ Align stack
+    bl     artAllocObjectFromCode  @ (uint32_t type_idx, Method* method)
+    add    sp, #12
+    ldmia  sp!, {lr}               @ restore LR
+    cmp    r0, #0                  @ success if result is non-null
+    movne  pc, lr                  @ return on success
+                                   @ set up for throwing exception
+    stmdb  sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
+    sub    sp, #16                 @ 4 words of space, bottom word will hold Method*
+    mov    r0, r9                  @ pass Thread::Current
+    mov    r1, sp                  @ pass SP
+    b      artDeliverPendingExceptionFromCode  @ artDeliverPendingExceptionFromCode(Thread*, SP)
+
     .global art_array_alloc_from_code
     .extern artArrayAllocFromCode
     /*