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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 9167011: Support inlining and crankshaft optimization of Math.random. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments. Created 8 years, 11 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/lithium-arm.cc ('k') | src/hydrogen.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3177 matching lines...) Expand 10 before | Expand all | Expand 10 after
3188 MathPowStub stub(MathPowStub::INTEGER); 3188 MathPowStub stub(MathPowStub::INTEGER);
3189 __ CallStub(&stub); 3189 __ CallStub(&stub);
3190 } else { 3190 } else {
3191 ASSERT(exponent_type.IsDouble()); 3191 ASSERT(exponent_type.IsDouble());
3192 MathPowStub stub(MathPowStub::DOUBLE); 3192 MathPowStub stub(MathPowStub::DOUBLE);
3193 __ CallStub(&stub); 3193 __ CallStub(&stub);
3194 } 3194 }
3195 } 3195 }
3196 3196
3197 3197
3198 void LCodeGen::DoRandom(LRandom* instr) {
3199 // Having marked this instruction as a call we can use any
3200 // registers.
3201 ASSERT(ToDoubleRegister(instr->result()).is(d7));
3202 ASSERT(ToRegister(instr->InputAt(0)).is(r0));
3203
3204 __ PrepareCallCFunction(1, scratch0());
3205 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalContextOffset));
3206 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
3207
3208 // 0x41300000 is the top half of 1.0 x 2^20 as a double.
3209 // Create this constant using mov/orr to avoid PC relative load.
3210 __ mov(r1, Operand(0x41000000));
3211 __ orr(r1, r1, Operand(0x300000));
3212 // Move 0x41300000xxxxxxxx (x = random bits) to VFP.
3213 __ vmov(d7, r0, r1);
3214 // Move 0x4130000000000000 to VFP.
3215 __ mov(r0, Operand(0, RelocInfo::NONE));
3216 __ vmov(d8, r0, r1);
3217 // Subtract and store the result in the heap number.
3218 __ vsub(d7, d7, d8);
3219 }
3220
3221
3198 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { 3222 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) {
3199 ASSERT(ToDoubleRegister(instr->result()).is(d2)); 3223 ASSERT(ToDoubleRegister(instr->result()).is(d2));
3200 TranscendentalCacheStub stub(TranscendentalCache::LOG, 3224 TranscendentalCacheStub stub(TranscendentalCache::LOG,
3201 TranscendentalCacheStub::UNTAGGED); 3225 TranscendentalCacheStub::UNTAGGED);
3202 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 3226 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3203 } 3227 }
3204 3228
3205 3229
3206 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) { 3230 void LCodeGen::DoMathTan(LUnaryMathOperation* instr) {
3207 ASSERT(ToDoubleRegister(instr->result()).is(d2)); 3231 ASSERT(ToDoubleRegister(instr->result()).is(d2));
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
4750 ASSERT(osr_pc_offset_ == -1); 4774 ASSERT(osr_pc_offset_ == -1);
4751 osr_pc_offset_ = masm()->pc_offset(); 4775 osr_pc_offset_ = masm()->pc_offset();
4752 } 4776 }
4753 4777
4754 4778
4755 4779
4756 4780
4757 #undef __ 4781 #undef __
4758 4782
4759 } } // namespace v8::internal 4783 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698