Commit f8b274ee authored by antonm@chromium.org's avatar antonm@chromium.org

Rename some x64 macros to be more precise about their semantics.

Review URL: http://codereview.chromium.org/3574002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5566 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4e961fdd
......@@ -715,7 +715,7 @@ static void ArrayNativeCode(MacroAssembler* masm,
__ 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.
......
......@@ -3801,7 +3801,7 @@ void SubStringStub::Generate(MacroAssembler* masm) {
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);
......
......@@ -1884,8 +1884,7 @@ Result CodeGenerator::ConstantSmiBinaryOperation(BinaryOperation* expr,
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 @@ void CodeGenerator::GenerateIsNonNegativeSmi(ZoneList<Expression*>* args) {
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 @@ void CodeGenerator::GenerateSwapElements(ZoneList<Expression*>* args) {
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 @@ Result CodeGenerator::EmitNamedStore(Handle<String> name, bool is_contextual) {
}
// 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 @@ Result CodeGenerator::EmitKeyedLoad() {
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(),
......
......@@ -767,7 +767,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// 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 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(Expression* expr,
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 @@ void FullCodeGenerator::EmitIsNonNegativeSmi(ZoneList<Expression*>* args) {
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);
}
......
......@@ -895,7 +895,7 @@ void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
// 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));
......
......@@ -825,7 +825,7 @@ Condition MacroAssembler::CheckSmi(Register src) {
}
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::CheckBothSmi(Register first, Register second) {
}
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;
}
......
......@@ -265,14 +265,14 @@ class MacroAssembler: public Assembler {
// 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 @@ class MacroAssembler: public Assembler {
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 @@ class MacroAssembler: public Assembler {
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 @@ void MacroAssembler::JumpIfNotSmi(Register src, LabelType* on_not_smi) {
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 @@ void MacroAssembler::JumpIfNotBothSmi(Register src1,
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);
}
......
......@@ -519,40 +519,40 @@ TEST(SmiCheck) {
__ 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment