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

Unified Diff: vm/intrinsifier_ia32.cc

Issue 8934010: Optimize truncated divide (intrinsics and inline). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | vm/opt_code_generator_ia32.cc » ('j') | vm/opt_code_generator_ia32.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/intrinsifier_ia32.cc
===================================================================
--- vm/intrinsifier_ia32.cc (revision 2388)
+++ vm/intrinsifier_ia32.cc (working copy)
@@ -34,6 +34,7 @@
V(IntegerImplementation, mulFromInteger, Integer_mulFromInteger) \
V(IntegerImplementation, *, Integer_mulFromInteger) \
V(IntegerImplementation, %, Integer_modulo) \
+ V(IntegerImplementation, ~/, Integer_truncDivide) \
V(IntegerImplementation, negate, Integer_negate) \
V(IntegerImplementation, bitAndFromInteger, Integer_bitAndFromInteger) \
V(IntegerImplementation, &, Integer_bitAndFromInteger) \
@@ -357,6 +358,25 @@
}
+static bool Integer_truncDivide(Assembler* assembler) {
+ Label fall_through;
+ TestBothArgumentsSmis(assembler, &fall_through);
+ // EAX: right argument (divisor)
+ __ cmpl(EAX, Immediate(0));
+ __ j(EQUAL, &fall_through, Assembler::kNearJump);
+ __ movl(EBX, EAX);
+ __ SmiUntag(EBX);
+ __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Left argument (dividend).
+ __ SmiUntag(EAX);
+ __ cdq();
+ __ idivl(EBX);
+ __ SmiTag(EAX);
sra1 2011/12/13 21:12:08 MIN_SMI / -1 is not a Smi.
srdjan 2011/12/13 21:29:35 Thanks, fixing it now.
+ __ ret();
+ __ Bind(&fall_through);
+ return false;
+}
+
+
static bool Integer_negate(Assembler* assembler) {
Label fall_through;
__ movl(EAX, Address(ESP, + 1 * kWordSize));
« no previous file with comments | « no previous file | vm/opt_code_generator_ia32.cc » ('j') | vm/opt_code_generator_ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698