Clean up and augment Atomic class.  Replace QuasiAtomic MemBars.

Add a number of missing C++11 operations to Atomic class.
Invoke the 64 bit routines in QuasiAtomic when necessary.
Replace QuasiAtomic membars with fences that correspond to C++11 fences.

QuasiAtomic was moved to the top of the file.  Only fence implementations
actually changed.

This replaces some buggy uses of MembarStoreStore, as reported
in b/14685856 .

Avoid some redundant fences for long volatile operations.

Incompletely converts low-level memory access operations to Atomic.

Change-Id: Iea828431a0cea46540eb74fcaa02071cab6fdcda
diff --git a/runtime/interpreter/interpreter_goto_table_impl.cc b/runtime/interpreter/interpreter_goto_table_impl.cc
index 99153c8..623d9c3 100644
--- a/runtime/interpreter/interpreter_goto_table_impl.cc
+++ b/runtime/interpreter/interpreter_goto_table_impl.cc
@@ -247,7 +247,7 @@
       // If access checks are required then the dex-to-dex compiler and analysis of
       // whether the class has final fields hasn't been performed. Conservatively
       // perform the memory barrier now.
-      QuasiAtomic::MembarStoreLoad();
+      QuasiAtomic::ThreadFenceForConstructor();
     }
     if (UNLIKELY(self->TestAllFlags())) {
       CheckSuspend(self);
@@ -266,7 +266,7 @@
   HANDLE_INSTRUCTION_END();
 
   HANDLE_INSTRUCTION_START(RETURN_VOID_BARRIER) {
-    QuasiAtomic::MembarStoreLoad();
+    QuasiAtomic::ThreadFenceForConstructor();
     JValue result;
     if (UNLIKELY(self->TestAllFlags())) {
       CheckSuspend(self);
diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc
index 3c7880c..d592a53 100644
--- a/runtime/interpreter/interpreter_switch_impl.cc
+++ b/runtime/interpreter/interpreter_switch_impl.cc
@@ -175,7 +175,7 @@
           // If access checks are required then the dex-to-dex compiler and analysis of
           // whether the class has final fields hasn't been performed. Conservatively
           // perform the memory barrier now.
-          QuasiAtomic::MembarStoreLoad();
+          QuasiAtomic::ThreadFenceForConstructor();
         }
         if (UNLIKELY(self->TestAllFlags())) {
           CheckSuspend(self);
@@ -191,7 +191,7 @@
         return result;
       }
       case Instruction::RETURN_VOID_BARRIER: {
-        QuasiAtomic::MembarStoreLoad();
+        QuasiAtomic::ThreadFenceForConstructor();
         JValue result;
         if (UNLIKELY(self->TestAllFlags())) {
           CheckSuspend(self);