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

Side by Side 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: Cleanup 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_DBC. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_DBC.
6 #if defined(TARGET_ARCH_DBC) 6 #if defined(TARGET_ARCH_DBC)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 18 matching lines...) Expand all
29 DECLARE_FLAG(int, optimization_counter_threshold); 29 DECLARE_FLAG(int, optimization_counter_threshold);
30 30
31 // List of instructions that are still unimplemented by DBC backend. 31 // List of instructions that are still unimplemented by DBC backend.
32 #define FOR_EACH_UNIMPLEMENTED_INSTRUCTION(M) \ 32 #define FOR_EACH_UNIMPLEMENTED_INSTRUCTION(M) \
33 M(LoadCodeUnits) \ 33 M(LoadCodeUnits) \
34 M(LoadUntagged) \ 34 M(LoadUntagged) \
35 M(AllocateUninitializedContext) \ 35 M(AllocateUninitializedContext) \
36 M(BinaryInt32Op) \ 36 M(BinaryInt32Op) \
37 M(Int32ToDouble) \ 37 M(Int32ToDouble) \
38 M(DoubleToInteger) \ 38 M(DoubleToInteger) \
39 M(DoubleToSmi) \
40 M(DoubleToDouble) \ 39 M(DoubleToDouble) \
41 M(DoubleToFloat) \ 40 M(DoubleToFloat) \
42 M(FloatToDouble) \ 41 M(FloatToDouble) \
43 M(MathUnary) \
44 M(MathMinMax) \
45 M(BoxInt64) \ 42 M(BoxInt64) \
46 M(InvokeMathCFunction) \ 43 M(InvokeMathCFunction) \
47 M(MergedMath) \ 44 M(MergedMath) \
48 M(GuardFieldClass) \ 45 M(GuardFieldClass) \
49 M(GuardFieldLength) \ 46 M(GuardFieldLength) \
50 M(IfThenElse) \ 47 M(IfThenElse) \
51 M(ExtractNthOutput) \ 48 M(ExtractNthOutput) \
52 M(BinaryUint32Op) \ 49 M(BinaryUint32Op) \
53 M(ShiftUint32Op) \ 50 M(ShiftUint32Op) \
54 M(UnaryUint32Op) \ 51 M(UnaryUint32Op) \
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 __ IfEqNull(box); 1257 __ IfEqNull(box);
1261 compiler->EmitDeopt(GetDeoptId(), ICData::kDeoptCheckClass); 1258 compiler->EmitDeopt(GetDeoptId(), ICData::kDeoptCheckClass);
1262 __ UnboxDouble(result, box); 1259 __ UnboxDouble(result, box);
1263 } else { 1260 } else {
1264 __ CheckedUnboxDouble(result, box); 1261 __ CheckedUnboxDouble(result, box);
1265 compiler->EmitDeopt(GetDeoptId(), ICData::kDeoptCheckClass); 1262 compiler->EmitDeopt(GetDeoptId(), ICData::kDeoptCheckClass);
1266 } 1263 }
1267 } 1264 }
1268 1265
1269 1266
1267 EMIT_NATIVE_CODE(DoubleToSmi, 1, Location::RequiresRegister()) {
1268 const Register value = locs()->in(0).reg();
1269 const Register result = locs()->out(0).reg();
1270 __ DoubleToSmi(result, value);
1271 compiler->EmitDeopt(deopt_id(), ICData::kDeoptDoubleToSmi);
1272 }
1273
1274
1270 EMIT_NATIVE_CODE(SmiToDouble, 1, Location::RequiresRegister()) { 1275 EMIT_NATIVE_CODE(SmiToDouble, 1, Location::RequiresRegister()) {
1271 const Register value = locs()->in(0).reg(); 1276 const Register value = locs()->in(0).reg();
1272 const Register result = locs()->out(0).reg(); 1277 const Register result = locs()->out(0).reg();
1273 __ SmiToDouble(result, value); 1278 __ SmiToDouble(result, value);
1274 } 1279 }
1275 1280
1276 1281
1277 EMIT_NATIVE_CODE(BinaryDoubleOp, 2, Location::RequiresRegister()) { 1282 EMIT_NATIVE_CODE(BinaryDoubleOp, 2, Location::RequiresRegister()) {
1278 const Register left = locs()->in(0).reg(); 1283 const Register left = locs()->in(0).reg();
1279 const Register right = locs()->in(1).reg(); 1284 const Register right = locs()->in(1).reg();
1280 const Register result = locs()->out(0).reg(); 1285 const Register result = locs()->out(0).reg();
1281 switch (op_kind()) { 1286 switch (op_kind()) {
1282 case Token::kADD: __ DAdd(result, left, right); break; 1287 case Token::kADD: __ DAdd(result, left, right); break;
1283 case Token::kSUB: __ DSub(result, left, right); break; 1288 case Token::kSUB: __ DSub(result, left, right); break;
1284 case Token::kMUL: __ DMul(result, left, right); break; 1289 case Token::kMUL: __ DMul(result, left, right); break;
1285 case Token::kDIV: __ DDiv(result, left, right); break; 1290 case Token::kDIV: __ DDiv(result, left, right); break;
1286 default: UNREACHABLE(); 1291 default: UNREACHABLE();
1287 } 1292 }
1288 } 1293 }
1289 1294
1290 1295
1291 EMIT_NATIVE_CODE(UnaryDoubleOp, 1, Location::RequiresRegister()) { 1296 EMIT_NATIVE_CODE(UnaryDoubleOp, 1, Location::RequiresRegister()) {
1292 const Register value = locs()->in(0).reg(); 1297 const Register value = locs()->in(0).reg();
1293 const Register result = locs()->out(0).reg(); 1298 const Register result = locs()->out(0).reg();
1294 __ DNeg(result, value); 1299 __ DNeg(result, value);
1295 } 1300 }
1296 1301
1297 1302
1303 EMIT_NATIVE_CODE(MathUnary, 1, Location::RequiresRegister()) {
1304 if (kind() == MathUnaryInstr::kSqrt) {
1305 const Register value = locs()->in(0).reg();
1306 const Register result = locs()->out(0).reg();
1307 __ DSqrt(result, value);
1308 } else if (kind() == MathUnaryInstr::kDoubleSquare) {
1309 const Register value = locs()->in(0).reg();
1310 const Register result = locs()->out(0).reg();
1311 __ DMul(result, value, value);
1312 } else {
1313 Unsupported(compiler);
1314 UNREACHABLE();
1315 }
1316 }
1317
1318
1319 EMIT_NATIVE_CODE(MathMinMax, 2, Location::RequiresRegister()) {
1320 ASSERT((op_kind() == MethodRecognizer::kMathMin) ||
1321 (op_kind() == MethodRecognizer::kMathMax));
1322 const Register left = locs()->in(0).reg();
1323 const Register right = locs()->in(1).reg();
1324 const Register result = locs()->out(0).reg();
1325 if (result_cid() == kDoubleCid) {
1326 if (op_kind() == MethodRecognizer::kMathMin) {
1327 __ DMin(result, left, right);
1328 } else {
1329 __ DMax(result, left, right);
1330 }
1331 } else {
1332 ASSERT(result_cid() == kSmiCid);
1333 if (op_kind() == MethodRecognizer::kMathMin) {
1334 __ Min(result, left, right);
1335 } else {
1336 __ Max(result, left, right);
1337 }
1338 }
1339 }
1340
1341
1298 static Token::Kind FlipCondition(Token::Kind kind) { 1342 static Token::Kind FlipCondition(Token::Kind kind) {
1299 switch (kind) { 1343 switch (kind) {
1300 case Token::kEQ: return Token::kNE; 1344 case Token::kEQ: return Token::kNE;
1301 case Token::kNE: return Token::kEQ; 1345 case Token::kNE: return Token::kEQ;
1302 case Token::kLT: return Token::kGTE; 1346 case Token::kLT: return Token::kGTE;
1303 case Token::kGT: return Token::kLTE; 1347 case Token::kGT: return Token::kLTE;
1304 case Token::kLTE: return Token::kGT; 1348 case Token::kLTE: return Token::kGT;
1305 case Token::kGTE: return Token::kLT; 1349 case Token::kGTE: return Token::kLT;
1306 default: 1350 default:
1307 UNREACHABLE(); 1351 UNREACHABLE();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 __ IfULe(length, index); 1507 __ IfULe(length, index);
1464 compiler->EmitDeopt(deopt_id(), 1508 compiler->EmitDeopt(deopt_id(),
1465 ICData::kDeoptCheckArrayBound, 1509 ICData::kDeoptCheckArrayBound,
1466 (generalized_ ? ICData::kGeneralized : 0) | 1510 (generalized_ ? ICData::kGeneralized : 0) |
1467 (licm_hoisted_ ? ICData::kHoisted : 0)); 1511 (licm_hoisted_ ? ICData::kHoisted : 0));
1468 } 1512 }
1469 1513
1470 } // namespace dart 1514 } // namespace dart
1471 1515
1472 #endif // defined TARGET_ARCH_DBC 1516 #endif // defined TARGET_ARCH_DBC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698