Index: src/x64/macro-assembler-x64.h |
diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h |
index 8086388b12854251d557cfff29d561be4514912f..4c177205b6be4f143933f751678641b9dbc14f52 100644 |
--- a/src/x64/macro-assembler-x64.h |
+++ b/src/x64/macro-assembler-x64.h |
@@ -323,6 +323,16 @@ class MacroAssembler: public Assembler { |
Register src, |
int power); |
+ // Perform the logical or of two smi values and return a smi value. |
+ // If either argument is not a smi, jump to on_not_smis and retain |
+ // the original values of source registers. The destination register |
+ // may be changed if it's not one of the source registers. |
+ template <typename LabelType> |
+ void SmiOrIfSmis(Register dst, |
+ Register src1, |
+ Register src2, |
+ LabelType* on_not_smis); |
+ |
// Simple comparison of smis. Both sides must be known smis to use these, |
// otherwise use Cmp. |
@@ -1790,6 +1800,24 @@ void MacroAssembler::JumpUnlessBothNonNegativeSmi(Register src1, |
template <typename LabelType> |
+void MacroAssembler::SmiOrIfSmis(Register dst, Register src1, Register src2, |
+ LabelType* on_not_smis) { |
+ if (dst.is(src1) || dst.is(src2)) { |
+ ASSERT(!src1.is(kScratchRegister)); |
+ ASSERT(!src2.is(kScratchRegister)); |
+ movq(kScratchRegister, src1); |
+ or_(kScratchRegister, src2); |
+ JumpIfNotSmi(kScratchRegister, on_not_smis); |
+ movq(dst, kScratchRegister); |
+ } else { |
+ movq(dst, src1); |
+ or_(dst, src2); |
+ JumpIfNotSmi(dst, on_not_smis); |
+ } |
+} |
+ |
+ |
+template <typename LabelType> |
void MacroAssembler::JumpIfNotString(Register object, |
Register object_map, |
LabelType* not_string) { |