OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 5136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5147 case Token::SUB: | 5147 case Token::SUB: |
5148 __ subl(answer.reg(), right->reg()); | 5148 __ subl(answer.reg(), right->reg()); |
5149 deferred->Branch(overflow); | 5149 deferred->Branch(overflow); |
5150 break; | 5150 break; |
5151 | 5151 |
5152 case Token::MUL: { | 5152 case Token::MUL: { |
5153 // If the smi tag is 0 we can just leave the tag on one operand. | 5153 // If the smi tag is 0 we can just leave the tag on one operand. |
5154 ASSERT(kSmiTag == 0); // Adjust code below if not the case. | 5154 ASSERT(kSmiTag == 0); // Adjust code below if not the case. |
5155 // Remove smi tag from the left operand (but keep sign). | 5155 // Remove smi tag from the left operand (but keep sign). |
5156 // Left-hand operand has been copied into answer. | 5156 // Left-hand operand has been copied into answer. |
5157 __ sar(answer.reg(), Immediate(kSmiTagSize)); | 5157 __ sarl(answer.reg(), Immediate(kSmiTagSize)); |
5158 // Do multiplication of smis, leaving result in answer. | 5158 // Do multiplication of smis, leaving result in answer. |
5159 __ imull(answer.reg(), right->reg()); | 5159 __ imull(answer.reg(), right->reg()); |
5160 // Go slow on overflows. | 5160 // Go slow on overflows. |
5161 deferred->Branch(overflow); | 5161 deferred->Branch(overflow); |
5162 // Check for negative zero result. If product is zero, and one | 5162 // Check for negative zero result. If product is zero, and one |
5163 // argument is negative, go to slow case. The frame is unchanged | 5163 // argument is negative, go to slow case. The frame is unchanged |
5164 // in this block, so local control flow can use a Label rather | 5164 // in this block, so local control flow can use a Label rather |
5165 // than a JumpTarget. | 5165 // than a JumpTarget. |
5166 Label non_zero_result; | 5166 Label non_zero_result; |
5167 __ testq(answer.reg(), answer.reg()); | 5167 __ testq(answer.reg(), answer.reg()); |
5168 __ j(not_zero, &non_zero_result); | 5168 __ j(not_zero, &non_zero_result); |
5169 __ movq(answer.reg(), left->reg()); | 5169 __ movq(answer.reg(), left->reg()); |
5170 __ or_(answer.reg(), right->reg()); | 5170 __ or_(answer.reg(), right->reg()); |
5171 deferred->Branch(negative); | 5171 deferred->Branch(negative); |
5172 __ xor_(answer.reg(), answer.reg()); // Positive 0 is correct. | 5172 __ xor_(answer.reg(), answer.reg()); // Positive 0 is correct. |
5173 __ bind(&non_zero_result); | 5173 __ bind(&non_zero_result); |
5174 break; | 5174 break; |
5175 } | 5175 } |
5176 | 5176 |
5177 case Token::BIT_OR: | 5177 case Token::BIT_OR: |
5178 __ or_(answer.reg(), right->reg()); | 5178 __ or_(answer.reg(), right->reg()); |
5179 break; | 5179 break; |
5180 | 5180 |
5181 case Token::BIT_AND: | 5181 case Token::BIT_AND: |
5182 __ and_(answer.reg(), right->reg()); | 5182 __ and_(answer.reg(), right->reg()); |
5183 break; | 5183 break; |
5184 | 5184 |
5185 case Token::BIT_XOR: | 5185 case Token::BIT_XOR: |
| 5186 ASSERT(kSmiTag == 0); // Adjust code below if not the case. |
5186 __ xor_(answer.reg(), right->reg()); | 5187 __ xor_(answer.reg(), right->reg()); |
5187 break; | 5188 break; |
5188 | 5189 |
5189 default: | 5190 default: |
5190 UNREACHABLE(); | 5191 UNREACHABLE(); |
5191 break; | 5192 break; |
5192 } | 5193 } |
5193 deferred->BindExit(); | 5194 deferred->BindExit(); |
5194 left->Unuse(); | 5195 left->Unuse(); |
5195 right->Unuse(); | 5196 right->Unuse(); |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6423 Register src, | 6424 Register src, |
6424 XMMRegister dst) { | 6425 XMMRegister dst) { |
6425 Label load_smi, done; | 6426 Label load_smi, done; |
6426 | 6427 |
6427 __ testl(src, Immediate(kSmiTagMask)); | 6428 __ testl(src, Immediate(kSmiTagMask)); |
6428 __ j(zero, &load_smi); | 6429 __ j(zero, &load_smi); |
6429 __ movsd(dst, FieldOperand(src, HeapNumber::kValueOffset)); | 6430 __ movsd(dst, FieldOperand(src, HeapNumber::kValueOffset)); |
6430 __ jmp(&done); | 6431 __ jmp(&done); |
6431 | 6432 |
6432 __ bind(&load_smi); | 6433 __ bind(&load_smi); |
6433 __ sar(src, Immediate(kSmiTagSize)); | 6434 __ sarl(src, Immediate(kSmiTagSize)); |
6434 __ cvtlsi2sd(dst, src); | 6435 __ cvtlsi2sd(dst, src); |
6435 | 6436 |
6436 __ bind(&done); | 6437 __ bind(&done); |
6437 } | 6438 } |
6438 | 6439 |
6439 | 6440 |
6440 void FloatingPointHelper::LoadFloatOperands(MacroAssembler* masm, | 6441 void FloatingPointHelper::LoadFloatOperands(MacroAssembler* masm, |
6441 XMMRegister dst1, | 6442 XMMRegister dst1, |
6442 XMMRegister dst2) { | 6443 XMMRegister dst2) { |
6443 __ movq(kScratchRegister, Operand(rsp, 2 * kPointerSize)); | 6444 __ movq(kScratchRegister, Operand(rsp, 2 * kPointerSize)); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6579 __ subl(rax, rbx); | 6580 __ subl(rax, rbx); |
6580 __ j(overflow, slow); // The slow case rereads operands from the stack. | 6581 __ j(overflow, slow); // The slow case rereads operands from the stack. |
6581 __ movsxlq(rax, rax); // Sign extend eax into rax. | 6582 __ movsxlq(rax, rax); // Sign extend eax into rax. |
6582 break; | 6583 break; |
6583 } | 6584 } |
6584 | 6585 |
6585 case Token::MUL: | 6586 case Token::MUL: |
6586 // If the smi tag is 0 we can just leave the tag on one operand. | 6587 // If the smi tag is 0 we can just leave the tag on one operand. |
6587 ASSERT(kSmiTag == 0); // adjust code below if not the case | 6588 ASSERT(kSmiTag == 0); // adjust code below if not the case |
6588 // Remove tag from one of the operands (but keep sign). | 6589 // Remove tag from one of the operands (but keep sign). |
6589 __ sar(rax, Immediate(kSmiTagSize)); | 6590 __ sarl(rax, Immediate(kSmiTagSize)); |
6590 // Do multiplication. | 6591 // Do multiplication. |
6591 __ imull(rax, rbx); // multiplication of smis; result in eax | 6592 __ imull(rax, rbx); // multiplication of smis; result in eax |
6592 // Go slow on overflows. | 6593 // Go slow on overflows. |
6593 __ j(overflow, slow); | 6594 __ j(overflow, slow); |
6594 // Check for negative zero result. | 6595 // Check for negative zero result. |
6595 __ movsxlq(rax, rax); // Sign extend eax into rax. | 6596 __ movsxlq(rax, rax); // Sign extend eax into rax. |
6596 __ NegativeZeroTest(rax, rcx, slow); // use rcx = x | y | 6597 __ NegativeZeroTest(rax, rcx, slow); // use rcx = x | y |
6597 break; | 6598 break; |
6598 | 6599 |
6599 case Token::DIV: | 6600 case Token::DIV: |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6942 int CompareStub::MinorKey() { | 6943 int CompareStub::MinorKey() { |
6943 // Encode the two parameters in a unique 16 bit value. | 6944 // Encode the two parameters in a unique 16 bit value. |
6944 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); | 6945 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); |
6945 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); | 6946 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); |
6946 } | 6947 } |
6947 | 6948 |
6948 | 6949 |
6949 #undef __ | 6950 #undef __ |
6950 | 6951 |
6951 } } // namespace v8::internal | 6952 } } // namespace v8::internal |
OLD | NEW |