Index: src/x64/macro-assembler-x64.cc |
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
index a0ebfdc95d164f7ab6bbcbadda93eed1e0f53069..b06b8c8a9d3a6d1b35e67a2d67559cb38dc61a15 100644 |
--- a/src/x64/macro-assembler-x64.cc |
+++ b/src/x64/macro-assembler-x64.cc |
@@ -581,6 +581,20 @@ Condition MacroAssembler::CheckBothSmi(Register first, Register second) { |
} |
+Condition MacroAssembler::CheckBothPositiveSmi(Register first, |
+ Register second) { |
+ if (first.is(second)) { |
+ return CheckPositiveSmi(first); |
+ } |
+ movl(kScratchRegister, first); |
+ orl(kScratchRegister, second); |
+ rol(kScratchRegister, Immediate(1)); |
+ testl(kScratchRegister, Immediate(0x03)); |
+ return zero; |
+} |
+ |
+ |
+ |
Condition MacroAssembler::CheckEitherSmi(Register first, Register second) { |
if (first.is(second)) { |
return CheckSmi(first); |
@@ -660,7 +674,17 @@ void MacroAssembler::SmiSub(Register dst, |
Register src2, |
Label* on_not_smi_result) { |
ASSERT(!dst.is(src2)); |
- if (dst.is(src1)) { |
+ if (on_not_smi_result == NULL) { |
+ // No overflow checking. Use only when it's known that |
+ // overflowing is impossible (e.g., subtracting two positive smis). |
+ if (dst.is(src1)) { |
+ subq(dst, src2); |
+ } else { |
+ movq(dst, src1); |
+ subq(dst, src2); |
+ } |
+ Assert(no_overflow, "Smi substraction onverflow"); |
+ } else if (dst.is(src1)) { |
subq(dst, src2); |
Label smi_result; |
j(no_overflow, &smi_result); |
@@ -1292,6 +1316,14 @@ void MacroAssembler::JumpIfNotBothSmi(Register src1, Register src2, |
} |
+void MacroAssembler::JumpIfNotBothPositiveSmi(Register src1, Register src2, |
+ Label* on_not_both_smi) { |
+ Condition both_smi = CheckBothPositiveSmi(src1, src2); |
+ j(NegateCondition(both_smi), on_not_both_smi); |
+} |
+ |
+ |
+ |
void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register first_object, |
Register second_object, |
Register scratch1, |
@@ -1517,6 +1549,17 @@ void MacroAssembler::CmpInstanceType(Register map, InstanceType type) { |
} |
+Condition MacroAssembler::IsObjectStringType(Register heap_object, |
+ Register map, |
+ Register instance_type) { |
+ movq(map, FieldOperand(heap_object, HeapObject::kMapOffset)); |
+ movzxbq(instance_type, FieldOperand(map, Map::kInstanceTypeOffset)); |
+ ASSERT(kNotStringTag != 0); |
+ testb(instance_type, Immediate(kIsNotStringMask)); |
+ return zero; |
+} |
+ |
+ |
void MacroAssembler::TryGetFunctionPrototype(Register function, |
Register result, |
Label* miss) { |