Index: src/x64/macro-assembler-x64.h |
diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h |
index a5a03f6aca2e0555a5b9b4b288a721cd788ab5fe..52209227c9e2602360020c64de5994d3db7f1a29 100644 |
--- a/src/x64/macro-assembler-x64.h |
+++ b/src/x64/macro-assembler-x64.h |
@@ -1022,8 +1022,22 @@ class MacroAssembler: public Assembler { |
template<typename Field> |
void DecodeFieldToSmi(Register reg) { |
- andp(reg, Immediate(Field::kMask)); |
- shlp(reg, Immediate(kSmiShift - Field::kShift)); |
+ if (SmiValuesAre32Bits()) { |
+ andp(reg, Immediate(Field::kMask)); |
+ shlp(reg, Immediate(kSmiShift - Field::kShift)); |
+ } else { |
+ static const int shift = Field::kShift; |
+ static const int mask = (Field::kMask >> Field::kShift) << kSmiTagSize; |
haitao.feng
2014/06/09 05:43:06
Clang reports an error when using kSmiShift:
|
+ ASSERT(SmiValuesAre31Bits()); |
+ ASSERT(kSmiShift == kSmiTagSize); |
+ ASSERT((mask & 0x80000000u) == 0); |
+ if (shift < kSmiShift) { |
+ shlp(reg, Immediate(kSmiShift - shift)); |
+ } else if (shift > kSmiShift) { |
+ sarp(reg, Immediate(shift - kSmiShift)); |
+ } |
+ andp(reg, Immediate(mask)); |
+ } |
} |
// Abort execution if argument is not a number, enabled via --debug-code. |