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

Side by Side Diff: src/ia32/full-codegen-ia32.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/arm/full-codegen-arm.cc ('k') | src/runtime.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 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 2224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 void FullCodeGenerator::EmitRandomHeapNumber(ZoneList<Expression*>* args) { 2235 void FullCodeGenerator::EmitRandomHeapNumber(ZoneList<Expression*>* args) {
2236 ASSERT(args->length() == 0); 2236 ASSERT(args->length() == 0);
2237 2237
2238 Label slow_allocate_heapnumber; 2238 Label slow_allocate_heapnumber;
2239 Label heapnumber_allocated; 2239 Label heapnumber_allocated;
2240 2240
2241 __ AllocateHeapNumber(edi, ebx, ecx, &slow_allocate_heapnumber); 2241 __ AllocateHeapNumber(edi, ebx, ecx, &slow_allocate_heapnumber);
2242 __ jmp(&heapnumber_allocated); 2242 __ jmp(&heapnumber_allocated);
2243 2243
2244 __ bind(&slow_allocate_heapnumber); 2244 __ bind(&slow_allocate_heapnumber);
2245 // To allocate a heap number, and ensure that it is not a smi, we 2245 // Allocate a heap number.
2246 // call the runtime function FUnaryMinus on 0, returning the double 2246 __ CallRuntime(Runtime::kNumberAlloc, 0);
2247 // -0.0. A new, distinct heap number is returned each time.
2248 __ push(Immediate(Smi::FromInt(0)));
2249 __ CallRuntime(Runtime::kNumberUnaryMinus, 1);
2250 __ mov(edi, eax); 2247 __ mov(edi, eax);
2251 2248
2252 __ bind(&heapnumber_allocated); 2249 __ bind(&heapnumber_allocated);
2253 2250
2254 __ PrepareCallCFunction(0, ebx); 2251 __ PrepareCallCFunction(0, ebx);
2255 __ CallCFunction(ExternalReference::random_uint32_function(), 0); 2252 __ CallCFunction(ExternalReference::random_uint32_function(), 0);
2256 2253
2257 // Convert 32 random bits in eax to 0.(32 random bits) in a double 2254 // Convert 32 random bits in eax to 0.(32 random bits) in a double
2258 // by computing: 2255 // by computing:
2259 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). 2256 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
3255 // And return. 3252 // And return.
3256 __ ret(0); 3253 __ ret(0);
3257 } 3254 }
3258 3255
3259 3256
3260 #undef __ 3257 #undef __
3261 3258
3262 } } // namespace v8::internal 3259 } } // namespace v8::internal
3263 3260
3264 #endif // V8_TARGET_ARCH_IA32 3261 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698