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

Side by Side Diff: src/mips/full-codegen-mips.cc

Issue 8162014: Moved random generator state to global context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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/isolate.h ('k') | src/objects.cc » ('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 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 2757 matching lines...) Expand 10 before | Expand all | Expand 10 after
2768 __ CallRuntime(Runtime::kNumberAlloc, 0); 2768 __ CallRuntime(Runtime::kNumberAlloc, 0);
2769 __ mov(s0, v0); // Save result in s0, so it is saved thru CFunc call. 2769 __ mov(s0, v0); // Save result in s0, so it is saved thru CFunc call.
2770 2770
2771 __ bind(&heapnumber_allocated); 2771 __ bind(&heapnumber_allocated);
2772 2772
2773 // Convert 32 random bits in v0 to 0.(32 random bits) in a double 2773 // Convert 32 random bits in v0 to 0.(32 random bits) in a double
2774 // by computing: 2774 // by computing:
2775 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). 2775 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
2776 if (CpuFeatures::IsSupported(FPU)) { 2776 if (CpuFeatures::IsSupported(FPU)) {
2777 __ PrepareCallCFunction(1, a0); 2777 __ PrepareCallCFunction(1, a0);
2778 __ li(a0, Operand(ExternalReference::isolate_address())); 2778 __ lw(a0, ContextOperand(cp, Context::GLOBAL_INDEX));
2779 __ lw(a0, FieldOperand(a0, GlobalObject::kGlobalContextOffset));
2779 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); 2780 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
2780 2781
2781 2782
2782 CpuFeatures::Scope scope(FPU); 2783 CpuFeatures::Scope scope(FPU);
2783 // 0x41300000 is the top half of 1.0 x 2^20 as a double. 2784 // 0x41300000 is the top half of 1.0 x 2^20 as a double.
2784 __ li(a1, Operand(0x41300000)); 2785 __ li(a1, Operand(0x41300000));
2785 // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU. 2786 // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU.
2786 __ Move(f12, v0, a1); 2787 __ Move(f12, v0, a1);
2787 // Move 0x4130000000000000 to FPU. 2788 // Move 0x4130000000000000 to FPU.
2788 __ Move(f14, zero_reg, a1); 2789 __ Move(f14, zero_reg, a1);
2789 // Subtract and store the result in the heap number. 2790 // Subtract and store the result in the heap number.
2790 __ sub_d(f0, f12, f14); 2791 __ sub_d(f0, f12, f14);
2791 __ sdc1(f0, MemOperand(s0, HeapNumber::kValueOffset - kHeapObjectTag)); 2792 __ sdc1(f0, MemOperand(s0, HeapNumber::kValueOffset - kHeapObjectTag));
2792 __ mov(v0, s0); 2793 __ mov(v0, s0);
2793 } else { 2794 } else {
2794 __ PrepareCallCFunction(2, a0); 2795 __ PrepareCallCFunction(2, a0);
2795 __ mov(a0, s0); 2796 __ mov(a0, s0);
2796 __ li(a1, Operand(ExternalReference::isolate_address())); 2797 __ lw(a1, ContextOperand(cp, Context::GLOBAL_INDEX));
2798 __ lw(a1, FieldOperand(a1, GlobalObject::kGlobalContextOffset));
2797 __ CallCFunction( 2799 __ CallCFunction(
2798 ExternalReference::fill_heap_number_with_random_function(isolate()), 2); 2800 ExternalReference::fill_heap_number_with_random_function(isolate()), 2);
2799 } 2801 }
2800 2802
2801 context()->Plug(v0); 2803 context()->Plug(v0);
2802 } 2804 }
2803 2805
2804 2806
2805 void FullCodeGenerator::EmitSubString(ZoneList<Expression*>* args) { 2807 void FullCodeGenerator::EmitSubString(ZoneList<Expression*>* args) {
2806 // Load the arguments on the stack and call the stub. 2808 // Load the arguments on the stack and call the stub.
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after
4251 *context_length = 0; 4253 *context_length = 0;
4252 return previous_; 4254 return previous_;
4253 } 4255 }
4254 4256
4255 4257
4256 #undef __ 4258 #undef __
4257 4259
4258 } } // namespace v8::internal 4260 } } // namespace v8::internal
4259 4261
4260 #endif // V8_TARGET_ARCH_MIPS 4262 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698