Revision: 5566
Author: [email protected]
Date: Thu Sep 30 04:48:03 2010
Log: Rename some x64 macros to be more precise about their semantics.

Review URL: http://codereview.chromium.org/3574002
http://code.google.com/p/v8/source/detail?r=5566

Modified:
 /branches/bleeding_edge/src/x64/builtins-x64.cc
 /branches/bleeding_edge/src/x64/code-stubs-x64.cc
 /branches/bleeding_edge/src/x64/codegen-x64.cc
 /branches/bleeding_edge/src/x64/full-codegen-x64.cc
 /branches/bleeding_edge/src/x64/ic-x64.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.h
 /branches/bleeding_edge/test/cctest/test-macro-assembler-x64.cc

=======================================
--- /branches/bleeding_edge/src/x64/builtins-x64.cc     Thu Sep 23 02:15:26 2010
+++ /branches/bleeding_edge/src/x64/builtins-x64.cc     Thu Sep 30 04:48:03 2010
@@ -715,7 +715,7 @@
   __ cmpq(rax, Immediate(1));
   __ j(not_equal, &argc_two_or_more);
__ movq(rdx, Operand(rsp, kPointerSize)); // Get the argument from the stack.
-  __ JumpIfNotPositiveSmi(rdx, call_generic_code);
+  __ JumpUnlessNonNegativeSmi(rdx, call_generic_code);

// Handle construction of an empty array of a certain size. Bail out if size
   // is to large to actually allocate an elements array.
=======================================
--- /branches/bleeding_edge/src/x64/code-stubs-x64.cc Thu Sep 16 01:17:46 2010 +++ /branches/bleeding_edge/src/x64/code-stubs-x64.cc Thu Sep 30 04:48:03 2010
@@ -3801,7 +3801,7 @@
   Label result_longer_than_two;
   __ movq(rcx, Operand(rsp, kToOffset));
   __ movq(rdx, Operand(rsp, kFromOffset));
-  __ JumpIfNotBothPositiveSmi(rcx, rdx, &runtime);
+  __ JumpUnlessBothNonNegativeSmi(rcx, rdx, &runtime);

   __ SmiSub(rcx, rcx, rdx);  // Overflow doesn't happen.
   __ cmpq(FieldOperand(rax, String::kLengthOffset), rcx);
=======================================
--- /branches/bleeding_edge/src/x64/codegen-x64.cc      Mon Sep 27 00:24:01 2010
+++ /branches/bleeding_edge/src/x64/codegen-x64.cc      Thu Sep 30 04:48:03 2010
@@ -1884,8 +1884,7 @@
                                            operand->reg(),
                                            smi_value,
                                            overwrite_mode);
-        // Check for negative or non-Smi left hand side.
-        __ JumpIfNotPositiveSmi(operand->reg(), deferred->entry_label());
+ __ JumpUnlessNonNegativeSmi(operand->reg(), deferred->entry_label());
         if (int_value < 0) int_value = -int_value;
         if (int_value == 1) {
           __ Move(operand->reg(), Smi::FromInt(0));
@@ -5684,9 +5683,9 @@
   Result value = frame_->Pop();
   value.ToRegister();
   ASSERT(value.is_valid());
-  Condition positive_smi = masm_->CheckPositiveSmi(value.reg());
+  Condition non_negative_smi = masm_->CheckNonNegativeSmi(value.reg());
   value.Unuse();
-  destination()->Split(positive_smi);
+  destination()->Split(non_negative_smi);
 }


@@ -6911,7 +6910,7 @@
   deferred->Branch(not_equal);

   // Check that both indices are smis.
-  Condition both_smi = __ CheckBothSmi(index1.reg(), index2.reg());
+  Condition both_smi = masm()->CheckBothSmi(index1.reg(), index2.reg());
   deferred->Branch(NegateCondition(both_smi));

   // Bring addresses into index1 and index2.
@@ -8377,7 +8376,7 @@
     }

     // Check that the receiver is a heap object.
-    Condition is_smi = __ CheckSmi(receiver.reg());
+    Condition is_smi = masm()->CheckSmi(receiver.reg());
     slow.Branch(is_smi, &value, &receiver);

     // This is the map check instruction that will be patched.
@@ -8506,8 +8505,7 @@
                 kScratchRegister);
     deferred->Branch(not_equal);

-    // Check that the key is a non-negative smi.
-    __ JumpIfNotPositiveSmi(key.reg(), deferred->entry_label());
+    __ JumpUnlessNonNegativeSmi(key.reg(), deferred->entry_label());

     // Get the elements array from the receiver.
     __ movq(elements.reg(),
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Fri Sep 24 02:35:19 2010 +++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Thu Sep 30 04:48:03 2010
@@ -767,7 +767,7 @@

   // Get the current entry of the array into register rbx.
   __ movq(rbx, Operand(rsp, 2 * kPointerSize));
-  SmiIndex index = __ SmiToIndex(rax, rax, kPointerSizeLog2);
+  SmiIndex index = masm()->SmiToIndex(rax, rax, kPointerSizeLog2);
   __ movq(rbx, FieldOperand(rbx,
                             index.reg,
                             index.scale,
@@ -1407,7 +1407,7 @@
   Label done, stub_call, smi_case;
   __ pop(rdx);
   __ movq(rcx, rax);
-  Condition smi = __ CheckBothSmi(rdx, rax);
+  Condition smi = masm()->CheckBothSmi(rdx, rax);
   __ j(smi, &smi_case);

   __ bind(&stub_call);
@@ -1965,8 +1965,8 @@
   context()->PrepareTest(&materialize_true, &materialize_false,
                          &if_true, &if_false, &fall_through);

-  Condition positive_smi = __ CheckPositiveSmi(rax);
-  Split(positive_smi, if_true, if_false, fall_through);
+  Condition non_negative_smi = masm()->CheckNonNegativeSmi(rax);
+  Split(non_negative_smi, if_true, if_false, fall_through);

   context()->Plug(if_true, if_false);
 }
=======================================
--- /branches/bleeding_edge/src/x64/ic-x64.cc   Wed Sep 29 11:15:36 2010
+++ /branches/bleeding_edge/src/x64/ic-x64.cc   Thu Sep 30 04:48:03 2010
@@ -895,7 +895,7 @@

   // Check that the key is an array index, that is Uint32.
   STATIC_ASSERT(kSmiValueSize <= 32);
-  __ JumpIfNotPositiveSmi(rax, &slow);
+  __ JumpUnlessNonNegativeSmi(rax, &slow);

   // Get the map of the receiver.
   __ movq(rcx, FieldOperand(rdx, HeapObject::kMapOffset));
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Thu Sep 23 02:22:45 2010 +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Thu Sep 30 04:48:03 2010
@@ -825,7 +825,7 @@
 }


-Condition MacroAssembler::CheckPositiveSmi(Register src) {
+Condition MacroAssembler::CheckNonNegativeSmi(Register src) {
   ASSERT_EQ(0, kSmiTag);
   // Make mask 0x8000000000000001 and test that both bits are zero.
   movq(kScratchRegister, src);
@@ -846,15 +846,15 @@
 }


-Condition MacroAssembler::CheckBothPositiveSmi(Register first,
-                                               Register second) {
+Condition MacroAssembler::CheckBothNonNegativeSmi(Register first,
+                                                  Register second) {
   if (first.is(second)) {
-    return CheckPositiveSmi(first);
+    return CheckNonNegativeSmi(first);
   }
   movq(kScratchRegister, first);
   or_(kScratchRegister, second);
   rol(kScratchRegister, Immediate(1));
-  testl(kScratchRegister, Immediate(0x03));
+  testl(kScratchRegister, Immediate(3));
   return zero;
 }

=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.h Thu Sep 23 02:22:45 2010 +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.h Thu Sep 30 04:48:03 2010
@@ -265,14 +265,14 @@
   // Is the value a tagged smi.
   Condition CheckSmi(Register src);

-  // Is the value a positive tagged smi.
-  Condition CheckPositiveSmi(Register src);
+  // Is the value a non-negative tagged smi.
+  Condition CheckNonNegativeSmi(Register src);

   // Are both values tagged smis.
   Condition CheckBothSmi(Register first, Register second);

-  // Are both values tagged smis.
-  Condition CheckBothPositiveSmi(Register first, Register second);
+  // Are both values non-negative tagged smis.
+  Condition CheckBothNonNegativeSmi(Register first, Register second);

   // Are either value a tagged smi.
   Condition CheckEitherSmi(Register first,
@@ -311,9 +311,9 @@
   template <typename LabelType>
   void JumpIfNotSmi(Register src, LabelType* on_not_smi);

-  // Jump to label if the value is not a positive tagged smi.
+  // Jump to label if the value is not a non-negative tagged smi.
   template <typename LabelType>
-  void JumpIfNotPositiveSmi(Register src, LabelType* on_not_smi);
+  void JumpUnlessNonNegativeSmi(Register src, LabelType* on_not_smi);

// Jump to label if the value, which must be a tagged smi, has value equal
   // to the constant.
@@ -328,10 +328,10 @@
                         Register src2,
                         LabelType* on_not_both_smi);

-  // Jump if either or both register are not positive smi values.
+  // Jump if either or both register are not non-negative smi values.
   template <typename LabelType>
-  void JumpIfNotBothPositiveSmi(Register src1, Register src2,
-                                LabelType* on_not_both_smi);
+  void JumpUnlessBothNonNegativeSmi(Register src1, Register src2,
+                                    LabelType* on_not_both_smi);

   // Operations on tagged smi values.

@@ -1463,10 +1463,10 @@


 template <typename LabelType>
-void MacroAssembler::JumpIfNotPositiveSmi(Register src,
-                                          LabelType* on_not_positive_smi) {
-  Condition positive_smi = CheckPositiveSmi(src);
-  j(NegateCondition(positive_smi), on_not_positive_smi);
+void MacroAssembler::JumpUnlessNonNegativeSmi(
+    Register src, LabelType* on_not_smi_or_negative) {
+  Condition non_negative_smi = CheckNonNegativeSmi(src);
+  j(NegateCondition(non_negative_smi), on_not_smi_or_negative);
 }


@@ -1505,10 +1505,10 @@


 template <typename LabelType>
-void MacroAssembler::JumpIfNotBothPositiveSmi(Register src1,
-                                              Register src2,
-                                              LabelType* on_not_both_smi) {
-  Condition both_smi = CheckBothPositiveSmi(src1, src2);
+void MacroAssembler::JumpUnlessBothNonNegativeSmi(Register src1,
+                                                  Register src2,
+ LabelType* on_not_both_smi) {
+  Condition both_smi = CheckBothNonNegativeSmi(src1, src2);
   j(NegateCondition(both_smi), on_not_both_smi);
 }

=======================================
--- /branches/bleeding_edge/test/cctest/test-macro-assembler-x64.cc Fri Jul 2 07:09:35 2010 +++ /branches/bleeding_edge/test/cctest/test-macro-assembler-x64.cc Thu Sep 30 04:48:03 2010
@@ -519,40 +519,40 @@
   __ incq(rax);
   __ movl(rcx, Immediate(0));
   __ Integer32ToSmi(rcx, rcx);
-  cond = masm->CheckPositiveSmi(rcx);  // Zero counts as positive.
+  cond = masm->CheckNonNegativeSmi(rcx);
   __ j(NegateCondition(cond), &exit);

   __ incq(rax);
   __ xor_(rcx, Immediate(kSmiTagMask));
-  cond = masm->CheckPositiveSmi(rcx);  // "zero" non-smi.
+  cond = masm->CheckNonNegativeSmi(rcx);  // "zero" non-smi.
   __ j(cond, &exit);

   __ incq(rax);
   __ movq(rcx, Immediate(-1));
   __ Integer32ToSmi(rcx, rcx);
-  cond = masm->CheckPositiveSmi(rcx);  // Negative smis are not positive.
+ cond = masm->CheckNonNegativeSmi(rcx); // Negative smis are not positive.
   __ j(cond, &exit);

   __ incq(rax);
   __ movq(rcx, Immediate(Smi::kMinValue));
   __ Integer32ToSmi(rcx, rcx);
- cond = masm->CheckPositiveSmi(rcx); // Most negative smi is not positive. + cond = masm->CheckNonNegativeSmi(rcx); // Most negative smi is not positive.
   __ j(cond, &exit);

   __ incq(rax);
   __ xor_(rcx, Immediate(kSmiTagMask));
-  cond = masm->CheckPositiveSmi(rcx);  // "Negative" non-smi.
+  cond = masm->CheckNonNegativeSmi(rcx);  // "Negative" non-smi.
   __ j(cond, &exit);

   __ incq(rax);
   __ movq(rcx, Immediate(Smi::kMaxValue));
   __ Integer32ToSmi(rcx, rcx);
-  cond = masm->CheckPositiveSmi(rcx);  // Most positive smi is positive.
+  cond = masm->CheckNonNegativeSmi(rcx);  // Most positive smi is positive.
   __ j(NegateCondition(cond), &exit);

   __ incq(rax);
   __ xor_(rcx, Immediate(kSmiTagMask));
-  cond = masm->CheckPositiveSmi(rcx);  // "Positive" non-smi.
+  cond = masm->CheckNonNegativeSmi(rcx);  // "Positive" non-smi.
   __ j(cond, &exit);

   // CheckIsMinSmi

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

Reply via email to