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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 11016028: Add fast 64-bit integer ADD and SUB to the optimizing compiler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_ia32.cc
===================================================================
--- runtime/vm/intermediate_language_ia32.cc (revision 13168)
+++ runtime/vm/intermediate_language_ia32.cc (working copy)
@@ -2413,13 +2413,34 @@
LocationSummary* UnboxedMintBinaryOpInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 2;
- const intptr_t kNumTemps = 0;
- LocationSummary* summary =
- new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
- summary->set_in(0, Location::RequiresXmmRegister());
- summary->set_in(1, Location::RequiresXmmRegister());
- summary->set_out(Location::SameAsFirstInput());
- return summary;
+ switch (op_kind()) {
+ case Token::kBIT_AND:
+ case Token::kBIT_OR:
+ case Token::kBIT_XOR: {
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary =
+ new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ summary->set_in(0, Location::RequiresXmmRegister());
+ summary->set_in(1, Location::RequiresXmmRegister());
+ summary->set_out(Location::SameAsFirstInput());
+ return summary;
+ }
+ case Token::kADD:
+ case Token::kSUB: {
+ const intptr_t kNumTemps = 2;
+ LocationSummary* summary =
+ new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ summary->set_in(0, Location::RequiresXmmRegister());
+ summary->set_in(1, Location::RequiresXmmRegister());
+ summary->set_temp(0, Location::RegisterLocation(EAX));
+ summary->set_temp(1, Location::RegisterLocation(EDX));
+ summary->set_out(Location::SameAsFirstInput());
+ return summary;
+ }
+ default:
+ UNREACHABLE();
+ return NULL;
+ }
}
@@ -2433,12 +2454,36 @@
case Token::kBIT_AND: __ andpd(left, right); break;
case Token::kBIT_OR: __ orpd(left, right); break;
case Token::kBIT_XOR: __ xorpd(left, right); break;
+ case Token::kADD:
+ case Token::kSUB: {
+ Label* deopt = compiler->AddDeoptStub(deopt_id(),
+ kDeoptBinaryMintOp);
+ Label done, overflow;
+ __ pextrd(EAX, right, Immediate(0)); // Lower half left
+ __ pextrd(EDX, right, Immediate(1)); // Upper half left
+ __ subl(ESP, Immediate(2 * kWordSize));
+ __ movq(Address(ESP, 0), left);
+ if (op_kind() == Token::kADD) {
+ __ addl(Address(ESP, 0), EAX);
+ __ adcl(Address(ESP, 4), EDX);
+ } else {
+ __ subl(Address(ESP, 0), EAX);
+ __ sbbl(Address(ESP, 4), EDX);
+ }
+ __ j(OVERFLOW, &overflow);
+ __ movq(left, Address(ESP, 0));
+ __ addl(ESP, Immediate(2 * kWordSize));
+ __ jmp(&done);
+ __ Bind(&overflow);
+ __ addl(ESP, Immediate(2 * kWordSize));
+ __ jmp(deopt);
+ __ Bind(&done);
+ break;
+ }
default: UNREACHABLE();
}
}
-
-
} // namespace dart
#undef __
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698