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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 12316065: Set instruction/use_index when adding an input to an IL instruction. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 7 years, 10 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_type_propagator.cc ('k') | runtime/vm/intermediate_language.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) 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 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 kUnboxedDouble, 342 kUnboxedDouble,
343 kUnboxedMint 343 kUnboxedMint
344 }; 344 };
345 345
346 346
347 // An embedded container with N elements of type T. Used (with partial 347 // An embedded container with N elements of type T. Used (with partial
348 // specialization for N=0) because embedded arrays cannot have size 0. 348 // specialization for N=0) because embedded arrays cannot have size 0.
349 template<typename T, intptr_t N> 349 template<typename T, intptr_t N>
350 class EmbeddedArray { 350 class EmbeddedArray {
351 public: 351 public:
352 EmbeddedArray() { 352 EmbeddedArray() : elements_() { }
353 for (intptr_t i = 0; i < N; i++) elements_[i] = NULL;
354 }
355 353
356 intptr_t length() const { return N; } 354 intptr_t length() const { return N; }
357 355
358 const T& operator[](intptr_t i) const { 356 const T& operator[](intptr_t i) const {
359 ASSERT(i < length()); 357 ASSERT(i < length());
360 return elements_[i]; 358 return elements_[i];
361 } 359 }
362 360
363 T& operator[](intptr_t i) { 361 T& operator[](intptr_t i) {
364 ASSERT(i < length()); 362 ASSERT(i < length());
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 virtual BlockEntryInstr* AsBlockEntry() { return NULL; } 514 virtual BlockEntryInstr* AsBlockEntry() { return NULL; }
517 515
518 bool IsDefinition() { return (AsDefinition() != NULL); } 516 bool IsDefinition() { return (AsDefinition() != NULL); }
519 virtual Definition* AsDefinition() { return NULL; } 517 virtual Definition* AsDefinition() { return NULL; }
520 518
521 bool IsControl() { return (AsControl() != NULL); } 519 bool IsControl() { return (AsControl() != NULL); }
522 virtual ControlInstruction* AsControl() { return NULL; } 520 virtual ControlInstruction* AsControl() { return NULL; }
523 521
524 virtual intptr_t InputCount() const = 0; 522 virtual intptr_t InputCount() const = 0;
525 virtual Value* InputAt(intptr_t i) const = 0; 523 virtual Value* InputAt(intptr_t i) const = 0;
526 virtual void SetInputAt(intptr_t i, Value* value) = 0; 524 void SetInputAt(intptr_t i, Value* value) {
525 ASSERT(value != NULL);
526 value->set_instruction(this);
527 value->set_use_index(i);
528 RawSetInputAt(i, value);
529 }
527 530
528 // Remove all inputs (including in the environment) from their 531 // Remove all inputs (including in the environment) from their
529 // definition's use lists. 532 // definition's use lists.
530 void UnuseAllInputs(); 533 void UnuseAllInputs();
531 534
532 // Call instructions override this function and return the number of 535 // Call instructions override this function and return the number of
533 // pushed arguments. 536 // pushed arguments.
534 virtual intptr_t ArgumentCount() const = 0; 537 virtual intptr_t ArgumentCount() const = 0;
535 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { 538 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
536 UNREACHABLE(); 539 UNREACHABLE();
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 friend class CheckSmiInstr; 717 friend class CheckSmiInstr;
715 friend class CheckArrayBoundInstr; 718 friend class CheckArrayBoundInstr;
716 friend class CheckEitherNonSmiInstr; 719 friend class CheckEitherNonSmiInstr;
717 friend class LICM; 720 friend class LICM;
718 friend class DoubleToSmiInstr; 721 friend class DoubleToSmiInstr;
719 friend class DoubleToDoubleInstr; 722 friend class DoubleToDoubleInstr;
720 friend class InvokeMathCFunctionInstr; 723 friend class InvokeMathCFunctionInstr;
721 friend class FlowGraphOptimizer; 724 friend class FlowGraphOptimizer;
722 friend class LoadIndexedInstr; 725 friend class LoadIndexedInstr;
723 726
727 virtual void RawSetInputAt(intptr_t i, Value* value) = 0;
728
724 intptr_t deopt_id_; 729 intptr_t deopt_id_;
725 intptr_t lifetime_position_; // Position used by register allocator. 730 intptr_t lifetime_position_; // Position used by register allocator.
726 Instruction* previous_; 731 Instruction* previous_;
727 Instruction* next_; 732 Instruction* next_;
728 Environment* env_; 733 Environment* env_;
729 intptr_t expr_id_; 734 intptr_t expr_id_;
730 735
731 DISALLOW_COPY_AND_ASSIGN(Instruction); 736 DISALLOW_COPY_AND_ASSIGN(Instruction);
732 }; 737 };
733 738
734 739
735 template<intptr_t N> 740 template<intptr_t N>
736 class TemplateInstruction: public Instruction { 741 class TemplateInstruction: public Instruction {
737 public: 742 public:
738 TemplateInstruction<N>() : locs_(NULL) { } 743 TemplateInstruction<N>() : locs_(NULL) { }
739 744
740 virtual intptr_t InputCount() const { return N; } 745 virtual intptr_t InputCount() const { return N; }
741 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } 746 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; }
742 virtual void SetInputAt(intptr_t i, Value* value) {
743 ASSERT(value != NULL);
744 inputs_[i] = value;
745 }
746 747
747 virtual LocationSummary* locs() { 748 virtual LocationSummary* locs() {
748 if (locs_ == NULL) { 749 if (locs_ == NULL) {
749 locs_ = MakeLocationSummary(); 750 locs_ = MakeLocationSummary();
750 } 751 }
751 return locs_; 752 return locs_;
752 } 753 }
753 754
754 protected: 755 protected:
755 EmbeddedArray<Value*, N> inputs_; 756 EmbeddedArray<Value*, N> inputs_;
756 757
757 private: 758 private:
759 virtual void RawSetInputAt(intptr_t i, Value* value) {
760 inputs_[i] = value;
761 }
762
758 LocationSummary* locs_; 763 LocationSummary* locs_;
759 }; 764 };
760 765
761 766
762 class MoveOperands : public ZoneAllocated { 767 class MoveOperands : public ZoneAllocated {
763 public: 768 public:
764 MoveOperands(Location dest, Location src) : dest_(dest), src_(src) { } 769 MoveOperands(Location dest, Location src) : dest_(dest), src_(src) { }
765 770
766 Location src() const { return src_; } 771 Location src() const { return src_; }
767 Location dest() const { return dest_; } 772 Location dest() const { return dest_; }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 GrowableArray<intptr_t>* parent, 934 GrowableArray<intptr_t>* parent,
930 GrowableArray<BitVector*>* assigned_vars, 935 GrowableArray<BitVector*>* assigned_vars,
931 intptr_t variable_count, 936 intptr_t variable_count,
932 intptr_t fixed_parameter_count); 937 intptr_t fixed_parameter_count);
933 938
934 virtual intptr_t InputCount() const { return 0; } 939 virtual intptr_t InputCount() const { return 0; }
935 virtual Value* InputAt(intptr_t i) const { 940 virtual Value* InputAt(intptr_t i) const {
936 UNREACHABLE(); 941 UNREACHABLE();
937 return NULL; 942 return NULL;
938 } 943 }
939 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
940 944
941 virtual intptr_t ArgumentCount() const { return 0; } 945 virtual intptr_t ArgumentCount() const { return 0; }
942 946
943 virtual bool CanDeoptimize() const { return false; } 947 virtual bool CanDeoptimize() const { return false; }
944 948
945 virtual bool HasSideEffect() const { return false; } 949 virtual bool HasSideEffect() const { return false; }
946 950
947 intptr_t try_index() const { return try_index_; } 951 intptr_t try_index() const { return try_index_; }
948 952
949 BitVector* loop_info() const { return loop_info_; } 953 BitVector* loop_info() const { return loop_info_; }
(...skipping 16 matching lines...) Expand all
966 try_index_(try_index), 970 try_index_(try_index),
967 preorder_number_(-1), 971 preorder_number_(-1),
968 postorder_number_(-1), 972 postorder_number_(-1),
969 dominator_(NULL), 973 dominator_(NULL),
970 dominated_blocks_(1), 974 dominated_blocks_(1),
971 last_instruction_(NULL), 975 last_instruction_(NULL),
972 parallel_move_(NULL), 976 parallel_move_(NULL),
973 loop_info_(NULL) { } 977 loop_info_(NULL) { }
974 978
975 private: 979 private:
980 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
981
976 virtual void ClearPredecessors() = 0; 982 virtual void ClearPredecessors() = 0;
977 virtual void AddPredecessor(BlockEntryInstr* predecessor) = 0; 983 virtual void AddPredecessor(BlockEntryInstr* predecessor) = 0;
978 984
979 const intptr_t block_id_; 985 const intptr_t block_id_;
980 const intptr_t try_index_; 986 const intptr_t try_index_;
981 intptr_t preorder_number_; 987 intptr_t preorder_number_;
982 intptr_t postorder_number_; 988 intptr_t postorder_number_;
983 // Starting and ending lifetime positions for this block. Used by 989 // Starting and ending lifetime positions for this block. Used by
984 // the linear scan register allocator. 990 // the linear scan register allocator.
985 intptr_t start_pos_; 991 intptr_t start_pos_;
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 UseKind use_kind_; 1383 UseKind use_kind_;
1378 1384
1379 Object& constant_value_; 1385 Object& constant_value_;
1380 1386
1381 DISALLOW_COPY_AND_ASSIGN(Definition); 1387 DISALLOW_COPY_AND_ASSIGN(Definition);
1382 }; 1388 };
1383 1389
1384 1390
1385 class PhiInstr : public Definition { 1391 class PhiInstr : public Definition {
1386 public: 1392 public:
1387 explicit PhiInstr(JoinEntryInstr* block, intptr_t num_inputs) 1393 PhiInstr(JoinEntryInstr* block, intptr_t num_inputs)
1388 : block_(block), 1394 : block_(block),
1389 inputs_(num_inputs), 1395 inputs_(num_inputs),
1390 is_alive_(false), 1396 is_alive_(false),
1391 representation_(kTagged), 1397 representation_(kTagged),
1392 reaching_defs_(NULL) { 1398 reaching_defs_(NULL) {
1393 for (intptr_t i = 0; i < num_inputs; ++i) { 1399 for (intptr_t i = 0; i < num_inputs; ++i) {
1394 inputs_.Add(NULL); 1400 inputs_.Add(NULL);
1395 } 1401 }
1396 } 1402 }
1397 1403
1398 // Get the block entry for that instruction. 1404 // Get the block entry for that instruction.
1399 virtual BlockEntryInstr* GetBlock() const { return block(); } 1405 virtual BlockEntryInstr* GetBlock() const { return block(); }
1400 JoinEntryInstr* block() const { return block_; } 1406 JoinEntryInstr* block() const { return block_; }
1401 1407
1402 virtual CompileType ComputeType() const; 1408 virtual CompileType ComputeType() const;
1403 virtual bool RecomputeType(); 1409 virtual bool RecomputeType();
1404 1410
1405 virtual intptr_t ArgumentCount() const { return 0; } 1411 virtual intptr_t ArgumentCount() const { return 0; }
1406 1412
1407 intptr_t InputCount() const { return inputs_.length(); } 1413 intptr_t InputCount() const { return inputs_.length(); }
1408 1414
1409 Value* InputAt(intptr_t i) const { return inputs_[i]; } 1415 Value* InputAt(intptr_t i) const { return inputs_[i]; }
1410 1416
1411 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; }
1412
1413 virtual bool CanDeoptimize() const { return false; } 1417 virtual bool CanDeoptimize() const { return false; }
1414 1418
1415 virtual bool HasSideEffect() const { return false; } 1419 virtual bool HasSideEffect() const { return false; }
1416 1420
1417 // Phi is alive if it reaches a non-environment use. 1421 // Phi is alive if it reaches a non-environment use.
1418 bool is_alive() const { return is_alive_; } 1422 bool is_alive() const { return is_alive_; }
1419 void mark_alive() { is_alive_ = true; } 1423 void mark_alive() { is_alive_ = true; }
1420 1424
1421 virtual Representation RequiredInputRepresentation(intptr_t i) const { 1425 virtual Representation RequiredInputRepresentation(intptr_t i) const {
1422 return representation_; 1426 return representation_;
(...skipping 20 matching lines...) Expand all
1443 1447
1444 BitVector* reaching_defs() const { 1448 BitVector* reaching_defs() const {
1445 return reaching_defs_; 1449 return reaching_defs_;
1446 } 1450 }
1447 1451
1448 void set_reaching_defs(BitVector* reaching_defs) { 1452 void set_reaching_defs(BitVector* reaching_defs) {
1449 reaching_defs_ = reaching_defs; 1453 reaching_defs_ = reaching_defs;
1450 } 1454 }
1451 1455
1452 private: 1456 private:
1453 friend class ConstantPropagator; // Direct access to inputs_. 1457 // Direct access to inputs_ in order to resize it due to unreachable
1458 // predecessors.
1459 friend class ConstantPropagator;
1460
1461 void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; }
1454 1462
1455 JoinEntryInstr* block_; 1463 JoinEntryInstr* block_;
1456 GrowableArray<Value*> inputs_; 1464 GrowableArray<Value*> inputs_;
1457 bool is_alive_; 1465 bool is_alive_;
1458 Representation representation_; 1466 Representation representation_;
1459 1467
1460 BitVector* reaching_defs_; 1468 BitVector* reaching_defs_;
1461 1469
1462 DISALLOW_COPY_AND_ASSIGN(PhiInstr); 1470 DISALLOW_COPY_AND_ASSIGN(PhiInstr);
1463 }; 1471 };
1464 1472
1465 1473
1466 class ParameterInstr : public Definition { 1474 class ParameterInstr : public Definition {
1467 public: 1475 public:
1468 explicit ParameterInstr(intptr_t index, GraphEntryInstr* block) 1476 ParameterInstr(intptr_t index, GraphEntryInstr* block)
1469 : index_(index), block_(block) { } 1477 : index_(index), block_(block) { }
1470 1478
1471 DECLARE_INSTRUCTION(Parameter) 1479 DECLARE_INSTRUCTION(Parameter)
1472 1480
1473 intptr_t index() const { return index_; } 1481 intptr_t index() const { return index_; }
1474 1482
1475 // Get the block entry for that instruction. 1483 // Get the block entry for that instruction.
1476 virtual BlockEntryInstr* GetBlock() const { return block_; } 1484 virtual BlockEntryInstr* GetBlock() const { return block_; }
1477 1485
1478 virtual intptr_t ArgumentCount() const { return 0; } 1486 virtual intptr_t ArgumentCount() const { return 0; }
1479 1487
1480 intptr_t InputCount() const { return 0; } 1488 intptr_t InputCount() const { return 0; }
1481 Value* InputAt(intptr_t i) const { 1489 Value* InputAt(intptr_t i) const {
1482 UNREACHABLE(); 1490 UNREACHABLE();
1483 return NULL; 1491 return NULL;
1484 } 1492 }
1485 void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
1486 1493
1487 virtual bool CanDeoptimize() const { return false; } 1494 virtual bool CanDeoptimize() const { return false; }
1488 1495
1489 virtual bool HasSideEffect() const { return false; } 1496 virtual bool HasSideEffect() const { return false; }
1490 1497
1491 virtual intptr_t Hashcode() const { 1498 virtual intptr_t Hashcode() const {
1492 UNREACHABLE(); 1499 UNREACHABLE();
1493 return 0; 1500 return 0;
1494 } 1501 }
1495 1502
1496 virtual void PrintOperandsTo(BufferFormatter* f) const; 1503 virtual void PrintOperandsTo(BufferFormatter* f) const;
1497 1504
1498 virtual CompileType ComputeType() const; 1505 virtual CompileType ComputeType() const;
1499 1506
1500 private: 1507 private:
1508 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
1509
1501 const intptr_t index_; 1510 const intptr_t index_;
1502 GraphEntryInstr* block_; 1511 GraphEntryInstr* block_;
1503 1512
1504 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); 1513 DISALLOW_COPY_AND_ASSIGN(ParameterInstr);
1505 }; 1514 };
1506 1515
1507 1516
1508 class PushArgumentInstr : public Definition { 1517 class PushArgumentInstr : public Definition {
1509 public: 1518 public:
1510 explicit PushArgumentInstr(Value* value) : value_(value), locs_(NULL) { 1519 explicit PushArgumentInstr(Value* value) : locs_(NULL) {
1511 ASSERT(value != NULL); 1520 SetInputAt(0, value);
1512 set_use_kind(kEffect); // Override the default. 1521 set_use_kind(kEffect); // Override the default.
1513 } 1522 }
1514 1523
1515 DECLARE_INSTRUCTION(PushArgument) 1524 DECLARE_INSTRUCTION(PushArgument)
1516 1525
1517 intptr_t InputCount() const { return 1; } 1526 intptr_t InputCount() const { return 1; }
1518 Value* InputAt(intptr_t i) const { 1527 Value* InputAt(intptr_t i) const {
1519 ASSERT(i == 0); 1528 ASSERT(i == 0);
1520 return value_; 1529 return value_;
1521 } 1530 }
1522 void SetInputAt(intptr_t i, Value* value) {
1523 ASSERT(i == 0);
1524 value_ = value;
1525 }
1526 1531
1527 virtual intptr_t ArgumentCount() const { return 0; } 1532 virtual intptr_t ArgumentCount() const { return 0; }
1528 1533
1529 virtual CompileType ComputeType() const; 1534 virtual CompileType ComputeType() const;
1530 1535
1531 Value* value() const { return value_; } 1536 Value* value() const { return value_; }
1532 1537
1533 virtual LocationSummary* locs() { 1538 virtual LocationSummary* locs() {
1534 if (locs_ == NULL) { 1539 if (locs_ == NULL) {
1535 locs_ = MakeLocationSummary(); 1540 locs_ = MakeLocationSummary();
1536 } 1541 }
1537 return locs_; 1542 return locs_;
1538 } 1543 }
1539 1544
1540 virtual intptr_t Hashcode() const { 1545 virtual intptr_t Hashcode() const {
1541 UNREACHABLE(); 1546 UNREACHABLE();
1542 return 0; 1547 return 0;
1543 } 1548 }
1544 1549
1545 virtual bool CanDeoptimize() const { return false; } 1550 virtual bool CanDeoptimize() const { return false; }
1546 1551
1547 virtual bool HasSideEffect() const { return false; } 1552 virtual bool HasSideEffect() const { return false; }
1548 1553
1549 virtual void PrintOperandsTo(BufferFormatter* f) const; 1554 virtual void PrintOperandsTo(BufferFormatter* f) const;
1550 1555
1551 private: 1556 private:
1557 virtual void RawSetInputAt(intptr_t i, Value* value) {
1558 ASSERT(i == 0);
1559 value_ = value;
1560 }
1561
1552 Value* value_; 1562 Value* value_;
1553 LocationSummary* locs_; 1563 LocationSummary* locs_;
1554 1564
1555 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); 1565 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr);
1556 }; 1566 };
1557 1567
1558 1568
1559 inline Definition* Instruction::ArgumentAt(intptr_t index) const { 1569 inline Definition* Instruction::ArgumentAt(intptr_t index) const {
1560 return PushArgumentAt(index)->value()->definition(); 1570 return PushArgumentAt(index)->value()->definition();
1561 } 1571 }
1562 1572
1563 1573
1564 class ReturnInstr : public TemplateInstruction<1> { 1574 class ReturnInstr : public TemplateInstruction<1> {
1565 public: 1575 public:
1566 ReturnInstr(intptr_t token_pos, Value* value) 1576 ReturnInstr(intptr_t token_pos, Value* value)
1567 : token_pos_(token_pos) { 1577 : token_pos_(token_pos) {
1568 ASSERT(value != NULL); 1578 SetInputAt(0, value);
1569 inputs_[0] = value;
1570 } 1579 }
1571 1580
1572 DECLARE_INSTRUCTION(Return) 1581 DECLARE_INSTRUCTION(Return)
1573 1582
1574 virtual intptr_t ArgumentCount() const { return 0; } 1583 virtual intptr_t ArgumentCount() const { return 0; }
1575 1584
1576 intptr_t token_pos() const { return token_pos_; } 1585 intptr_t token_pos() const { return token_pos_; }
1577 Value* value() const { return inputs_[0]; } 1586 Value* value() const { return inputs_[0]; }
1578 1587
1579 virtual bool CanDeoptimize() const { return false; } 1588 virtual bool CanDeoptimize() const { return false; }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 private: 1706 private:
1698 TargetEntryInstr* true_successor_; 1707 TargetEntryInstr* true_successor_;
1699 TargetEntryInstr* false_successor_; 1708 TargetEntryInstr* false_successor_;
1700 1709
1701 DISALLOW_COPY_AND_ASSIGN(ControlInstruction); 1710 DISALLOW_COPY_AND_ASSIGN(ControlInstruction);
1702 }; 1711 };
1703 1712
1704 1713
1705 class BranchInstr : public ControlInstruction { 1714 class BranchInstr : public ControlInstruction {
1706 public: 1715 public:
1707 explicit BranchInstr(ComparisonInstr* comparison, bool is_checked = false) 1716 explicit BranchInstr(ComparisonInstr* comparison, bool is_checked = false);
1708 : comparison_(comparison), is_checked_(is_checked) { }
1709 1717
1710 DECLARE_INSTRUCTION(Branch) 1718 DECLARE_INSTRUCTION(Branch)
1711 1719
1712 virtual intptr_t ArgumentCount() const; 1720 virtual intptr_t ArgumentCount() const;
1713 intptr_t InputCount() const; 1721 intptr_t InputCount() const;
1714 Value* InputAt(intptr_t i) const; 1722 Value* InputAt(intptr_t i) const;
1715 void SetInputAt(intptr_t i, Value* value);
1716 virtual bool CanDeoptimize() const; 1723 virtual bool CanDeoptimize() const;
1717 1724
1718 virtual bool HasSideEffect() const; 1725 virtual bool HasSideEffect() const;
1719 1726
1720 ComparisonInstr* comparison() const { return comparison_; } 1727 ComparisonInstr* comparison() const { return comparison_; }
1721 void SetComparison(ComparisonInstr* comp); 1728 void SetComparison(ComparisonInstr* comp);
1722 1729
1723 bool is_checked() const { return is_checked_; } 1730 bool is_checked() const { return is_checked_; }
1724 1731
1725 virtual LocationSummary* locs(); 1732 virtual LocationSummary* locs();
1726 virtual intptr_t DeoptimizationTarget() const; 1733 virtual intptr_t DeoptimizationTarget() const;
1727 virtual Representation RequiredInputRepresentation(intptr_t i) const; 1734 virtual Representation RequiredInputRepresentation(intptr_t i) const;
1728 1735
1729 // A misleadingly named function for use in template functions that also 1736 // A misleadingly named function for use in template functions that also
1730 // replace definitions. In this case, leave the branch intact and replace 1737 // replace definitions. In this case, leave the branch intact and replace
1731 // its comparison with another comparison that has been removed from the 1738 // its comparison with another comparison that has been removed from the
1732 // graph but still has uses properly linked into their definition's use 1739 // graph but still has uses properly linked into their definition's use
1733 // list. 1740 // list.
1734 void ReplaceWith(ComparisonInstr* other, 1741 void ReplaceWith(ComparisonInstr* other,
1735 ForwardInstructionIterator* ignored); 1742 ForwardInstructionIterator* ignored);
1736 1743
1737 virtual Instruction* Canonicalize(FlowGraphOptimizer* optimizer); 1744 virtual Instruction* Canonicalize(FlowGraphOptimizer* optimizer);
1738 1745
1739 virtual void PrintTo(BufferFormatter* f) const; 1746 virtual void PrintTo(BufferFormatter* f) const;
1740 1747
1741 private: 1748 private:
1749 virtual void RawSetInputAt(intptr_t i, Value* value);
1750
1742 ComparisonInstr* comparison_; 1751 ComparisonInstr* comparison_;
1743 const bool is_checked_; 1752 const bool is_checked_;
1744 1753
1745 DISALLOW_COPY_AND_ASSIGN(BranchInstr); 1754 DISALLOW_COPY_AND_ASSIGN(BranchInstr);
1746 }; 1755 };
1747 1756
1748 1757
1749 class StoreContextInstr : public TemplateInstruction<1> { 1758 class StoreContextInstr : public TemplateInstruction<1> {
1750 public: 1759 public:
1751 explicit StoreContextInstr(Value* value) { 1760 explicit StoreContextInstr(Value* value) {
1752 ASSERT(value != NULL); 1761 SetInputAt(0, value);
1753 inputs_[0] = value;
1754 } 1762 }
1755 1763
1756 DECLARE_INSTRUCTION(StoreContext); 1764 DECLARE_INSTRUCTION(StoreContext);
1757 1765
1758 virtual intptr_t ArgumentCount() const { return 0; } 1766 virtual intptr_t ArgumentCount() const { return 0; }
1759 1767
1760 Value* value() const { return inputs_[0]; } 1768 Value* value() const { return inputs_[0]; }
1761 1769
1762 virtual bool CanDeoptimize() const { return false; } 1770 virtual bool CanDeoptimize() const { return false; }
1763 1771
1764 virtual bool HasSideEffect() const { return false; } 1772 virtual bool HasSideEffect() const { return false; }
1765 1773
1766 private: 1774 private:
1767 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr); 1775 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr);
1768 }; 1776 };
1769 1777
1770 1778
1771 template<intptr_t N> 1779 template<intptr_t N>
1772 class TemplateDefinition : public Definition { 1780 class TemplateDefinition : public Definition {
1773 public: 1781 public:
1774 TemplateDefinition<N>() : locs_(NULL) { } 1782 TemplateDefinition<N>() : locs_(NULL) { }
1775 1783
1776 virtual intptr_t InputCount() const { return N; } 1784 virtual intptr_t InputCount() const { return N; }
1777 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } 1785 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; }
1778 virtual void SetInputAt(intptr_t i, Value* value) {
1779 ASSERT(value != NULL);
1780 inputs_[i] = value;
1781 }
1782 1786
1783 // Returns a structure describing the location constraints required 1787 // Returns a structure describing the location constraints required
1784 // to emit native code for this definition. 1788 // to emit native code for this definition.
1785 LocationSummary* locs() { 1789 LocationSummary* locs() {
1786 if (locs_ == NULL) { 1790 if (locs_ == NULL) {
1787 locs_ = MakeLocationSummary(); 1791 locs_ = MakeLocationSummary();
1788 } 1792 }
1789 return locs_; 1793 return locs_;
1790 } 1794 }
1791 1795
1792 protected: 1796 protected:
1793 EmbeddedArray<Value*, N> inputs_; 1797 EmbeddedArray<Value*, N> inputs_;
1794 1798
1795 private: 1799 private:
1796 friend class BranchInstr; 1800 friend class BranchInstr;
1797 1801
1802 virtual void RawSetInputAt(intptr_t i, Value* value) {
1803 inputs_[i] = value;
1804 }
1805
1798 LocationSummary* locs_; 1806 LocationSummary* locs_;
1799 }; 1807 };
1800 1808
1801 1809
1802 class RangeBoundary : public ValueObject { 1810 class RangeBoundary : public ValueObject {
1803 public: 1811 public:
1804 enum Kind { kUnknown, kSymbol, kConstant }; 1812 enum Kind { kUnknown, kSymbol, kConstant };
1805 1813
1806 RangeBoundary() : kind_(kUnknown), value_(0), offset_(0) { } 1814 RangeBoundary() : kind_(kUnknown), value_(0), offset_(0) { }
1807 1815
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 private: 1963 private:
1956 RangeBoundary min_; 1964 RangeBoundary min_;
1957 RangeBoundary max_; 1965 RangeBoundary max_;
1958 }; 1966 };
1959 1967
1960 1968
1961 class ConstraintInstr : public TemplateDefinition<2> { 1969 class ConstraintInstr : public TemplateDefinition<2> {
1962 public: 1970 public:
1963 ConstraintInstr(Value* value, Range* constraint) 1971 ConstraintInstr(Value* value, Range* constraint)
1964 : constraint_(constraint) { 1972 : constraint_(constraint) {
1965 inputs_[0] = value; 1973 SetInputAt(0, value);
1966 inputs_[1] = NULL; // Dependency.
1967 } 1974 }
1968 1975
1969 DECLARE_INSTRUCTION(Constraint) 1976 DECLARE_INSTRUCTION(Constraint)
1970 1977
1971 virtual intptr_t InputCount() const { 1978 virtual intptr_t InputCount() const {
1972 return (inputs_[1] == NULL) ? 1 : 2; 1979 return (inputs_[1] == NULL) ? 1 : 2;
1973 } 1980 }
1974 1981
1975 virtual CompileType ComputeType() const; 1982 virtual CompileType ComputeType() const;
1976 1983
1977 virtual bool CanDeoptimize() const { return false; } 1984 virtual bool CanDeoptimize() const { return false; }
1978 1985
1979 virtual bool HasSideEffect() const { return false; } 1986 virtual bool HasSideEffect() const { return false; }
1980 1987
1981 virtual bool AttributesEqual(Instruction* other) const { 1988 virtual bool AttributesEqual(Instruction* other) const {
1982 UNREACHABLE(); 1989 UNREACHABLE();
1983 return false; 1990 return false;
1984 } 1991 }
1985 1992
1986 virtual void PrintOperandsTo(BufferFormatter* f) const; 1993 virtual void PrintOperandsTo(BufferFormatter* f) const;
1987 1994
1988 Value* value() const { return inputs_[0]; } 1995 Value* value() const { return inputs_[0]; }
1989 Range* constraint() const { return constraint_; } 1996 Range* constraint() const { return constraint_; }
1990 1997
1991 virtual void InferRange(); 1998 virtual void InferRange();
1992 1999
1993 void AddDependency(Definition* defn) { 2000 void AddDependency(Definition* defn) {
1994 Value* val = new Value(defn); 2001 Value* val = new Value(defn);
1995 val->set_use_index(1);
1996 val->set_instruction(this);
1997 defn->AddInputUse(val); 2002 defn->AddInputUse(val);
1998 set_dependency(val); 2003 SetInputAt(1, val);
1999 } 2004 }
2000 2005
2001 private: 2006 private:
2002 Value* dependency() { 2007 Value* dependency() {
2003 return inputs_[1]; 2008 return inputs_[1];
2004 } 2009 }
2005 2010
2006 void set_dependency(Value* value) {
2007 inputs_[1] = value;
2008 }
2009
2010 Range* constraint_; 2011 Range* constraint_;
2011 2012
2012 DISALLOW_COPY_AND_ASSIGN(ConstraintInstr); 2013 DISALLOW_COPY_AND_ASSIGN(ConstraintInstr);
2013 }; 2014 };
2014 2015
2015 2016
2016 class ConstantInstr : public TemplateDefinition<0> { 2017 class ConstantInstr : public TemplateDefinition<0> {
2017 public: 2018 public:
2018 explicit ConstantInstr(const Object& value) 2019 explicit ConstantInstr(const Object& value)
2019 : value_(value) { } 2020 : value_(value) { }
(...skipping 25 matching lines...) Expand all
2045 public: 2046 public:
2046 AssertAssignableInstr(intptr_t token_pos, 2047 AssertAssignableInstr(intptr_t token_pos,
2047 Value* value, 2048 Value* value,
2048 Value* instantiator, 2049 Value* instantiator,
2049 Value* instantiator_type_arguments, 2050 Value* instantiator_type_arguments,
2050 const AbstractType& dst_type, 2051 const AbstractType& dst_type,
2051 const String& dst_name) 2052 const String& dst_name)
2052 : token_pos_(token_pos), 2053 : token_pos_(token_pos),
2053 dst_type_(AbstractType::ZoneHandle(dst_type.raw())), 2054 dst_type_(AbstractType::ZoneHandle(dst_type.raw())),
2054 dst_name_(dst_name) { 2055 dst_name_(dst_name) {
2055 ASSERT(value != NULL);
2056 ASSERT(instantiator != NULL);
2057 ASSERT(instantiator_type_arguments != NULL);
2058 ASSERT(!dst_type.IsNull()); 2056 ASSERT(!dst_type.IsNull());
2059 ASSERT(!dst_name.IsNull()); 2057 ASSERT(!dst_name.IsNull());
2060 inputs_[0] = value; 2058 SetInputAt(0, value);
2061 inputs_[1] = instantiator; 2059 SetInputAt(1, instantiator);
2062 inputs_[2] = instantiator_type_arguments; 2060 SetInputAt(2, instantiator_type_arguments);
2063 } 2061 }
2064 2062
2065 DECLARE_INSTRUCTION(AssertAssignable) 2063 DECLARE_INSTRUCTION(AssertAssignable)
2066 virtual CompileType* ComputeInitialType() const; 2064 virtual CompileType* ComputeInitialType() const;
2067 virtual bool RecomputeType(); 2065 virtual bool RecomputeType();
2068 2066
2069 Value* value() const { return inputs_[0]; } 2067 Value* value() const { return inputs_[0]; }
2070 Value* instantiator() const { return inputs_[1]; } 2068 Value* instantiator() const { return inputs_[1]; }
2071 Value* instantiator_type_arguments() const { return inputs_[2]; } 2069 Value* instantiator_type_arguments() const { return inputs_[2]; }
2072 2070
(...skipping 21 matching lines...) Expand all
2094 const String& dst_name_; 2092 const String& dst_name_;
2095 2093
2096 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr); 2094 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr);
2097 }; 2095 };
2098 2096
2099 2097
2100 class AssertBooleanInstr : public TemplateDefinition<1> { 2098 class AssertBooleanInstr : public TemplateDefinition<1> {
2101 public: 2099 public:
2102 AssertBooleanInstr(intptr_t token_pos, Value* value) 2100 AssertBooleanInstr(intptr_t token_pos, Value* value)
2103 : token_pos_(token_pos) { 2101 : token_pos_(token_pos) {
2104 ASSERT(value != NULL); 2102 SetInputAt(0, value);
2105 inputs_[0] = value;
2106 } 2103 }
2107 2104
2108 DECLARE_INSTRUCTION(AssertBoolean) 2105 DECLARE_INSTRUCTION(AssertBoolean)
2109 virtual CompileType ComputeType() const; 2106 virtual CompileType ComputeType() const;
2110 2107
2111 intptr_t token_pos() const { return token_pos_; } 2108 intptr_t token_pos() const { return token_pos_; }
2112 Value* value() const { return inputs_[0]; } 2109 Value* value() const { return inputs_[0]; }
2113 2110
2114 virtual void PrintOperandsTo(BufferFormatter* f) const; 2111 virtual void PrintOperandsTo(BufferFormatter* f) const;
2115 2112
(...skipping 11 matching lines...) Expand all
2127 2124
2128 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr); 2125 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr);
2129 }; 2126 };
2130 2127
2131 2128
2132 class ArgumentDefinitionTestInstr : public TemplateDefinition<1> { 2129 class ArgumentDefinitionTestInstr : public TemplateDefinition<1> {
2133 public: 2130 public:
2134 ArgumentDefinitionTestInstr(ArgumentDefinitionTestNode* node, 2131 ArgumentDefinitionTestInstr(ArgumentDefinitionTestNode* node,
2135 Value* saved_arguments_descriptor) 2132 Value* saved_arguments_descriptor)
2136 : ast_node_(*node) { 2133 : ast_node_(*node) {
2137 ASSERT(saved_arguments_descriptor != NULL); 2134 SetInputAt(0, saved_arguments_descriptor);
2138 inputs_[0] = saved_arguments_descriptor;
2139 } 2135 }
2140 2136
2141 DECLARE_INSTRUCTION(ArgumentDefinitionTest) 2137 DECLARE_INSTRUCTION(ArgumentDefinitionTest)
2142 virtual CompileType ComputeType() const; 2138 virtual CompileType ComputeType() const;
2143 2139
2144 intptr_t token_pos() const { return ast_node_.token_pos(); } 2140 intptr_t token_pos() const { return ast_node_.token_pos(); }
2145 intptr_t formal_parameter_index() const { 2141 intptr_t formal_parameter_index() const {
2146 return ast_node_.formal_parameter_index(); 2142 return ast_node_.formal_parameter_index();
2147 } 2143 }
2148 const String& formal_parameter_name() const { 2144 const String& formal_parameter_name() const {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2320 const bool with_checks_; 2316 const bool with_checks_;
2321 2317
2322 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); 2318 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr);
2323 }; 2319 };
2324 2320
2325 2321
2326 class ComparisonInstr : public TemplateDefinition<2> { 2322 class ComparisonInstr : public TemplateDefinition<2> {
2327 public: 2323 public:
2328 ComparisonInstr(Token::Kind kind, Value* left, Value* right) 2324 ComparisonInstr(Token::Kind kind, Value* left, Value* right)
2329 : kind_(kind) { 2325 : kind_(kind) {
2330 ASSERT(left != NULL); 2326 SetInputAt(0, left);
2331 ASSERT(right != NULL); 2327 SetInputAt(1, right);
2332 inputs_[0] = left;
2333 inputs_[1] = right;
2334 } 2328 }
2335 2329
2336 Value* left() const { return inputs_[0]; } 2330 Value* left() const { return inputs_[0]; }
2337 Value* right() const { return inputs_[1]; } 2331 Value* right() const { return inputs_[1]; }
2338 2332
2339 virtual ComparisonInstr* AsComparison() { return this; } 2333 virtual ComparisonInstr* AsComparison() { return this; }
2340 2334
2341 Token::Kind kind() const { return kind_; } 2335 Token::Kind kind() const { return kind_; }
2342 2336
2343 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2337 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
(...skipping 13 matching lines...) Expand all
2357 inline intptr_t BranchInstr::InputCount() const { 2351 inline intptr_t BranchInstr::InputCount() const {
2358 return comparison()->InputCount(); 2352 return comparison()->InputCount();
2359 } 2353 }
2360 2354
2361 2355
2362 inline Value* BranchInstr::InputAt(intptr_t i) const { 2356 inline Value* BranchInstr::InputAt(intptr_t i) const {
2363 return comparison()->InputAt(i); 2357 return comparison()->InputAt(i);
2364 } 2358 }
2365 2359
2366 2360
2367 inline void BranchInstr::SetInputAt(intptr_t i, Value* value) {
2368 comparison()->SetInputAt(i, value);
2369 }
2370
2371
2372 inline bool BranchInstr::CanDeoptimize() const { 2361 inline bool BranchInstr::CanDeoptimize() const {
2373 // Branches need a deoptimization info in checked mode if they 2362 // Branches need a deoptimization info in checked mode if they
2374 // can throw a type check error. 2363 // can throw a type check error.
2375 return comparison()->CanDeoptimize() || is_checked(); 2364 return comparison()->CanDeoptimize() || is_checked();
2376 } 2365 }
2377 2366
2378 2367
2379 inline bool BranchInstr::HasSideEffect() const { 2368 inline bool BranchInstr::HasSideEffect() const {
2380 return comparison()->HasSideEffect(); 2369 return comparison()->HasSideEffect();
2381 } 2370 }
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
2663 }; 2652 };
2664 2653
2665 2654
2666 class StoreLocalInstr : public TemplateDefinition<1> { 2655 class StoreLocalInstr : public TemplateDefinition<1> {
2667 public: 2656 public:
2668 StoreLocalInstr(const LocalVariable& local, 2657 StoreLocalInstr(const LocalVariable& local,
2669 Value* value, 2658 Value* value,
2670 intptr_t context_level) 2659 intptr_t context_level)
2671 : local_(local), 2660 : local_(local),
2672 context_level_(context_level) { 2661 context_level_(context_level) {
2673 ASSERT(value != NULL); 2662 SetInputAt(0, value);
2674 inputs_[0] = value;
2675 } 2663 }
2676 2664
2677 DECLARE_INSTRUCTION(StoreLocal) 2665 DECLARE_INSTRUCTION(StoreLocal)
2678 virtual CompileType* ComputeInitialType() const; 2666 virtual CompileType* ComputeInitialType() const;
2679 2667
2680 const LocalVariable& local() const { return local_; } 2668 const LocalVariable& local() const { return local_; }
2681 Value* value() const { return inputs_[0]; } 2669 Value* value() const { return inputs_[0]; }
2682 intptr_t context_level() const { return context_level_; } 2670 intptr_t context_level() const { return context_level_; }
2683 2671
2684 virtual void RecordAssignedVars(BitVector* assigned_vars, 2672 virtual void RecordAssignedVars(BitVector* assigned_vars,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 }; 2721 };
2734 2722
2735 2723
2736 class StoreInstanceFieldInstr : public TemplateDefinition<2> { 2724 class StoreInstanceFieldInstr : public TemplateDefinition<2> {
2737 public: 2725 public:
2738 StoreInstanceFieldInstr(const Field& field, 2726 StoreInstanceFieldInstr(const Field& field,
2739 Value* instance, 2727 Value* instance,
2740 Value* value, 2728 Value* value,
2741 bool emit_store_barrier) 2729 bool emit_store_barrier)
2742 : field_(field), emit_store_barrier_(emit_store_barrier) { 2730 : field_(field), emit_store_barrier_(emit_store_barrier) {
2743 ASSERT(instance != NULL); 2731 SetInputAt(0, instance);
2744 ASSERT(value != NULL); 2732 SetInputAt(1, value);
2745 inputs_[0] = instance;
2746 inputs_[1] = value;
2747 } 2733 }
2748 2734
2749 DECLARE_INSTRUCTION(StoreInstanceField) 2735 DECLARE_INSTRUCTION(StoreInstanceField)
2750 virtual CompileType* ComputeInitialType() const; 2736 virtual CompileType* ComputeInitialType() const;
2751 2737
2752 const Field& field() const { return field_; } 2738 const Field& field() const { return field_; }
2753 2739
2754 Value* instance() const { return inputs_[0]; } 2740 Value* instance() const { return inputs_[0]; }
2755 Value* value() const { return inputs_[1]; } 2741 Value* value() const { return inputs_[1]; }
2756 bool ShouldEmitStoreBarrier() const { 2742 bool ShouldEmitStoreBarrier() const {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2794 2780
2795 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); 2781 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr);
2796 }; 2782 };
2797 2783
2798 2784
2799 class StoreStaticFieldInstr : public TemplateDefinition<1> { 2785 class StoreStaticFieldInstr : public TemplateDefinition<1> {
2800 public: 2786 public:
2801 StoreStaticFieldInstr(const Field& field, Value* value) 2787 StoreStaticFieldInstr(const Field& field, Value* value)
2802 : field_(field) { 2788 : field_(field) {
2803 ASSERT(field.IsZoneHandle()); 2789 ASSERT(field.IsZoneHandle());
2804 ASSERT(value != NULL); 2790 SetInputAt(0, value);
2805 inputs_[0] = value;
2806 } 2791 }
2807 2792
2808 DECLARE_INSTRUCTION(StoreStaticField); 2793 DECLARE_INSTRUCTION(StoreStaticField);
2809 virtual CompileType* ComputeInitialType() const; 2794 virtual CompileType* ComputeInitialType() const;
2810 2795
2811 const Field& field() const { return field_; } 2796 const Field& field() const { return field_; }
2812 Value* value() const { return inputs_[0]; } 2797 Value* value() const { return inputs_[0]; }
2813 2798
2814 virtual void PrintOperandsTo(BufferFormatter* f) const; 2799 virtual void PrintOperandsTo(BufferFormatter* f) const;
2815 2800
2816 virtual bool CanDeoptimize() const { return false; } 2801 virtual bool CanDeoptimize() const { return false; }
2817 2802
2818 virtual bool HasSideEffect() const { return true; } 2803 virtual bool HasSideEffect() const { return true; }
2819 2804
2820 private: 2805 private:
2821 const Field& field_; 2806 const Field& field_;
2822 2807
2823 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); 2808 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr);
2824 }; 2809 };
2825 2810
2826 2811
2827 class LoadIndexedInstr : public TemplateDefinition<2> { 2812 class LoadIndexedInstr : public TemplateDefinition<2> {
2828 public: 2813 public:
2829 LoadIndexedInstr(Value* array, 2814 LoadIndexedInstr(Value* array,
2830 Value* index, 2815 Value* index,
2831 intptr_t index_scale, 2816 intptr_t index_scale,
2832 intptr_t class_id, 2817 intptr_t class_id,
2833 intptr_t deopt_id) 2818 intptr_t deopt_id)
2834 : index_scale_(index_scale), class_id_(class_id) { 2819 : index_scale_(index_scale), class_id_(class_id) {
2835 ASSERT(array != NULL); 2820 SetInputAt(0, array);
2836 ASSERT(index != NULL); 2821 SetInputAt(1, index);
2837 inputs_[0] = array;
2838 inputs_[1] = index;
2839 deopt_id_ = deopt_id; 2822 deopt_id_ = deopt_id;
2840 } 2823 }
2841 2824
2842 DECLARE_INSTRUCTION(LoadIndexed) 2825 DECLARE_INSTRUCTION(LoadIndexed)
2843 virtual CompileType ComputeType() const; 2826 virtual CompileType ComputeType() const;
2844 2827
2845 Value* array() const { return inputs_[0]; } 2828 Value* array() const { return inputs_[0]; }
2846 Value* index() const { return inputs_[1]; } 2829 Value* index() const { return inputs_[1]; }
2847 intptr_t index_scale() const { return index_scale_; } 2830 intptr_t index_scale() const { return index_scale_; }
2848 intptr_t class_id() const { return class_id_; } 2831 intptr_t class_id() const { return class_id_; }
(...skipping 15 matching lines...) Expand all
2864 private: 2847 private:
2865 const intptr_t index_scale_; 2848 const intptr_t index_scale_;
2866 const intptr_t class_id_; 2849 const intptr_t class_id_;
2867 2850
2868 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); 2851 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr);
2869 }; 2852 };
2870 2853
2871 2854
2872 class StringFromCharCodeInstr : public TemplateDefinition<1> { 2855 class StringFromCharCodeInstr : public TemplateDefinition<1> {
2873 public: 2856 public:
2874 explicit StringFromCharCodeInstr(Value* char_code, 2857 StringFromCharCodeInstr(Value* char_code, intptr_t cid) : cid_(cid) {
2875 intptr_t cid) : cid_(cid) {
2876 ASSERT(char_code != NULL); 2858 ASSERT(char_code != NULL);
2877 ASSERT(char_code->definition()->IsLoadIndexed() && 2859 ASSERT(char_code->definition()->IsLoadIndexed() &&
2878 (char_code->definition()->AsLoadIndexed()->class_id() == 2860 (char_code->definition()->AsLoadIndexed()->class_id() ==
2879 kOneByteStringCid)); 2861 kOneByteStringCid));
2880 inputs_[0] = char_code; 2862 SetInputAt(0, char_code);
2881 } 2863 }
2882 2864
2883 DECLARE_INSTRUCTION(StringFromCharCode) 2865 DECLARE_INSTRUCTION(StringFromCharCode)
2884 virtual CompileType ComputeType() const; 2866 virtual CompileType ComputeType() const;
2885 2867
2886 Value* char_code() const { return inputs_[0]; } 2868 Value* char_code() const { return inputs_[0]; }
2887 2869
2888 virtual bool CanDeoptimize() const { return false; } 2870 virtual bool CanDeoptimize() const { return false; }
2889 2871
2890 virtual bool HasSideEffect() const { return false; } 2872 virtual bool HasSideEffect() const { return false; }
(...skipping 13 matching lines...) Expand all
2904 public: 2886 public:
2905 StoreIndexedInstr(Value* array, 2887 StoreIndexedInstr(Value* array,
2906 Value* index, 2888 Value* index,
2907 Value* value, 2889 Value* value,
2908 bool emit_store_barrier, 2890 bool emit_store_barrier,
2909 intptr_t class_id, 2891 intptr_t class_id,
2910 intptr_t deopt_id) 2892 intptr_t deopt_id)
2911 : emit_store_barrier_(emit_store_barrier), 2893 : emit_store_barrier_(emit_store_barrier),
2912 class_id_(class_id), 2894 class_id_(class_id),
2913 deopt_id_(deopt_id) { 2895 deopt_id_(deopt_id) {
2914 ASSERT(array != NULL); 2896 SetInputAt(0, array);
2915 ASSERT(index != NULL); 2897 SetInputAt(1, index);
2916 ASSERT(value != NULL); 2898 SetInputAt(2, value);
2917 inputs_[0] = array;
2918 inputs_[1] = index;
2919 inputs_[2] = value;
2920 } 2899 }
2921 2900
2922 DECLARE_INSTRUCTION(StoreIndexed) 2901 DECLARE_INSTRUCTION(StoreIndexed)
2923 2902
2924 Value* array() const { return inputs_[0]; } 2903 Value* array() const { return inputs_[0]; }
2925 Value* index() const { return inputs_[1]; } 2904 Value* index() const { return inputs_[1]; }
2926 Value* value() const { return inputs_[2]; } 2905 Value* value() const { return inputs_[2]; }
2927 intptr_t class_id() const { return class_id_; } 2906 intptr_t class_id() const { return class_id_; }
2928 2907
2929 bool ShouldEmitStoreBarrier() const { 2908 bool ShouldEmitStoreBarrier() const {
(...skipping 18 matching lines...) Expand all
2948 const intptr_t deopt_id_; 2927 const intptr_t deopt_id_;
2949 2928
2950 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); 2929 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr);
2951 }; 2930 };
2952 2931
2953 2932
2954 // Note overrideable, built-in: value? false : true. 2933 // Note overrideable, built-in: value? false : true.
2955 class BooleanNegateInstr : public TemplateDefinition<1> { 2934 class BooleanNegateInstr : public TemplateDefinition<1> {
2956 public: 2935 public:
2957 explicit BooleanNegateInstr(Value* value) { 2936 explicit BooleanNegateInstr(Value* value) {
2958 ASSERT(value != NULL); 2937 SetInputAt(0, value);
2959 inputs_[0] = value;
2960 } 2938 }
2961 2939
2962 DECLARE_INSTRUCTION(BooleanNegate) 2940 DECLARE_INSTRUCTION(BooleanNegate)
2963 virtual CompileType ComputeType() const; 2941 virtual CompileType ComputeType() const;
2964 2942
2965 Value* value() const { return inputs_[0]; } 2943 Value* value() const { return inputs_[0]; }
2966 2944
2967 virtual bool CanDeoptimize() const { return false; } 2945 virtual bool CanDeoptimize() const { return false; }
2968 2946
2969 virtual bool HasSideEffect() const { return false; } 2947 virtual bool HasSideEffect() const { return false; }
2970 2948
2971 private: 2949 private:
2972 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); 2950 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr);
2973 }; 2951 };
2974 2952
2975 2953
2976 class InstanceOfInstr : public TemplateDefinition<3> { 2954 class InstanceOfInstr : public TemplateDefinition<3> {
2977 public: 2955 public:
2978 InstanceOfInstr(intptr_t token_pos, 2956 InstanceOfInstr(intptr_t token_pos,
2979 Value* value, 2957 Value* value,
2980 Value* instantiator, 2958 Value* instantiator,
2981 Value* instantiator_type_arguments, 2959 Value* instantiator_type_arguments,
2982 const AbstractType& type, 2960 const AbstractType& type,
2983 bool negate_result) 2961 bool negate_result)
2984 : token_pos_(token_pos), 2962 : token_pos_(token_pos),
2985 type_(type), 2963 type_(type),
2986 negate_result_(negate_result) { 2964 negate_result_(negate_result) {
2987 ASSERT(value != NULL);
2988 ASSERT(instantiator != NULL);
2989 ASSERT(instantiator_type_arguments != NULL);
2990 ASSERT(!type.IsNull()); 2965 ASSERT(!type.IsNull());
2991 inputs_[0] = value; 2966 SetInputAt(0, value);
2992 inputs_[1] = instantiator; 2967 SetInputAt(1, instantiator);
2993 inputs_[2] = instantiator_type_arguments; 2968 SetInputAt(2, instantiator_type_arguments);
2994 } 2969 }
2995 2970
2996 DECLARE_INSTRUCTION(InstanceOf) 2971 DECLARE_INSTRUCTION(InstanceOf)
2997 virtual CompileType ComputeType() const; 2972 virtual CompileType ComputeType() const;
2998 2973
2999 Value* value() const { return inputs_[0]; } 2974 Value* value() const { return inputs_[0]; }
3000 Value* instantiator() const { return inputs_[1]; } 2975 Value* instantiator() const { return inputs_[1]; }
3001 Value* instantiator_type_arguments() const { return inputs_[2]; } 2976 Value* instantiator_type_arguments() const { return inputs_[2]; }
3002 2977
3003 bool negate_result() const { return negate_result_; } 2978 bool negate_result() const { return negate_result_; }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3058 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr); 3033 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr);
3059 }; 3034 };
3060 3035
3061 3036
3062 class AllocateObjectWithBoundsCheckInstr : public TemplateDefinition<2> { 3037 class AllocateObjectWithBoundsCheckInstr : public TemplateDefinition<2> {
3063 public: 3038 public:
3064 AllocateObjectWithBoundsCheckInstr(ConstructorCallNode* node, 3039 AllocateObjectWithBoundsCheckInstr(ConstructorCallNode* node,
3065 Value* type_arguments, 3040 Value* type_arguments,
3066 Value* instantiator) 3041 Value* instantiator)
3067 : ast_node_(*node) { 3042 : ast_node_(*node) {
3068 ASSERT(type_arguments != NULL); 3043 SetInputAt(0, type_arguments);
3069 ASSERT(instantiator != NULL); 3044 SetInputAt(1, instantiator);
3070 inputs_[0] = type_arguments;
3071 inputs_[1] = instantiator;
3072 } 3045 }
3073 3046
3074 DECLARE_INSTRUCTION(AllocateObjectWithBoundsCheck) 3047 DECLARE_INSTRUCTION(AllocateObjectWithBoundsCheck)
3075 3048
3076 const Function& constructor() const { return ast_node_.constructor(); } 3049 const Function& constructor() const { return ast_node_.constructor(); }
3077 intptr_t token_pos() const { return ast_node_.token_pos(); } 3050 intptr_t token_pos() const { return ast_node_.token_pos(); }
3078 3051
3079 virtual void PrintOperandsTo(BufferFormatter* f) const; 3052 virtual void PrintOperandsTo(BufferFormatter* f) const;
3080 3053
3081 virtual bool CanDeoptimize() const { return true; } 3054 virtual bool CanDeoptimize() const { return true; }
3082 3055
3083 virtual bool HasSideEffect() const { return true; } 3056 virtual bool HasSideEffect() const { return true; }
3084 3057
3085 private: 3058 private:
3086 const ConstructorCallNode& ast_node_; 3059 const ConstructorCallNode& ast_node_;
3087 3060
3088 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckInstr); 3061 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckInstr);
3089 }; 3062 };
3090 3063
3091 3064
3092 class CreateArrayInstr : public TemplateDefinition<1> { 3065 class CreateArrayInstr : public TemplateDefinition<1> {
3093 public: 3066 public:
3094 CreateArrayInstr(intptr_t token_pos, 3067 CreateArrayInstr(intptr_t token_pos,
3095 intptr_t num_elements, 3068 intptr_t num_elements,
3096 const AbstractType& type, 3069 const AbstractType& type,
3097 Value* element_type) 3070 Value* element_type)
3098 : token_pos_(token_pos), 3071 : token_pos_(token_pos),
3099 num_elements_(num_elements), 3072 num_elements_(num_elements),
3100 type_(type) { 3073 type_(type) {
3101 #if defined(DEBUG)
3102 ASSERT(element_type != NULL);
3103 ASSERT(type_.IsZoneHandle()); 3074 ASSERT(type_.IsZoneHandle());
3104 ASSERT(!type_.IsNull()); 3075 ASSERT(!type_.IsNull());
3105 ASSERT(type_.IsFinalized()); 3076 ASSERT(type_.IsFinalized());
3106 #endif 3077 SetInputAt(0, element_type);
3107 inputs_[0] = element_type;
3108 } 3078 }
3109 3079
3110 DECLARE_INSTRUCTION(CreateArray) 3080 DECLARE_INSTRUCTION(CreateArray)
3111 virtual CompileType ComputeType() const; 3081 virtual CompileType ComputeType() const;
3112 3082
3113 intptr_t num_elements() const { return num_elements_; } 3083 intptr_t num_elements() const { return num_elements_; }
3114 3084
3115 intptr_t token_pos() const { return token_pos_; } 3085 intptr_t token_pos() const { return token_pos_; }
3116 const AbstractType& type() const { return type_; } 3086 const AbstractType& type() const { return type_; }
3117 Value* element_type() const { return inputs_[0]; } 3087 Value* element_type() const { return inputs_[0]; }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3170 public: 3140 public:
3171 LoadFieldInstr(Value* value, 3141 LoadFieldInstr(Value* value,
3172 intptr_t offset_in_bytes, 3142 intptr_t offset_in_bytes,
3173 const AbstractType& type, 3143 const AbstractType& type,
3174 bool immutable = false) 3144 bool immutable = false)
3175 : offset_in_bytes_(offset_in_bytes), 3145 : offset_in_bytes_(offset_in_bytes),
3176 type_(type), 3146 type_(type),
3177 result_cid_(kDynamicCid), 3147 result_cid_(kDynamicCid),
3178 immutable_(immutable), 3148 immutable_(immutable),
3179 recognized_kind_(MethodRecognizer::kUnknown) { 3149 recognized_kind_(MethodRecognizer::kUnknown) {
3180 ASSERT(value != NULL);
3181 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. 3150 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance.
3182 inputs_[0] = value; 3151 SetInputAt(0, value);
3183 } 3152 }
3184 3153
3185 DECLARE_INSTRUCTION(LoadField) 3154 DECLARE_INSTRUCTION(LoadField)
3186 virtual CompileType ComputeType() const; 3155 virtual CompileType ComputeType() const;
3187 3156
3188 Value* value() const { return inputs_[0]; } 3157 Value* value() const { return inputs_[0]; }
3189 intptr_t offset_in_bytes() const { return offset_in_bytes_; } 3158 intptr_t offset_in_bytes() const { return offset_in_bytes_; }
3190 const AbstractType& type() const { return type_; } 3159 const AbstractType& type() const { return type_; }
3191 void set_result_cid(intptr_t value) { result_cid_ = value; } 3160 void set_result_cid(intptr_t value) { result_cid_ = value; }
3192 3161
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3228 }; 3197 };
3229 3198
3230 3199
3231 class StoreVMFieldInstr : public TemplateDefinition<2> { 3200 class StoreVMFieldInstr : public TemplateDefinition<2> {
3232 public: 3201 public:
3233 StoreVMFieldInstr(Value* dest, 3202 StoreVMFieldInstr(Value* dest,
3234 intptr_t offset_in_bytes, 3203 intptr_t offset_in_bytes,
3235 Value* value, 3204 Value* value,
3236 const AbstractType& type) 3205 const AbstractType& type)
3237 : offset_in_bytes_(offset_in_bytes), type_(type) { 3206 : offset_in_bytes_(offset_in_bytes), type_(type) {
3238 ASSERT(value != NULL);
3239 ASSERT(dest != NULL);
3240 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. 3207 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance.
3241 inputs_[0] = value; 3208 SetInputAt(0, value);
3242 inputs_[1] = dest; 3209 SetInputAt(1, dest);
3243 } 3210 }
3244 3211
3245 DECLARE_INSTRUCTION(StoreVMField) 3212 DECLARE_INSTRUCTION(StoreVMField)
3246 virtual CompileType* ComputeInitialType() const; 3213 virtual CompileType* ComputeInitialType() const;
3247 3214
3248 Value* value() const { return inputs_[0]; } 3215 Value* value() const { return inputs_[0]; }
3249 Value* dest() const { return inputs_[1]; } 3216 Value* dest() const { return inputs_[1]; }
3250 intptr_t offset_in_bytes() const { return offset_in_bytes_; } 3217 intptr_t offset_in_bytes() const { return offset_in_bytes_; }
3251 const AbstractType& type() const { return type_; } 3218 const AbstractType& type() const { return type_; }
3252 3219
(...skipping 12 matching lines...) Expand all
3265 3232
3266 3233
3267 class InstantiateTypeArgumentsInstr : public TemplateDefinition<1> { 3234 class InstantiateTypeArgumentsInstr : public TemplateDefinition<1> {
3268 public: 3235 public:
3269 InstantiateTypeArgumentsInstr(intptr_t token_pos, 3236 InstantiateTypeArgumentsInstr(intptr_t token_pos,
3270 const AbstractTypeArguments& type_arguments, 3237 const AbstractTypeArguments& type_arguments,
3271 Value* instantiator) 3238 Value* instantiator)
3272 : token_pos_(token_pos), 3239 : token_pos_(token_pos),
3273 type_arguments_(type_arguments) { 3240 type_arguments_(type_arguments) {
3274 ASSERT(type_arguments.IsZoneHandle()); 3241 ASSERT(type_arguments.IsZoneHandle());
3275 ASSERT(instantiator != NULL); 3242 SetInputAt(0, instantiator);
3276 inputs_[0] = instantiator;
3277 } 3243 }
3278 3244
3279 DECLARE_INSTRUCTION(InstantiateTypeArguments) 3245 DECLARE_INSTRUCTION(InstantiateTypeArguments)
3280 3246
3281 Value* instantiator() const { return inputs_[0]; } 3247 Value* instantiator() const { return inputs_[0]; }
3282 const AbstractTypeArguments& type_arguments() const { 3248 const AbstractTypeArguments& type_arguments() const {
3283 return type_arguments_; 3249 return type_arguments_;
3284 } 3250 }
3285 intptr_t token_pos() const { return token_pos_; } 3251 intptr_t token_pos() const { return token_pos_; }
3286 3252
(...skipping 12 matching lines...) Expand all
3299 3265
3300 3266
3301 class ExtractConstructorTypeArgumentsInstr : public TemplateDefinition<1> { 3267 class ExtractConstructorTypeArgumentsInstr : public TemplateDefinition<1> {
3302 public: 3268 public:
3303 ExtractConstructorTypeArgumentsInstr( 3269 ExtractConstructorTypeArgumentsInstr(
3304 intptr_t token_pos, 3270 intptr_t token_pos,
3305 const AbstractTypeArguments& type_arguments, 3271 const AbstractTypeArguments& type_arguments,
3306 Value* instantiator) 3272 Value* instantiator)
3307 : token_pos_(token_pos), 3273 : token_pos_(token_pos),
3308 type_arguments_(type_arguments) { 3274 type_arguments_(type_arguments) {
3309 ASSERT(instantiator != NULL); 3275 SetInputAt(0, instantiator);
3310 inputs_[0] = instantiator;
3311 } 3276 }
3312 3277
3313 DECLARE_INSTRUCTION(ExtractConstructorTypeArguments) 3278 DECLARE_INSTRUCTION(ExtractConstructorTypeArguments)
3314 3279
3315 Value* instantiator() const { return inputs_[0]; } 3280 Value* instantiator() const { return inputs_[0]; }
3316 const AbstractTypeArguments& type_arguments() const { 3281 const AbstractTypeArguments& type_arguments() const {
3317 return type_arguments_; 3282 return type_arguments_;
3318 } 3283 }
3319 intptr_t token_pos() const { return token_pos_; } 3284 intptr_t token_pos() const { return token_pos_; }
3320 3285
3321 virtual void PrintOperandsTo(BufferFormatter* f) const; 3286 virtual void PrintOperandsTo(BufferFormatter* f) const;
3322 3287
3323 virtual bool CanDeoptimize() const { return false; } 3288 virtual bool CanDeoptimize() const { return false; }
3324 3289
3325 virtual bool HasSideEffect() const { return false; } 3290 virtual bool HasSideEffect() const { return false; }
3326 3291
3327 private: 3292 private:
3328 const intptr_t token_pos_; 3293 const intptr_t token_pos_;
3329 const AbstractTypeArguments& type_arguments_; 3294 const AbstractTypeArguments& type_arguments_;
3330 3295
3331 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsInstr); 3296 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsInstr);
3332 }; 3297 };
3333 3298
3334 3299
3335 class ExtractConstructorInstantiatorInstr : public TemplateDefinition<1> { 3300 class ExtractConstructorInstantiatorInstr : public TemplateDefinition<1> {
3336 public: 3301 public:
3337 ExtractConstructorInstantiatorInstr(ConstructorCallNode* ast_node, 3302 ExtractConstructorInstantiatorInstr(ConstructorCallNode* ast_node,
3338 Value* instantiator) 3303 Value* instantiator)
3339 : ast_node_(*ast_node) { 3304 : ast_node_(*ast_node) {
3340 ASSERT(instantiator != NULL); 3305 SetInputAt(0, instantiator);
3341 inputs_[0] = instantiator;
3342 } 3306 }
3343 3307
3344 DECLARE_INSTRUCTION(ExtractConstructorInstantiator) 3308 DECLARE_INSTRUCTION(ExtractConstructorInstantiator)
3345 3309
3346 Value* instantiator() const { return inputs_[0]; } 3310 Value* instantiator() const { return inputs_[0]; }
3347 const AbstractTypeArguments& type_arguments() const { 3311 const AbstractTypeArguments& type_arguments() const {
3348 return ast_node_.type_arguments(); 3312 return ast_node_.type_arguments();
3349 } 3313 }
3350 const Function& constructor() const { return ast_node_.constructor(); } 3314 const Function& constructor() const { return ast_node_.constructor(); }
3351 intptr_t token_pos() const { return ast_node_.token_pos(); } 3315 intptr_t token_pos() const { return ast_node_.token_pos(); }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3384 const intptr_t token_pos_; 3348 const intptr_t token_pos_;
3385 const intptr_t num_context_variables_; 3349 const intptr_t num_context_variables_;
3386 3350
3387 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); 3351 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr);
3388 }; 3352 };
3389 3353
3390 3354
3391 class ChainContextInstr : public TemplateInstruction<1> { 3355 class ChainContextInstr : public TemplateInstruction<1> {
3392 public: 3356 public:
3393 explicit ChainContextInstr(Value* context_value) { 3357 explicit ChainContextInstr(Value* context_value) {
3394 ASSERT(context_value != NULL); 3358 SetInputAt(0, context_value);
3395 inputs_[0] = context_value;
3396 } 3359 }
3397 3360
3398 DECLARE_INSTRUCTION(ChainContext) 3361 DECLARE_INSTRUCTION(ChainContext)
3399 3362
3400 virtual intptr_t ArgumentCount() const { return 0; } 3363 virtual intptr_t ArgumentCount() const { return 0; }
3401 3364
3402 Value* context_value() const { return inputs_[0]; } 3365 Value* context_value() const { return inputs_[0]; }
3403 3366
3404 virtual bool CanDeoptimize() const { return false; } 3367 virtual bool CanDeoptimize() const { return false; }
3405 3368
3406 virtual bool HasSideEffect() const { return true; } 3369 virtual bool HasSideEffect() const { return true; }
3407 3370
3408 private: 3371 private:
3409 DISALLOW_COPY_AND_ASSIGN(ChainContextInstr); 3372 DISALLOW_COPY_AND_ASSIGN(ChainContextInstr);
3410 }; 3373 };
3411 3374
3412 3375
3413 class CloneContextInstr : public TemplateDefinition<1> { 3376 class CloneContextInstr : public TemplateDefinition<1> {
3414 public: 3377 public:
3415 CloneContextInstr(intptr_t token_pos, Value* context_value) 3378 CloneContextInstr(intptr_t token_pos, Value* context_value)
3416 : token_pos_(token_pos) { 3379 : token_pos_(token_pos) {
3417 ASSERT(context_value != NULL); 3380 SetInputAt(0, context_value);
3418 inputs_[0] = context_value;
3419 } 3381 }
3420 3382
3421 intptr_t token_pos() const { return token_pos_; } 3383 intptr_t token_pos() const { return token_pos_; }
3422 Value* context_value() const { return inputs_[0]; } 3384 Value* context_value() const { return inputs_[0]; }
3423 3385
3424 DECLARE_INSTRUCTION(CloneContext) 3386 DECLARE_INSTRUCTION(CloneContext)
3425 virtual CompileType ComputeType() const; 3387 virtual CompileType ComputeType() const;
3426 3388
3427 virtual bool CanDeoptimize() const { return true; } 3389 virtual bool CanDeoptimize() const { return true; }
3428 3390
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3460 3422
3461 DISALLOW_COPY_AND_ASSIGN(CatchEntryInstr); 3423 DISALLOW_COPY_AND_ASSIGN(CatchEntryInstr);
3462 }; 3424 };
3463 3425
3464 3426
3465 class CheckEitherNonSmiInstr : public TemplateInstruction<2> { 3427 class CheckEitherNonSmiInstr : public TemplateInstruction<2> {
3466 public: 3428 public:
3467 CheckEitherNonSmiInstr(Value* left, 3429 CheckEitherNonSmiInstr(Value* left,
3468 Value* right, 3430 Value* right,
3469 InstanceCallInstr* instance_call) { 3431 InstanceCallInstr* instance_call) {
3470 ASSERT(left != NULL); 3432 SetInputAt(0, left);
3471 ASSERT(right != NULL); 3433 SetInputAt(1, right);
3472 inputs_[0] = left;
3473 inputs_[1] = right;
3474 deopt_id_ = instance_call->deopt_id(); 3434 deopt_id_ = instance_call->deopt_id();
3475 } 3435 }
3476 3436
3477 DECLARE_INSTRUCTION(CheckEitherNonSmi) 3437 DECLARE_INSTRUCTION(CheckEitherNonSmi)
3478 3438
3479 virtual intptr_t ArgumentCount() const { return 0; } 3439 virtual intptr_t ArgumentCount() const { return 0; }
3480 3440
3481 virtual bool CanDeoptimize() const { return true; } 3441 virtual bool CanDeoptimize() const { return true; }
3482 3442
3483 virtual bool HasSideEffect() const { return false; } 3443 virtual bool HasSideEffect() const { return false; }
(...skipping 10 matching lines...) Expand all
3494 3454
3495 private: 3455 private:
3496 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr); 3456 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr);
3497 }; 3457 };
3498 3458
3499 3459
3500 class BoxDoubleInstr : public TemplateDefinition<1> { 3460 class BoxDoubleInstr : public TemplateDefinition<1> {
3501 public: 3461 public:
3502 BoxDoubleInstr(Value* value, InstanceCallInstr* instance_call) 3462 BoxDoubleInstr(Value* value, InstanceCallInstr* instance_call)
3503 : token_pos_((instance_call != NULL) ? instance_call->token_pos() : 0) { 3463 : token_pos_((instance_call != NULL) ? instance_call->token_pos() : 0) {
3504 ASSERT(value != NULL); 3464 SetInputAt(0, value);
3505 inputs_[0] = value;
3506 } 3465 }
3507 3466
3508 Value* value() const { return inputs_[0]; } 3467 Value* value() const { return inputs_[0]; }
3509 3468
3510 intptr_t token_pos() const { return token_pos_; } 3469 intptr_t token_pos() const { return token_pos_; }
3511 3470
3512 virtual bool CanDeoptimize() const { return false; } 3471 virtual bool CanDeoptimize() const { return false; }
3513 3472
3514 virtual bool HasSideEffect() const { return false; } 3473 virtual bool HasSideEffect() const { return false; }
3515 3474
(...skipping 11 matching lines...) Expand all
3527 private: 3486 private:
3528 const intptr_t token_pos_; 3487 const intptr_t token_pos_;
3529 3488
3530 DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr); 3489 DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr);
3531 }; 3490 };
3532 3491
3533 3492
3534 class BoxIntegerInstr : public TemplateDefinition<1> { 3493 class BoxIntegerInstr : public TemplateDefinition<1> {
3535 public: 3494 public:
3536 explicit BoxIntegerInstr(Value* value) { 3495 explicit BoxIntegerInstr(Value* value) {
3537 ASSERT(value != NULL); 3496 SetInputAt(0, value);
3538 inputs_[0] = value;
3539 } 3497 }
3540 3498
3541 Value* value() const { return inputs_[0]; } 3499 Value* value() const { return inputs_[0]; }
3542 3500
3543 virtual bool CanDeoptimize() const { return false; } 3501 virtual bool CanDeoptimize() const { return false; }
3544 3502
3545 virtual bool HasSideEffect() const { return false; } 3503 virtual bool HasSideEffect() const { return false; }
3546 3504
3547 virtual bool AffectedBySideEffect() const { return false; } 3505 virtual bool AffectedBySideEffect() const { return false; }
3548 virtual bool AttributesEqual(Instruction* other) const { return true; } 3506 virtual bool AttributesEqual(Instruction* other) const { return true; }
3549 3507
3550 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 3508 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3551 ASSERT(idx == 0); 3509 ASSERT(idx == 0);
3552 return kUnboxedMint; 3510 return kUnboxedMint;
3553 } 3511 }
3554 3512
3555 DECLARE_INSTRUCTION(BoxInteger) 3513 DECLARE_INSTRUCTION(BoxInteger)
3556 virtual CompileType ComputeType() const; 3514 virtual CompileType ComputeType() const;
3557 3515
3558 private: 3516 private:
3559 DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr); 3517 DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr);
3560 }; 3518 };
3561 3519
3562 3520
3563 class UnboxDoubleInstr : public TemplateDefinition<1> { 3521 class UnboxDoubleInstr : public TemplateDefinition<1> {
3564 public: 3522 public:
3565 UnboxDoubleInstr(Value* value, intptr_t deopt_id) { 3523 UnboxDoubleInstr(Value* value, intptr_t deopt_id) {
3566 ASSERT(value != NULL); 3524 SetInputAt(0, value);
3567 inputs_[0] = value;
3568 deopt_id_ = deopt_id; 3525 deopt_id_ = deopt_id;
3569 } 3526 }
3570 3527
3571 Value* value() const { return inputs_[0]; } 3528 Value* value() const { return inputs_[0]; }
3572 3529
3573 virtual bool CanDeoptimize() const { 3530 virtual bool CanDeoptimize() const {
3574 return (value()->Type()->ToCid() != kDoubleCid) 3531 return (value()->Type()->ToCid() != kDoubleCid)
3575 && (value()->Type()->ToCid() != kSmiCid); 3532 && (value()->Type()->ToCid() != kSmiCid);
3576 } 3533 }
3577 3534
(...skipping 10 matching lines...) Expand all
3588 virtual CompileType ComputeType() const; 3545 virtual CompileType ComputeType() const;
3589 3546
3590 private: 3547 private:
3591 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); 3548 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr);
3592 }; 3549 };
3593 3550
3594 3551
3595 class UnboxIntegerInstr : public TemplateDefinition<1> { 3552 class UnboxIntegerInstr : public TemplateDefinition<1> {
3596 public: 3553 public:
3597 UnboxIntegerInstr(Value* value, intptr_t deopt_id) { 3554 UnboxIntegerInstr(Value* value, intptr_t deopt_id) {
3598 ASSERT(value != NULL); 3555 SetInputAt(0, value);
3599 inputs_[0] = value;
3600 deopt_id_ = deopt_id; 3556 deopt_id_ = deopt_id;
3601 } 3557 }
3602 3558
3603 Value* value() const { return inputs_[0]; } 3559 Value* value() const { return inputs_[0]; }
3604 3560
3605 virtual bool CanDeoptimize() const { 3561 virtual bool CanDeoptimize() const {
3606 return (value()->Type()->ToCid() != kSmiCid) 3562 return (value()->Type()->ToCid() != kSmiCid)
3607 && (value()->Type()->ToCid() != kMintCid); 3563 && (value()->Type()->ToCid() != kMintCid);
3608 } 3564 }
3609 3565
(...skipping 12 matching lines...) Expand all
3622 DECLARE_INSTRUCTION(UnboxInteger) 3578 DECLARE_INSTRUCTION(UnboxInteger)
3623 3579
3624 private: 3580 private:
3625 DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr); 3581 DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr);
3626 }; 3582 };
3627 3583
3628 3584
3629 class MathSqrtInstr : public TemplateDefinition<1> { 3585 class MathSqrtInstr : public TemplateDefinition<1> {
3630 public: 3586 public:
3631 MathSqrtInstr(Value* value, StaticCallInstr* instance_call) { 3587 MathSqrtInstr(Value* value, StaticCallInstr* instance_call) {
3632 ASSERT(value != NULL); 3588 SetInputAt(0, value);
3633 inputs_[0] = value;
3634 deopt_id_ = instance_call->deopt_id(); 3589 deopt_id_ = instance_call->deopt_id();
3635 } 3590 }
3636 3591
3637 Value* value() const { return inputs_[0]; } 3592 Value* value() const { return inputs_[0]; }
3638 3593
3639 virtual bool CanDeoptimize() const { return false; } 3594 virtual bool CanDeoptimize() const { return false; }
3640 3595
3641 virtual bool HasSideEffect() const { return false; } 3596 virtual bool HasSideEffect() const { return false; }
3642 3597
3643 virtual bool AttributesEqual(Instruction* other) const { 3598 virtual bool AttributesEqual(Instruction* other) const {
(...skipping 23 matching lines...) Expand all
3667 }; 3622 };
3668 3623
3669 3624
3670 class BinaryDoubleOpInstr : public TemplateDefinition<2> { 3625 class BinaryDoubleOpInstr : public TemplateDefinition<2> {
3671 public: 3626 public:
3672 BinaryDoubleOpInstr(Token::Kind op_kind, 3627 BinaryDoubleOpInstr(Token::Kind op_kind,
3673 Value* left, 3628 Value* left,
3674 Value* right, 3629 Value* right,
3675 InstanceCallInstr* instance_call) 3630 InstanceCallInstr* instance_call)
3676 : op_kind_(op_kind) { 3631 : op_kind_(op_kind) {
3677 ASSERT(left != NULL); 3632 SetInputAt(0, left);
3678 ASSERT(right != NULL); 3633 SetInputAt(1, right);
3679 inputs_[0] = left;
3680 inputs_[1] = right;
3681 deopt_id_ = instance_call->deopt_id(); 3634 deopt_id_ = instance_call->deopt_id();
3682 } 3635 }
3683 3636
3684 Value* left() const { return inputs_[0]; } 3637 Value* left() const { return inputs_[0]; }
3685 Value* right() const { return inputs_[1]; } 3638 Value* right() const { return inputs_[1]; }
3686 3639
3687 Token::Kind op_kind() const { return op_kind_; } 3640 Token::Kind op_kind() const { return op_kind_; }
3688 3641
3689 virtual void PrintOperandsTo(BufferFormatter* f) const; 3642 virtual void PrintOperandsTo(BufferFormatter* f) const;
3690 3643
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3726 3679
3727 3680
3728 class BinaryMintOpInstr : public TemplateDefinition<2> { 3681 class BinaryMintOpInstr : public TemplateDefinition<2> {
3729 public: 3682 public:
3730 BinaryMintOpInstr(Token::Kind op_kind, 3683 BinaryMintOpInstr(Token::Kind op_kind,
3731 Value* left, 3684 Value* left,
3732 Value* right, 3685 Value* right,
3733 InstanceCallInstr* instance_call) 3686 InstanceCallInstr* instance_call)
3734 : op_kind_(op_kind), 3687 : op_kind_(op_kind),
3735 instance_call_(instance_call) { 3688 instance_call_(instance_call) {
3736 ASSERT(left != NULL); 3689 SetInputAt(0, left);
3737 ASSERT(right != NULL); 3690 SetInputAt(1, right);
3738 inputs_[0] = left;
3739 inputs_[1] = right;
3740 deopt_id_ = instance_call->deopt_id(); 3691 deopt_id_ = instance_call->deopt_id();
3741 } 3692 }
3742 3693
3743 Value* left() const { return inputs_[0]; } 3694 Value* left() const { return inputs_[0]; }
3744 Value* right() const { return inputs_[1]; } 3695 Value* right() const { return inputs_[1]; }
3745 3696
3746 Token::Kind op_kind() const { return op_kind_; } 3697 Token::Kind op_kind() const { return op_kind_; }
3747 3698
3748 InstanceCallInstr* instance_call() const { return instance_call_; } 3699 InstanceCallInstr* instance_call() const { return instance_call_; }
3749 3700
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3791 }; 3742 };
3792 3743
3793 3744
3794 class ShiftMintOpInstr : public TemplateDefinition<2> { 3745 class ShiftMintOpInstr : public TemplateDefinition<2> {
3795 public: 3746 public:
3796 ShiftMintOpInstr(Token::Kind op_kind, 3747 ShiftMintOpInstr(Token::Kind op_kind,
3797 Value* left, 3748 Value* left,
3798 Value* right, 3749 Value* right,
3799 InstanceCallInstr* instance_call) 3750 InstanceCallInstr* instance_call)
3800 : op_kind_(op_kind) { 3751 : op_kind_(op_kind) {
3801 ASSERT(left != NULL);
3802 ASSERT(right != NULL);
3803 ASSERT(op_kind == Token::kSHR || op_kind == Token::kSHL); 3752 ASSERT(op_kind == Token::kSHR || op_kind == Token::kSHL);
3804 inputs_[0] = left; 3753 SetInputAt(0, left);
3805 inputs_[1] = right; 3754 SetInputAt(1, right);
3806 deopt_id_ = instance_call->deopt_id(); 3755 deopt_id_ = instance_call->deopt_id();
3807 } 3756 }
3808 3757
3809 Value* left() const { return inputs_[0]; } 3758 Value* left() const { return inputs_[0]; }
3810 Value* right() const { return inputs_[1]; } 3759 Value* right() const { return inputs_[1]; }
3811 3760
3812 Token::Kind op_kind() const { return op_kind_; } 3761 Token::Kind op_kind() const { return op_kind_; }
3813 3762
3814 virtual void PrintOperandsTo(BufferFormatter* f) const; 3763 virtual void PrintOperandsTo(BufferFormatter* f) const;
3815 3764
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3848 DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr); 3797 DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr);
3849 }; 3798 };
3850 3799
3851 3800
3852 class UnaryMintOpInstr : public TemplateDefinition<1> { 3801 class UnaryMintOpInstr : public TemplateDefinition<1> {
3853 public: 3802 public:
3854 UnaryMintOpInstr(Token::Kind op_kind, 3803 UnaryMintOpInstr(Token::Kind op_kind,
3855 Value* value, 3804 Value* value,
3856 InstanceCallInstr* instance_call) 3805 InstanceCallInstr* instance_call)
3857 : op_kind_(op_kind) { 3806 : op_kind_(op_kind) {
3858 ASSERT(value != NULL);
3859 ASSERT(op_kind == Token::kBIT_NOT); 3807 ASSERT(op_kind == Token::kBIT_NOT);
3860 inputs_[0] = value; 3808 SetInputAt(0, value);
3861 deopt_id_ = instance_call->deopt_id(); 3809 deopt_id_ = instance_call->deopt_id();
3862 } 3810 }
3863 3811
3864 Value* value() const { return inputs_[0]; } 3812 Value* value() const { return inputs_[0]; }
3865 3813
3866 Token::Kind op_kind() const { return op_kind_; } 3814 Token::Kind op_kind() const { return op_kind_; }
3867 3815
3868 virtual void PrintOperandsTo(BufferFormatter* f) const; 3816 virtual void PrintOperandsTo(BufferFormatter* f) const;
3869 3817
3870 virtual bool CanDeoptimize() const { return false; } 3818 virtual bool CanDeoptimize() const { return false; }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3906 class BinarySmiOpInstr : public TemplateDefinition<2> { 3854 class BinarySmiOpInstr : public TemplateDefinition<2> {
3907 public: 3855 public:
3908 BinarySmiOpInstr(Token::Kind op_kind, 3856 BinarySmiOpInstr(Token::Kind op_kind,
3909 InstanceCallInstr* instance_call, 3857 InstanceCallInstr* instance_call,
3910 Value* left, 3858 Value* left,
3911 Value* right) 3859 Value* right)
3912 : op_kind_(op_kind), 3860 : op_kind_(op_kind),
3913 instance_call_(instance_call), 3861 instance_call_(instance_call),
3914 overflow_(true), 3862 overflow_(true),
3915 is_truncating_(false) { 3863 is_truncating_(false) {
3916 ASSERT(left != NULL); 3864 SetInputAt(0, left);
3917 ASSERT(right != NULL); 3865 SetInputAt(1, right);
3918 inputs_[0] = left;
3919 inputs_[1] = right;
3920 deopt_id_ = instance_call->deopt_id(); 3866 deopt_id_ = instance_call->deopt_id();
3921 } 3867 }
3922 3868
3923 Value* left() const { return inputs_[0]; } 3869 Value* left() const { return inputs_[0]; }
3924 Value* right() const { return inputs_[1]; } 3870 Value* right() const { return inputs_[1]; }
3925 3871
3926 Token::Kind op_kind() const { return op_kind_; } 3872 Token::Kind op_kind() const { return op_kind_; }
3927 3873
3928 InstanceCallInstr* instance_call() const { return instance_call_; } 3874 InstanceCallInstr* instance_call() const { return instance_call_; }
3929 3875
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3972 3918
3973 3919
3974 // Handles both Smi operations: BIT_OR and NEGATE. 3920 // Handles both Smi operations: BIT_OR and NEGATE.
3975 class UnarySmiOpInstr : public TemplateDefinition<1> { 3921 class UnarySmiOpInstr : public TemplateDefinition<1> {
3976 public: 3922 public:
3977 UnarySmiOpInstr(Token::Kind op_kind, 3923 UnarySmiOpInstr(Token::Kind op_kind,
3978 InstanceCallInstr* instance_call, 3924 InstanceCallInstr* instance_call,
3979 Value* value) 3925 Value* value)
3980 : op_kind_(op_kind) { 3926 : op_kind_(op_kind) {
3981 ASSERT((op_kind == Token::kNEGATE) || (op_kind == Token::kBIT_NOT)); 3927 ASSERT((op_kind == Token::kNEGATE) || (op_kind == Token::kBIT_NOT));
3982 ASSERT(value != NULL); 3928 SetInputAt(0, value);
3983 inputs_[0] = value;
3984 deopt_id_ = instance_call->deopt_id(); 3929 deopt_id_ = instance_call->deopt_id();
3985 } 3930 }
3986 3931
3987 Value* value() const { return inputs_[0]; } 3932 Value* value() const { return inputs_[0]; }
3988 Token::Kind op_kind() const { return op_kind_; } 3933 Token::Kind op_kind() const { return op_kind_; }
3989 3934
3990 virtual void PrintOperandsTo(BufferFormatter* f) const; 3935 virtual void PrintOperandsTo(BufferFormatter* f) const;
3991 3936
3992 DECLARE_INSTRUCTION(UnarySmiOp) 3937 DECLARE_INSTRUCTION(UnarySmiOp)
3993 virtual CompileType ComputeType() const; 3938 virtual CompileType ComputeType() const;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
4045 InstanceCallInstr* instance_call_; 3990 InstanceCallInstr* instance_call_;
4046 3991
4047 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); 3992 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr);
4048 }; 3993 };
4049 3994
4050 3995
4051 class DoubleToIntegerInstr : public TemplateDefinition<1> { 3996 class DoubleToIntegerInstr : public TemplateDefinition<1> {
4052 public: 3997 public:
4053 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) 3998 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call)
4054 : instance_call_(instance_call) { 3999 : instance_call_(instance_call) {
4055 ASSERT(value != NULL); 4000 SetInputAt(0, value);
4056 inputs_[0] = value;
4057 } 4001 }
4058 4002
4059 Value* value() const { return inputs_[0]; } 4003 Value* value() const { return inputs_[0]; }
4060 InstanceCallInstr* instance_call() const { return instance_call_; } 4004 InstanceCallInstr* instance_call() const { return instance_call_; }
4061 4005
4062 DECLARE_INSTRUCTION(DoubleToInteger) 4006 DECLARE_INSTRUCTION(DoubleToInteger)
4063 virtual CompileType ComputeType() const; 4007 virtual CompileType ComputeType() const;
4064 4008
4065 virtual intptr_t ArgumentCount() const { return 1; } 4009 virtual intptr_t ArgumentCount() const { return 1; }
4066 4010
4067 virtual bool CanDeoptimize() const { return true; } 4011 virtual bool CanDeoptimize() const { return true; }
4068 4012
4069 virtual bool HasSideEffect() const { return false; } 4013 virtual bool HasSideEffect() const { return false; }
4070 4014
4071 private: 4015 private:
4072 InstanceCallInstr* instance_call_; 4016 InstanceCallInstr* instance_call_;
4073 4017
4074 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr); 4018 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr);
4075 }; 4019 };
4076 4020
4077 4021
4078 // Similar to 'DoubleToIntegerInstr' but expects unboxed double as input 4022 // Similar to 'DoubleToIntegerInstr' but expects unboxed double as input
4079 // and creates a Smi. 4023 // and creates a Smi.
4080 class DoubleToSmiInstr : public TemplateDefinition<1> { 4024 class DoubleToSmiInstr : public TemplateDefinition<1> {
4081 public: 4025 public:
4082 DoubleToSmiInstr(Value* value, InstanceCallInstr* instance_call) { 4026 DoubleToSmiInstr(Value* value, InstanceCallInstr* instance_call) {
4083 ASSERT(value != NULL); 4027 SetInputAt(0, value);
4084 inputs_[0] = value;
4085 deopt_id_ = instance_call->deopt_id(); 4028 deopt_id_ = instance_call->deopt_id();
4086 } 4029 }
4087 4030
4088 Value* value() const { return inputs_[0]; } 4031 Value* value() const { return inputs_[0]; }
4089 4032
4090 DECLARE_INSTRUCTION(DoubleToSmi) 4033 DECLARE_INSTRUCTION(DoubleToSmi)
4091 virtual CompileType ComputeType() const; 4034 virtual CompileType ComputeType() const;
4092 4035
4093 virtual bool CanDeoptimize() const { return true; } 4036 virtual bool CanDeoptimize() const { return true; }
4094 4037
(...skipping 10 matching lines...) Expand all
4105 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr); 4048 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr);
4106 }; 4049 };
4107 4050
4108 4051
4109 class DoubleToDoubleInstr : public TemplateDefinition<1> { 4052 class DoubleToDoubleInstr : public TemplateDefinition<1> {
4110 public: 4053 public:
4111 DoubleToDoubleInstr(Value* value, 4054 DoubleToDoubleInstr(Value* value,
4112 InstanceCallInstr* instance_call, 4055 InstanceCallInstr* instance_call,
4113 MethodRecognizer::Kind recognized_kind) 4056 MethodRecognizer::Kind recognized_kind)
4114 : recognized_kind_(recognized_kind) { 4057 : recognized_kind_(recognized_kind) {
4115 ASSERT(value != NULL); 4058 SetInputAt(0, value);
4116 inputs_[0] = value;
4117 deopt_id_ = instance_call->deopt_id(); 4059 deopt_id_ = instance_call->deopt_id();
4118 } 4060 }
4119 4061
4120 Value* value() const { return inputs_[0]; } 4062 Value* value() const { return inputs_[0]; }
4121 4063
4122 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } 4064 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; }
4123 4065
4124 DECLARE_INSTRUCTION(DoubleToDouble) 4066 DECLARE_INSTRUCTION(DoubleToDouble)
4125 virtual CompileType ComputeType() const; 4067 virtual CompileType ComputeType() const;
4126 4068
(...skipping 16 matching lines...) Expand all
4143 const MethodRecognizer::Kind recognized_kind_; 4085 const MethodRecognizer::Kind recognized_kind_;
4144 4086
4145 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr); 4087 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr);
4146 }; 4088 };
4147 4089
4148 4090
4149 class InvokeMathCFunctionInstr : public Definition { 4091 class InvokeMathCFunctionInstr : public Definition {
4150 public: 4092 public:
4151 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs, 4093 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs,
4152 InstanceCallInstr* instance_call, 4094 InstanceCallInstr* instance_call,
4153 MethodRecognizer::Kind recognized_kind) 4095 MethodRecognizer::Kind recognized_kind);
4154 : inputs_(inputs), locs_(NULL), recognized_kind_(recognized_kind) {
4155 ASSERT(inputs_->length() == ArgumentCountFor(recognized_kind_));
4156 deopt_id_ = instance_call->deopt_id();
4157 }
4158 4096
4159 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_); 4097 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_);
4160 4098
4161 const RuntimeEntry& TargetFunction() const; 4099 const RuntimeEntry& TargetFunction() const;
4162 4100
4163 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } 4101 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; }
4164 4102
4165 DECLARE_INSTRUCTION(InvokeMathCFunction) 4103 DECLARE_INSTRUCTION(InvokeMathCFunction)
4166 virtual CompileType ComputeType() const; 4104 virtual CompileType ComputeType() const;
4167 virtual void PrintOperandsTo(BufferFormatter* f) const; 4105 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 14 matching lines...) Expand all
4182 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } 4120 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
4183 4121
4184 virtual intptr_t InputCount() const { 4122 virtual intptr_t InputCount() const {
4185 return inputs_->length(); 4123 return inputs_->length();
4186 } 4124 }
4187 4125
4188 virtual Value* InputAt(intptr_t i) const { 4126 virtual Value* InputAt(intptr_t i) const {
4189 return (*inputs_)[i]; 4127 return (*inputs_)[i];
4190 } 4128 }
4191 4129
4192 virtual void SetInputAt(intptr_t i, Value* value) {
4193 ASSERT(value != NULL);
4194 (*inputs_)[i] = value;
4195 }
4196
4197 // Returns a structure describing the location constraints required 4130 // Returns a structure describing the location constraints required
4198 // to emit native code for this definition. 4131 // to emit native code for this definition.
4199 LocationSummary* locs() { 4132 LocationSummary* locs() {
4200 if (locs_ == NULL) { 4133 if (locs_ == NULL) {
4201 locs_ = MakeLocationSummary(); 4134 locs_ = MakeLocationSummary();
4202 } 4135 }
4203 return locs_; 4136 return locs_;
4204 } 4137 }
4205 4138
4206 private: 4139 private:
4140 virtual void RawSetInputAt(intptr_t i, Value* value) {
4141 (*inputs_)[i] = value;
4142 }
4143
4207 ZoneGrowableArray<Value*>* inputs_; 4144 ZoneGrowableArray<Value*>* inputs_;
4208 4145
4209 LocationSummary* locs_; 4146 LocationSummary* locs_;
4210 4147
4211 const MethodRecognizer::Kind recognized_kind_; 4148 const MethodRecognizer::Kind recognized_kind_;
4212 4149
4213 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr); 4150 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr);
4214 }; 4151 };
4215 4152
4216 4153
(...skipping 26 matching lines...) Expand all
4243 private: 4180 private:
4244 const ICData& unary_checks_; 4181 const ICData& unary_checks_;
4245 4182
4246 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); 4183 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr);
4247 }; 4184 };
4248 4185
4249 4186
4250 class CheckSmiInstr : public TemplateInstruction<1> { 4187 class CheckSmiInstr : public TemplateInstruction<1> {
4251 public: 4188 public:
4252 CheckSmiInstr(Value* value, intptr_t original_deopt_id) { 4189 CheckSmiInstr(Value* value, intptr_t original_deopt_id) {
4253 ASSERT(value != NULL);
4254 ASSERT(original_deopt_id != Isolate::kNoDeoptId); 4190 ASSERT(original_deopt_id != Isolate::kNoDeoptId);
4255 inputs_[0] = value; 4191 SetInputAt(0, value);
4256 deopt_id_ = original_deopt_id; 4192 deopt_id_ = original_deopt_id;
4257 } 4193 }
4258 4194
4259 DECLARE_INSTRUCTION(CheckSmi) 4195 DECLARE_INSTRUCTION(CheckSmi)
4260 4196
4261 virtual intptr_t ArgumentCount() const { return 0; } 4197 virtual intptr_t ArgumentCount() const { return 0; }
4262 4198
4263 virtual bool CanDeoptimize() const { return true; } 4199 virtual bool CanDeoptimize() const { return true; }
4264 4200
4265 virtual bool HasSideEffect() const { return false; } 4201 virtual bool HasSideEffect() const { return false; }
(...skipping 11 matching lines...) Expand all
4277 }; 4213 };
4278 4214
4279 4215
4280 class CheckArrayBoundInstr : public TemplateInstruction<2> { 4216 class CheckArrayBoundInstr : public TemplateInstruction<2> {
4281 public: 4217 public:
4282 CheckArrayBoundInstr(Value* length, 4218 CheckArrayBoundInstr(Value* length,
4283 Value* index, 4219 Value* index,
4284 intptr_t array_type, 4220 intptr_t array_type,
4285 InstanceCallInstr* instance_call) 4221 InstanceCallInstr* instance_call)
4286 : array_type_(array_type) { 4222 : array_type_(array_type) {
4287 ASSERT(length != NULL); 4223 SetInputAt(0, length);
4288 ASSERT(index != NULL); 4224 SetInputAt(1, index);
4289 inputs_[0] = length;
4290 inputs_[1] = index;
4291 deopt_id_ = instance_call->deopt_id(); 4225 deopt_id_ = instance_call->deopt_id();
4292 } 4226 }
4293 4227
4294 DECLARE_INSTRUCTION(CheckArrayBound) 4228 DECLARE_INSTRUCTION(CheckArrayBound)
4295 4229
4296 virtual intptr_t ArgumentCount() const { return 0; } 4230 virtual intptr_t ArgumentCount() const { return 0; }
4297 4231
4298 virtual bool CanDeoptimize() const { return true; } 4232 virtual bool CanDeoptimize() const { return true; }
4299 4233
4300 virtual bool HasSideEffect() const { return false; } 4234 virtual bool HasSideEffect() const { return false; }
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
4544 ForwardInstructionIterator* current_iterator_; 4478 ForwardInstructionIterator* current_iterator_;
4545 4479
4546 private: 4480 private:
4547 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4481 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4548 }; 4482 };
4549 4483
4550 4484
4551 } // namespace dart 4485 } // namespace dart
4552 4486
4553 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4487 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698