Reviewers: Lasse Reichstein,

Description:
Very small optimization of ARM compare stub.

Please review this at http://codereview.chromium.org/551048

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/arm/codegen-arm.cc


Index: src/arm/codegen-arm.cc
===================================================================
--- src/arm/codegen-arm.cc      (revision 3618)
+++ src/arm/codegen-arm.cc      (working copy)
@@ -4909,13 +4909,14 @@
   Register lhs_mantissa = exp_first ? r1 : r0;
   Register rhs_mantissa = exp_first ? r3 : r2;
   Label one_is_nan, neither_is_nan;
+  Label rhs_not_nan_exp_mask_is_loaded;

   Register exp_mask_reg = r5;

   __ mov(exp_mask_reg, Operand(HeapNumber::kExponentMask));
   __ and_(r4, rhs_exponent, Operand(exp_mask_reg));
   __ cmp(r4, Operand(exp_mask_reg));
-  __ b(ne, rhs_not_nan);
+  __ b(ne, &rhs_not_nan_exp_mask_is_loaded);
   __ mov(r4,
          Operand(rhs_exponent, LSL, HeapNumber::kNonMantissaBitsInTopWord),
          SetCC);
@@ -4925,6 +4926,7 @@

   __ bind(rhs_not_nan);
   __ mov(exp_mask_reg, Operand(HeapNumber::kExponentMask));
+  __ bind(&rhs_not_nan_exp_mask_is_loaded);
   __ and_(r4, lhs_exponent, Operand(exp_mask_reg));
   __ cmp(r4, Operand(exp_mask_reg));
   __ b(ne, &neither_is_nan);
@@ -5036,9 +5038,10 @@
                                        Label* both_loaded_as_doubles,
                                        Label* not_heap_numbers,
                                        Label* slow) {
-  __ CompareObjectType(r0, r2, r2, HEAP_NUMBER_TYPE);
+  __ CompareObjectType(r0, r3, r2, HEAP_NUMBER_TYPE);
   __ b(ne, not_heap_numbers);
-  __ CompareObjectType(r1, r3, r3, HEAP_NUMBER_TYPE);
+  __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset));
+  __ cmp(r2, r3);
__ b(ne, slow); // First was a heap number, second wasn't. Go slow case.

   // Both are heap numbers.  Load them up then jump to the code we have
@@ -5139,7 +5142,7 @@
   // Check for heap-number-heap-number comparison.  Can jump to slow case,
// or load both doubles into r0, r1, r2, r3 and jump to the code that handles // that case. If the inputs are not doubles then jumps to check_for_symbols.
-  // In this case r2 will contain the type of r0.
+  // In this case r2 will contain the type of r0.  Never falls through.
   EmitCheckForTwoHeapNumbers(masm,
                              &both_loaded_as_doubles,
                              &check_for_symbols,


-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to