Index: src/mips/macro-assembler-mips.h |
diff --git a/src/mips/macro-assembler-mips.h b/src/mips/macro-assembler-mips.h |
index d3fdbd6b33ad2e3a603d2c91991019d4e3b1d6d9..e9d9f1c0e45b32171548e282910494bcd5126722 100644 |
--- a/src/mips/macro-assembler-mips.h |
+++ b/src/mips/macro-assembler-mips.h |
@@ -1371,6 +1371,21 @@ class MacroAssembler: public Assembler { |
Addu(dst, src, src); |
} |
+ // Try to convert int32 to smi. If the value is to large, preserve |
+ // the original value and jump to not_a_smi. Destroys scratch and |
+ // sets flags. |
+ void TrySmiTag(Register reg, Register scratch, Label* not_a_smi) { |
+ TrySmiTag(reg, reg, scratch, not_a_smi); |
+ } |
+ void TrySmiTag(Register dst, |
+ Register src, |
+ Register scratch, |
+ Label* not_a_smi) { |
+ SmiTagCheckOverflow(at, src, scratch); |
+ BranchOnOverflow(not_a_smi, scratch); |
+ mov(dst, at); |
+ } |
+ |
void SmiUntag(Register reg) { |
sra(reg, reg, kSmiTagSize); |
} |
@@ -1379,6 +1394,14 @@ class MacroAssembler: public Assembler { |
sra(dst, src, kSmiTagSize); |
} |
+ // Test if the register contains a smi. |
+ inline void SmiTst(Register value, Register scratch) { |
+ And(scratch, value, Operand(kSmiTagMask)); |
+ } |
+ inline void NonNegativeSmiTst(Register value, Register scratch) { |
+ And(scratch, value, Operand(kSmiTagMask | kSmiSignMask)); |
+ } |
+ |
// Untag the source value into destination and jump if source is a smi. |
// Souce and destination can be the same register. |
void UntagAndJumpIfSmi(Register dst, Register src, Label* smi_case); |