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

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

Issue 2815039: ARM: Correctness fix to Math.pow optimization... (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 | « no previous file | 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 4328 matching lines...) Expand 10 before | Expand all | Expand 10 after
4339 4339
4340 // Run through all the bits in the exponent. The result is calculated in d0 4340 // Run through all the bits in the exponent. The result is calculated in d0
4341 // and d1 holds base^(bit^2). 4341 // and d1 holds base^(bit^2).
4342 Label more_bits; 4342 Label more_bits;
4343 __ bind(&more_bits); 4343 __ bind(&more_bits);
4344 __ mov(scratch1, Operand(scratch1, LSR, 1), SetCC); 4344 __ mov(scratch1, Operand(scratch1, LSR, 1), SetCC);
4345 __ vmul(d0, d0, d1, cs); // Multiply with base^(bit^2) if bit is set. 4345 __ vmul(d0, d0, d1, cs); // Multiply with base^(bit^2) if bit is set.
4346 __ vmul(d1, d1, d1, ne); // Don't bother calculating next d1 if done. 4346 __ vmul(d1, d1, d1, ne); // Don't bother calculating next d1 if done.
4347 __ b(ne, &more_bits); 4347 __ b(ne, &more_bits);
4348 4348
4349 // If exponent is positive we are done.
4350 __ cmp(exponent, Operand(0));
4351 __ b(ge, &allocate_return);
4352
4349 // If exponent is negative result is 1/result (d2 already holds 1.0 in that 4353 // If exponent is negative result is 1/result (d2 already holds 1.0 in that
4350 // case). 4354 // case). However if d0 has reached infinity this will not provide the
4351 __ cmp(exponent, Operand(0)); 4355 // correct result, so call runtime if that is the case.
4352 __ vdiv(d0, d2, d0, mi); 4356 __ mov(scratch2, Operand(0x7FF00000));
4357 __ mov(scratch1, Operand(0));
4358 __ vmov(d1, scratch1, scratch2); // Load infinity into d1.
4359 __ vcmp(d0, d1);
4360 __ vmrs(pc);
4361 runtime.Branch(eq); // d0 reached infinity.
4362 __ vdiv(d0, d2, d0);
4353 __ b(&allocate_return); 4363 __ b(&allocate_return);
4354 4364
4355 __ bind(&exponent_nonsmi); 4365 __ bind(&exponent_nonsmi);
4356 // Special handling of raising to the power of -0.5 and 0.5. First check 4366 // Special handling of raising to the power of -0.5 and 0.5. First check
4357 // that the value is a heap number and that the lower bits (which for both 4367 // that the value is a heap number and that the lower bits (which for both
4358 // values are zero). 4368 // values are zero).
4359 heap_number_map = r6; 4369 heap_number_map = r6;
4360 __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); 4370 __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex);
4361 __ ldr(scratch1, FieldMemOperand(exponent, HeapObject::kMapOffset)); 4371 __ ldr(scratch1, FieldMemOperand(exponent, HeapObject::kMapOffset));
4362 __ ldr(scratch2, FieldMemOperand(exponent, HeapNumber::kMantissaOffset)); 4372 __ ldr(scratch2, FieldMemOperand(exponent, HeapNumber::kMantissaOffset));
(...skipping 6749 matching lines...) Expand 10 before | Expand all | Expand 10 after
11112 __ bind(&string_add_runtime); 11122 __ bind(&string_add_runtime);
11113 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); 11123 __ TailCallRuntime(Runtime::kStringAdd, 2, 1);
11114 } 11124 }
11115 11125
11116 11126
11117 #undef __ 11127 #undef __
11118 11128
11119 } } // namespace v8::internal 11129 } } // namespace v8::internal
11120 11130
11121 #endif // V8_TARGET_ARCH_ARM 11131 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698