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

Unified Diff: src/compiler/machine-type.h

Issue 652363006: [turbofan] First step towards correctified 64-bit addressing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixes2 Created 6 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/compiler/instruction.h ('k') | src/compiler/node-matchers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/machine-type.h
diff --git a/src/compiler/machine-type.h b/src/compiler/machine-type.h
index 4c38a6d4027e496c105787bffa80167c7ff832da..4c51a9ffe5ebd45a89fa3a24723307f6690f13f2 100644
--- a/src/compiler/machine-type.h
+++ b/src/compiler/machine-type.h
@@ -81,26 +81,34 @@ inline MachineType RepresentationOf(MachineType machine_type) {
return static_cast<MachineType>(result);
}
-// Gets the element size in bytes of the machine type.
-inline int ElementSizeOf(MachineType machine_type) {
+// Gets the log2 of the element size in bytes of the machine type.
+inline int ElementSizeLog2Of(MachineType machine_type) {
switch (RepresentationOf(machine_type)) {
case kRepBit:
case kRepWord8:
- return 1;
+ return 0;
case kRepWord16:
- return 2;
+ return 1;
case kRepWord32:
case kRepFloat32:
- return 4;
+ return 2;
case kRepWord64:
case kRepFloat64:
- return 8;
+ return 3;
case kRepTagged:
- return kPointerSize;
+ return kPointerSizeLog2;
default:
- UNREACHABLE();
- return kPointerSize;
+ break;
}
+ UNREACHABLE();
+ return -1;
+}
+
+// Gets the element size in bytes of the machine type.
+inline int ElementSizeOf(MachineType machine_type) {
+ const int shift = ElementSizeLog2Of(machine_type);
+ DCHECK_NE(-1, shift);
+ return 1 << shift;
}
// Describes the inputs and outputs of a function or call.
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/node-matchers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698