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

Unified Diff: vm/opt_code_generator_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
« vm/intrinsifier_ia32.cc ('K') | « vm/intrinsifier_ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/opt_code_generator_ia32.cc
===================================================================
--- vm/opt_code_generator_ia32.cc (revision 2388)
+++ vm/opt_code_generator_ia32.cc (working copy)
@@ -755,6 +755,7 @@
if ((kind == Token::kADD) ||
(kind == Token::kSUB) ||
(kind == Token::kMUL) ||
+ (kind == Token::kTRUNCDIV) ||
(kind == Token::kBIT_AND) ||
(kind == Token::kBIT_OR) ||
(kind == Token::kBIT_XOR)) {
@@ -858,6 +859,20 @@
__ xorl(EAX, EDX);
break;
}
+ case Token::kTRUNCDIV: {
+ // Handle Divide by Zero elsewhere
+ __ cmpl(EDX, Immediate(0));
+ __ j(EQUAL, overflow_label);
+ // Move right to ECX, left is in EAX.
+ __ movl(ECX, EDX);
+ __ SmiUntag(ECX);
+ __ SmiUntag(EAX);
+ // Sign extend EAX -> EDX:EAX.
+ __ cdq();
+ __ idivl(ECX);
+ __ SmiTag(EAX);
sra1 2011/12/13 21:12:08 MIN_SMI / -1 is not a Smi.
+ break;
+ }
default:
UNREACHABLE();
}
« vm/intrinsifier_ia32.cc ('K') | « vm/intrinsifier_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698