OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 3705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3716 Register result_bits = ToRegister(instr->temp3()); | 3716 Register result_bits = ToRegister(instr->temp3()); |
3717 Register result = ToRegister(instr->result()); | 3717 Register result = ToRegister(instr->result()); |
3718 Label done; | 3718 Label done; |
3719 | 3719 |
3720 // Handle smis inline. | 3720 // Handle smis inline. |
3721 // We can treat smis as 64-bit integers, since the (low-order) tag bits will | 3721 // We can treat smis as 64-bit integers, since the (low-order) tag bits will |
3722 // never get set by the negation. This is therefore the same as the Integer32 | 3722 // never get set by the negation. This is therefore the same as the Integer32 |
3723 // case in DoMathAbs, except that it operates on 64-bit values. | 3723 // case in DoMathAbs, except that it operates on 64-bit values. |
3724 STATIC_ASSERT((kSmiValueSize == 32) && (kSmiShift == 32) && (kSmiTag == 0)); | 3724 STATIC_ASSERT((kSmiValueSize == 32) && (kSmiShift == 32) && (kSmiTag == 0)); |
3725 | 3725 |
3726 // TODO(jbramley): We can't use JumpIfNotSmi here because the tbz it uses | 3726 __ JumpIfNotSmi(input, deferred->entry()); |
3727 // doesn't always have enough range. Consider making a variant of it, or a | |
3728 // TestIsSmi helper. | |
3729 STATIC_ASSERT(kSmiTag == 0); | |
3730 __ Tst(input, kSmiTagMask); | |
3731 __ B(ne, deferred->entry()); | |
3732 | 3727 |
3733 __ Abs(result, input, NULL, &done); | 3728 __ Abs(result, input, NULL, &done); |
3734 | 3729 |
3735 // The result is the magnitude (abs) of the smallest value a smi can | 3730 // The result is the magnitude (abs) of the smallest value a smi can |
3736 // represent, encoded as a double. | 3731 // represent, encoded as a double. |
3737 __ Mov(result_bits, double_to_rawbits(0x80000000)); | 3732 __ Mov(result_bits, double_to_rawbits(0x80000000)); |
3738 __ B(deferred->allocation_entry()); | 3733 __ B(deferred->allocation_entry()); |
3739 | 3734 |
3740 __ Bind(deferred->exit()); | 3735 __ Bind(deferred->exit()); |
3741 __ Str(result_bits, FieldMemOperand(result, HeapNumber::kValueOffset)); | 3736 __ Str(result_bits, FieldMemOperand(result, HeapNumber::kValueOffset)); |
(...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5673 __ Bind(&out_of_object); | 5668 __ Bind(&out_of_object); |
5674 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5669 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
5675 // Index is equal to negated out of object property index plus 1. | 5670 // Index is equal to negated out of object property index plus 1. |
5676 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5671 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
5677 __ Ldr(result, FieldMemOperand(result, | 5672 __ Ldr(result, FieldMemOperand(result, |
5678 FixedArray::kHeaderSize - kPointerSize)); | 5673 FixedArray::kHeaderSize - kPointerSize)); |
5679 __ Bind(&done); | 5674 __ Bind(&done); |
5680 } | 5675 } |
5681 | 5676 |
5682 } } // namespace v8::internal | 5677 } } // namespace v8::internal |
OLD | NEW |