| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 // Convert and store int passed in register ival to IEEE 754 single precision | 946 // Convert and store int passed in register ival to IEEE 754 single precision |
| 947 // floating point value at memory location (dst + 4 * wordoffset) | 947 // floating point value at memory location (dst + 4 * wordoffset) |
| 948 // If VFP3 is available use it for conversion. | 948 // If VFP3 is available use it for conversion. |
| 949 static void StoreIntAsFloat(MacroAssembler* masm, | 949 static void StoreIntAsFloat(MacroAssembler* masm, |
| 950 Register dst, | 950 Register dst, |
| 951 Register wordoffset, | 951 Register wordoffset, |
| 952 Register ival, | 952 Register ival, |
| 953 Register fval, | 953 Register fval, |
| 954 Register scratch1, | 954 Register scratch1, |
| 955 Register scratch2) { | 955 Register scratch2) { |
| 956 if (CpuFeatures::IsSupported(VFP3)) { | 956 if (masm->isolate()->cpu_features()->IsSupported(VFP3)) { |
| 957 CpuFeatures::Scope scope(VFP3); | 957 CpuFeatures::Scope scope(VFP3); |
| 958 __ vmov(s0, ival); | 958 __ vmov(s0, ival); |
| 959 __ add(scratch1, dst, Operand(wordoffset, LSL, 2)); | 959 __ add(scratch1, dst, Operand(wordoffset, LSL, 2)); |
| 960 __ vcvt_f32_s32(s0, s0); | 960 __ vcvt_f32_s32(s0, s0); |
| 961 __ vstr(s0, scratch1, 0); | 961 __ vstr(s0, scratch1, 0); |
| 962 } else { | 962 } else { |
| 963 Label not_special, done; | 963 Label not_special, done; |
| 964 // Move sign bit from source to destination. This works because the sign | 964 // Move sign bit from source to destination. This works because the sign |
| 965 // bit in the exponent word of the double has the same position and polarity | 965 // bit in the exponent word of the double has the same position and polarity |
| 966 // as the 2's complement sign bit in a Smi. | 966 // as the 2's complement sign bit in a Smi. |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2041 JSFunction* function, | 2041 JSFunction* function, |
| 2042 String* name) { | 2042 String* name) { |
| 2043 // ----------- S t a t e ------------- | 2043 // ----------- S t a t e ------------- |
| 2044 // -- r2 : function name | 2044 // -- r2 : function name |
| 2045 // -- lr : return address | 2045 // -- lr : return address |
| 2046 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) | 2046 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) |
| 2047 // -- ... | 2047 // -- ... |
| 2048 // -- sp[argc * 4] : receiver | 2048 // -- sp[argc * 4] : receiver |
| 2049 // ----------------------------------- | 2049 // ----------------------------------- |
| 2050 | 2050 |
| 2051 if (!CpuFeatures::IsSupported(VFP3)) { | 2051 if (!masm()->isolate()->cpu_features()->IsSupported(VFP3)) { |
| 2052 return heap()->undefined_value(); | 2052 return heap()->undefined_value(); |
| 2053 } | 2053 } |
| 2054 | 2054 |
| 2055 CpuFeatures::Scope scope_vfp3(VFP3); | 2055 CpuFeatures::Scope scope_vfp3(VFP3); |
| 2056 | 2056 |
| 2057 const int argc = arguments().immediate(); | 2057 const int argc = arguments().immediate(); |
| 2058 | 2058 |
| 2059 // If the object is not a JSObject or we got an unexpected number of | 2059 // If the object is not a JSObject or we got an unexpected number of |
| 2060 // arguments, bail out to the regular call. | 2060 // arguments, bail out to the regular call. |
| 2061 if (!object->IsJSObject() || argc != 1) return heap()->undefined_value(); | 2061 if (!object->IsJSObject() || argc != 1) return heap()->undefined_value(); |
| (...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3502 __ ldrsh(value, MemOperand(r3, key, LSL, 0)); | 3502 __ ldrsh(value, MemOperand(r3, key, LSL, 0)); |
| 3503 break; | 3503 break; |
| 3504 case kExternalUnsignedShortArray: | 3504 case kExternalUnsignedShortArray: |
| 3505 __ ldrh(value, MemOperand(r3, key, LSL, 0)); | 3505 __ ldrh(value, MemOperand(r3, key, LSL, 0)); |
| 3506 break; | 3506 break; |
| 3507 case kExternalIntArray: | 3507 case kExternalIntArray: |
| 3508 case kExternalUnsignedIntArray: | 3508 case kExternalUnsignedIntArray: |
| 3509 __ ldr(value, MemOperand(r3, key, LSL, 1)); | 3509 __ ldr(value, MemOperand(r3, key, LSL, 1)); |
| 3510 break; | 3510 break; |
| 3511 case kExternalFloatArray: | 3511 case kExternalFloatArray: |
| 3512 if (CpuFeatures::IsSupported(VFP3)) { | 3512 if (masm()->isolate()->cpu_features()->IsSupported(VFP3)) { |
| 3513 CpuFeatures::Scope scope(VFP3); | 3513 CpuFeatures::Scope scope(VFP3); |
| 3514 __ add(r2, r3, Operand(key, LSL, 1)); | 3514 __ add(r2, r3, Operand(key, LSL, 1)); |
| 3515 __ vldr(s0, r2, 0); | 3515 __ vldr(s0, r2, 0); |
| 3516 } else { | 3516 } else { |
| 3517 __ ldr(value, MemOperand(r3, key, LSL, 1)); | 3517 __ ldr(value, MemOperand(r3, key, LSL, 1)); |
| 3518 } | 3518 } |
| 3519 break; | 3519 break; |
| 3520 default: | 3520 default: |
| 3521 UNREACHABLE(); | 3521 UNREACHABLE(); |
| 3522 break; | 3522 break; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3541 | 3541 |
| 3542 __ bind(&box_int); | 3542 __ bind(&box_int); |
| 3543 // Allocate a HeapNumber for the result and perform int-to-double | 3543 // Allocate a HeapNumber for the result and perform int-to-double |
| 3544 // conversion. Don't touch r0 or r1 as they are needed if allocation | 3544 // conversion. Don't touch r0 or r1 as they are needed if allocation |
| 3545 // fails. | 3545 // fails. |
| 3546 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex); | 3546 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex); |
| 3547 __ AllocateHeapNumber(r5, r3, r4, r6, &slow); | 3547 __ AllocateHeapNumber(r5, r3, r4, r6, &slow); |
| 3548 // Now we can use r0 for the result as key is not needed any more. | 3548 // Now we can use r0 for the result as key is not needed any more. |
| 3549 __ mov(r0, r5); | 3549 __ mov(r0, r5); |
| 3550 | 3550 |
| 3551 if (CpuFeatures::IsSupported(VFP3)) { | 3551 if (masm()->isolate()->cpu_features()->IsSupported(VFP3)) { |
| 3552 CpuFeatures::Scope scope(VFP3); | 3552 CpuFeatures::Scope scope(VFP3); |
| 3553 __ vmov(s0, value); | 3553 __ vmov(s0, value); |
| 3554 __ vcvt_f64_s32(d0, s0); | 3554 __ vcvt_f64_s32(d0, s0); |
| 3555 __ sub(r3, r0, Operand(kHeapObjectTag)); | 3555 __ sub(r3, r0, Operand(kHeapObjectTag)); |
| 3556 __ vstr(d0, r3, HeapNumber::kValueOffset); | 3556 __ vstr(d0, r3, HeapNumber::kValueOffset); |
| 3557 __ Ret(); | 3557 __ Ret(); |
| 3558 } else { | 3558 } else { |
| 3559 WriteInt32ToHeapNumberStub stub(value, r0, r3); | 3559 WriteInt32ToHeapNumberStub stub(value, r0, r3); |
| 3560 __ TailCallStub(&stub); | 3560 __ TailCallStub(&stub); |
| 3561 } | 3561 } |
| 3562 } else if (array_type == kExternalUnsignedIntArray) { | 3562 } else if (array_type == kExternalUnsignedIntArray) { |
| 3563 // The test is different for unsigned int values. Since we need | 3563 // The test is different for unsigned int values. Since we need |
| 3564 // the value to be in the range of a positive smi, we can't | 3564 // the value to be in the range of a positive smi, we can't |
| 3565 // handle either of the top two bits being set in the value. | 3565 // handle either of the top two bits being set in the value. |
| 3566 if (CpuFeatures::IsSupported(VFP3)) { | 3566 if (masm()->isolate()->cpu_features()->IsSupported(VFP3)) { |
| 3567 CpuFeatures::Scope scope(VFP3); | 3567 CpuFeatures::Scope scope(VFP3); |
| 3568 Label box_int, done; | 3568 Label box_int, done; |
| 3569 __ tst(value, Operand(0xC0000000)); | 3569 __ tst(value, Operand(0xC0000000)); |
| 3570 __ b(ne, &box_int); | 3570 __ b(ne, &box_int); |
| 3571 // Tag integer as smi and return it. | 3571 // Tag integer as smi and return it. |
| 3572 __ mov(r0, Operand(value, LSL, kSmiTagSize)); | 3572 __ mov(r0, Operand(value, LSL, kSmiTagSize)); |
| 3573 __ Ret(); | 3573 __ Ret(); |
| 3574 | 3574 |
| 3575 __ bind(&box_int); | 3575 __ bind(&box_int); |
| 3576 __ vmov(s0, value); | 3576 __ vmov(s0, value); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3620 | 3620 |
| 3621 __ str(hiword, FieldMemOperand(r4, HeapNumber::kExponentOffset)); | 3621 __ str(hiword, FieldMemOperand(r4, HeapNumber::kExponentOffset)); |
| 3622 __ str(loword, FieldMemOperand(r4, HeapNumber::kMantissaOffset)); | 3622 __ str(loword, FieldMemOperand(r4, HeapNumber::kMantissaOffset)); |
| 3623 | 3623 |
| 3624 __ mov(r0, r4); | 3624 __ mov(r0, r4); |
| 3625 __ Ret(); | 3625 __ Ret(); |
| 3626 } | 3626 } |
| 3627 } else if (array_type == kExternalFloatArray) { | 3627 } else if (array_type == kExternalFloatArray) { |
| 3628 // For the floating-point array type, we need to always allocate a | 3628 // For the floating-point array type, we need to always allocate a |
| 3629 // HeapNumber. | 3629 // HeapNumber. |
| 3630 if (CpuFeatures::IsSupported(VFP3)) { | 3630 if (masm()->isolate()->cpu_features()->IsSupported(VFP3)) { |
| 3631 CpuFeatures::Scope scope(VFP3); | 3631 CpuFeatures::Scope scope(VFP3); |
| 3632 // Allocate a HeapNumber for the result. Don't use r0 and r1 as | 3632 // Allocate a HeapNumber for the result. Don't use r0 and r1 as |
| 3633 // AllocateHeapNumber clobbers all registers - also when jumping due to | 3633 // AllocateHeapNumber clobbers all registers - also when jumping due to |
| 3634 // exhausted young space. | 3634 // exhausted young space. |
| 3635 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex); | 3635 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex); |
| 3636 __ AllocateHeapNumber(r2, r3, r4, r6, &slow); | 3636 __ AllocateHeapNumber(r2, r3, r4, r6, &slow); |
| 3637 __ vcvt_f64_f32(d0, s0); | 3637 __ vcvt_f64_f32(d0, s0); |
| 3638 __ sub(r1, r2, Operand(kHeapObjectTag)); | 3638 __ sub(r1, r2, Operand(kHeapObjectTag)); |
| 3639 __ vstr(d0, r1, HeapNumber::kValueOffset); | 3639 __ vstr(d0, r1, HeapNumber::kValueOffset); |
| 3640 | 3640 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3813 __ b(ne, &slow); | 3813 __ b(ne, &slow); |
| 3814 | 3814 |
| 3815 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset)); | 3815 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset)); |
| 3816 | 3816 |
| 3817 // r3: base pointer of external storage. | 3817 // r3: base pointer of external storage. |
| 3818 // r4: key (integer). | 3818 // r4: key (integer). |
| 3819 | 3819 |
| 3820 // The WebGL specification leaves the behavior of storing NaN and | 3820 // The WebGL specification leaves the behavior of storing NaN and |
| 3821 // +/-Infinity into integer arrays basically undefined. For more | 3821 // +/-Infinity into integer arrays basically undefined. For more |
| 3822 // reproducible behavior, convert these to zero. | 3822 // reproducible behavior, convert these to zero. |
| 3823 if (CpuFeatures::IsSupported(VFP3)) { | 3823 if (masm()->isolate()->cpu_features()->IsSupported(VFP3)) { |
| 3824 CpuFeatures::Scope scope(VFP3); | 3824 CpuFeatures::Scope scope(VFP3); |
| 3825 | 3825 |
| 3826 if (array_type == kExternalFloatArray) { | 3826 if (array_type == kExternalFloatArray) { |
| 3827 // vldr requires offset to be a multiple of 4 so we can not | 3827 // vldr requires offset to be a multiple of 4 so we can not |
| 3828 // include -kHeapObjectTag into it. | 3828 // include -kHeapObjectTag into it. |
| 3829 __ sub(r5, r0, Operand(kHeapObjectTag)); | 3829 __ sub(r5, r0, Operand(kHeapObjectTag)); |
| 3830 __ vldr(d0, r5, HeapNumber::kValueOffset); | 3830 __ vldr(d0, r5, HeapNumber::kValueOffset); |
| 3831 __ add(r5, r3, Operand(r4, LSL, 2)); | 3831 __ add(r5, r3, Operand(r4, LSL, 2)); |
| 3832 __ vcvt_f32_f64(s0, d0); | 3832 __ vcvt_f32_f64(s0, d0); |
| 3833 __ vstr(s0, r5, 0); | 3833 __ vstr(s0, r5, 0); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4025 | 4025 |
| 4026 return GetCode(flags); | 4026 return GetCode(flags); |
| 4027 } | 4027 } |
| 4028 | 4028 |
| 4029 | 4029 |
| 4030 #undef __ | 4030 #undef __ |
| 4031 | 4031 |
| 4032 } } // namespace v8::internal | 4032 } } // namespace v8::internal |
| 4033 | 4033 |
| 4034 #endif // V8_TARGET_ARCH_ARM | 4034 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |