Fix signal test to work with gcstress

We now avoid running GC if we are handling a stack overflow, this
helps prevent running past the end of the stack overflow reserved
bytes.

Added logic in ThrowStackOverflowError to use a stack overflow
exception without a stack trace if we fail to allocate the stack
trace.

Bug: 16406852
Change-Id: Ib34e235cd0af6d7c4c93c9705fa822f2b9b23b38
diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc
index e734d45..db51264 100644
--- a/runtime/entrypoints/entrypoint_utils.cc
+++ b/runtime/entrypoints/entrypoint_utils.cc
@@ -183,14 +183,12 @@
         env->SetObjectField(exc.get(),
                             WellKnownClasses::java_lang_Throwable_stackTrace,
                             stack_trace_elem.get());
-
-        // Throw the exception.
-        ThrowLocation throw_location = self->GetCurrentLocationForThrow();
-        self->SetException(throw_location,
-            reinterpret_cast<mirror::Throwable*>(self->DecodeJObject(exc.get())));
       } else {
         error_msg = "Could not create stack trace.";
       }
+      // Throw the exception.
+      self->SetException(self->GetCurrentLocationForThrow(),
+                         reinterpret_cast<mirror::Throwable*>(self->DecodeJObject(exc.get())));
     } else {
       // Could not allocate a string object.
       error_msg = "Couldn't throw new StackOverflowError because JNI NewStringUTF failed.";