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

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: 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 __ IfEqNull(box); 1275 __ IfEqNull(box);
1279 compiler->EmitDeopt(GetDeoptId(), ICData::kDeoptCheckClass); 1276 compiler->EmitDeopt(GetDeoptId(), ICData::kDeoptCheckClass);
1280 __ UnboxDouble(result, box); 1277 __ UnboxDouble(result, box);
1281 } else { 1278 } else {
1282 __ CheckedUnboxDouble(result, box); 1279 __ CheckedUnboxDouble(result, box);
1283 compiler->EmitDeopt(GetDeoptId(), ICData::kDeoptCheckClass); 1280 compiler->EmitDeopt(GetDeoptId(), ICData::kDeoptCheckClass);
1284 } 1281 }
1285 } 1282 }
1286 1283
1287 1284
1285 EMIT_NATIVE_CODE(DoubleToSmi, 1, Location::RequiresRegister()) {
1286 const Register value = locs()->in(0).reg();
1287 const Register result = locs()->out(0).reg();
1288 __ DoubleToSmi(result, value);
1289 compiler->EmitDeopt(deopt_id(), ICData::kDeoptDoubleToSmi);
1290 }
1291
1292
1288 EMIT_NATIVE_CODE(SmiToDouble, 1, Location::RequiresRegister()) { 1293 EMIT_NATIVE_CODE(SmiToDouble, 1, Location::RequiresRegister()) {
1289 const Register value = locs()->in(0).reg(); 1294 const Register value = locs()->in(0).reg();
1290 const Register result = locs()->out(0).reg(); 1295 const Register result = locs()->out(0).reg();
1291 __ SmiToDouble(result, value); 1296 __ SmiToDouble(result, value);
1292 } 1297 }
1293 1298
1294 1299
1295 EMIT_NATIVE_CODE(BinaryDoubleOp, 2, Location::RequiresRegister()) { 1300 EMIT_NATIVE_CODE(BinaryDoubleOp, 2, Location::RequiresRegister()) {
1296 const Register left = locs()->in(0).reg(); 1301 const Register left = locs()->in(0).reg();
1297 const Register right = locs()->in(1).reg(); 1302 const Register right = locs()->in(1).reg();
1298 const Register result = locs()->out(0).reg(); 1303 const Register result = locs()->out(0).reg();
1299 switch (op_kind()) { 1304 switch (op_kind()) {
1300 case Token::kADD: __ DAdd(result, left, right); break; 1305 case Token::kADD: __ DAdd(result, left, right); break;
1301 case Token::kSUB: __ DSub(result, left, right); break; 1306 case Token::kSUB: __ DSub(result, left, right); break;
1302 case Token::kMUL: __ DMul(result, left, right); break; 1307 case Token::kMUL: __ DMul(result, left, right); break;
1303 case Token::kDIV: __ DDiv(result, left, right); break; 1308 case Token::kDIV: __ DDiv(result, left, right); break;
1304 default: UNREACHABLE(); 1309 default: UNREACHABLE();
1305 } 1310 }
1306 } 1311 }
1307 1312
1308 1313
1309 EMIT_NATIVE_CODE(UnaryDoubleOp, 1, Location::RequiresRegister()) { 1314 EMIT_NATIVE_CODE(UnaryDoubleOp, 1, Location::RequiresRegister()) {
1310 const Register value = locs()->in(0).reg(); 1315 const Register value = locs()->in(0).reg();
1311 const Register result = locs()->out(0).reg(); 1316 const Register result = locs()->out(0).reg();
1312 __ DNeg(result, value); 1317 __ DNeg(result, value);
1313 } 1318 }
1314 1319
1315 1320
1321 EMIT_NATIVE_CODE(MathUnary, 1, Location::RequiresRegister()) {
1322 if (kind() == MathUnaryInstr::kSqrt) {
1323 const Register value = locs()->in(0).reg();
1324 const Register result = locs()->out(0).reg();
1325 __ DSqrt(result, value);
1326 } else if (kind() == MathUnaryInstr::kDoubleSquare) {
1327 const Register value = locs()->in(0).reg();
1328 const Register result = locs()->out(0).reg();
1329 __ DMul(result, value, value);
1330 } else {
1331 Unsupported(compiler);
1332 UNREACHABLE();
1333 }
1334 }
1335
1336
1337 EMIT_NATIVE_CODE(MathMinMax, 2, Location::RequiresRegister()) {
1338 ASSERT((op_kind() == MethodRecognizer::kMathMin) ||
1339 (op_kind() == MethodRecognizer::kMathMax));
1340 const Register left = locs()->in(0).reg();
1341 const Register right = locs()->in(1).reg();
1342 const Register result = locs()->out(0).reg();
1343 if (result_cid() == kDoubleCid) {
1344 if (op_kind() == MethodRecognizer::kMathMin) {
1345 __ DMin(result, left, right);
1346 } else {
1347 __ DMax(result, left, right);
1348 }
1349 } else {
1350 ASSERT(result_cid() == kSmiCid);
1351 if (op_kind() == MethodRecognizer::kMathMin) {
1352 __ Min(result, left, right);
1353 } else {
1354 __ Max(result, left, right);
1355 }
1356 }
1357 }
1358
1359
1316 static Token::Kind FlipCondition(Token::Kind kind) { 1360 static Token::Kind FlipCondition(Token::Kind kind) {
1317 switch (kind) { 1361 switch (kind) {
1318 case Token::kEQ: return Token::kNE; 1362 case Token::kEQ: return Token::kNE;
1319 case Token::kNE: return Token::kEQ; 1363 case Token::kNE: return Token::kEQ;
1320 case Token::kLT: return Token::kGTE; 1364 case Token::kLT: return Token::kGTE;
1321 case Token::kGT: return Token::kLTE; 1365 case Token::kGT: return Token::kLTE;
1322 case Token::kLTE: return Token::kGT; 1366 case Token::kLTE: return Token::kGT;
1323 case Token::kGTE: return Token::kLT; 1367 case Token::kGTE: return Token::kLT;
1324 default: 1368 default:
1325 UNREACHABLE(); 1369 UNREACHABLE();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 __ IfULe(length, index); 1525 __ IfULe(length, index);
1482 compiler->EmitDeopt(deopt_id(), 1526 compiler->EmitDeopt(deopt_id(),
1483 ICData::kDeoptCheckArrayBound, 1527 ICData::kDeoptCheckArrayBound,
1484 (generalized_ ? ICData::kGeneralized : 0) | 1528 (generalized_ ? ICData::kGeneralized : 0) |
1485 (licm_hoisted_ ? ICData::kHoisted : 0)); 1529 (licm_hoisted_ ? ICData::kHoisted : 0));
1486 } 1530 }
1487 1531
1488 } // namespace dart 1532 } // namespace dart
1489 1533
1490 #endif // defined TARGET_ARCH_DBC 1534 #endif // defined TARGET_ARCH_DBC
OLDNEW
« 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