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

Side by Side Diff: src/x64/full-codegen-x64.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/v8.cc ('k') | no next file » | 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 2640 matching lines...) Expand 10 before | Expand all | Expand 10 after
2651 // Allocate a heap number. 2651 // Allocate a heap number.
2652 __ CallRuntime(Runtime::kNumberAlloc, 0); 2652 __ CallRuntime(Runtime::kNumberAlloc, 0);
2653 __ movq(rbx, rax); 2653 __ movq(rbx, rax);
2654 2654
2655 __ bind(&heapnumber_allocated); 2655 __ bind(&heapnumber_allocated);
2656 2656
2657 // Return a random uint32 number in rax. 2657 // Return a random uint32 number in rax.
2658 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. 2658 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs.
2659 __ PrepareCallCFunction(1); 2659 __ PrepareCallCFunction(1);
2660 #ifdef _WIN64 2660 #ifdef _WIN64
2661 __ LoadAddress(rcx, ExternalReference::isolate_address()); 2661 __ movq(rcx, ContextOperand(context_register(), Context::GLOBAL_INDEX));
2662 __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset));
2663
2662 #else 2664 #else
2663 __ LoadAddress(rdi, ExternalReference::isolate_address()); 2665 __ movq(rdi, ContextOperand(context_register(), Context::GLOBAL_INDEX));
2666 __ movq(rdi, FieldOperand(rdi, GlobalObject::kGlobalContextOffset));
2664 #endif 2667 #endif
2665 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); 2668 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
2666 2669
2667 // Convert 32 random bits in rax to 0.(32 random bits) in a double 2670 // Convert 32 random bits in rax to 0.(32 random bits) in a double
2668 // by computing: 2671 // by computing:
2669 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). 2672 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
2670 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. 2673 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single.
2671 __ movd(xmm1, rcx); 2674 __ movd(xmm1, rcx);
2672 __ movd(xmm0, rax); 2675 __ movd(xmm0, rax);
2673 __ cvtss2sd(xmm1, xmm1); 2676 __ cvtss2sd(xmm1, xmm1);
(...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after
4196 *context_length = 0; 4199 *context_length = 0;
4197 return previous_; 4200 return previous_;
4198 } 4201 }
4199 4202
4200 4203
4201 #undef __ 4204 #undef __
4202 4205
4203 } } // namespace v8::internal 4206 } } // namespace v8::internal
4204 4207
4205 #endif // V8_TARGET_ARCH_X64 4208 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/v8.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698