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

Unified Diff: src/x87/assembler-x87.h

Issue 1380863004: Revert of Reland: Remove register index/code indirection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/compiler/test-gap-resolver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/assembler-x87.h
diff --git a/src/x87/assembler-x87.h b/src/x87/assembler-x87.h
index 6d2c4e33db587107565a9a39adb9f06136c8139e..2b5c7d252854f14f5d91fd7e58c0a0635eade1bc 100644
--- a/src/x87/assembler-x87.h
+++ b/src/x87/assembler-x87.h
@@ -76,6 +76,10 @@
static inline const char* AllocationIndexToString(int index);
+ static inline int ToAllocationIndex(Register reg);
+
+ static inline Register FromAllocationIndex(int index);
+
static Register from_code(int code) {
DCHECK(code >= 0);
DCHECK(code < kNumRegisters);
@@ -125,6 +129,18 @@
// This is the mapping of allocation indices to registers.
const char* const kNames[] = { "eax", "ecx", "edx", "ebx", "esi", "edi" };
return kNames[index];
+}
+
+
+inline int Register::ToAllocationIndex(Register reg) {
+ DCHECK(reg.is_valid() && !reg.is(esp) && !reg.is(ebp));
+ return (reg.code() >= 6) ? reg.code() - 2 : reg.code();
+}
+
+
+inline Register Register::FromAllocationIndex(int index) {
+ DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters);
+ return (index >= 4) ? from_code(index + 2) : from_code(index);
}
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/compiler/test-gap-resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698