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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 23219002: Add double unary operation (negate). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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
Index: runtime/vm/intermediate_language_x64.cc
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 26120)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -3776,6 +3776,48 @@
}
+void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ Register value = locs()->in(0).reg();
+ ASSERT(value == locs()->out().reg());
+ switch (op_kind()) {
+ case Token::kNEGATE: {
+ Label* deopt = compiler->AddDeoptStub(deopt_id(),
+ kDeoptUnaryOp);
+ __ negq(value);
+ __ j(OVERFLOW, deopt);
+ if (FLAG_throw_on_javascript_int_overflow) {
+ EmitJavascriptOverflowCheck(compiler, range(), deopt, value);
+ }
+ break;
+ }
+ case Token::kBIT_NOT:
+ __ notq(value);
+ __ andq(value, Immediate(~kSmiTagMask)); // Remove inverted smi-tag.
+ break;
+ default:
+ UNREACHABLE();
+ }
+}
+
+
+LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary() const {
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary =
+ new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ summary->set_in(0, Location::RequiresFpuRegister());
+ summary->set_out(Location::SameAsFirstInput());
+ return summary;
+}
+
+
+void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ XmmRegister value = locs()->in(0).fpu_reg();
+ ASSERT(locs()->out().fpu_reg() == value);
+ __ DoubleNegate(value);
+}
+
+
LocationSummary* MathMinMaxInstr::MakeLocationSummary() const {
if (result_cid() == kDoubleCid) {
const intptr_t kNumInputs = 2;
@@ -3865,30 +3907,6 @@
}
-void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- Register value = locs()->in(0).reg();
- ASSERT(value == locs()->out().reg());
- switch (op_kind()) {
- case Token::kNEGATE: {
- Label* deopt = compiler->AddDeoptStub(deopt_id(),
- kDeoptUnaryOp);
- __ negq(value);
- __ j(OVERFLOW, deopt);
- if (FLAG_throw_on_javascript_int_overflow) {
- EmitJavascriptOverflowCheck(compiler, range(), deopt, value);
- }
- break;
- }
- case Token::kBIT_NOT:
- __ notq(value);
- __ andq(value, Immediate(~kSmiTagMask)); // Remove inverted smi-tag.
- break;
- default:
- UNREACHABLE();
- }
-}
-
-
LocationSummary* SmiToDoubleInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = 0;
« runtime/vm/intermediate_language_mips.cc ('K') | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698