Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: src/a64/simulator-a64.h

Issue 207703003: Revert "Use constant length for memcpy on A64 simulator." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/a64/simulator-a64.h
diff --git a/src/a64/simulator-a64.h b/src/a64/simulator-a64.h
index db585341c1f1b8f1cedfcfc13adec8c6f78f85bb..1ef891a151ecee375870f5e6073f01cc93d1d773 100644
--- a/src/a64/simulator-a64.h
+++ b/src/a64/simulator-a64.h
@@ -166,18 +166,10 @@ 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.
- 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 @@ class SimRegisterBase {
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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698