Reviewers: Sven Panne, jbramley, Rodolph Perfetta (ARM), Rodolph Perfetta,


https://codereview.chromium.org/203263017/diff/1/src/a64/simulator-a64.h
File src/a64/simulator-a64.h (right):

https://codereview.chromium.org/203263017/diff/1/src/a64/simulator-a64.h#newcode171
src/a64/simulator-a64.h:171: if (size == kXRegSize) {
On 2014/03/20 11:33:57, Rodolph Perfetta wrote:
STATIC_ASSERT(kXRegSize == kDRegSize);

This is more to document the fact this is also used for S and D
registers

same below with W and S

Done.

https://codereview.chromium.org/203263017/diff/1/src/a64/simulator-a64.h#newcode187
src/a64/simulator-a64.h:187: memset(&result, 0, sizeof(result));
On 2014/03/20 10:22:38, Sven Panne wrote:
I think this could be moved into the 2nd case, just like Set.

Done.

Description:
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

Please review this at https://codereview.chromium.org/203263017/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+18, -4 lines):
  M src/a64/simulator-a64.h


Index: src/a64/simulator-a64.h
diff --git a/src/a64/simulator-a64.h b/src/a64/simulator-a64.h
index 959644b773e21bec17eea32c840ebd413fc799c2..acca27c1302dbf935daea99dd471af49def42b0a 100644
--- a/src/a64/simulator-a64.h
+++ b/src/a64/simulator-a64.h
@@ -166,10 +166,18 @@ class SimRegisterBase {
   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 @@ class SimRegisterBase {
   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
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to