Commit 389d57af authored by haitao.feng@intel.com's avatar haitao.feng@intel.com

Update DecodeFieldToSmi to support x32 port.

R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/310803003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21738 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent dc7fe989
......@@ -1053,8 +1053,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;
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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment