Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: src/mips/stub-cache-mips.cc

Issue 12391055: Cleaned up CpuFeature scope handling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed nits Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
2101 // -- ra : return address 2101 // -- ra : return address
2102 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 2102 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
2103 // -- ... 2103 // -- ...
2104 // -- sp[argc * 4] : receiver 2104 // -- sp[argc * 4] : receiver
2105 // ----------------------------------- 2105 // -----------------------------------
2106 2106
2107 if (!CpuFeatures::IsSupported(FPU)) { 2107 if (!CpuFeatures::IsSupported(FPU)) {
2108 return Handle<Code>::null(); 2108 return Handle<Code>::null();
2109 } 2109 }
2110 2110
2111 CpuFeatures::Scope scope_fpu(FPU); 2111 CpuFeatureScope scope_fpu(masm(), FPU);
2112 const int argc = arguments().immediate(); 2112 const int argc = arguments().immediate();
2113 // If the object is not a JSObject or we got an unexpected number of 2113 // If the object is not a JSObject or we got an unexpected number of
2114 // arguments, bail out to the regular call. 2114 // arguments, bail out to the regular call.
2115 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); 2115 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null();
2116 2116
2117 Label miss, slow; 2117 Label miss, slow;
2118 GenerateNameCheck(name, &miss); 2118 GenerateNameCheck(name, &miss);
2119 2119
2120 if (cell.is_null()) { 2120 if (cell.is_null()) {
2121 __ lw(a1, MemOperand(sp, 1 * kPointerSize)); 2121 __ lw(a1, MemOperand(sp, 1 * kPointerSize));
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
3346 3346
3347 3347
3348 static void GenerateSmiKeyCheck(MacroAssembler* masm, 3348 static void GenerateSmiKeyCheck(MacroAssembler* masm,
3349 Register key, 3349 Register key,
3350 Register scratch0, 3350 Register scratch0,
3351 Register scratch1, 3351 Register scratch1,
3352 FPURegister double_scratch0, 3352 FPURegister double_scratch0,
3353 FPURegister double_scratch1, 3353 FPURegister double_scratch1,
3354 Label* fail) { 3354 Label* fail) {
3355 if (CpuFeatures::IsSupported(FPU)) { 3355 if (CpuFeatures::IsSupported(FPU)) {
3356 CpuFeatures::Scope scope(FPU); 3356 CpuFeatureScope scope(masm, FPU);
3357 Label key_ok; 3357 Label key_ok;
3358 // Check for smi or a smi inside a heap number. We convert the heap 3358 // Check for smi or a smi inside a heap number. We convert the heap
3359 // number and check if the conversion is exact and fits into the smi 3359 // number and check if the conversion is exact and fits into the smi
3360 // range. 3360 // range.
3361 __ JumpIfSmi(key, &key_ok); 3361 __ JumpIfSmi(key, &key_ok);
3362 __ CheckMap(key, 3362 __ CheckMap(key,
3363 scratch0, 3363 scratch0,
3364 Heap::kHeapNumberMapRootIndex, 3364 Heap::kHeapNumberMapRootIndex,
3365 fail, 3365 fail,
3366 DONT_DO_SMI_CHECK); 3366 DONT_DO_SMI_CHECK);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
3482 if (CpuFeatures::IsSupported(FPU)) { 3482 if (CpuFeatures::IsSupported(FPU)) {
3483 destination = FloatingPointHelper::kFPURegisters; 3483 destination = FloatingPointHelper::kFPURegisters;
3484 } else { 3484 } else {
3485 destination = FloatingPointHelper::kCoreRegisters; 3485 destination = FloatingPointHelper::kCoreRegisters;
3486 } 3486 }
3487 FloatingPointHelper::ConvertIntToDouble( 3487 FloatingPointHelper::ConvertIntToDouble(
3488 masm, t1, destination, 3488 masm, t1, destination,
3489 f0, t2, t3, // These are: double_dst, dst_mantissa, dst_exponent. 3489 f0, t2, t3, // These are: double_dst, dst_mantissa, dst_exponent.
3490 t0, f2); // These are: scratch2, single_scratch. 3490 t0, f2); // These are: scratch2, single_scratch.
3491 if (destination == FloatingPointHelper::kFPURegisters) { 3491 if (destination == FloatingPointHelper::kFPURegisters) {
3492 CpuFeatures::Scope scope(FPU); 3492 CpuFeatureScope scope(masm(), FPU);
3493 __ sdc1(f0, MemOperand(a3, 0)); 3493 __ sdc1(f0, MemOperand(a3, 0));
3494 } else { 3494 } else {
3495 __ sw(t2, MemOperand(a3, 0)); 3495 __ sw(t2, MemOperand(a3, 0));
3496 __ sw(t3, MemOperand(a3, Register::kSizeInBytes)); 3496 __ sw(t3, MemOperand(a3, Register::kSizeInBytes));
3497 } 3497 }
3498 break; 3498 break;
3499 case FAST_ELEMENTS: 3499 case FAST_ELEMENTS:
3500 case FAST_SMI_ELEMENTS: 3500 case FAST_SMI_ELEMENTS:
3501 case FAST_DOUBLE_ELEMENTS: 3501 case FAST_DOUBLE_ELEMENTS:
3502 case FAST_HOLEY_ELEMENTS: 3502 case FAST_HOLEY_ELEMENTS:
(...skipping 17 matching lines...) Expand all
3520 3520
3521 __ lw(a3, FieldMemOperand(a3, ExternalArray::kExternalPointerOffset)); 3521 __ lw(a3, FieldMemOperand(a3, ExternalArray::kExternalPointerOffset));
3522 3522
3523 // a3: base pointer of external storage. 3523 // a3: base pointer of external storage.
3524 3524
3525 // The WebGL specification leaves the behavior of storing NaN and 3525 // The WebGL specification leaves the behavior of storing NaN and
3526 // +/-Infinity into integer arrays basically undefined. For more 3526 // +/-Infinity into integer arrays basically undefined. For more
3527 // reproducible behavior, convert these to zero. 3527 // reproducible behavior, convert these to zero.
3528 3528
3529 if (CpuFeatures::IsSupported(FPU)) { 3529 if (CpuFeatures::IsSupported(FPU)) {
3530 CpuFeatures::Scope scope(FPU); 3530 CpuFeatureScope scope(masm, FPU);
3531 3531
3532 __ ldc1(f0, FieldMemOperand(a0, HeapNumber::kValueOffset)); 3532 __ ldc1(f0, FieldMemOperand(a0, HeapNumber::kValueOffset));
3533 3533
3534 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { 3534 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) {
3535 __ cvt_s_d(f0, f0); 3535 __ cvt_s_d(f0, f0);
3536 __ sll(t8, key, 1); 3536 __ sll(t8, key, 1);
3537 __ addu(t8, a3, t8); 3537 __ addu(t8, a3, t8);
3538 __ swc1(f0, MemOperand(t8, 0)); 3538 __ swc1(f0, MemOperand(t8, 0));
3539 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { 3539 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
3540 __ sll(t8, key, 2); 3540 __ sll(t8, key, 2);
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
4111 __ Jump(ic_slow, RelocInfo::CODE_TARGET); 4111 __ Jump(ic_slow, RelocInfo::CODE_TARGET);
4112 } 4112 }
4113 } 4113 }
4114 4114
4115 4115
4116 #undef __ 4116 #undef __
4117 4117
4118 } } // namespace v8::internal 4118 } } // namespace v8::internal
4119 4119
4120 #endif // V8_TARGET_ARCH_MIPS 4120 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698