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

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 190383002: Handle non-power-of-2 divisors in division-like operations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 6 years, 9 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/ia32/macro-assembler-ia32.h ('k') | src/utils.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 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 3585 matching lines...) Expand 10 before | Expand all | Expand 10 after
3596 mov(scratch1, FieldOperand(current, Map::kBitField2Offset)); 3596 mov(scratch1, FieldOperand(current, Map::kBitField2Offset));
3597 and_(scratch1, Map::kElementsKindMask); 3597 and_(scratch1, Map::kElementsKindMask);
3598 shr(scratch1, Map::kElementsKindShift); 3598 shr(scratch1, Map::kElementsKindShift);
3599 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); 3599 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS));
3600 j(equal, found); 3600 j(equal, found);
3601 mov(current, FieldOperand(current, Map::kPrototypeOffset)); 3601 mov(current, FieldOperand(current, Map::kPrototypeOffset));
3602 cmp(current, Immediate(factory->null_value())); 3602 cmp(current, Immediate(factory->null_value()));
3603 j(not_equal, &loop_again); 3603 j(not_equal, &loop_again);
3604 } 3604 }
3605 3605
3606
3607 void MacroAssembler::FlooringDiv(Register dividend, int32_t divisor) {
3608 ASSERT(!dividend.is(eax));
3609 ASSERT(!dividend.is(edx));
3610 MultiplierAndShift ms(divisor);
3611 mov(eax, Immediate(ms.multiplier()));
3612 imul(dividend);
3613 if (divisor > 0 && ms.multiplier() < 0) add(edx, dividend);
3614 if (divisor < 0 && ms.multiplier() > 0) sub(edx, dividend);
3615 if (ms.shift() > 0) sar(edx, ms.shift());
3616 mov(eax, dividend);
3617 shr(eax, 31);
3618 add(edx, eax);
3619 }
3620
3621
3606 } } // namespace v8::internal 3622 } } // namespace v8::internal
3607 3623
3608 #endif // V8_TARGET_ARCH_IA32 3624 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698