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 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 // floating point value at memory location (dst + 4 * wordoffset) | 991 // floating point value at memory location (dst + 4 * wordoffset) |
992 // If FPU is available use it for conversion. | 992 // If FPU is available use it for conversion. |
993 static void StoreIntAsFloat(MacroAssembler* masm, | 993 static void StoreIntAsFloat(MacroAssembler* masm, |
994 Register dst, | 994 Register dst, |
995 Register wordoffset, | 995 Register wordoffset, |
996 Register ival, | 996 Register ival, |
997 Register fval, | 997 Register fval, |
998 Register scratch1, | 998 Register scratch1, |
999 Register scratch2) { | 999 Register scratch2) { |
1000 if (CpuFeatures::IsSupported(FPU)) { | 1000 if (CpuFeatures::IsSupported(FPU)) { |
1001 CpuFeatures::Scope scope(FPU); | 1001 CpuFeatureScope scope(masm, FPU); |
1002 __ mtc1(ival, f0); | 1002 __ mtc1(ival, f0); |
1003 __ cvt_s_w(f0, f0); | 1003 __ cvt_s_w(f0, f0); |
1004 __ sll(scratch1, wordoffset, 2); | 1004 __ sll(scratch1, wordoffset, 2); |
1005 __ addu(scratch1, dst, scratch1); | 1005 __ addu(scratch1, dst, scratch1); |
1006 __ swc1(f0, MemOperand(scratch1, 0)); | 1006 __ swc1(f0, MemOperand(scratch1, 0)); |
1007 } else { | 1007 } else { |
1008 // FPU is not available, do manual conversions. | 1008 // FPU is not available, do manual conversions. |
1009 | 1009 |
1010 Label not_special, done; | 1010 Label not_special, done; |
1011 // Move sign bit from source to destination. This works because the sign | 1011 // Move sign bit from source to destination. This works because the sign |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2159 // -- ra : return address | 2159 // -- ra : return address |
2160 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) | 2160 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) |
2161 // -- ... | 2161 // -- ... |
2162 // -- sp[argc * 4] : receiver | 2162 // -- sp[argc * 4] : receiver |
2163 // ----------------------------------- | 2163 // ----------------------------------- |
2164 | 2164 |
2165 if (!CpuFeatures::IsSupported(FPU)) { | 2165 if (!CpuFeatures::IsSupported(FPU)) { |
2166 return Handle<Code>::null(); | 2166 return Handle<Code>::null(); |
2167 } | 2167 } |
2168 | 2168 |
2169 CpuFeatures::Scope scope_fpu(FPU); | 2169 CpuFeatureScope scope_fpu(masm(), FPU); |
2170 const int argc = arguments().immediate(); | 2170 const int argc = arguments().immediate(); |
2171 // If the object is not a JSObject or we got an unexpected number of | 2171 // If the object is not a JSObject or we got an unexpected number of |
2172 // arguments, bail out to the regular call. | 2172 // arguments, bail out to the regular call. |
2173 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); | 2173 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); |
2174 | 2174 |
2175 Label miss, slow; | 2175 Label miss, slow; |
2176 GenerateNameCheck(name, &miss); | 2176 GenerateNameCheck(name, &miss); |
2177 | 2177 |
2178 if (cell.is_null()) { | 2178 if (cell.is_null()) { |
2179 __ lw(a1, MemOperand(sp, 1 * kPointerSize)); | 2179 __ lw(a1, MemOperand(sp, 1 * kPointerSize)); |
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3463 | 3463 |
3464 | 3464 |
3465 static void GenerateSmiKeyCheck(MacroAssembler* masm, | 3465 static void GenerateSmiKeyCheck(MacroAssembler* masm, |
3466 Register key, | 3466 Register key, |
3467 Register scratch0, | 3467 Register scratch0, |
3468 Register scratch1, | 3468 Register scratch1, |
3469 FPURegister double_scratch0, | 3469 FPURegister double_scratch0, |
3470 FPURegister double_scratch1, | 3470 FPURegister double_scratch1, |
3471 Label* fail) { | 3471 Label* fail) { |
3472 if (CpuFeatures::IsSupported(FPU)) { | 3472 if (CpuFeatures::IsSupported(FPU)) { |
3473 CpuFeatures::Scope scope(FPU); | 3473 CpuFeatureScope scope(masm, FPU); |
3474 Label key_ok; | 3474 Label key_ok; |
3475 // Check for smi or a smi inside a heap number. We convert the heap | 3475 // Check for smi or a smi inside a heap number. We convert the heap |
3476 // number and check if the conversion is exact and fits into the smi | 3476 // number and check if the conversion is exact and fits into the smi |
3477 // range. | 3477 // range. |
3478 __ JumpIfSmi(key, &key_ok); | 3478 __ JumpIfSmi(key, &key_ok); |
3479 __ CheckMap(key, | 3479 __ CheckMap(key, |
3480 scratch0, | 3480 scratch0, |
3481 Heap::kHeapNumberMapRootIndex, | 3481 Heap::kHeapNumberMapRootIndex, |
3482 fail, | 3482 fail, |
3483 DONT_DO_SMI_CHECK); | 3483 DONT_DO_SMI_CHECK); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3599 if (CpuFeatures::IsSupported(FPU)) { | 3599 if (CpuFeatures::IsSupported(FPU)) { |
3600 destination = FloatingPointHelper::kFPURegisters; | 3600 destination = FloatingPointHelper::kFPURegisters; |
3601 } else { | 3601 } else { |
3602 destination = FloatingPointHelper::kCoreRegisters; | 3602 destination = FloatingPointHelper::kCoreRegisters; |
3603 } | 3603 } |
3604 FloatingPointHelper::ConvertIntToDouble( | 3604 FloatingPointHelper::ConvertIntToDouble( |
3605 masm, t1, destination, | 3605 masm, t1, destination, |
3606 f0, t2, t3, // These are: double_dst, dst_mantissa, dst_exponent. | 3606 f0, t2, t3, // These are: double_dst, dst_mantissa, dst_exponent. |
3607 t0, f2); // These are: scratch2, single_scratch. | 3607 t0, f2); // These are: scratch2, single_scratch. |
3608 if (destination == FloatingPointHelper::kFPURegisters) { | 3608 if (destination == FloatingPointHelper::kFPURegisters) { |
3609 CpuFeatures::Scope scope(FPU); | 3609 CpuFeatureScope scope(masm(), FPU); |
3610 __ sdc1(f0, MemOperand(a3, 0)); | 3610 __ sdc1(f0, MemOperand(a3, 0)); |
3611 } else { | 3611 } else { |
3612 __ sw(t2, MemOperand(a3, 0)); | 3612 __ sw(t2, MemOperand(a3, 0)); |
3613 __ sw(t3, MemOperand(a3, Register::kSizeInBytes)); | 3613 __ sw(t3, MemOperand(a3, Register::kSizeInBytes)); |
3614 } | 3614 } |
3615 break; | 3615 break; |
3616 case FAST_ELEMENTS: | 3616 case FAST_ELEMENTS: |
3617 case FAST_SMI_ELEMENTS: | 3617 case FAST_SMI_ELEMENTS: |
3618 case FAST_DOUBLE_ELEMENTS: | 3618 case FAST_DOUBLE_ELEMENTS: |
3619 case FAST_HOLEY_ELEMENTS: | 3619 case FAST_HOLEY_ELEMENTS: |
(...skipping 17 matching lines...) Expand all Loading... |
3637 | 3637 |
3638 __ lw(a3, FieldMemOperand(a3, ExternalArray::kExternalPointerOffset)); | 3638 __ lw(a3, FieldMemOperand(a3, ExternalArray::kExternalPointerOffset)); |
3639 | 3639 |
3640 // a3: base pointer of external storage. | 3640 // a3: base pointer of external storage. |
3641 | 3641 |
3642 // The WebGL specification leaves the behavior of storing NaN and | 3642 // The WebGL specification leaves the behavior of storing NaN and |
3643 // +/-Infinity into integer arrays basically undefined. For more | 3643 // +/-Infinity into integer arrays basically undefined. For more |
3644 // reproducible behavior, convert these to zero. | 3644 // reproducible behavior, convert these to zero. |
3645 | 3645 |
3646 if (CpuFeatures::IsSupported(FPU)) { | 3646 if (CpuFeatures::IsSupported(FPU)) { |
3647 CpuFeatures::Scope scope(FPU); | 3647 CpuFeatureScope scope(masm, FPU); |
3648 | 3648 |
3649 __ ldc1(f0, FieldMemOperand(a0, HeapNumber::kValueOffset)); | 3649 __ ldc1(f0, FieldMemOperand(a0, HeapNumber::kValueOffset)); |
3650 | 3650 |
3651 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { | 3651 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { |
3652 __ cvt_s_d(f0, f0); | 3652 __ cvt_s_d(f0, f0); |
3653 __ sll(t8, key, 1); | 3653 __ sll(t8, key, 1); |
3654 __ addu(t8, a3, t8); | 3654 __ addu(t8, a3, t8); |
3655 __ swc1(f0, MemOperand(t8, 0)); | 3655 __ swc1(f0, MemOperand(t8, 0)); |
3656 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 3656 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
3657 __ sll(t8, key, 2); | 3657 __ sll(t8, key, 2); |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4228 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4228 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
4229 } | 4229 } |
4230 } | 4230 } |
4231 | 4231 |
4232 | 4232 |
4233 #undef __ | 4233 #undef __ |
4234 | 4234 |
4235 } } // namespace v8::internal | 4235 } } // namespace v8::internal |
4236 | 4236 |
4237 #endif // V8_TARGET_ARCH_MIPS | 4237 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |