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

Side by Side Diff: runtime/vm/flow_graph_optimizer.cc

Issue 626223002: Add unboxed Mint for X64 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language.h » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 static bool ShouldInlineSimd() { 56 static bool ShouldInlineSimd() {
57 return FlowGraphCompiler::SupportsUnboxedSimd128(); 57 return FlowGraphCompiler::SupportsUnboxedSimd128();
58 } 58 }
59 59
60 60
61 static bool CanUnboxDouble() { 61 static bool CanUnboxDouble() {
62 return FlowGraphCompiler::SupportsUnboxedDoubles(); 62 return FlowGraphCompiler::SupportsUnboxedDoubles();
63 } 63 }
64 64
65 65
66 static bool ShouldInlineInt64ArrayOps() {
67 #if defined(TARGET_ARCH_X64)
68 return true;
69 #endif
70 return false;
71 }
72
66 static bool CanConvertUnboxedMintToDouble() { 73 static bool CanConvertUnboxedMintToDouble() {
67 #if defined(TARGET_ARCH_IA32) 74 #if defined(TARGET_ARCH_IA32)
68 return true; 75 return true;
69 #else 76 #else
70 // ARM does not have a short instruction sequence for converting int64 to 77 // ARM does not have a short instruction sequence for converting int64 to
71 // double. 78 // double.
72 // TODO(johnmccutchan): Investigate possibility on MIPS once 79 // TODO(johnmccutchan): Investigate possibility on MIPS once
73 // mints are implemented there. 80 // mints are implemented there.
74 return false; 81 return false;
75 #endif 82 #endif
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 return kTypedDataUint16ArrayCid; 1176 return kTypedDataUint16ArrayCid;
1170 1177
1171 case MethodRecognizer::kInt32ArrayGetIndexed: 1178 case MethodRecognizer::kInt32ArrayGetIndexed:
1172 case MethodRecognizer::kInt32ArraySetIndexed: 1179 case MethodRecognizer::kInt32ArraySetIndexed:
1173 return kTypedDataInt32ArrayCid; 1180 return kTypedDataInt32ArrayCid;
1174 1181
1175 case MethodRecognizer::kUint32ArrayGetIndexed: 1182 case MethodRecognizer::kUint32ArrayGetIndexed:
1176 case MethodRecognizer::kUint32ArraySetIndexed: 1183 case MethodRecognizer::kUint32ArraySetIndexed:
1177 return kTypedDataUint32ArrayCid; 1184 return kTypedDataUint32ArrayCid;
1178 1185
1186 case MethodRecognizer::kInt64ArrayGetIndexed:
1187 case MethodRecognizer::kInt64ArraySetIndexed:
1188 return kTypedDataInt64ArrayCid;
1189
1179 case MethodRecognizer::kFloat32x4ArrayGetIndexed: 1190 case MethodRecognizer::kFloat32x4ArrayGetIndexed:
1180 case MethodRecognizer::kFloat32x4ArraySetIndexed: 1191 case MethodRecognizer::kFloat32x4ArraySetIndexed:
1181 return kTypedDataFloat32x4ArrayCid; 1192 return kTypedDataFloat32x4ArrayCid;
1182 1193
1183 case MethodRecognizer::kInt32x4ArrayGetIndexed: 1194 case MethodRecognizer::kInt32x4ArrayGetIndexed:
1184 case MethodRecognizer::kInt32x4ArraySetIndexed: 1195 case MethodRecognizer::kInt32x4ArraySetIndexed:
1185 return kTypedDataInt32x4ArrayCid; 1196 return kTypedDataInt32x4ArrayCid;
1186 1197
1187 case MethodRecognizer::kFloat64x2ArrayGetIndexed: 1198 case MethodRecognizer::kFloat64x2ArrayGetIndexed:
1188 case MethodRecognizer::kFloat64x2ArraySetIndexed: 1199 case MethodRecognizer::kFloat64x2ArraySetIndexed:
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 } 1304 }
1294 case kTypedDataInt8ArrayCid: 1305 case kTypedDataInt8ArrayCid:
1295 case kTypedDataUint8ArrayCid: 1306 case kTypedDataUint8ArrayCid:
1296 case kTypedDataUint8ClampedArrayCid: 1307 case kTypedDataUint8ClampedArrayCid:
1297 case kExternalTypedDataUint8ArrayCid: 1308 case kExternalTypedDataUint8ArrayCid:
1298 case kExternalTypedDataUint8ClampedArrayCid: 1309 case kExternalTypedDataUint8ClampedArrayCid:
1299 case kTypedDataInt16ArrayCid: 1310 case kTypedDataInt16ArrayCid:
1300 case kTypedDataUint16ArrayCid: 1311 case kTypedDataUint16ArrayCid:
1301 case kTypedDataInt32ArrayCid: 1312 case kTypedDataInt32ArrayCid:
1302 case kTypedDataUint32ArrayCid: 1313 case kTypedDataUint32ArrayCid:
1314 case kTypedDataInt64ArrayCid:
1303 ASSERT(value_type.IsIntType()); 1315 ASSERT(value_type.IsIntType());
1304 // Fall through. 1316 // Fall through.
1305 case kTypedDataFloat32ArrayCid: 1317 case kTypedDataFloat32ArrayCid:
1306 case kTypedDataFloat64ArrayCid: { 1318 case kTypedDataFloat64ArrayCid: {
1307 type_args = instantiator = flow_graph_->constant_null(); 1319 type_args = instantiator = flow_graph_->constant_null();
1308 ASSERT((array_cid != kTypedDataFloat32ArrayCid && 1320 ASSERT((array_cid != kTypedDataFloat32ArrayCid &&
1309 array_cid != kTypedDataFloat64ArrayCid) || 1321 array_cid != kTypedDataFloat64ArrayCid) ||
1310 value_type.IsDoubleType()); 1322 value_type.IsDoubleType());
1311 ASSERT(value_type.IsInstantiated()); 1323 ASSERT(value_type.IsInstantiated());
1312 break; 1324 break;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 case MethodRecognizer::kFloat64x2ArrayGetIndexed: 1465 case MethodRecognizer::kFloat64x2ArrayGetIndexed:
1454 if (!ShouldInlineSimd()) { 1466 if (!ShouldInlineSimd()) {
1455 return false; 1467 return false;
1456 } 1468 }
1457 return InlineGetIndexed(kind, call, receiver, ic_data, entry, last); 1469 return InlineGetIndexed(kind, call, receiver, ic_data, entry, last);
1458 case MethodRecognizer::kInt32ArrayGetIndexed: 1470 case MethodRecognizer::kInt32ArrayGetIndexed:
1459 case MethodRecognizer::kUint32ArrayGetIndexed: 1471 case MethodRecognizer::kUint32ArrayGetIndexed:
1460 if (!CanUnboxInt32()) return false; 1472 if (!CanUnboxInt32()) return false;
1461 return InlineGetIndexed(kind, call, receiver, ic_data, entry, last); 1473 return InlineGetIndexed(kind, call, receiver, ic_data, entry, last);
1462 1474
1475 case MethodRecognizer::kInt64ArrayGetIndexed:
1476 if (!ShouldInlineInt64ArrayOps()) {
1477 return false;
1478 }
1479 return InlineGetIndexed(kind, call, receiver, ic_data, entry, last);
1463 // Recognized []= operators. 1480 // Recognized []= operators.
1464 case MethodRecognizer::kObjectArraySetIndexed: 1481 case MethodRecognizer::kObjectArraySetIndexed:
1465 case MethodRecognizer::kGrowableArraySetIndexed: 1482 case MethodRecognizer::kGrowableArraySetIndexed:
1466 if (ArgIsAlways(kSmiCid, ic_data, 2)) { 1483 if (ArgIsAlways(kSmiCid, ic_data, 2)) {
1467 value_check = ic_data.AsUnaryClassChecksForArgNr(2); 1484 value_check = ic_data.AsUnaryClassChecksForArgNr(2);
1468 } 1485 }
1469 return InlineSetIndexed(kind, target, call, receiver, token_pos, 1486 return InlineSetIndexed(kind, target, call, receiver, token_pos,
1470 &ic_data, value_check, entry, last); 1487 &ic_data, value_check, entry, last);
1471 case MethodRecognizer::kInt8ArraySetIndexed: 1488 case MethodRecognizer::kInt8ArraySetIndexed:
1472 case MethodRecognizer::kUint8ArraySetIndexed: 1489 case MethodRecognizer::kUint8ArraySetIndexed:
(...skipping 11 matching lines...) Expand all
1484 case MethodRecognizer::kInt32ArraySetIndexed: 1501 case MethodRecognizer::kInt32ArraySetIndexed:
1485 case MethodRecognizer::kUint32ArraySetIndexed: 1502 case MethodRecognizer::kUint32ArraySetIndexed:
1486 // Check that value is always smi or mint. We use Int32/Uint32 unboxing 1503 // Check that value is always smi or mint. We use Int32/Uint32 unboxing
1487 // which can only deal unbox these values. 1504 // which can only deal unbox these values.
1488 value_check = ic_data.AsUnaryClassChecksForArgNr(2); 1505 value_check = ic_data.AsUnaryClassChecksForArgNr(2);
1489 if (!HasOnlySmiOrMint(value_check)) { 1506 if (!HasOnlySmiOrMint(value_check)) {
1490 return false; 1507 return false;
1491 } 1508 }
1492 return InlineSetIndexed(kind, target, call, receiver, token_pos, 1509 return InlineSetIndexed(kind, target, call, receiver, token_pos,
1493 &ic_data, value_check, entry, last); 1510 &ic_data, value_check, entry, last);
1511 case MethodRecognizer::kInt64ArraySetIndexed:
1512 if (!ShouldInlineInt64ArrayOps()) {
1513 return false;
1514 }
1515 return InlineSetIndexed(kind, target, call, receiver, token_pos,
1516 &ic_data, value_check, entry, last);
1494 case MethodRecognizer::kFloat32ArraySetIndexed: 1517 case MethodRecognizer::kFloat32ArraySetIndexed:
1495 case MethodRecognizer::kFloat64ArraySetIndexed: 1518 case MethodRecognizer::kFloat64ArraySetIndexed:
1496 if (!CanUnboxDouble()) { 1519 if (!CanUnboxDouble()) {
1497 return false; 1520 return false;
1498 } 1521 }
1499 // Check that value is always double. 1522 // Check that value is always double.
1500 if (!ArgIsAlways(kDoubleCid, ic_data, 2)) { 1523 if (!ArgIsAlways(kDoubleCid, ic_data, 2)) {
1501 return false; 1524 return false;
1502 } 1525 }
1503 value_check = ic_data.AsUnaryClassChecksForArgNr(2); 1526 value_check = ic_data.AsUnaryClassChecksForArgNr(2);
(...skipping 8603 matching lines...) Expand 10 before | Expand all | Expand 10 after
10107 10130
10108 // Insert materializations at environment uses. 10131 // Insert materializations at environment uses.
10109 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { 10132 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) {
10110 CreateMaterializationAt( 10133 CreateMaterializationAt(
10111 exits_collector_.exits()[i], alloc, alloc->cls(), *slots); 10134 exits_collector_.exits()[i], alloc, alloc->cls(), *slots);
10112 } 10135 }
10113 } 10136 }
10114 10137
10115 10138
10116 } // namespace dart 10139 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698