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

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

Issue 2899004: Add number allocation call to runtime.cc instead of misusing (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 5 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/runtime.h ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 void FullCodeGenerator::EmitRandomHeapNumber(ZoneList<Expression*>* args) { 2236 void FullCodeGenerator::EmitRandomHeapNumber(ZoneList<Expression*>* args) {
2237 ASSERT(args->length() == 0); 2237 ASSERT(args->length() == 0);
2238 2238
2239 Label slow_allocate_heapnumber; 2239 Label slow_allocate_heapnumber;
2240 Label heapnumber_allocated; 2240 Label heapnumber_allocated;
2241 2241
2242 __ AllocateHeapNumber(rbx, rcx, &slow_allocate_heapnumber); 2242 __ AllocateHeapNumber(rbx, rcx, &slow_allocate_heapnumber);
2243 __ jmp(&heapnumber_allocated); 2243 __ jmp(&heapnumber_allocated);
2244 2244
2245 __ bind(&slow_allocate_heapnumber); 2245 __ bind(&slow_allocate_heapnumber);
2246 // To allocate a heap number, and ensure that it is not a smi, we 2246 // Allocate a heap number.
2247 // call the runtime function FUnaryMinus on 0, returning the double 2247 __ CallRuntime(Runtime::kNumberAlloc, 0);
2248 // -0.0. A new, distinct heap number is returned each time.
2249 __ Push(Smi::FromInt(0));
2250 __ CallRuntime(Runtime::kNumberUnaryMinus, 1);
2251 __ movq(rbx, rax); 2248 __ movq(rbx, rax);
2252 2249
2253 __ bind(&heapnumber_allocated); 2250 __ bind(&heapnumber_allocated);
2254 2251
2255 // Return a random uint32 number in rax. 2252 // Return a random uint32 number in rax.
2256 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. 2253 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs.
2257 __ PrepareCallCFunction(0); 2254 __ PrepareCallCFunction(0);
2258 __ CallCFunction(ExternalReference::random_uint32_function(), 0); 2255 __ CallCFunction(ExternalReference::random_uint32_function(), 0);
2259 2256
2260 // Convert 32 random bits in rax to 0.(32 random bits) in a double 2257 // Convert 32 random bits in rax to 0.(32 random bits) in a double
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
3245 __ ret(0); 3242 __ ret(0);
3246 } 3243 }
3247 3244
3248 3245
3249 #undef __ 3246 #undef __
3250 3247
3251 3248
3252 } } // namespace v8::internal 3249 } } // namespace v8::internal
3253 3250
3254 #endif // V8_TARGET_ARCH_X64 3251 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698