| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3637 Representation exponent_type = instr->hydrogen()->right()->representation(); | 3637 Representation exponent_type = instr->hydrogen()->right()->representation(); |
| 3638 // Having marked this as a call, we can use any registers. | 3638 // Having marked this as a call, we can use any registers. |
| 3639 // Just make sure that the input/output registers are the expected ones. | 3639 // Just make sure that the input/output registers are the expected ones. |
| 3640 ASSERT(!instr->right()->IsDoubleRegister() || | 3640 ASSERT(!instr->right()->IsDoubleRegister() || |
| 3641 ToDoubleRegister(instr->right()).is(f4)); | 3641 ToDoubleRegister(instr->right()).is(f4)); |
| 3642 ASSERT(!instr->right()->IsRegister() || | 3642 ASSERT(!instr->right()->IsRegister() || |
| 3643 ToRegister(instr->right()).is(a2)); | 3643 ToRegister(instr->right()).is(a2)); |
| 3644 ASSERT(ToDoubleRegister(instr->left()).is(f2)); | 3644 ASSERT(ToDoubleRegister(instr->left()).is(f2)); |
| 3645 ASSERT(ToDoubleRegister(instr->result()).is(f0)); | 3645 ASSERT(ToDoubleRegister(instr->result()).is(f0)); |
| 3646 | 3646 |
| 3647 if (exponent_type.IsTagged()) { | 3647 if (exponent_type.IsSmi()) { |
| 3648 MathPowStub stub(MathPowStub::TAGGED); |
| 3649 __ CallStub(&stub); |
| 3650 } else if (exponent_type.IsTagged()) { |
| 3648 Label no_deopt; | 3651 Label no_deopt; |
| 3649 __ JumpIfSmi(a2, &no_deopt); | 3652 __ JumpIfSmi(a2, &no_deopt); |
| 3650 __ lw(t3, FieldMemOperand(a2, HeapObject::kMapOffset)); | 3653 __ lw(t3, FieldMemOperand(a2, HeapObject::kMapOffset)); |
| 3651 DeoptimizeIf(ne, instr->environment(), t3, Operand(at)); | 3654 DeoptimizeIf(ne, instr->environment(), t3, Operand(at)); |
| 3652 __ bind(&no_deopt); | 3655 __ bind(&no_deopt); |
| 3653 MathPowStub stub(MathPowStub::TAGGED); | 3656 MathPowStub stub(MathPowStub::TAGGED); |
| 3654 __ CallStub(&stub); | 3657 __ CallStub(&stub); |
| 3655 } else if (exponent_type.IsInteger32()) { | 3658 } else if (exponent_type.IsInteger32()) { |
| 3656 MathPowStub stub(MathPowStub::INTEGER); | 3659 MathPowStub stub(MathPowStub::INTEGER); |
| 3657 __ CallStub(&stub); | 3660 __ CallStub(&stub); |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4641 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { | 4644 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { |
| 4642 Register scratch = scratch0(); | 4645 Register scratch = scratch0(); |
| 4643 Register input = ToRegister(instr->value()); | 4646 Register input = ToRegister(instr->value()); |
| 4644 Register result = ToRegister(instr->result()); | 4647 Register result = ToRegister(instr->result()); |
| 4645 if (instr->needs_check()) { | 4648 if (instr->needs_check()) { |
| 4646 STATIC_ASSERT(kHeapObjectTag == 1); | 4649 STATIC_ASSERT(kHeapObjectTag == 1); |
| 4647 // If the input is a HeapObject, value of scratch won't be zero. | 4650 // If the input is a HeapObject, value of scratch won't be zero. |
| 4648 __ And(scratch, input, Operand(kHeapObjectTag)); | 4651 __ And(scratch, input, Operand(kHeapObjectTag)); |
| 4649 __ SmiUntag(result, input); | 4652 __ SmiUntag(result, input); |
| 4650 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg)); | 4653 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg)); |
| 4651 } else if (instr->hydrogen()->value()->IsLoadKeyed()) { | |
| 4652 HLoadKeyed* load = HLoadKeyed::cast(instr->hydrogen()->value()); | |
| 4653 if (load->UsesMustHandleHole()) { | |
| 4654 __ And(scratch, input, Operand(kHeapObjectTag)); | |
| 4655 __ SmiUntag(result, input); | |
| 4656 if (load->hole_mode() == ALLOW_RETURN_HOLE) { | |
| 4657 Label done; | |
| 4658 __ Branch(&done, eq, scratch, Operand(zero_reg)); | |
| 4659 __ li(result, Operand(Smi::FromInt(0))); | |
| 4660 __ bind(&done); | |
| 4661 } else { | |
| 4662 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg)); | |
| 4663 } | |
| 4664 } else { | |
| 4665 __ SmiUntag(result, input); | |
| 4666 } | |
| 4667 } else { | 4654 } else { |
| 4668 __ SmiUntag(result, input); | 4655 __ SmiUntag(result, input); |
| 4669 } | 4656 } |
| 4670 } | 4657 } |
| 4671 | 4658 |
| 4672 | 4659 |
| 4673 void LCodeGen::EmitNumberUntagD(Register input_reg, | 4660 void LCodeGen::EmitNumberUntagD(Register input_reg, |
| 4674 DoubleRegister result_reg, | 4661 DoubleRegister result_reg, |
| 4675 bool deoptimize_on_undefined, | 4662 bool deoptimize_on_undefined, |
| 4676 bool deoptimize_on_minus_zero, | 4663 bool deoptimize_on_minus_zero, |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5765 __ Subu(scratch, result, scratch); | 5752 __ Subu(scratch, result, scratch); |
| 5766 __ lw(result, FieldMemOperand(scratch, | 5753 __ lw(result, FieldMemOperand(scratch, |
| 5767 FixedArray::kHeaderSize - kPointerSize)); | 5754 FixedArray::kHeaderSize - kPointerSize)); |
| 5768 __ bind(&done); | 5755 __ bind(&done); |
| 5769 } | 5756 } |
| 5770 | 5757 |
| 5771 | 5758 |
| 5772 #undef __ | 5759 #undef __ |
| 5773 | 5760 |
| 5774 } } // namespace v8::internal | 5761 } } // namespace v8::internal |
| OLD | NEW |