Revision: 20141
Author:   svenpa...@chromium.org
Date:     Fri Mar 21 07:08:08 2014 UTC
Log:      Use constant length for memcpy on A64 simulator.

Compiler can't optimize away variable length memcpy.
About a 18% boost.

Before - 5:40

Richards: 75.2
DeltaBlue: 105
Crypto: 64.0
RayTrace: 188
EarleyBoyer: 146
RegExp: 23.8
Splay: 96.2
NavierStokes: 91.9
----
Score (version 7): 85.7

After - 4:39

Richards: 90.8
DeltaBlue: 134
Crypto: 81.7
RayTrace: 227
EarleyBoyer: 177
RegExp: 29.7
Splay: 126
NavierStokes: 108
----
Score (version 7): 106

R=rodolph.perfe...@gmail.com, svenpa...@chromium.org

Review URL: https://codereview.chromium.org/203263017
http://code.google.com/p/v8/source/detail?r=20141

Modified:
 /branches/bleeding_edge/src/a64/simulator-a64.h

=======================================
--- /branches/bleeding_edge/src/a64/simulator-a64.h Thu Mar 20 15:25:27 2014 UTC +++ /branches/bleeding_edge/src/a64/simulator-a64.h Fri Mar 21 07:08:08 2014 UTC
@@ -166,10 +166,18 @@
   void Set(T new_value, unsigned size = sizeof(T)) {
     ASSERT(size <= kSizeInBytes);
     ASSERT(size <= sizeof(new_value));
+    STATIC_ASSERT(kXRegSize == kDRegSize);
+    STATIC_ASSERT(kWRegSize == kSRegSize);
// All AArch64 registers are zero-extending; Writing a W register clears the
     // top bits of the corresponding X register.
-    memset(value_, 0, kSizeInBytes);
-    memcpy(value_, &new_value, size);
+    if (size == kXRegSize) {
+      memcpy(value_, &new_value, kXRegSize);
+    } else if (size == kWRegSize) {
+      memset(value_, 0, kSizeInBytes);
+      memcpy(value_, &new_value, kWRegSize);
+    } else {
+      UNREACHABLE();
+    }
   }

// Copy 'size' bytes of the register to the result, and zero-extend to fill
@@ -178,8 +186,14 @@
   T Get(unsigned size = sizeof(T)) const {
     ASSERT(size <= kSizeInBytes);
     T result;
-    memset(&result, 0, sizeof(result));
-    memcpy(&result, value_, size);
+    if (size == kXRegSize) {
+      memcpy(&result, value_, kXRegSize);
+    } else if (size == kWRegSize) {
+      memset(&result, 0, sizeof(result));
+      memcpy(&result, value_, kWRegSize);
+    } else {
+      UNREACHABLE();
+    }
     return result;
   }

--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to