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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 // floating point value at memory location (dst + 4 * wordoffset) | 997 // floating point value at memory location (dst + 4 * wordoffset) |
998 // If VFP3 is available use it for conversion. | 998 // If VFP3 is available use it for conversion. |
999 static void StoreIntAsFloat(MacroAssembler* masm, | 999 static void StoreIntAsFloat(MacroAssembler* masm, |
1000 Register dst, | 1000 Register dst, |
1001 Register wordoffset, | 1001 Register wordoffset, |
1002 Register ival, | 1002 Register ival, |
1003 Register fval, | 1003 Register fval, |
1004 Register scratch1, | 1004 Register scratch1, |
1005 Register scratch2) { | 1005 Register scratch2) { |
1006 if (CpuFeatures::IsSupported(VFP2)) { | 1006 if (CpuFeatures::IsSupported(VFP2)) { |
1007 CpuFeatures::Scope scope(VFP2); | 1007 CpuFeatureScope scope(masm, VFP2); |
1008 __ vmov(s0, ival); | 1008 __ vmov(s0, ival); |
1009 __ add(scratch1, dst, Operand(wordoffset, LSL, 2)); | 1009 __ add(scratch1, dst, Operand(wordoffset, LSL, 2)); |
1010 __ vcvt_f32_s32(s0, s0); | 1010 __ vcvt_f32_s32(s0, s0); |
1011 __ vstr(s0, scratch1, 0); | 1011 __ vstr(s0, scratch1, 0); |
1012 } else { | 1012 } else { |
1013 Label not_special, done; | 1013 Label not_special, done; |
1014 // Move sign bit from source to destination. This works because the sign | 1014 // Move sign bit from source to destination. This works because the sign |
1015 // bit in the exponent word of the double has the same position and polarity | 1015 // bit in the exponent word of the double has the same position and polarity |
1016 // as the 2's complement sign bit in a Smi. | 1016 // as the 2's complement sign bit in a Smi. |
1017 ASSERT(kBinary32SignMask == 0x80000000u); | 1017 ASSERT(kBinary32SignMask == 0x80000000u); |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 // -- lr : return address | 2111 // -- lr : return address |
2112 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) | 2112 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) |
2113 // -- ... | 2113 // -- ... |
2114 // -- sp[argc * 4] : receiver | 2114 // -- sp[argc * 4] : receiver |
2115 // ----------------------------------- | 2115 // ----------------------------------- |
2116 | 2116 |
2117 if (!CpuFeatures::IsSupported(VFP2)) { | 2117 if (!CpuFeatures::IsSupported(VFP2)) { |
2118 return Handle<Code>::null(); | 2118 return Handle<Code>::null(); |
2119 } | 2119 } |
2120 | 2120 |
2121 CpuFeatures::Scope scope_vfp2(VFP2); | 2121 CpuFeatureScope scope_vfp2(masm(), VFP2); |
2122 const int argc = arguments().immediate(); | 2122 const int argc = arguments().immediate(); |
2123 // If the object is not a JSObject or we got an unexpected number of | 2123 // If the object is not a JSObject or we got an unexpected number of |
2124 // arguments, bail out to the regular call. | 2124 // arguments, bail out to the regular call. |
2125 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); | 2125 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); |
2126 | 2126 |
2127 Label miss, slow; | 2127 Label miss, slow; |
2128 GenerateNameCheck(name, &miss); | 2128 GenerateNameCheck(name, &miss); |
2129 | 2129 |
2130 if (cell.is_null()) { | 2130 if (cell.is_null()) { |
2131 __ ldr(r1, MemOperand(sp, 1 * kPointerSize)); | 2131 __ ldr(r1, MemOperand(sp, 1 * kPointerSize)); |
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3372 | 3372 |
3373 | 3373 |
3374 static void GenerateSmiKeyCheck(MacroAssembler* masm, | 3374 static void GenerateSmiKeyCheck(MacroAssembler* masm, |
3375 Register key, | 3375 Register key, |
3376 Register scratch0, | 3376 Register scratch0, |
3377 Register scratch1, | 3377 Register scratch1, |
3378 DwVfpRegister double_scratch0, | 3378 DwVfpRegister double_scratch0, |
3379 DwVfpRegister double_scratch1, | 3379 DwVfpRegister double_scratch1, |
3380 Label* fail) { | 3380 Label* fail) { |
3381 if (CpuFeatures::IsSupported(VFP2)) { | 3381 if (CpuFeatures::IsSupported(VFP2)) { |
3382 CpuFeatures::Scope scope(VFP2); | 3382 CpuFeatureScope scope(masm, VFP2); |
3383 Label key_ok; | 3383 Label key_ok; |
3384 // Check for smi or a smi inside a heap number. We convert the heap | 3384 // Check for smi or a smi inside a heap number. We convert the heap |
3385 // number and check if the conversion is exact and fits into the smi | 3385 // number and check if the conversion is exact and fits into the smi |
3386 // range. | 3386 // range. |
3387 __ JumpIfSmi(key, &key_ok); | 3387 __ JumpIfSmi(key, &key_ok); |
3388 __ CheckMap(key, | 3388 __ CheckMap(key, |
3389 scratch0, | 3389 scratch0, |
3390 Heap::kHeapNumberMapRootIndex, | 3390 Heap::kHeapNumberMapRootIndex, |
3391 fail, | 3391 fail, |
3392 DONT_DO_SMI_CHECK); | 3392 DONT_DO_SMI_CHECK); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3484 if (CpuFeatures::IsSupported(VFP2)) { | 3484 if (CpuFeatures::IsSupported(VFP2)) { |
3485 destination = FloatingPointHelper::kVFPRegisters; | 3485 destination = FloatingPointHelper::kVFPRegisters; |
3486 } else { | 3486 } else { |
3487 destination = FloatingPointHelper::kCoreRegisters; | 3487 destination = FloatingPointHelper::kCoreRegisters; |
3488 } | 3488 } |
3489 FloatingPointHelper::ConvertIntToDouble( | 3489 FloatingPointHelper::ConvertIntToDouble( |
3490 masm, r5, destination, | 3490 masm, r5, destination, |
3491 d0, r6, r7, // These are: double_dst, dst_mantissa, dst_exponent. | 3491 d0, r6, r7, // These are: double_dst, dst_mantissa, dst_exponent. |
3492 r4, s2); // These are: scratch2, single_scratch. | 3492 r4, s2); // These are: scratch2, single_scratch. |
3493 if (destination == FloatingPointHelper::kVFPRegisters) { | 3493 if (destination == FloatingPointHelper::kVFPRegisters) { |
3494 CpuFeatures::Scope scope(VFP2); | 3494 CpuFeatureScope scope(masm, VFP2); |
3495 __ vstr(d0, r3, 0); | 3495 __ vstr(d0, r3, 0); |
3496 } else { | 3496 } else { |
3497 __ str(r6, MemOperand(r3, 0)); | 3497 __ str(r6, MemOperand(r3, 0)); |
3498 __ str(r7, MemOperand(r3, Register::kSizeInBytes)); | 3498 __ str(r7, MemOperand(r3, Register::kSizeInBytes)); |
3499 } | 3499 } |
3500 break; | 3500 break; |
3501 case FAST_ELEMENTS: | 3501 case FAST_ELEMENTS: |
3502 case FAST_SMI_ELEMENTS: | 3502 case FAST_SMI_ELEMENTS: |
3503 case FAST_DOUBLE_ELEMENTS: | 3503 case FAST_DOUBLE_ELEMENTS: |
3504 case FAST_HOLEY_ELEMENTS: | 3504 case FAST_HOLEY_ELEMENTS: |
(...skipping 15 matching lines...) Expand all Loading... |
3520 __ b(ne, &slow); | 3520 __ b(ne, &slow); |
3521 | 3521 |
3522 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset)); | 3522 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset)); |
3523 | 3523 |
3524 // r3: base pointer of external storage. | 3524 // r3: base pointer of external storage. |
3525 | 3525 |
3526 // The WebGL specification leaves the behavior of storing NaN and | 3526 // The WebGL specification leaves the behavior of storing NaN and |
3527 // +/-Infinity into integer arrays basically undefined. For more | 3527 // +/-Infinity into integer arrays basically undefined. For more |
3528 // reproducible behavior, convert these to zero. | 3528 // reproducible behavior, convert these to zero. |
3529 if (CpuFeatures::IsSupported(VFP2)) { | 3529 if (CpuFeatures::IsSupported(VFP2)) { |
3530 CpuFeatures::Scope scope(VFP2); | 3530 CpuFeatureScope scope(masm, VFP2); |
3531 | 3531 |
3532 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { | 3532 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { |
3533 // vldr requires offset to be a multiple of 4 so we can not | 3533 // vldr requires offset to be a multiple of 4 so we can not |
3534 // include -kHeapObjectTag into it. | 3534 // include -kHeapObjectTag into it. |
3535 __ sub(r5, r0, Operand(kHeapObjectTag)); | 3535 __ sub(r5, r0, Operand(kHeapObjectTag)); |
3536 __ vldr(d0, r5, HeapNumber::kValueOffset); | 3536 __ vldr(d0, r5, HeapNumber::kValueOffset); |
3537 __ add(r5, r3, Operand(key, LSL, 1)); | 3537 __ add(r5, r3, Operand(key, LSL, 1)); |
3538 __ vcvt_f32_f64(s0, d0); | 3538 __ vcvt_f32_f64(s0, d0); |
3539 __ vstr(s0, r5, 0); | 3539 __ vstr(s0, r5, 0); |
3540 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 3540 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4083 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4083 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
4084 } | 4084 } |
4085 } | 4085 } |
4086 | 4086 |
4087 | 4087 |
4088 #undef __ | 4088 #undef __ |
4089 | 4089 |
4090 } } // namespace v8::internal | 4090 } } // namespace v8::internal |
4091 | 4091 |
4092 #endif // V8_TARGET_ARCH_ARM | 4092 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |