Revision: 20142
Author: [email protected]
Date: Fri Mar 21 08:03:26 2014 UTC
Log: Revert "Use constant length for memcpy on A64 simulator."
This reverts commit r20141 which broke the build with some GCC versions. The
reason behind that is GCC emits a warning about code which can never be
reached,
but GCC can't figure that out.
The right approach would be using template specialization instead of these
runtime if/then/else cascades, which would be nicer from a SW engineering
perspective, too.
[email protected]
Review URL: https://codereview.chromium.org/207703003
http://code.google.com/p/v8/source/detail?r=20142
Modified:
/branches/bleeding_edge/src/a64/simulator-a64.h
=======================================
--- /branches/bleeding_edge/src/a64/simulator-a64.h Fri Mar 21 07:08:08
2014 UTC
+++ /branches/bleeding_edge/src/a64/simulator-a64.h Fri Mar 21 08:03:26
2014 UTC
@@ -166,18 +166,10 @@
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.
- if (size == kXRegSize) {
- memcpy(value_, &new_value, kXRegSize);
- } else if (size == kWRegSize) {
- memset(value_, 0, kSizeInBytes);
- memcpy(value_, &new_value, kWRegSize);
- } else {
- UNREACHABLE();
- }
+ memset(value_, 0, kSizeInBytes);
+ memcpy(value_, &new_value, size);
}
// Copy 'size' bytes of the register to the result, and zero-extend to
fill
@@ -186,14 +178,8 @@
T Get(unsigned size = sizeof(T)) const {
ASSERT(size <= kSizeInBytes);
T result;
- if (size == kXRegSize) {
- memcpy(&result, value_, kXRegSize);
- } else if (size == kWRegSize) {
- memset(&result, 0, sizeof(result));
- memcpy(&result, value_, kWRegSize);
- } else {
- UNREACHABLE();
- }
+ memset(&result, 0, sizeof(result));
+ memcpy(&result, value_, size);
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.