| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2844 __ mov(s0, v0); // Save result in s0, so it is saved thru CFunc call. | 2844 __ mov(s0, v0); // Save result in s0, so it is saved thru CFunc call. |
| 2845 | 2845 |
| 2846 __ bind(&heapnumber_allocated); | 2846 __ bind(&heapnumber_allocated); |
| 2847 | 2847 |
| 2848 // Convert 32 random bits in v0 to 0.(32 random bits) in a double | 2848 // Convert 32 random bits in v0 to 0.(32 random bits) in a double |
| 2849 // by computing: | 2849 // by computing: |
| 2850 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 2850 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
| 2851 if (CpuFeatures::IsSupported(FPU)) { | 2851 if (CpuFeatures::IsSupported(FPU)) { |
| 2852 __ PrepareCallCFunction(1, a0); | 2852 __ PrepareCallCFunction(1, a0); |
| 2853 __ lw(a0, ContextOperand(cp, Context::GLOBAL_INDEX)); | 2853 __ lw(a0, ContextOperand(cp, Context::GLOBAL_INDEX)); |
| 2854 __ lw(a0, FieldOperand(a0, GlobalObject::kGlobalContextOffset)); | 2854 __ lw(a0, FieldMemOperand(a0, GlobalObject::kGlobalContextOffset)); |
| 2855 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | 2855 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
| 2856 | 2856 |
| 2857 | 2857 |
| 2858 CpuFeatures::Scope scope(FPU); | 2858 CpuFeatures::Scope scope(FPU); |
| 2859 // 0x41300000 is the top half of 1.0 x 2^20 as a double. | 2859 // 0x41300000 is the top half of 1.0 x 2^20 as a double. |
| 2860 __ li(a1, Operand(0x41300000)); | 2860 __ li(a1, Operand(0x41300000)); |
| 2861 // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU. | 2861 // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU. |
| 2862 __ Move(f12, v0, a1); | 2862 __ Move(f12, v0, a1); |
| 2863 // Move 0x4130000000000000 to FPU. | 2863 // Move 0x4130000000000000 to FPU. |
| 2864 __ Move(f14, zero_reg, a1); | 2864 __ Move(f14, zero_reg, a1); |
| 2865 // Subtract and store the result in the heap number. | 2865 // Subtract and store the result in the heap number. |
| 2866 __ sub_d(f0, f12, f14); | 2866 __ sub_d(f0, f12, f14); |
| 2867 __ sdc1(f0, MemOperand(s0, HeapNumber::kValueOffset - kHeapObjectTag)); | 2867 __ sdc1(f0, MemOperand(s0, HeapNumber::kValueOffset - kHeapObjectTag)); |
| 2868 __ mov(v0, s0); | 2868 __ mov(v0, s0); |
| 2869 } else { | 2869 } else { |
| 2870 __ PrepareCallCFunction(2, a0); | 2870 __ PrepareCallCFunction(2, a0); |
| 2871 __ mov(a0, s0); | 2871 __ mov(a0, s0); |
| 2872 __ lw(a1, ContextOperand(cp, Context::GLOBAL_INDEX)); | 2872 __ lw(a1, ContextOperand(cp, Context::GLOBAL_INDEX)); |
| 2873 __ lw(a1, FieldOperand(a1, GlobalObject::kGlobalContextOffset)); | 2873 __ lw(a1, FieldMemOperand(a1, GlobalObject::kGlobalContextOffset)); |
| 2874 __ CallCFunction( | 2874 __ CallCFunction( |
| 2875 ExternalReference::fill_heap_number_with_random_function(isolate()), 2); | 2875 ExternalReference::fill_heap_number_with_random_function(isolate()), 2); |
| 2876 } | 2876 } |
| 2877 | 2877 |
| 2878 context()->Plug(v0); | 2878 context()->Plug(v0); |
| 2879 } | 2879 } |
| 2880 | 2880 |
| 2881 | 2881 |
| 2882 void FullCodeGenerator::EmitSubString(ZoneList<Expression*>* args) { | 2882 void FullCodeGenerator::EmitSubString(ZoneList<Expression*>* args) { |
| 2883 // Load the arguments on the stack and call the stub. | 2883 // Load the arguments on the stack and call the stub. |
| (...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4336 *context_length = 0; | 4336 *context_length = 0; |
| 4337 return previous_; | 4337 return previous_; |
| 4338 } | 4338 } |
| 4339 | 4339 |
| 4340 | 4340 |
| 4341 #undef __ | 4341 #undef __ |
| 4342 | 4342 |
| 4343 } } // namespace v8::internal | 4343 } } // namespace v8::internal |
| 4344 | 4344 |
| 4345 #endif // V8_TARGET_ARCH_MIPS | 4345 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |