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 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1730 __ Branch(&return_undefined, lt, t0, Operand(zero_reg)); | 1730 __ Branch(&return_undefined, lt, t0, Operand(zero_reg)); |
1731 | 1731 |
1732 // Get the last element. | 1732 // Get the last element. |
1733 __ LoadRoot(t2, Heap::kTheHoleValueRootIndex); | 1733 __ LoadRoot(t2, Heap::kTheHoleValueRootIndex); |
1734 STATIC_ASSERT(kSmiTagSize == 1); | 1734 STATIC_ASSERT(kSmiTagSize == 1); |
1735 STATIC_ASSERT(kSmiTag == 0); | 1735 STATIC_ASSERT(kSmiTag == 0); |
1736 // We can't address the last element in one operation. Compute the more | 1736 // We can't address the last element in one operation. Compute the more |
1737 // expensive shift first, and use an offset later on. | 1737 // expensive shift first, and use an offset later on. |
1738 __ sll(t1, t0, kPointerSizeLog2 - kSmiTagSize); | 1738 __ sll(t1, t0, kPointerSizeLog2 - kSmiTagSize); |
1739 __ Addu(elements, elements, t1); | 1739 __ Addu(elements, elements, t1); |
1740 __ lw(v0, MemOperand(elements, FixedArray::kHeaderSize - kHeapObjectTag)); | 1740 __ lw(v0, FieldMemOperand(elements, FixedArray::kHeaderSize)); |
1741 __ Branch(&call_builtin, eq, v0, Operand(t2)); | 1741 __ Branch(&call_builtin, eq, v0, Operand(t2)); |
1742 | 1742 |
1743 // Set the array's length. | 1743 // Set the array's length. |
1744 __ sw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset)); | 1744 __ sw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
1745 | 1745 |
1746 // Fill with the hole. | 1746 // Fill with the hole. |
1747 __ sw(t2, MemOperand(elements, FixedArray::kHeaderSize - kHeapObjectTag)); | 1747 __ sw(t2, FieldMemOperand(elements, FixedArray::kHeaderSize)); |
1748 __ Drop(argc + 1); | 1748 __ Drop(argc + 1); |
1749 __ Ret(); | 1749 __ Ret(); |
1750 | 1750 |
1751 __ bind(&return_undefined); | 1751 __ bind(&return_undefined); |
1752 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); | 1752 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); |
1753 __ Drop(argc + 1); | 1753 __ Drop(argc + 1); |
1754 __ Ret(); | 1754 __ Ret(); |
1755 | 1755 |
1756 __ bind(&call_builtin); | 1756 __ bind(&call_builtin); |
1757 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop, | 1757 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop, |
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3489 // conversion. | 3489 // conversion. |
3490 // The arm version uses a temporary here to save r0, but we don't need to | 3490 // The arm version uses a temporary here to save r0, but we don't need to |
3491 // (a0 is not modified). | 3491 // (a0 is not modified). |
3492 __ LoadRoot(t1, Heap::kHeapNumberMapRootIndex); | 3492 __ LoadRoot(t1, Heap::kHeapNumberMapRootIndex); |
3493 __ AllocateHeapNumber(v0, a3, t0, t1, &slow); | 3493 __ AllocateHeapNumber(v0, a3, t0, t1, &slow); |
3494 | 3494 |
3495 if (CpuFeatures::IsSupported(FPU)) { | 3495 if (CpuFeatures::IsSupported(FPU)) { |
3496 CpuFeatures::Scope scope(FPU); | 3496 CpuFeatures::Scope scope(FPU); |
3497 __ mtc1(value, f0); | 3497 __ mtc1(value, f0); |
3498 __ cvt_d_w(f0, f0); | 3498 __ cvt_d_w(f0, f0); |
3499 __ sdc1(f0, MemOperand(v0, HeapNumber::kValueOffset - kHeapObjectTag)); | 3499 __ sdc1(f0, FieldMemOperand(v0, HeapNumber::kValueOffset)); |
3500 __ Ret(); | 3500 __ Ret(); |
3501 } else { | 3501 } else { |
3502 Register dst1 = t2; | 3502 Register dst1 = t2; |
3503 Register dst2 = t3; | 3503 Register dst2 = t3; |
3504 FloatingPointHelper::Destination dest = | 3504 FloatingPointHelper::Destination dest = |
3505 FloatingPointHelper::kCoreRegisters; | 3505 FloatingPointHelper::kCoreRegisters; |
3506 FloatingPointHelper::ConvertIntToDouble(masm, | 3506 FloatingPointHelper::ConvertIntToDouble(masm, |
3507 value, | 3507 value, |
3508 dest, | 3508 dest, |
3509 f0, | 3509 f0, |
(...skipping 27 matching lines...) Expand all Loading... |
3537 __ LoadRoot(t6, Heap::kHeapNumberMapRootIndex); | 3537 __ LoadRoot(t6, Heap::kHeapNumberMapRootIndex); |
3538 __ AllocateHeapNumber(v0, t2, t3, t6, &slow); | 3538 __ AllocateHeapNumber(v0, t2, t3, t6, &slow); |
3539 | 3539 |
3540 // This is replaced by a macro: | 3540 // This is replaced by a macro: |
3541 // __ mtc1(value, f0); // LS 32-bits. | 3541 // __ mtc1(value, f0); // LS 32-bits. |
3542 // __ mtc1(zero_reg, f1); // MS 32-bits are all zero. | 3542 // __ mtc1(zero_reg, f1); // MS 32-bits are all zero. |
3543 // __ cvt_d_l(f0, f0); // Use 64 bit conv to get correct unsigned 32-bit. | 3543 // __ cvt_d_l(f0, f0); // Use 64 bit conv to get correct unsigned 32-bit. |
3544 | 3544 |
3545 __ Cvt_d_uw(f0, value, f22); | 3545 __ Cvt_d_uw(f0, value, f22); |
3546 | 3546 |
3547 __ sdc1(f0, MemOperand(v0, HeapNumber::kValueOffset - kHeapObjectTag)); | 3547 __ sdc1(f0, FieldMemOperand(v0, HeapNumber::kValueOffset)); |
3548 | 3548 |
3549 __ Ret(); | 3549 __ Ret(); |
3550 } else { | 3550 } else { |
3551 // Check whether unsigned integer fits into smi. | 3551 // Check whether unsigned integer fits into smi. |
3552 Label box_int_0, box_int_1, done; | 3552 Label box_int_0, box_int_1, done; |
3553 __ And(t2, value, Operand(0x80000000)); | 3553 __ And(t2, value, Operand(0x80000000)); |
3554 __ Branch(&box_int_0, ne, t2, Operand(zero_reg)); | 3554 __ Branch(&box_int_0, ne, t2, Operand(zero_reg)); |
3555 __ And(t2, value, Operand(0x40000000)); | 3555 __ And(t2, value, Operand(0x40000000)); |
3556 __ Branch(&box_int_1, ne, t2, Operand(zero_reg)); | 3556 __ Branch(&box_int_1, ne, t2, Operand(zero_reg)); |
3557 | 3557 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3591 // HeapNumber. | 3591 // HeapNumber. |
3592 if (CpuFeatures::IsSupported(FPU)) { | 3592 if (CpuFeatures::IsSupported(FPU)) { |
3593 CpuFeatures::Scope scope(FPU); | 3593 CpuFeatures::Scope scope(FPU); |
3594 // Allocate a HeapNumber for the result. Don't use a0 and a1 as | 3594 // Allocate a HeapNumber for the result. Don't use a0 and a1 as |
3595 // AllocateHeapNumber clobbers all registers - also when jumping due to | 3595 // AllocateHeapNumber clobbers all registers - also when jumping due to |
3596 // exhausted young space. | 3596 // exhausted young space. |
3597 __ LoadRoot(t6, Heap::kHeapNumberMapRootIndex); | 3597 __ LoadRoot(t6, Heap::kHeapNumberMapRootIndex); |
3598 __ AllocateHeapNumber(v0, t3, t5, t6, &slow); | 3598 __ AllocateHeapNumber(v0, t3, t5, t6, &slow); |
3599 // The float (single) value is already in fpu reg f0 (if we use float). | 3599 // The float (single) value is already in fpu reg f0 (if we use float). |
3600 __ cvt_d_s(f0, f0); | 3600 __ cvt_d_s(f0, f0); |
3601 __ sdc1(f0, MemOperand(v0, HeapNumber::kValueOffset - kHeapObjectTag)); | 3601 __ sdc1(f0, FieldMemOperand(v0, HeapNumber::kValueOffset)); |
3602 __ Ret(); | 3602 __ Ret(); |
3603 } else { | 3603 } else { |
3604 // Allocate a HeapNumber for the result. Don't use a0 and a1 as | 3604 // Allocate a HeapNumber for the result. Don't use a0 and a1 as |
3605 // AllocateHeapNumber clobbers all registers - also when jumping due to | 3605 // AllocateHeapNumber clobbers all registers - also when jumping due to |
3606 // exhausted young space. | 3606 // exhausted young space. |
3607 __ LoadRoot(t6, Heap::kHeapNumberMapRootIndex); | 3607 __ LoadRoot(t6, Heap::kHeapNumberMapRootIndex); |
3608 __ AllocateHeapNumber(v0, t3, t5, t6, &slow); | 3608 __ AllocateHeapNumber(v0, t3, t5, t6, &slow); |
3609 // FPU is not available, do manual single to double conversion. | 3609 // FPU is not available, do manual single to double conversion. |
3610 | 3610 |
3611 // a2: floating point value (binary32). | 3611 // a2: floating point value (binary32). |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4510 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4510 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
4511 } | 4511 } |
4512 } | 4512 } |
4513 | 4513 |
4514 | 4514 |
4515 #undef __ | 4515 #undef __ |
4516 | 4516 |
4517 } } // namespace v8::internal | 4517 } } // namespace v8::internal |
4518 | 4518 |
4519 #endif // V8_TARGET_ARCH_MIPS | 4519 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |