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

Unified Diff: runtime/vm/intermediate_language_dbc.cc

Issue 2162173002: DBC: Misc double instructions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Make test deopt Created 4 years, 5 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/constants_dbc.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_dbc.cc
diff --git a/runtime/vm/intermediate_language_dbc.cc b/runtime/vm/intermediate_language_dbc.cc
index 74586cea2c6c0f79d61ca0d035d6056d280cf2d4..3d8fee77bf098a1afcd62d350a6418e834834885 100644
--- a/runtime/vm/intermediate_language_dbc.cc
+++ b/runtime/vm/intermediate_language_dbc.cc
@@ -36,12 +36,9 @@ DECLARE_FLAG(int, optimization_counter_threshold);
M(BinaryInt32Op) \
M(Int32ToDouble) \
M(DoubleToInteger) \
- M(DoubleToSmi) \
M(DoubleToDouble) \
M(DoubleToFloat) \
M(FloatToDouble) \
- M(MathUnary) \
- M(MathMinMax) \
M(BoxInt64) \
M(InvokeMathCFunction) \
M(MergedMath) \
@@ -1285,6 +1282,14 @@ EMIT_NATIVE_CODE(Unbox, 1, Location::RequiresRegister()) {
}
+EMIT_NATIVE_CODE(DoubleToSmi, 1, Location::RequiresRegister()) {
+ const Register value = locs()->in(0).reg();
+ const Register result = locs()->out(0).reg();
+ __ DoubleToSmi(result, value);
+ compiler->EmitDeopt(deopt_id(), ICData::kDeoptDoubleToSmi);
+}
+
+
EMIT_NATIVE_CODE(SmiToDouble, 1, Location::RequiresRegister()) {
const Register value = locs()->in(0).reg();
const Register result = locs()->out(0).reg();
@@ -1313,6 +1318,45 @@ EMIT_NATIVE_CODE(UnaryDoubleOp, 1, Location::RequiresRegister()) {
}
+EMIT_NATIVE_CODE(MathUnary, 1, Location::RequiresRegister()) {
+ if (kind() == MathUnaryInstr::kSqrt) {
+ const Register value = locs()->in(0).reg();
+ const Register result = locs()->out(0).reg();
+ __ DSqrt(result, value);
+ } else if (kind() == MathUnaryInstr::kDoubleSquare) {
+ const Register value = locs()->in(0).reg();
+ const Register result = locs()->out(0).reg();
+ __ DMul(result, value, value);
+ } else {
+ Unsupported(compiler);
+ UNREACHABLE();
+ }
+}
+
+
+EMIT_NATIVE_CODE(MathMinMax, 2, Location::RequiresRegister()) {
+ ASSERT((op_kind() == MethodRecognizer::kMathMin) ||
+ (op_kind() == MethodRecognizer::kMathMax));
+ const Register left = locs()->in(0).reg();
+ const Register right = locs()->in(1).reg();
+ const Register result = locs()->out(0).reg();
+ if (result_cid() == kDoubleCid) {
+ if (op_kind() == MethodRecognizer::kMathMin) {
+ __ DMin(result, left, right);
+ } else {
+ __ DMax(result, left, right);
+ }
+ } else {
+ ASSERT(result_cid() == kSmiCid);
+ if (op_kind() == MethodRecognizer::kMathMin) {
+ __ Min(result, left, right);
+ } else {
+ __ Max(result, left, right);
+ }
+ }
+}
+
+
static Token::Kind FlipCondition(Token::Kind kind) {
switch (kind) {
case Token::kEQ: return Token::kNE;
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698