Index: src/x64/macro-assembler-x64.h |
diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h |
index 34d034ac03172a7f05bf3ba8560792d369eccf3a..ae5a95983af36afa8d7f4744452167f8e41f72be 100644 |
--- a/src/x64/macro-assembler-x64.h |
+++ b/src/x64/macro-assembler-x64.h |
@@ -1014,10 +1014,18 @@ class MacroAssembler: public Assembler { |
void DecodeField(Register reg) { |
static const int shift = Field::kShift; |
static const int mask = Field::kMask >> Field::kShift; |
- shrp(reg, Immediate(shift)); |
+ if (shift != 0) { |
+ shrp(reg, Immediate(shift)); |
+ } |
andp(reg, Immediate(mask)); |
} |
+ template<typename Field> |
+ void DecodeFieldToSmi(Register reg) { |
+ andp(reg, Immediate(Field::kMask)); |
+ shlp(reg, Immediate(kSmiShift - Field::kShift)); |
+ } |
+ |
// Abort execution if argument is not a number, enabled via --debug-code. |
void AssertNumber(Register object); |