Implement the Thread.sleep native method.

This makes returning TS_SLEEPING from JDWP simple and cheap, and
makes the stack dumps for sleeping threads more easily understood
by app developers (because there's no Object.wait magic going, and
the thread state is "Sleeping" rather than "TimedWaiting").

Also make Object.wait() a native method in its own right, so every call into
Monitor::Wait can explicitly pass the most appropriate ThreadState: kSleeping,
kWaiting, or kTimedWaiting.

Also add Thread.sleep and Object.wait(long, int) calls to the ThreadStress test.

Change-Id: I49adb45dbcd669eba7cf3def45e6cbfc461a3254
diff --git a/src/monitor.h b/src/monitor.h
index c3b4b21..977a7f1 100644
--- a/src/monitor.h
+++ b/src/monitor.h
@@ -82,7 +82,7 @@
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
   static void NotifyAll(Thread* self, Object* obj)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-  static void Wait(Thread* self, Object* obj, int64_t ms, int32_t ns, bool interruptShouldThrow)
+  static void Wait(Thread* self, Object* obj, int64_t ms, int32_t ns, bool interruptShouldThrow, ThreadState why)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
   static void DescribeWait(std::ostream& os, const Thread* thread)
@@ -125,9 +125,9 @@
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
 
-  void Wait(Thread* self, int64_t msec, int32_t nsec, bool interruptShouldThrow)
+  void Wait(Thread* self, int64_t msec, int32_t nsec, bool interruptShouldThrow, ThreadState why)
       NO_THREAD_SAFETY_ANALYSIS;
-  void WaitWithLock(Thread* self, int64_t ms, int32_t ns, bool interruptShouldThrow)
+  void WaitWithLock(Thread* self, int64_t ms, int32_t ns, bool interruptShouldThrow, ThreadState why)
       EXCLUSIVE_LOCKS_REQUIRED(monitor_lock_)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);