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

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

Issue 812733003: Revert "Tweaks in the VM's typed_data implementations." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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_optimizer.h ('k') | runtime/vm/method_recognizer.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 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 return false; 1463 return false;
1464 } 1464 }
1465 // Check that value is always a Float32x4. 1465 // Check that value is always a Float32x4.
1466 if (!ArgIsAlways(kFloat64x2Cid, ic_data, 2)) { 1466 if (!ArgIsAlways(kFloat64x2Cid, ic_data, 2)) {
1467 return false; 1467 return false;
1468 } 1468 }
1469 value_check = ic_data.AsUnaryClassChecksForArgNr(2); 1469 value_check = ic_data.AsUnaryClassChecksForArgNr(2);
1470 return InlineSetIndexed(kind, target, call, receiver, token_pos, 1470 return InlineSetIndexed(kind, target, call, receiver, token_pos,
1471 value_check, entry, last); 1471 value_check, entry, last);
1472 case MethodRecognizer::kByteArrayBaseGetInt8: 1472 case MethodRecognizer::kByteArrayBaseGetInt8:
1473 return InlineByteArrayBaseLoad(call, receiver, receiver_cid, 1473 return InlineByteArrayViewLoad(call, receiver, receiver_cid,
1474 kTypedDataInt8ArrayCid, 1474 kTypedDataInt8ArrayCid,
1475 ic_data, entry, last); 1475 ic_data, entry, last);
1476 case MethodRecognizer::kByteArrayBaseGetUint8: 1476 case MethodRecognizer::kByteArrayBaseGetUint8:
1477 return InlineByteArrayBaseLoad(call, receiver, receiver_cid, 1477 return InlineByteArrayViewLoad(call, receiver, receiver_cid,
1478 kTypedDataUint8ArrayCid, 1478 kTypedDataUint8ArrayCid,
1479 ic_data, entry, last); 1479 ic_data, entry, last);
1480 case MethodRecognizer::kByteArrayBaseGetInt16: 1480 case MethodRecognizer::kByteArrayBaseGetInt16:
1481 return InlineByteArrayBaseLoad(call, receiver, receiver_cid, 1481 return InlineByteArrayViewLoad(call, receiver, receiver_cid,
1482 kTypedDataInt16ArrayCid, 1482 kTypedDataInt16ArrayCid,
1483 ic_data, entry, last); 1483 ic_data, entry, last);
1484 case MethodRecognizer::kByteArrayBaseGetUint16: 1484 case MethodRecognizer::kByteArrayBaseGetUint16:
1485 return InlineByteArrayBaseLoad(call, receiver, receiver_cid, 1485 return InlineByteArrayViewLoad(call, receiver, receiver_cid,
1486 kTypedDataUint16ArrayCid, 1486 kTypedDataUint16ArrayCid,
1487 ic_data, entry, last); 1487 ic_data, entry, last);
1488 case MethodRecognizer::kByteArrayBaseGetInt32: 1488 case MethodRecognizer::kByteArrayBaseGetInt32:
1489 if (!CanUnboxInt32()) { 1489 if (!CanUnboxInt32()) {
1490 return false; 1490 return false;
1491 } 1491 }
1492 return InlineByteArrayBaseLoad(call, receiver, receiver_cid, 1492 return InlineByteArrayViewLoad(call, receiver, receiver_cid,
1493 kTypedDataInt32ArrayCid, 1493 kTypedDataInt32ArrayCid,
1494 ic_data, entry, last); 1494 ic_data, entry, last);
1495 case MethodRecognizer::kByteArrayBaseGetUint32: 1495 case MethodRecognizer::kByteArrayBaseGetUint32:
1496 if (!CanUnboxInt32()) { 1496 if (!CanUnboxInt32()) {
1497 return false; 1497 return false;
1498 } 1498 }
1499 return InlineByteArrayBaseLoad(call, receiver, receiver_cid, 1499 return InlineByteArrayViewLoad(call, receiver, receiver_cid,
1500 kTypedDataUint32ArrayCid, 1500 kTypedDataUint32ArrayCid,
1501 ic_data, entry, last); 1501 ic_data, entry, last);
1502 case MethodRecognizer::kByteArrayBaseGetFloat32: 1502 case MethodRecognizer::kByteArrayBaseGetFloat32:
1503 if (!CanUnboxDouble()) { 1503 if (!CanUnboxDouble()) {
1504 return false; 1504 return false;
1505 } 1505 }
1506 return InlineByteArrayBaseLoad(call, receiver, receiver_cid, 1506 return InlineByteArrayViewLoad(call, receiver, receiver_cid,
1507 kTypedDataFloat32ArrayCid, 1507 kTypedDataFloat32ArrayCid,
1508 ic_data, entry, last); 1508 ic_data, entry, last);
1509 case MethodRecognizer::kByteArrayBaseGetFloat64: 1509 case MethodRecognizer::kByteArrayBaseGetFloat64:
1510 if (!CanUnboxDouble()) { 1510 if (!CanUnboxDouble()) {
1511 return false; 1511 return false;
1512 } 1512 }
1513 return InlineByteArrayBaseLoad(call, receiver, receiver_cid, 1513 return InlineByteArrayViewLoad(call, receiver, receiver_cid,
1514 kTypedDataFloat64ArrayCid, 1514 kTypedDataFloat64ArrayCid,
1515 ic_data, entry, last); 1515 ic_data, entry, last);
1516 case MethodRecognizer::kByteArrayBaseGetFloat32x4: 1516 case MethodRecognizer::kByteArrayBaseGetFloat32x4:
1517 if (!ShouldInlineSimd()) { 1517 if (!ShouldInlineSimd()) {
1518 return false; 1518 return false;
1519 } 1519 }
1520 return InlineByteArrayBaseLoad(call, receiver, receiver_cid, 1520 return InlineByteArrayViewLoad(call, receiver, receiver_cid,
1521 kTypedDataFloat32x4ArrayCid, 1521 kTypedDataFloat32x4ArrayCid,
1522 ic_data, entry, last); 1522 ic_data, entry, last);
1523 case MethodRecognizer::kByteArrayBaseGetInt32x4: 1523 case MethodRecognizer::kByteArrayBaseGetInt32x4:
1524 if (!ShouldInlineSimd()) { 1524 if (!ShouldInlineSimd()) {
1525 return false; 1525 return false;
1526 } 1526 }
1527 return InlineByteArrayBaseLoad(call, receiver, receiver_cid, 1527 return InlineByteArrayViewLoad(call, receiver, receiver_cid,
1528 kTypedDataInt32x4ArrayCid, 1528 kTypedDataInt32x4ArrayCid,
1529 ic_data, entry, last); 1529 ic_data, entry, last);
1530 case MethodRecognizer::kByteArrayBaseSetInt8: 1530 case MethodRecognizer::kByteArrayBaseSetInt8:
1531 return InlineByteArrayBaseStore(target, call, receiver, receiver_cid, 1531 return InlineByteArrayViewStore(target, call, receiver, receiver_cid,
1532 kTypedDataInt8ArrayCid, 1532 kTypedDataInt8ArrayCid,
1533 ic_data, entry, last); 1533 ic_data, entry, last);
1534 case MethodRecognizer::kByteArrayBaseSetUint8: 1534 case MethodRecognizer::kByteArrayBaseSetUint8:
1535 return InlineByteArrayBaseStore(target, call, receiver, receiver_cid, 1535 return InlineByteArrayViewStore(target, call, receiver, receiver_cid,
1536 kTypedDataUint8ArrayCid, 1536 kTypedDataUint8ArrayCid,
1537 ic_data, entry, last); 1537 ic_data, entry, last);
1538 case MethodRecognizer::kByteArrayBaseSetInt16: 1538 case MethodRecognizer::kByteArrayBaseSetInt16:
1539 return InlineByteArrayBaseStore(target, call, receiver, receiver_cid, 1539 return InlineByteArrayViewStore(target, call, receiver, receiver_cid,
1540 kTypedDataInt16ArrayCid, 1540 kTypedDataInt16ArrayCid,
1541 ic_data, entry, last); 1541 ic_data, entry, last);
1542 case MethodRecognizer::kByteArrayBaseSetUint16: 1542 case MethodRecognizer::kByteArrayBaseSetUint16:
1543 return InlineByteArrayBaseStore(target, call, receiver, receiver_cid, 1543 return InlineByteArrayViewStore(target, call, receiver, receiver_cid,
1544 kTypedDataUint16ArrayCid, 1544 kTypedDataUint16ArrayCid,
1545 ic_data, entry, last); 1545 ic_data, entry, last);
1546 case MethodRecognizer::kByteArrayBaseSetInt32: 1546 case MethodRecognizer::kByteArrayBaseSetInt32:
1547 return InlineByteArrayBaseStore(target, call, receiver, receiver_cid, 1547 return InlineByteArrayViewStore(target, call, receiver, receiver_cid,
1548 kTypedDataInt32ArrayCid, 1548 kTypedDataInt32ArrayCid,
1549 ic_data, entry, last); 1549 ic_data, entry, last);
1550 case MethodRecognizer::kByteArrayBaseSetUint32: 1550 case MethodRecognizer::kByteArrayBaseSetUint32:
1551 return InlineByteArrayBaseStore(target, call, receiver, receiver_cid, 1551 return InlineByteArrayViewStore(target, call, receiver, receiver_cid,
1552 kTypedDataUint32ArrayCid, 1552 kTypedDataUint32ArrayCid,
1553 ic_data, entry, last); 1553 ic_data, entry, last);
1554 case MethodRecognizer::kByteArrayBaseSetFloat32: 1554 case MethodRecognizer::kByteArrayBaseSetFloat32:
1555 if (!CanUnboxDouble()) { 1555 if (!CanUnboxDouble()) {
1556 return false; 1556 return false;
1557 } 1557 }
1558 return InlineByteArrayBaseStore(target, call, receiver, receiver_cid, 1558 return InlineByteArrayViewStore(target, call, receiver, receiver_cid,
1559 kTypedDataFloat32ArrayCid, 1559 kTypedDataFloat32ArrayCid,
1560 ic_data, entry, last); 1560 ic_data, entry, last);
1561 case MethodRecognizer::kByteArrayBaseSetFloat64: 1561 case MethodRecognizer::kByteArrayBaseSetFloat64:
1562 if (!CanUnboxDouble()) { 1562 if (!CanUnboxDouble()) {
1563 return false; 1563 return false;
1564 } 1564 }
1565 return InlineByteArrayBaseStore(target, call, receiver, receiver_cid, 1565 return InlineByteArrayViewStore(target, call, receiver, receiver_cid,
1566 kTypedDataFloat64ArrayCid, 1566 kTypedDataFloat64ArrayCid,
1567 ic_data, entry, last); 1567 ic_data, entry, last);
1568 case MethodRecognizer::kByteArrayBaseSetFloat32x4: 1568 case MethodRecognizer::kByteArrayBaseSetFloat32x4:
1569 if (!ShouldInlineSimd()) { 1569 if (!ShouldInlineSimd()) {
1570 return false; 1570 return false;
1571 } 1571 }
1572 return InlineByteArrayBaseStore(target, call, receiver, receiver_cid, 1572 return InlineByteArrayViewStore(target, call, receiver, receiver_cid,
1573 kTypedDataFloat32x4ArrayCid, 1573 kTypedDataFloat32x4ArrayCid,
1574 ic_data, entry, last); 1574 ic_data, entry, last);
1575 case MethodRecognizer::kByteArrayBaseSetInt32x4: 1575 case MethodRecognizer::kByteArrayBaseSetInt32x4:
1576 if (!ShouldInlineSimd()) { 1576 if (!ShouldInlineSimd()) {
1577 return false; 1577 return false;
1578 } 1578 }
1579 return InlineByteArrayBaseStore(target, call, receiver, receiver_cid, 1579 return InlineByteArrayViewStore(target, call, receiver, receiver_cid,
1580 kTypedDataInt32x4ArrayCid, 1580 kTypedDataInt32x4ArrayCid,
1581 ic_data, entry, last); 1581 ic_data, entry, last);
1582 case MethodRecognizer::kStringBaseCodeUnitAt: 1582 case MethodRecognizer::kStringBaseCodeUnitAt:
1583 return InlineStringCodeUnitAt(call, receiver_cid, entry, last); 1583 return InlineStringCodeUnitAt(call, receiver_cid, entry, last);
1584 case MethodRecognizer::kStringBaseCharAt: 1584 case MethodRecognizer::kStringBaseCharAt:
1585 return InlineStringBaseCharAt(call, receiver_cid, entry, last); 1585 return InlineStringBaseCharAt(call, receiver_cid, entry, last);
1586 case MethodRecognizer::kDoubleAdd: 1586 case MethodRecognizer::kDoubleAdd:
1587 return InlineDoubleOp(Token::kADD, call, entry, last); 1587 return InlineDoubleOp(Token::kADD, call, entry, last);
1588 case MethodRecognizer::kDoubleSub: 1588 case MethodRecognizer::kDoubleSub:
1589 return InlineDoubleOp(Token::kSUB, call, entry, last); 1589 return InlineDoubleOp(Token::kSUB, call, entry, last);
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
3001 (recognized_kind == MethodRecognizer::kByteArrayBaseSetFloat32) || 3001 (recognized_kind == MethodRecognizer::kByteArrayBaseSetFloat32) ||
3002 (recognized_kind == MethodRecognizer::kByteArrayBaseSetFloat64)) { 3002 (recognized_kind == MethodRecognizer::kByteArrayBaseSetFloat64)) {
3003 if (!CanUnboxDouble()) { 3003 if (!CanUnboxDouble()) {
3004 return false; 3004 return false;
3005 } 3005 }
3006 } 3006 }
3007 3007
3008 switch (recognized_kind) { 3008 switch (recognized_kind) {
3009 // ByteArray getters. 3009 // ByteArray getters.
3010 case MethodRecognizer::kByteArrayBaseGetInt8: 3010 case MethodRecognizer::kByteArrayBaseGetInt8:
3011 return BuildByteArrayBaseLoad(call, kTypedDataInt8ArrayCid); 3011 return BuildByteArrayViewLoad(call, kTypedDataInt8ArrayCid);
3012 case MethodRecognizer::kByteArrayBaseGetUint8: 3012 case MethodRecognizer::kByteArrayBaseGetUint8:
3013 return BuildByteArrayBaseLoad(call, kTypedDataUint8ArrayCid); 3013 return BuildByteArrayViewLoad(call, kTypedDataUint8ArrayCid);
3014 case MethodRecognizer::kByteArrayBaseGetInt16: 3014 case MethodRecognizer::kByteArrayBaseGetInt16:
3015 return BuildByteArrayBaseLoad(call, kTypedDataInt16ArrayCid); 3015 return BuildByteArrayViewLoad(call, kTypedDataInt16ArrayCid);
3016 case MethodRecognizer::kByteArrayBaseGetUint16: 3016 case MethodRecognizer::kByteArrayBaseGetUint16:
3017 return BuildByteArrayBaseLoad(call, kTypedDataUint16ArrayCid); 3017 return BuildByteArrayViewLoad(call, kTypedDataUint16ArrayCid);
3018 case MethodRecognizer::kByteArrayBaseGetInt32: 3018 case MethodRecognizer::kByteArrayBaseGetInt32:
3019 return BuildByteArrayBaseLoad(call, kTypedDataInt32ArrayCid); 3019 return BuildByteArrayViewLoad(call, kTypedDataInt32ArrayCid);
3020 case MethodRecognizer::kByteArrayBaseGetUint32: 3020 case MethodRecognizer::kByteArrayBaseGetUint32:
3021 return BuildByteArrayBaseLoad(call, kTypedDataUint32ArrayCid); 3021 return BuildByteArrayViewLoad(call, kTypedDataUint32ArrayCid);
3022 case MethodRecognizer::kByteArrayBaseGetFloat32: 3022 case MethodRecognizer::kByteArrayBaseGetFloat32:
3023 return BuildByteArrayBaseLoad(call, kTypedDataFloat32ArrayCid); 3023 return BuildByteArrayViewLoad(call, kTypedDataFloat32ArrayCid);
3024 case MethodRecognizer::kByteArrayBaseGetFloat64: 3024 case MethodRecognizer::kByteArrayBaseGetFloat64:
3025 return BuildByteArrayBaseLoad(call, kTypedDataFloat64ArrayCid); 3025 return BuildByteArrayViewLoad(call, kTypedDataFloat64ArrayCid);
3026 case MethodRecognizer::kByteArrayBaseGetFloat32x4: 3026 case MethodRecognizer::kByteArrayBaseGetFloat32x4:
3027 return BuildByteArrayBaseLoad(call, kTypedDataFloat32x4ArrayCid); 3027 return BuildByteArrayViewLoad(call, kTypedDataFloat32x4ArrayCid);
3028 case MethodRecognizer::kByteArrayBaseGetInt32x4: 3028 case MethodRecognizer::kByteArrayBaseGetInt32x4:
3029 return BuildByteArrayBaseLoad(call, kTypedDataInt32x4ArrayCid); 3029 return BuildByteArrayViewLoad(call, kTypedDataInt32x4ArrayCid);
3030 3030
3031 // ByteArray setters. 3031 // ByteArray setters.
3032 case MethodRecognizer::kByteArrayBaseSetInt8: 3032 case MethodRecognizer::kByteArrayBaseSetInt8:
3033 return BuildByteArrayBaseStore(call, kTypedDataInt8ArrayCid); 3033 return BuildByteArrayViewStore(call, kTypedDataInt8ArrayCid);
3034 case MethodRecognizer::kByteArrayBaseSetUint8: 3034 case MethodRecognizer::kByteArrayBaseSetUint8:
3035 return BuildByteArrayBaseStore(call, kTypedDataUint8ArrayCid); 3035 return BuildByteArrayViewStore(call, kTypedDataUint8ArrayCid);
3036 case MethodRecognizer::kByteArrayBaseSetInt16: 3036 case MethodRecognizer::kByteArrayBaseSetInt16:
3037 return BuildByteArrayBaseStore(call, kTypedDataInt16ArrayCid); 3037 return BuildByteArrayViewStore(call, kTypedDataInt16ArrayCid);
3038 case MethodRecognizer::kByteArrayBaseSetUint16: 3038 case MethodRecognizer::kByteArrayBaseSetUint16:
3039 return BuildByteArrayBaseStore(call, kTypedDataUint16ArrayCid); 3039 return BuildByteArrayViewStore(call, kTypedDataUint16ArrayCid);
3040 case MethodRecognizer::kByteArrayBaseSetInt32: 3040 case MethodRecognizer::kByteArrayBaseSetInt32:
3041 return BuildByteArrayBaseStore(call, kTypedDataInt32ArrayCid); 3041 return BuildByteArrayViewStore(call, kTypedDataInt32ArrayCid);
3042 case MethodRecognizer::kByteArrayBaseSetUint32: 3042 case MethodRecognizer::kByteArrayBaseSetUint32:
3043 return BuildByteArrayBaseStore(call, kTypedDataUint32ArrayCid); 3043 return BuildByteArrayViewStore(call, kTypedDataUint32ArrayCid);
3044 case MethodRecognizer::kByteArrayBaseSetFloat32: 3044 case MethodRecognizer::kByteArrayBaseSetFloat32:
3045 return BuildByteArrayBaseStore(call, kTypedDataFloat32ArrayCid); 3045 return BuildByteArrayViewStore(call, kTypedDataFloat32ArrayCid);
3046 case MethodRecognizer::kByteArrayBaseSetFloat64: 3046 case MethodRecognizer::kByteArrayBaseSetFloat64:
3047 return BuildByteArrayBaseStore(call, kTypedDataFloat64ArrayCid); 3047 return BuildByteArrayViewStore(call, kTypedDataFloat64ArrayCid);
3048 case MethodRecognizer::kByteArrayBaseSetFloat32x4: 3048 case MethodRecognizer::kByteArrayBaseSetFloat32x4:
3049 return BuildByteArrayBaseStore(call, kTypedDataFloat32x4ArrayCid); 3049 return BuildByteArrayViewStore(call, kTypedDataFloat32x4ArrayCid);
3050 case MethodRecognizer::kByteArrayBaseSetInt32x4: 3050 case MethodRecognizer::kByteArrayBaseSetInt32x4:
3051 return BuildByteArrayBaseStore(call, kTypedDataInt32x4ArrayCid); 3051 return BuildByteArrayViewStore(call, kTypedDataInt32x4ArrayCid);
3052 default: 3052 default:
3053 // Unsupported method. 3053 // Unsupported method.
3054 return false; 3054 return false;
3055 } 3055 }
3056 } 3056 }
3057 3057
3058 if ((class_ids[0] == kFloat32x4Cid) && (ic_data.NumberOfChecks() == 1)) { 3058 if ((class_ids[0] == kFloat32x4Cid) && (ic_data.NumberOfChecks() == 1)) {
3059 return TryInlineFloat32x4Method(call, recognized_kind); 3059 return TryInlineFloat32x4Method(call, recognized_kind);
3060 } 3060 }
3061 3061
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
3532 call->deopt_id()); 3532 call->deopt_id());
3533 ReplaceCall(call, setFlag); 3533 ReplaceCall(call, setFlag);
3534 return true; 3534 return true;
3535 } 3535 }
3536 default: 3536 default:
3537 return false; 3537 return false;
3538 } 3538 }
3539 } 3539 }
3540 3540
3541 3541
3542 bool FlowGraphOptimizer::InlineByteArrayBaseLoad(Instruction* call, 3542 bool FlowGraphOptimizer::InlineByteArrayViewLoad(Instruction* call,
3543 Definition* receiver, 3543 Definition* receiver,
3544 intptr_t array_cid, 3544 intptr_t array_cid,
3545 intptr_t view_cid, 3545 intptr_t view_cid,
3546 const ICData& ic_data, 3546 const ICData& ic_data,
3547 TargetEntryInstr** entry, 3547 TargetEntryInstr** entry,
3548 Definition** last) { 3548 Definition** last) {
3549 ASSERT(array_cid != kIllegalCid); 3549 ASSERT(array_cid != kIllegalCid);
3550 Definition* array = receiver; 3550 Definition* array = receiver;
3551 Definition* index = call->ArgumentAt(1); 3551 Definition* index = call->ArgumentAt(1);
3552 *entry = new(I) TargetEntryInstr(flow_graph()->allocate_block_id(), 3552 *entry = new(I) TargetEntryInstr(flow_graph()->allocate_block_id(),
3553 call->GetBlock()->try_index()); 3553 call->GetBlock()->try_index());
3554 (*entry)->InheritDeoptTarget(I, call); 3554 (*entry)->InheritDeoptTarget(I, call);
3555 Instruction* cursor = *entry; 3555 Instruction* cursor = *entry;
3556 3556
3557 array_cid = PrepareInlineByteArrayBaseOp(call, 3557 array_cid = PrepareInlineByteArrayViewOp(call,
3558 array_cid, 3558 array_cid,
3559 view_cid, 3559 view_cid,
3560 &array, 3560 &array,
3561 index, 3561 index,
3562 &cursor); 3562 &cursor);
3563 3563
3564 intptr_t deopt_id = Isolate::kNoDeoptId; 3564 intptr_t deopt_id = Isolate::kNoDeoptId;
3565 if ((array_cid == kTypedDataInt32ArrayCid) || 3565 if ((array_cid == kTypedDataInt32ArrayCid) ||
3566 (array_cid == kTypedDataUint32ArrayCid)) { 3566 (array_cid == kTypedDataUint32ArrayCid)) {
3567 // Deoptimization may be needed if result does not always fit in a Smi. 3567 // Deoptimization may be needed if result does not always fit in a Smi.
(...skipping 16 matching lines...) Expand all
3584 *last = new(I) FloatToDoubleInstr(new(I) Value(*last), deopt_id); 3584 *last = new(I) FloatToDoubleInstr(new(I) Value(*last), deopt_id);
3585 flow_graph()->AppendTo(cursor, 3585 flow_graph()->AppendTo(cursor,
3586 *last, 3586 *last,
3587 deopt_id != Isolate::kNoDeoptId ? call->env() : NULL, 3587 deopt_id != Isolate::kNoDeoptId ? call->env() : NULL,
3588 FlowGraph::kValue); 3588 FlowGraph::kValue);
3589 } 3589 }
3590 return true; 3590 return true;
3591 } 3591 }
3592 3592
3593 3593
3594 bool FlowGraphOptimizer::InlineByteArrayBaseStore(const Function& target, 3594 bool FlowGraphOptimizer::InlineByteArrayViewStore(const Function& target,
3595 Instruction* call, 3595 Instruction* call,
3596 Definition* receiver, 3596 Definition* receiver,
3597 intptr_t array_cid, 3597 intptr_t array_cid,
3598 intptr_t view_cid, 3598 intptr_t view_cid,
3599 const ICData& ic_data, 3599 const ICData& ic_data,
3600 TargetEntryInstr** entry, 3600 TargetEntryInstr** entry,
3601 Definition** last) { 3601 Definition** last) {
3602 ASSERT(array_cid != kIllegalCid); 3602 ASSERT(array_cid != kIllegalCid);
3603 Definition* array = receiver; 3603 Definition* array = receiver;
3604 Definition* index = call->ArgumentAt(1); 3604 Definition* index = call->ArgumentAt(1);
3605 *entry = new(I) TargetEntryInstr(flow_graph()->allocate_block_id(), 3605 *entry = new(I) TargetEntryInstr(flow_graph()->allocate_block_id(),
3606 call->GetBlock()->try_index()); 3606 call->GetBlock()->try_index());
3607 (*entry)->InheritDeoptTarget(I, call); 3607 (*entry)->InheritDeoptTarget(I, call);
3608 Instruction* cursor = *entry; 3608 Instruction* cursor = *entry;
3609 3609
3610 array_cid = PrepareInlineByteArrayBaseOp(call, 3610 array_cid = PrepareInlineByteArrayViewOp(call,
3611 array_cid, 3611 array_cid,
3612 view_cid, 3612 view_cid,
3613 &array, 3613 &array,
3614 index, 3614 index,
3615 &cursor); 3615 &cursor);
3616 3616
3617 // Extract the instance call so we can use the function_name in the stored 3617 // Extract the instance call so we can use the function_name in the stored
3618 // value check ICData. 3618 // value check ICData.
3619 InstanceCallInstr* i_call = NULL; 3619 InstanceCallInstr* i_call = NULL;
3620 if (call->IsPolymorphicInstanceCall()) { 3620 if (call->IsPolymorphicInstanceCall()) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
3736 flow_graph()->AppendTo(cursor, 3736 flow_graph()->AppendTo(cursor,
3737 *last, 3737 *last,
3738 call->deopt_id() != Isolate::kNoDeoptId ? 3738 call->deopt_id() != Isolate::kNoDeoptId ?
3739 call->env() : NULL, 3739 call->env() : NULL,
3740 FlowGraph::kEffect); 3740 FlowGraph::kEffect);
3741 return true; 3741 return true;
3742 } 3742 }
3743 3743
3744 3744
3745 3745
3746 intptr_t FlowGraphOptimizer::PrepareInlineByteArrayBaseOp( 3746 intptr_t FlowGraphOptimizer::PrepareInlineByteArrayViewOp(
3747 Instruction* call, 3747 Instruction* call,
3748 intptr_t array_cid, 3748 intptr_t array_cid,
3749 intptr_t view_cid, 3749 intptr_t view_cid,
3750 Definition** array, 3750 Definition** array,
3751 Definition* byte_index, 3751 Definition* byte_index,
3752 Instruction** cursor) { 3752 Instruction** cursor) {
3753 // Insert byte_index smi check. 3753 // Insert byte_index smi check.
3754 *cursor = flow_graph()->AppendTo(*cursor, 3754 *cursor = flow_graph()->AppendTo(*cursor,
3755 new(I) CheckSmiInstr( 3755 new(I) CheckSmiInstr(
3756 new(I) Value(byte_index), 3756 new(I) Value(byte_index),
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
3826 *cursor = flow_graph()->AppendTo(*cursor, 3826 *cursor = flow_graph()->AppendTo(*cursor,
3827 elements, 3827 elements,
3828 NULL, 3828 NULL,
3829 FlowGraph::kValue); 3829 FlowGraph::kValue);
3830 *array = elements; 3830 *array = elements;
3831 } 3831 }
3832 return array_cid; 3832 return array_cid;
3833 } 3833 }
3834 3834
3835 3835
3836 bool FlowGraphOptimizer::BuildByteArrayBaseLoad(InstanceCallInstr* call, 3836 bool FlowGraphOptimizer::BuildByteArrayViewLoad(InstanceCallInstr* call,
3837 intptr_t view_cid) { 3837 intptr_t view_cid) {
3838 const bool simd_view = (view_cid == kTypedDataFloat32x4ArrayCid) || 3838 const bool simd_view = (view_cid == kTypedDataFloat32x4ArrayCid) ||
3839 (view_cid == kTypedDataInt32x4ArrayCid); 3839 (view_cid == kTypedDataInt32x4ArrayCid);
3840 const bool float_view = (view_cid == kTypedDataFloat32ArrayCid) || 3840 const bool float_view = (view_cid == kTypedDataFloat32ArrayCid) ||
3841 (view_cid == kTypedDataFloat64ArrayCid); 3841 (view_cid == kTypedDataFloat64ArrayCid);
3842 if (float_view && !CanUnboxDouble()) { 3842 if (float_view && !CanUnboxDouble()) {
3843 return false; 3843 return false;
3844 } 3844 }
3845 if (simd_view && !ShouldInlineSimd()) { 3845 if (simd_view && !ShouldInlineSimd()) {
3846 return false; 3846 return false;
3847 } 3847 }
3848 return TryReplaceInstanceCallWithInline(call); 3848 return TryReplaceInstanceCallWithInline(call);
3849 } 3849 }
3850 3850
3851 3851
3852 bool FlowGraphOptimizer::BuildByteArrayBaseStore(InstanceCallInstr* call, 3852 bool FlowGraphOptimizer::BuildByteArrayViewStore(InstanceCallInstr* call,
3853 intptr_t view_cid) { 3853 intptr_t view_cid) {
3854 const bool simd_view = (view_cid == kTypedDataFloat32x4ArrayCid) || 3854 const bool simd_view = (view_cid == kTypedDataFloat32x4ArrayCid) ||
3855 (view_cid == kTypedDataInt32x4ArrayCid); 3855 (view_cid == kTypedDataInt32x4ArrayCid);
3856 const bool float_view = (view_cid == kTypedDataFloat32ArrayCid) || 3856 const bool float_view = (view_cid == kTypedDataFloat32ArrayCid) ||
3857 (view_cid == kTypedDataFloat64ArrayCid); 3857 (view_cid == kTypedDataFloat64ArrayCid);
3858 if (float_view && !CanUnboxDouble()) { 3858 if (float_view && !CanUnboxDouble()) {
3859 return false; 3859 return false;
3860 } 3860 }
3861 if (simd_view && !ShouldInlineSimd()) { 3861 if (simd_view && !ShouldInlineSimd()) {
3862 return false; 3862 return false;
(...skipping 4518 matching lines...) Expand 10 before | Expand all | Expand 10 after
8381 8381
8382 // Insert materializations at environment uses. 8382 // Insert materializations at environment uses.
8383 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { 8383 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) {
8384 CreateMaterializationAt( 8384 CreateMaterializationAt(
8385 exits_collector_.exits()[i], alloc, *slots); 8385 exits_collector_.exits()[i], alloc, *slots);
8386 } 8386 }
8387 } 8387 }
8388 8388
8389 8389
8390 } // namespace dart 8390 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/method_recognizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698