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 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 // floating point value at memory location (dst + 4 * wordoffset) | 996 // floating point value at memory location (dst + 4 * wordoffset) |
997 // If VFP3 is available use it for conversion. | 997 // If VFP3 is available use it for conversion. |
998 static void StoreIntAsFloat(MacroAssembler* masm, | 998 static void StoreIntAsFloat(MacroAssembler* masm, |
999 Register dst, | 999 Register dst, |
1000 Register wordoffset, | 1000 Register wordoffset, |
1001 Register ival, | 1001 Register ival, |
1002 Register fval, | 1002 Register fval, |
1003 Register scratch1, | 1003 Register scratch1, |
1004 Register scratch2) { | 1004 Register scratch2) { |
1005 if (CpuFeatures::IsSupported(VFP2)) { | 1005 if (CpuFeatures::IsSupported(VFP2)) { |
1006 CpuFeatures::Scope scope(VFP2); | 1006 CpuFeatureScope scope(masm, VFP2); |
1007 __ vmov(s0, ival); | 1007 __ vmov(s0, ival); |
1008 __ add(scratch1, dst, Operand(wordoffset, LSL, 2)); | 1008 __ add(scratch1, dst, Operand(wordoffset, LSL, 2)); |
1009 __ vcvt_f32_s32(s0, s0); | 1009 __ vcvt_f32_s32(s0, s0); |
1010 __ vstr(s0, scratch1, 0); | 1010 __ vstr(s0, scratch1, 0); |
1011 } else { | 1011 } else { |
1012 Label not_special, done; | 1012 Label not_special, done; |
1013 // Move sign bit from source to destination. This works because the sign | 1013 // Move sign bit from source to destination. This works because the sign |
1014 // bit in the exponent word of the double has the same position and polarity | 1014 // bit in the exponent word of the double has the same position and polarity |
1015 // as the 2's complement sign bit in a Smi. | 1015 // as the 2's complement sign bit in a Smi. |
1016 ASSERT(kBinary32SignMask == 0x80000000u); | 1016 ASSERT(kBinary32SignMask == 0x80000000u); |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2095 // -- lr : return address | 2095 // -- lr : return address |
2096 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) | 2096 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) |
2097 // -- ... | 2097 // -- ... |
2098 // -- sp[argc * 4] : receiver | 2098 // -- sp[argc * 4] : receiver |
2099 // ----------------------------------- | 2099 // ----------------------------------- |
2100 | 2100 |
2101 if (!CpuFeatures::IsSupported(VFP2)) { | 2101 if (!CpuFeatures::IsSupported(VFP2)) { |
2102 return Handle<Code>::null(); | 2102 return Handle<Code>::null(); |
2103 } | 2103 } |
2104 | 2104 |
2105 CpuFeatures::Scope scope_vfp2(VFP2); | 2105 CpuFeatureScope scope_vfp2(masm(), VFP2); |
2106 const int argc = arguments().immediate(); | 2106 const int argc = arguments().immediate(); |
2107 // If the object is not a JSObject or we got an unexpected number of | 2107 // If the object is not a JSObject or we got an unexpected number of |
2108 // arguments, bail out to the regular call. | 2108 // arguments, bail out to the regular call. |
2109 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); | 2109 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); |
2110 | 2110 |
2111 Label miss, slow; | 2111 Label miss, slow; |
2112 GenerateNameCheck(name, &miss); | 2112 GenerateNameCheck(name, &miss); |
2113 | 2113 |
2114 if (cell.is_null()) { | 2114 if (cell.is_null()) { |
2115 __ ldr(r1, MemOperand(sp, 1 * kPointerSize)); | 2115 __ ldr(r1, MemOperand(sp, 1 * kPointerSize)); |
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3349 | 3349 |
3350 | 3350 |
3351 static void GenerateSmiKeyCheck(MacroAssembler* masm, | 3351 static void GenerateSmiKeyCheck(MacroAssembler* masm, |
3352 Register key, | 3352 Register key, |
3353 Register scratch0, | 3353 Register scratch0, |
3354 Register scratch1, | 3354 Register scratch1, |
3355 DwVfpRegister double_scratch0, | 3355 DwVfpRegister double_scratch0, |
3356 DwVfpRegister double_scratch1, | 3356 DwVfpRegister double_scratch1, |
3357 Label* fail) { | 3357 Label* fail) { |
3358 if (CpuFeatures::IsSupported(VFP2)) { | 3358 if (CpuFeatures::IsSupported(VFP2)) { |
3359 CpuFeatures::Scope scope(VFP2); | 3359 CpuFeatureScope scope(masm, VFP2); |
3360 Label key_ok; | 3360 Label key_ok; |
3361 // Check for smi or a smi inside a heap number. We convert the heap | 3361 // Check for smi or a smi inside a heap number. We convert the heap |
3362 // number and check if the conversion is exact and fits into the smi | 3362 // number and check if the conversion is exact and fits into the smi |
3363 // range. | 3363 // range. |
3364 __ JumpIfSmi(key, &key_ok); | 3364 __ JumpIfSmi(key, &key_ok); |
3365 __ CheckMap(key, | 3365 __ CheckMap(key, |
3366 scratch0, | 3366 scratch0, |
3367 Heap::kHeapNumberMapRootIndex, | 3367 Heap::kHeapNumberMapRootIndex, |
3368 fail, | 3368 fail, |
3369 DONT_DO_SMI_CHECK); | 3369 DONT_DO_SMI_CHECK); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3461 if (CpuFeatures::IsSupported(VFP2)) { | 3461 if (CpuFeatures::IsSupported(VFP2)) { |
3462 destination = FloatingPointHelper::kVFPRegisters; | 3462 destination = FloatingPointHelper::kVFPRegisters; |
3463 } else { | 3463 } else { |
3464 destination = FloatingPointHelper::kCoreRegisters; | 3464 destination = FloatingPointHelper::kCoreRegisters; |
3465 } | 3465 } |
3466 FloatingPointHelper::ConvertIntToDouble( | 3466 FloatingPointHelper::ConvertIntToDouble( |
3467 masm, r5, destination, | 3467 masm, r5, destination, |
3468 d0, r6, r7, // These are: double_dst, dst_mantissa, dst_exponent. | 3468 d0, r6, r7, // These are: double_dst, dst_mantissa, dst_exponent. |
3469 r4, s2); // These are: scratch2, single_scratch. | 3469 r4, s2); // These are: scratch2, single_scratch. |
3470 if (destination == FloatingPointHelper::kVFPRegisters) { | 3470 if (destination == FloatingPointHelper::kVFPRegisters) { |
3471 CpuFeatures::Scope scope(VFP2); | 3471 CpuFeatureScope scope(masm, VFP2); |
3472 __ vstr(d0, r3, 0); | 3472 __ vstr(d0, r3, 0); |
3473 } else { | 3473 } else { |
3474 __ str(r6, MemOperand(r3, 0)); | 3474 __ str(r6, MemOperand(r3, 0)); |
3475 __ str(r7, MemOperand(r3, Register::kSizeInBytes)); | 3475 __ str(r7, MemOperand(r3, Register::kSizeInBytes)); |
3476 } | 3476 } |
3477 break; | 3477 break; |
3478 case FAST_ELEMENTS: | 3478 case FAST_ELEMENTS: |
3479 case FAST_SMI_ELEMENTS: | 3479 case FAST_SMI_ELEMENTS: |
3480 case FAST_DOUBLE_ELEMENTS: | 3480 case FAST_DOUBLE_ELEMENTS: |
3481 case FAST_HOLEY_ELEMENTS: | 3481 case FAST_HOLEY_ELEMENTS: |
(...skipping 15 matching lines...) Expand all Loading... |
3497 __ b(ne, &slow); | 3497 __ b(ne, &slow); |
3498 | 3498 |
3499 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset)); | 3499 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset)); |
3500 | 3500 |
3501 // r3: base pointer of external storage. | 3501 // r3: base pointer of external storage. |
3502 | 3502 |
3503 // The WebGL specification leaves the behavior of storing NaN and | 3503 // The WebGL specification leaves the behavior of storing NaN and |
3504 // +/-Infinity into integer arrays basically undefined. For more | 3504 // +/-Infinity into integer arrays basically undefined. For more |
3505 // reproducible behavior, convert these to zero. | 3505 // reproducible behavior, convert these to zero. |
3506 if (CpuFeatures::IsSupported(VFP2)) { | 3506 if (CpuFeatures::IsSupported(VFP2)) { |
3507 CpuFeatures::Scope scope(VFP2); | 3507 CpuFeatureScope scope(masm, VFP2); |
3508 | 3508 |
3509 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { | 3509 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { |
3510 // vldr requires offset to be a multiple of 4 so we can not | 3510 // vldr requires offset to be a multiple of 4 so we can not |
3511 // include -kHeapObjectTag into it. | 3511 // include -kHeapObjectTag into it. |
3512 __ sub(r5, r0, Operand(kHeapObjectTag)); | 3512 __ sub(r5, r0, Operand(kHeapObjectTag)); |
3513 __ vldr(d0, r5, HeapNumber::kValueOffset); | 3513 __ vldr(d0, r5, HeapNumber::kValueOffset); |
3514 __ add(r5, r3, Operand(key, LSL, 1)); | 3514 __ add(r5, r3, Operand(key, LSL, 1)); |
3515 __ vcvt_f32_f64(s0, d0); | 3515 __ vcvt_f32_f64(s0, d0); |
3516 __ vstr(s0, r5, 0); | 3516 __ vstr(s0, r5, 0); |
3517 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 3517 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4060 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4060 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
4061 } | 4061 } |
4062 } | 4062 } |
4063 | 4063 |
4064 | 4064 |
4065 #undef __ | 4065 #undef __ |
4066 | 4066 |
4067 } } // namespace v8::internal | 4067 } } // namespace v8::internal |
4068 | 4068 |
4069 #endif // V8_TARGET_ARCH_ARM | 4069 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |