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

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: 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
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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 kUnboxedDouble, 321 kUnboxedDouble,
322 kUnboxedMint 322 kUnboxedMint
323 }; 323 };
324 324
325 325
326 // An embedded container with N elements of type T. Used (with partial 326 // An embedded container with N elements of type T. Used (with partial
327 // specialization for N=0) because embedded arrays cannot have size 0. 327 // specialization for N=0) because embedded arrays cannot have size 0.
328 template<typename T, intptr_t N> 328 template<typename T, intptr_t N>
329 class EmbeddedArray { 329 class EmbeddedArray {
330 public: 330 public:
331 EmbeddedArray() { 331 EmbeddedArray() : elements_() { }
332 for (intptr_t i = 0; i < N; i++) elements_[i] = NULL;
333 }
334 332
335 intptr_t length() const { return N; } 333 intptr_t length() const { return N; }
336 334
337 const T& operator[](intptr_t i) const { 335 const T& operator[](intptr_t i) const {
338 ASSERT(i < length()); 336 ASSERT(i < length());
339 return elements_[i]; 337 return elements_[i];
340 } 338 }
341 339
342 T& operator[](intptr_t i) { 340 T& operator[](intptr_t i) {
343 ASSERT(i < length()); 341 ASSERT(i < length());
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 virtual BlockEntryInstr* AsBlockEntry() { return NULL; } 493 virtual BlockEntryInstr* AsBlockEntry() { return NULL; }
496 494
497 bool IsDefinition() { return (AsDefinition() != NULL); } 495 bool IsDefinition() { return (AsDefinition() != NULL); }
498 virtual Definition* AsDefinition() { return NULL; } 496 virtual Definition* AsDefinition() { return NULL; }
499 497
500 bool IsControl() { return (AsControl() != NULL); } 498 bool IsControl() { return (AsControl() != NULL); }
501 virtual ControlInstruction* AsControl() { return NULL; } 499 virtual ControlInstruction* AsControl() { return NULL; }
502 500
503 virtual intptr_t InputCount() const = 0; 501 virtual intptr_t InputCount() const = 0;
504 virtual Value* InputAt(intptr_t i) const = 0; 502 virtual Value* InputAt(intptr_t i) const = 0;
505 virtual void SetInputAt(intptr_t i, Value* value) = 0; 503 void SetInputAt(intptr_t i, Value* value) {
504 ASSERT(value != NULL);
505 value->set_instruction(this);
506 value->set_use_index(i);
507 RawSetInputAt(i, value);
508 }
506 509
507 // Remove all inputs (including in the environment) from their 510 // Remove all inputs (including in the environment) from their
508 // definition's use lists. 511 // definition's use lists.
509 void UnuseAllInputs(); 512 void UnuseAllInputs();
510 513
511 // Call instructions override this function and return the number of 514 // Call instructions override this function and return the number of
512 // pushed arguments. 515 // pushed arguments.
513 virtual intptr_t ArgumentCount() const = 0; 516 virtual intptr_t ArgumentCount() const = 0;
514 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { 517 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
515 UNREACHABLE(); 518 UNREACHABLE();
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 friend class CheckSmiInstr; 696 friend class CheckSmiInstr;
694 friend class CheckArrayBoundInstr; 697 friend class CheckArrayBoundInstr;
695 friend class CheckEitherNonSmiInstr; 698 friend class CheckEitherNonSmiInstr;
696 friend class LICM; 699 friend class LICM;
697 friend class DoubleToSmiInstr; 700 friend class DoubleToSmiInstr;
698 friend class DoubleToDoubleInstr; 701 friend class DoubleToDoubleInstr;
699 friend class InvokeMathCFunctionInstr; 702 friend class InvokeMathCFunctionInstr;
700 friend class FlowGraphOptimizer; 703 friend class FlowGraphOptimizer;
701 friend class LoadIndexedInstr; 704 friend class LoadIndexedInstr;
702 705
706 virtual void RawSetInputAt(intptr_t i, Value* value) = 0;
707
703 intptr_t deopt_id_; 708 intptr_t deopt_id_;
704 intptr_t lifetime_position_; // Position used by register allocator. 709 intptr_t lifetime_position_; // Position used by register allocator.
705 Instruction* previous_; 710 Instruction* previous_;
706 Instruction* next_; 711 Instruction* next_;
707 Environment* env_; 712 Environment* env_;
708 intptr_t expr_id_; 713 intptr_t expr_id_;
709 714
710 DISALLOW_COPY_AND_ASSIGN(Instruction); 715 DISALLOW_COPY_AND_ASSIGN(Instruction);
711 }; 716 };
712 717
713 718
714 template<intptr_t N> 719 template<intptr_t N>
715 class TemplateInstruction: public Instruction { 720 class TemplateInstruction: public Instruction {
716 public: 721 public:
717 TemplateInstruction<N>() : locs_(NULL) { } 722 TemplateInstruction<N>() : locs_(NULL) { }
718 723
719 virtual intptr_t InputCount() const { return N; } 724 virtual intptr_t InputCount() const { return N; }
720 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } 725 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; }
721 virtual void SetInputAt(intptr_t i, Value* value) {
722 ASSERT(value != NULL);
723 inputs_[i] = value;
724 }
725 726
726 virtual LocationSummary* locs() { 727 virtual LocationSummary* locs() {
727 if (locs_ == NULL) { 728 if (locs_ == NULL) {
728 locs_ = MakeLocationSummary(); 729 locs_ = MakeLocationSummary();
729 } 730 }
730 return locs_; 731 return locs_;
731 } 732 }
732 733
733 protected: 734 protected:
734 EmbeddedArray<Value*, N> inputs_; 735 EmbeddedArray<Value*, N> inputs_;
735 736
736 private: 737 private:
738 virtual void RawSetInputAt(intptr_t i, Value* value) {
739 inputs_[i] = value;
740 }
741
737 LocationSummary* locs_; 742 LocationSummary* locs_;
738 }; 743 };
739 744
740 745
741 class MoveOperands : public ZoneAllocated { 746 class MoveOperands : public ZoneAllocated {
742 public: 747 public:
743 MoveOperands(Location dest, Location src) : dest_(dest), src_(src) { } 748 MoveOperands(Location dest, Location src) : dest_(dest), src_(src) { }
744 749
745 Location src() const { return src_; } 750 Location src() const { return src_; }
746 Location dest() const { return dest_; } 751 Location dest() const { return dest_; }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 GrowableArray<intptr_t>* parent, 913 GrowableArray<intptr_t>* parent,
909 GrowableArray<BitVector*>* assigned_vars, 914 GrowableArray<BitVector*>* assigned_vars,
910 intptr_t variable_count, 915 intptr_t variable_count,
911 intptr_t fixed_parameter_count); 916 intptr_t fixed_parameter_count);
912 917
913 virtual intptr_t InputCount() const { return 0; } 918 virtual intptr_t InputCount() const { return 0; }
914 virtual Value* InputAt(intptr_t i) const { 919 virtual Value* InputAt(intptr_t i) const {
915 UNREACHABLE(); 920 UNREACHABLE();
916 return NULL; 921 return NULL;
917 } 922 }
918 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
919 923
920 virtual intptr_t ArgumentCount() const { return 0; } 924 virtual intptr_t ArgumentCount() const { return 0; }
921 925
922 virtual bool CanDeoptimize() const { return false; } 926 virtual bool CanDeoptimize() const { return false; }
923 927
924 virtual bool HasSideEffect() const { return false; } 928 virtual bool HasSideEffect() const { return false; }
925 929
926 intptr_t try_index() const { return try_index_; } 930 intptr_t try_index() const { return try_index_; }
927 931
928 BitVector* loop_info() const { return loop_info_; } 932 BitVector* loop_info() const { return loop_info_; }
(...skipping 16 matching lines...) Expand all
945 try_index_(try_index), 949 try_index_(try_index),
946 preorder_number_(-1), 950 preorder_number_(-1),
947 postorder_number_(-1), 951 postorder_number_(-1),
948 dominator_(NULL), 952 dominator_(NULL),
949 dominated_blocks_(1), 953 dominated_blocks_(1),
950 last_instruction_(NULL), 954 last_instruction_(NULL),
951 parallel_move_(NULL), 955 parallel_move_(NULL),
952 loop_info_(NULL) { } 956 loop_info_(NULL) { }
953 957
954 private: 958 private:
959 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
960
955 virtual void ClearPredecessors() = 0; 961 virtual void ClearPredecessors() = 0;
956 virtual void AddPredecessor(BlockEntryInstr* predecessor) = 0; 962 virtual void AddPredecessor(BlockEntryInstr* predecessor) = 0;
957 963
958 const intptr_t block_id_; 964 const intptr_t block_id_;
959 const intptr_t try_index_; 965 const intptr_t try_index_;
960 intptr_t preorder_number_; 966 intptr_t preorder_number_;
961 intptr_t postorder_number_; 967 intptr_t postorder_number_;
962 // Starting and ending lifetime positions for this block. Used by 968 // Starting and ending lifetime positions for this block. Used by
963 // the linear scan register allocator. 969 // the linear scan register allocator.
964 intptr_t start_pos_; 970 intptr_t start_pos_;
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 UseKind use_kind_; 1344 UseKind use_kind_;
1339 1345
1340 Object& constant_value_; 1346 Object& constant_value_;
1341 1347
1342 DISALLOW_COPY_AND_ASSIGN(Definition); 1348 DISALLOW_COPY_AND_ASSIGN(Definition);
1343 }; 1349 };
1344 1350
1345 1351
1346 class PhiInstr : public Definition { 1352 class PhiInstr : public Definition {
1347 public: 1353 public:
1348 explicit PhiInstr(JoinEntryInstr* block, intptr_t num_inputs) 1354 PhiInstr(JoinEntryInstr* block, intptr_t num_inputs)
1349 : block_(block), 1355 : block_(block),
1350 inputs_(num_inputs), 1356 inputs_(num_inputs),
1351 is_alive_(false), 1357 is_alive_(false),
1352 representation_(kTagged), 1358 representation_(kTagged),
1353 reaching_defs_(NULL) { 1359 reaching_defs_(NULL) {
1354 for (intptr_t i = 0; i < num_inputs; ++i) { 1360 for (intptr_t i = 0; i < num_inputs; ++i) {
1355 inputs_.Add(NULL); 1361 inputs_.Add(NULL);
1356 } 1362 }
1357 } 1363 }
1358 1364
1359 // Get the block entry for that instruction. 1365 // Get the block entry for that instruction.
1360 virtual BlockEntryInstr* GetBlock() const { return block(); } 1366 virtual BlockEntryInstr* GetBlock() const { return block(); }
1361 JoinEntryInstr* block() const { return block_; } 1367 JoinEntryInstr* block() const { return block_; }
1362 1368
1363 virtual CompileType* ComputeInitialType() const; 1369 virtual CompileType* ComputeInitialType() const;
1364 virtual bool RecomputeType(); 1370 virtual bool RecomputeType();
1365 1371
1366 virtual intptr_t ArgumentCount() const { return 0; } 1372 virtual intptr_t ArgumentCount() const { return 0; }
1367 1373
1368 intptr_t InputCount() const { return inputs_.length(); } 1374 intptr_t InputCount() const { return inputs_.length(); }
1369 1375
1370 Value* InputAt(intptr_t i) const { return inputs_[i]; } 1376 Value* InputAt(intptr_t i) const { return inputs_[i]; }
1371 1377
1372 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; }
1373
1374 virtual bool CanDeoptimize() const { return false; } 1378 virtual bool CanDeoptimize() const { return false; }
1375 1379
1376 virtual bool HasSideEffect() const { return false; } 1380 virtual bool HasSideEffect() const { return false; }
1377 1381
1378 // Phi is alive if it reaches a non-environment use. 1382 // Phi is alive if it reaches a non-environment use.
1379 bool is_alive() const { return is_alive_; } 1383 bool is_alive() const { return is_alive_; }
1380 void mark_alive() { is_alive_ = true; } 1384 void mark_alive() { is_alive_ = true; }
1381 1385
1382 virtual Representation RequiredInputRepresentation(intptr_t i) const { 1386 virtual Representation RequiredInputRepresentation(intptr_t i) const {
1383 return representation_; 1387 return representation_;
(...skipping 20 matching lines...) Expand all
1404 1408
1405 BitVector* reaching_defs() const { 1409 BitVector* reaching_defs() const {
1406 return reaching_defs_; 1410 return reaching_defs_;
1407 } 1411 }
1408 1412
1409 void set_reaching_defs(BitVector* reaching_defs) { 1413 void set_reaching_defs(BitVector* reaching_defs) {
1410 reaching_defs_ = reaching_defs; 1414 reaching_defs_ = reaching_defs;
1411 } 1415 }
1412 1416
1413 private: 1417 private:
1414 friend class ConstantPropagator; // Direct access to inputs_. 1418 // Direct access to inputs_ in order to resize it due to unreachable
1419 // predecessors.
1420 friend class ConstantPropagator;
Vyacheslav Egorov (Google) 2013/02/22 16:13:36 Comment does not match implementation. ConstantPro
Kevin Millikin (Google) 2013/02/25 11:08:07 It uses friend access to call inputs_.Truncate(...
1421
1422 void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; }
1415 1423
1416 JoinEntryInstr* block_; 1424 JoinEntryInstr* block_;
1417 GrowableArray<Value*> inputs_; 1425 GrowableArray<Value*> inputs_;
1418 bool is_alive_; 1426 bool is_alive_;
1419 Representation representation_; 1427 Representation representation_;
1420 1428
1421 BitVector* reaching_defs_; 1429 BitVector* reaching_defs_;
1422 1430
1423 DISALLOW_COPY_AND_ASSIGN(PhiInstr); 1431 DISALLOW_COPY_AND_ASSIGN(PhiInstr);
1424 }; 1432 };
1425 1433
1426 1434
1427 class ParameterInstr : public Definition { 1435 class ParameterInstr : public Definition {
1428 public: 1436 public:
1429 explicit ParameterInstr(intptr_t index, GraphEntryInstr* block) 1437 ParameterInstr(intptr_t index, GraphEntryInstr* block)
1430 : index_(index), block_(block) { } 1438 : index_(index), block_(block) { }
1431 1439
1432 DECLARE_INSTRUCTION(Parameter) 1440 DECLARE_INSTRUCTION(Parameter)
1433 1441
1434 intptr_t index() const { return index_; } 1442 intptr_t index() const { return index_; }
1435 1443
1436 // Get the block entry for that instruction. 1444 // Get the block entry for that instruction.
1437 virtual BlockEntryInstr* GetBlock() const { return block_; } 1445 virtual BlockEntryInstr* GetBlock() const { return block_; }
1438 1446
1439 virtual intptr_t ArgumentCount() const { return 0; } 1447 virtual intptr_t ArgumentCount() const { return 0; }
1440 1448
1441 intptr_t InputCount() const { return 0; } 1449 intptr_t InputCount() const { return 0; }
1442 Value* InputAt(intptr_t i) const { 1450 Value* InputAt(intptr_t i) const {
1443 UNREACHABLE(); 1451 UNREACHABLE();
1444 return NULL; 1452 return NULL;
1445 } 1453 }
1446 void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
1447 1454
1448 virtual bool CanDeoptimize() const { return false; } 1455 virtual bool CanDeoptimize() const { return false; }
1449 1456
1450 virtual bool HasSideEffect() const { return false; } 1457 virtual bool HasSideEffect() const { return false; }
1451 1458
1452 virtual intptr_t Hashcode() const { 1459 virtual intptr_t Hashcode() const {
1453 UNREACHABLE(); 1460 UNREACHABLE();
1454 return 0; 1461 return 0;
1455 } 1462 }
1456 1463
1457 virtual void PrintOperandsTo(BufferFormatter* f) const; 1464 virtual void PrintOperandsTo(BufferFormatter* f) const;
1458 1465
1459 virtual CompileType* ComputeInitialType() const; 1466 virtual CompileType* ComputeInitialType() const;
1460 1467
1461 private: 1468 private:
1469 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
1470
1462 const intptr_t index_; 1471 const intptr_t index_;
1463 GraphEntryInstr* block_; 1472 GraphEntryInstr* block_;
1464 1473
1465 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); 1474 DISALLOW_COPY_AND_ASSIGN(ParameterInstr);
1466 }; 1475 };
1467 1476
1468 1477
1469 class PushArgumentInstr : public Definition { 1478 class PushArgumentInstr : public Definition {
1470 public: 1479 public:
1471 explicit PushArgumentInstr(Value* value) : value_(value), locs_(NULL) { 1480 explicit PushArgumentInstr(Value* value) : locs_(NULL) {
1472 ASSERT(value != NULL); 1481 SetInputAt(0, value);
1473 set_use_kind(kEffect); // Override the default. 1482 set_use_kind(kEffect); // Override the default.
1474 } 1483 }
1475 1484
1476 DECLARE_INSTRUCTION(PushArgument) 1485 DECLARE_INSTRUCTION(PushArgument)
1477 1486
1478 intptr_t InputCount() const { return 1; } 1487 intptr_t InputCount() const { return 1; }
1479 Value* InputAt(intptr_t i) const { 1488 Value* InputAt(intptr_t i) const {
1480 ASSERT(i == 0); 1489 ASSERT(i == 0);
1481 return value_; 1490 return value_;
1482 } 1491 }
1483 void SetInputAt(intptr_t i, Value* value) {
1484 ASSERT(i == 0);
1485 value_ = value;
1486 }
1487 1492
1488 virtual intptr_t ArgumentCount() const { return 0; } 1493 virtual intptr_t ArgumentCount() const { return 0; }
1489 1494
1490 virtual CompileType* ComputeInitialType() const; 1495 virtual CompileType* ComputeInitialType() const;
1491 1496
1492 Value* value() const { return value_; } 1497 Value* value() const { return value_; }
1493 1498
1494 virtual LocationSummary* locs() { 1499 virtual LocationSummary* locs() {
1495 if (locs_ == NULL) { 1500 if (locs_ == NULL) {
1496 locs_ = MakeLocationSummary(); 1501 locs_ = MakeLocationSummary();
1497 } 1502 }
1498 return locs_; 1503 return locs_;
1499 } 1504 }
1500 1505
1501 virtual intptr_t Hashcode() const { 1506 virtual intptr_t Hashcode() const {
1502 UNREACHABLE(); 1507 UNREACHABLE();
1503 return 0; 1508 return 0;
1504 } 1509 }
1505 1510
1506 virtual bool CanDeoptimize() const { return false; } 1511 virtual bool CanDeoptimize() const { return false; }
1507 1512
1508 virtual bool HasSideEffect() const { return false; } 1513 virtual bool HasSideEffect() const { return false; }
1509 1514
1510 virtual void PrintOperandsTo(BufferFormatter* f) const; 1515 virtual void PrintOperandsTo(BufferFormatter* f) const;
1511 1516
1512 private: 1517 private:
1518 virtual void RawSetInputAt(intptr_t i, Value* value) {
1519 ASSERT(i == 0);
1520 value_ = value;
1521 }
1522
1513 Value* value_; 1523 Value* value_;
1514 LocationSummary* locs_; 1524 LocationSummary* locs_;
1515 1525
1516 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); 1526 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr);
1517 }; 1527 };
1518 1528
1519 1529
1520 inline Definition* Instruction::ArgumentAt(intptr_t index) const { 1530 inline Definition* Instruction::ArgumentAt(intptr_t index) const {
1521 return PushArgumentAt(index)->value()->definition(); 1531 return PushArgumentAt(index)->value()->definition();
1522 } 1532 }
1523 1533
1524 1534
1525 class ReturnInstr : public TemplateInstruction<1> { 1535 class ReturnInstr : public TemplateInstruction<1> {
1526 public: 1536 public:
1527 ReturnInstr(intptr_t token_pos, Value* value) 1537 ReturnInstr(intptr_t token_pos, Value* value)
1528 : token_pos_(token_pos) { 1538 : token_pos_(token_pos) {
1529 ASSERT(value != NULL); 1539 SetInputAt(0, value);
1530 inputs_[0] = value;
1531 } 1540 }
1532 1541
1533 DECLARE_INSTRUCTION(Return) 1542 DECLARE_INSTRUCTION(Return)
1534 1543
1535 virtual intptr_t ArgumentCount() const { return 0; } 1544 virtual intptr_t ArgumentCount() const { return 0; }
1536 1545
1537 intptr_t token_pos() const { return token_pos_; } 1546 intptr_t token_pos() const { return token_pos_; }
1538 Value* value() const { return inputs_[0]; } 1547 Value* value() const { return inputs_[0]; }
1539 1548
1540 virtual bool CanDeoptimize() const { return false; } 1549 virtual bool CanDeoptimize() const { return false; }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 private: 1667 private:
1659 TargetEntryInstr* true_successor_; 1668 TargetEntryInstr* true_successor_;
1660 TargetEntryInstr* false_successor_; 1669 TargetEntryInstr* false_successor_;
1661 1670
1662 DISALLOW_COPY_AND_ASSIGN(ControlInstruction); 1671 DISALLOW_COPY_AND_ASSIGN(ControlInstruction);
1663 }; 1672 };
1664 1673
1665 1674
1666 class BranchInstr : public ControlInstruction { 1675 class BranchInstr : public ControlInstruction {
1667 public: 1676 public:
1668 explicit BranchInstr(ComparisonInstr* comparison, bool is_checked = false) 1677 explicit BranchInstr(ComparisonInstr* comparison, bool is_checked = false);
1669 : comparison_(comparison), is_checked_(is_checked) { }
1670 1678
1671 DECLARE_INSTRUCTION(Branch) 1679 DECLARE_INSTRUCTION(Branch)
1672 1680
1673 virtual intptr_t ArgumentCount() const; 1681 virtual intptr_t ArgumentCount() const;
1674 intptr_t InputCount() const; 1682 intptr_t InputCount() const;
1675 Value* InputAt(intptr_t i) const; 1683 Value* InputAt(intptr_t i) const;
1676 void SetInputAt(intptr_t i, Value* value);
1677 virtual bool CanDeoptimize() const; 1684 virtual bool CanDeoptimize() const;
1678 1685
1679 virtual bool HasSideEffect() const; 1686 virtual bool HasSideEffect() const;
1680 1687
1681 ComparisonInstr* comparison() const { return comparison_; } 1688 ComparisonInstr* comparison() const { return comparison_; }
1682 void SetComparison(ComparisonInstr* comp); 1689 void SetComparison(ComparisonInstr* comp);
1683 1690
1684 bool is_checked() const { return is_checked_; } 1691 bool is_checked() const { return is_checked_; }
1685 1692
1686 virtual LocationSummary* locs(); 1693 virtual LocationSummary* locs();
1687 virtual intptr_t DeoptimizationTarget() const; 1694 virtual intptr_t DeoptimizationTarget() const;
1688 virtual Representation RequiredInputRepresentation(intptr_t i) const; 1695 virtual Representation RequiredInputRepresentation(intptr_t i) const;
1689 1696
1690 // A misleadingly named function for use in template functions that also 1697 // A misleadingly named function for use in template functions that also
1691 // replace definitions. In this case, leave the branch intact and replace 1698 // replace definitions. In this case, leave the branch intact and replace
1692 // its comparison with another comparison that has been removed from the 1699 // its comparison with another comparison that has been removed from the
1693 // graph but still has uses properly linked into their definition's use 1700 // graph but still has uses properly linked into their definition's use
1694 // list. 1701 // list.
1695 void ReplaceWith(ComparisonInstr* other, 1702 void ReplaceWith(ComparisonInstr* other,
1696 ForwardInstructionIterator* ignored); 1703 ForwardInstructionIterator* ignored);
1697 1704
1698 virtual Instruction* Canonicalize(FlowGraphOptimizer* optimizer); 1705 virtual Instruction* Canonicalize(FlowGraphOptimizer* optimizer);
1699 1706
1700 virtual void PrintTo(BufferFormatter* f) const; 1707 virtual void PrintTo(BufferFormatter* f) const;
1701 1708
1702 private: 1709 private:
1710 virtual void RawSetInputAt(intptr_t i, Value* value);
1711
1703 ComparisonInstr* comparison_; 1712 ComparisonInstr* comparison_;
1704 const bool is_checked_; 1713 const bool is_checked_;
1705 1714
1706 DISALLOW_COPY_AND_ASSIGN(BranchInstr); 1715 DISALLOW_COPY_AND_ASSIGN(BranchInstr);
1707 }; 1716 };
1708 1717
1709 1718
1710 class StoreContextInstr : public TemplateInstruction<1> { 1719 class StoreContextInstr : public TemplateInstruction<1> {
1711 public: 1720 public:
1712 explicit StoreContextInstr(Value* value) { 1721 explicit StoreContextInstr(Value* value) {
1713 ASSERT(value != NULL); 1722 SetInputAt(0, value);
1714 inputs_[0] = value;
1715 } 1723 }
1716 1724
1717 DECLARE_INSTRUCTION(StoreContext); 1725 DECLARE_INSTRUCTION(StoreContext);
1718 1726
1719 virtual intptr_t ArgumentCount() const { return 0; } 1727 virtual intptr_t ArgumentCount() const { return 0; }
1720 1728
1721 Value* value() const { return inputs_[0]; } 1729 Value* value() const { return inputs_[0]; }
1722 1730
1723 virtual bool CanDeoptimize() const { return false; } 1731 virtual bool CanDeoptimize() const { return false; }
1724 1732
1725 virtual bool HasSideEffect() const { return false; } 1733 virtual bool HasSideEffect() const { return false; }
1726 1734
1727 private: 1735 private:
1728 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr); 1736 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr);
1729 }; 1737 };
1730 1738
1731 1739
1732 template<intptr_t N> 1740 template<intptr_t N>
1733 class TemplateDefinition : public Definition { 1741 class TemplateDefinition : public Definition {
1734 public: 1742 public:
1735 TemplateDefinition<N>() : locs_(NULL) { } 1743 TemplateDefinition<N>() : locs_(NULL) { }
1736 1744
1737 virtual intptr_t InputCount() const { return N; } 1745 virtual intptr_t InputCount() const { return N; }
1738 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } 1746 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; }
1739 virtual void SetInputAt(intptr_t i, Value* value) {
1740 ASSERT(value != NULL);
1741 inputs_[i] = value;
1742 }
1743 1747
1744 // Returns a structure describing the location constraints required 1748 // Returns a structure describing the location constraints required
1745 // to emit native code for this definition. 1749 // to emit native code for this definition.
1746 LocationSummary* locs() { 1750 LocationSummary* locs() {
1747 if (locs_ == NULL) { 1751 if (locs_ == NULL) {
1748 locs_ = MakeLocationSummary(); 1752 locs_ = MakeLocationSummary();
1749 } 1753 }
1750 return locs_; 1754 return locs_;
1751 } 1755 }
1752 1756
1753 protected: 1757 protected:
1754 EmbeddedArray<Value*, N> inputs_; 1758 EmbeddedArray<Value*, N> inputs_;
1755 1759
1756 private: 1760 private:
1757 friend class BranchInstr; 1761 friend class BranchInstr;
1758 1762
1763 virtual void RawSetInputAt(intptr_t i, Value* value) {
1764 inputs_[i] = value;
1765 }
1766
1759 LocationSummary* locs_; 1767 LocationSummary* locs_;
1760 }; 1768 };
1761 1769
1762 1770
1763 class RangeBoundary : public ValueObject { 1771 class RangeBoundary : public ValueObject {
1764 public: 1772 public:
1765 enum Kind { kUnknown, kSymbol, kConstant }; 1773 enum Kind { kUnknown, kSymbol, kConstant };
1766 1774
1767 RangeBoundary() : kind_(kUnknown), value_(0), offset_(0) { } 1775 RangeBoundary() : kind_(kUnknown), value_(0), offset_(0) { }
1768 1776
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 private: 1924 private:
1917 RangeBoundary min_; 1925 RangeBoundary min_;
1918 RangeBoundary max_; 1926 RangeBoundary max_;
1919 }; 1927 };
1920 1928
1921 1929
1922 class ConstraintInstr : public TemplateDefinition<2> { 1930 class ConstraintInstr : public TemplateDefinition<2> {
1923 public: 1931 public:
1924 ConstraintInstr(Value* value, Range* constraint) 1932 ConstraintInstr(Value* value, Range* constraint)
1925 : constraint_(constraint) { 1933 : constraint_(constraint) {
1926 inputs_[0] = value; 1934 SetInputAt(0, value);
1927 inputs_[1] = NULL; // Dependency.
1928 } 1935 }
1929 1936
1930 DECLARE_INSTRUCTION(Constraint) 1937 DECLARE_INSTRUCTION(Constraint)
1931 1938
1932 virtual intptr_t InputCount() const { 1939 virtual intptr_t InputCount() const {
1933 return (inputs_[1] == NULL) ? 1 : 2; 1940 return (inputs_[1] == NULL) ? 1 : 2;
1934 } 1941 }
1935 1942
1936 virtual CompileType* ComputeInitialType() const; 1943 virtual CompileType* ComputeInitialType() const;
1937 1944
1938 virtual bool CanDeoptimize() const { return false; } 1945 virtual bool CanDeoptimize() const { return false; }
1939 1946
1940 virtual bool HasSideEffect() const { return false; } 1947 virtual bool HasSideEffect() const { return false; }
1941 1948
1942 virtual bool AttributesEqual(Instruction* other) const { 1949 virtual bool AttributesEqual(Instruction* other) const {
1943 UNREACHABLE(); 1950 UNREACHABLE();
1944 return false; 1951 return false;
1945 } 1952 }
1946 1953
1947 virtual void PrintOperandsTo(BufferFormatter* f) const; 1954 virtual void PrintOperandsTo(BufferFormatter* f) const;
1948 1955
1949 Value* value() const { return inputs_[0]; } 1956 Value* value() const { return inputs_[0]; }
1950 Range* constraint() const { return constraint_; } 1957 Range* constraint() const { return constraint_; }
1951 1958
1952 virtual void InferRange(); 1959 virtual void InferRange();
1953 1960
1954 void AddDependency(Definition* defn) { 1961 void AddDependency(Definition* defn) {
1955 Value* val = new Value(defn); 1962 Value* val = new Value(defn);
1956 val->set_use_index(1);
1957 val->set_instruction(this);
1958 defn->AddInputUse(val); 1963 defn->AddInputUse(val);
1959 set_dependency(val); 1964 SetInputAt(1, val);
1960 } 1965 }
1961 1966
1962 private: 1967 private:
1963 Value* dependency() { 1968 Value* dependency() {
1964 return inputs_[1]; 1969 return inputs_[1];
1965 } 1970 }
1966 1971
1967 void set_dependency(Value* value) {
1968 inputs_[1] = value;
1969 }
1970
1971 Range* constraint_; 1972 Range* constraint_;
1972 1973
1973 DISALLOW_COPY_AND_ASSIGN(ConstraintInstr); 1974 DISALLOW_COPY_AND_ASSIGN(ConstraintInstr);
1974 }; 1975 };
1975 1976
1976 1977
1977 class ConstantInstr : public TemplateDefinition<0> { 1978 class ConstantInstr : public TemplateDefinition<0> {
1978 public: 1979 public:
1979 explicit ConstantInstr(const Object& value) 1980 explicit ConstantInstr(const Object& value)
1980 : value_(value) { } 1981 : value_(value) { }
(...skipping 25 matching lines...) Expand all
2006 public: 2007 public:
2007 AssertAssignableInstr(intptr_t token_pos, 2008 AssertAssignableInstr(intptr_t token_pos,
2008 Value* value, 2009 Value* value,
2009 Value* instantiator, 2010 Value* instantiator,
2010 Value* instantiator_type_arguments, 2011 Value* instantiator_type_arguments,
2011 const AbstractType& dst_type, 2012 const AbstractType& dst_type,
2012 const String& dst_name) 2013 const String& dst_name)
2013 : token_pos_(token_pos), 2014 : token_pos_(token_pos),
2014 dst_type_(AbstractType::ZoneHandle(dst_type.raw())), 2015 dst_type_(AbstractType::ZoneHandle(dst_type.raw())),
2015 dst_name_(dst_name) { 2016 dst_name_(dst_name) {
2016 ASSERT(value != NULL);
2017 ASSERT(instantiator != NULL);
2018 ASSERT(instantiator_type_arguments != NULL);
2019 ASSERT(!dst_type.IsNull()); 2017 ASSERT(!dst_type.IsNull());
2020 ASSERT(!dst_name.IsNull()); 2018 ASSERT(!dst_name.IsNull());
2021 inputs_[0] = value; 2019 SetInputAt(0, value);
2022 inputs_[1] = instantiator; 2020 SetInputAt(1, instantiator);
2023 inputs_[2] = instantiator_type_arguments; 2021 SetInputAt(2, instantiator_type_arguments);
2024 } 2022 }
2025 2023
2026 DECLARE_INSTRUCTION(AssertAssignable) 2024 DECLARE_INSTRUCTION(AssertAssignable)
2027 virtual CompileType* ComputeInitialType() const; 2025 virtual CompileType* ComputeInitialType() const;
2028 virtual bool RecomputeType(); 2026 virtual bool RecomputeType();
2029 2027
2030 Value* value() const { return inputs_[0]; } 2028 Value* value() const { return inputs_[0]; }
2031 Value* instantiator() const { return inputs_[1]; } 2029 Value* instantiator() const { return inputs_[1]; }
2032 Value* instantiator_type_arguments() const { return inputs_[2]; } 2030 Value* instantiator_type_arguments() const { return inputs_[2]; }
2033 2031
(...skipping 21 matching lines...) Expand all
2055 const String& dst_name_; 2053 const String& dst_name_;
2056 2054
2057 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr); 2055 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr);
2058 }; 2056 };
2059 2057
2060 2058
2061 class AssertBooleanInstr : public TemplateDefinition<1> { 2059 class AssertBooleanInstr : public TemplateDefinition<1> {
2062 public: 2060 public:
2063 AssertBooleanInstr(intptr_t token_pos, Value* value) 2061 AssertBooleanInstr(intptr_t token_pos, Value* value)
2064 : token_pos_(token_pos) { 2062 : token_pos_(token_pos) {
2065 ASSERT(value != NULL); 2063 SetInputAt(0, value);
2066 inputs_[0] = value;
2067 } 2064 }
2068 2065
2069 DECLARE_INSTRUCTION(AssertBoolean) 2066 DECLARE_INSTRUCTION(AssertBoolean)
2070 virtual CompileType* ComputeInitialType() const; 2067 virtual CompileType* ComputeInitialType() const;
2071 2068
2072 intptr_t token_pos() const { return token_pos_; } 2069 intptr_t token_pos() const { return token_pos_; }
2073 Value* value() const { return inputs_[0]; } 2070 Value* value() const { return inputs_[0]; }
2074 2071
2075 virtual void PrintOperandsTo(BufferFormatter* f) const; 2072 virtual void PrintOperandsTo(BufferFormatter* f) const;
2076 2073
(...skipping 11 matching lines...) Expand all
2088 2085
2089 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr); 2086 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr);
2090 }; 2087 };
2091 2088
2092 2089
2093 class ArgumentDefinitionTestInstr : public TemplateDefinition<1> { 2090 class ArgumentDefinitionTestInstr : public TemplateDefinition<1> {
2094 public: 2091 public:
2095 ArgumentDefinitionTestInstr(ArgumentDefinitionTestNode* node, 2092 ArgumentDefinitionTestInstr(ArgumentDefinitionTestNode* node,
2096 Value* saved_arguments_descriptor) 2093 Value* saved_arguments_descriptor)
2097 : ast_node_(*node) { 2094 : ast_node_(*node) {
2098 ASSERT(saved_arguments_descriptor != NULL); 2095 SetInputAt(0, saved_arguments_descriptor);
2099 inputs_[0] = saved_arguments_descriptor;
2100 } 2096 }
2101 2097
2102 DECLARE_INSTRUCTION(ArgumentDefinitionTest) 2098 DECLARE_INSTRUCTION(ArgumentDefinitionTest)
2103 virtual CompileType* ComputeInitialType() const; 2099 virtual CompileType* ComputeInitialType() const;
2104 2100
2105 intptr_t token_pos() const { return ast_node_.token_pos(); } 2101 intptr_t token_pos() const { return ast_node_.token_pos(); }
2106 intptr_t formal_parameter_index() const { 2102 intptr_t formal_parameter_index() const {
2107 return ast_node_.formal_parameter_index(); 2103 return ast_node_.formal_parameter_index();
2108 } 2104 }
2109 const String& formal_parameter_name() const { 2105 const String& formal_parameter_name() const {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2281 const bool with_checks_; 2277 const bool with_checks_;
2282 2278
2283 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); 2279 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr);
2284 }; 2280 };
2285 2281
2286 2282
2287 class ComparisonInstr : public TemplateDefinition<2> { 2283 class ComparisonInstr : public TemplateDefinition<2> {
2288 public: 2284 public:
2289 ComparisonInstr(Token::Kind kind, Value* left, Value* right) 2285 ComparisonInstr(Token::Kind kind, Value* left, Value* right)
2290 : kind_(kind) { 2286 : kind_(kind) {
2291 ASSERT(left != NULL); 2287 SetInputAt(0, left);
2292 ASSERT(right != NULL); 2288 SetInputAt(1, right);
2293 inputs_[0] = left;
2294 inputs_[1] = right;
2295 } 2289 }
2296 2290
2297 Value* left() const { return inputs_[0]; } 2291 Value* left() const { return inputs_[0]; }
2298 Value* right() const { return inputs_[1]; } 2292 Value* right() const { return inputs_[1]; }
2299 2293
2300 virtual ComparisonInstr* AsComparison() { return this; } 2294 virtual ComparisonInstr* AsComparison() { return this; }
2301 2295
2302 Token::Kind kind() const { return kind_; } 2296 Token::Kind kind() const { return kind_; }
2303 2297
2304 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2298 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
(...skipping 13 matching lines...) Expand all
2318 inline intptr_t BranchInstr::InputCount() const { 2312 inline intptr_t BranchInstr::InputCount() const {
2319 return comparison()->InputCount(); 2313 return comparison()->InputCount();
2320 } 2314 }
2321 2315
2322 2316
2323 inline Value* BranchInstr::InputAt(intptr_t i) const { 2317 inline Value* BranchInstr::InputAt(intptr_t i) const {
2324 return comparison()->InputAt(i); 2318 return comparison()->InputAt(i);
2325 } 2319 }
2326 2320
2327 2321
2328 inline void BranchInstr::SetInputAt(intptr_t i, Value* value) {
2329 comparison()->SetInputAt(i, value);
2330 }
2331
2332
2333 inline bool BranchInstr::CanDeoptimize() const { 2322 inline bool BranchInstr::CanDeoptimize() const {
2334 // Branches need a deoptimization info in checked mode if they 2323 // Branches need a deoptimization info in checked mode if they
2335 // can throw a type check error. 2324 // can throw a type check error.
2336 return comparison()->CanDeoptimize() || is_checked(); 2325 return comparison()->CanDeoptimize() || is_checked();
2337 } 2326 }
2338 2327
2339 2328
2340 inline bool BranchInstr::HasSideEffect() const { 2329 inline bool BranchInstr::HasSideEffect() const {
2341 return comparison()->HasSideEffect(); 2330 return comparison()->HasSideEffect();
2342 } 2331 }
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
2622 }; 2611 };
2623 2612
2624 2613
2625 class StoreLocalInstr : public TemplateDefinition<1> { 2614 class StoreLocalInstr : public TemplateDefinition<1> {
2626 public: 2615 public:
2627 StoreLocalInstr(const LocalVariable& local, 2616 StoreLocalInstr(const LocalVariable& local,
2628 Value* value, 2617 Value* value,
2629 intptr_t context_level) 2618 intptr_t context_level)
2630 : local_(local), 2619 : local_(local),
2631 context_level_(context_level) { 2620 context_level_(context_level) {
2632 ASSERT(value != NULL); 2621 SetInputAt(0, value);
2633 inputs_[0] = value;
2634 } 2622 }
2635 2623
2636 DECLARE_INSTRUCTION(StoreLocal) 2624 DECLARE_INSTRUCTION(StoreLocal)
2637 virtual CompileType* ComputeInitialType() const; 2625 virtual CompileType* ComputeInitialType() const;
2638 2626
2639 const LocalVariable& local() const { return local_; } 2627 const LocalVariable& local() const { return local_; }
2640 Value* value() const { return inputs_[0]; } 2628 Value* value() const { return inputs_[0]; }
2641 intptr_t context_level() const { return context_level_; } 2629 intptr_t context_level() const { return context_level_; }
2642 2630
2643 virtual void RecordAssignedVars(BitVector* assigned_vars, 2631 virtual void RecordAssignedVars(BitVector* assigned_vars,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2692 }; 2680 };
2693 2681
2694 2682
2695 class StoreInstanceFieldInstr : public TemplateDefinition<2> { 2683 class StoreInstanceFieldInstr : public TemplateDefinition<2> {
2696 public: 2684 public:
2697 StoreInstanceFieldInstr(const Field& field, 2685 StoreInstanceFieldInstr(const Field& field,
2698 Value* instance, 2686 Value* instance,
2699 Value* value, 2687 Value* value,
2700 bool emit_store_barrier) 2688 bool emit_store_barrier)
2701 : field_(field), emit_store_barrier_(emit_store_barrier) { 2689 : field_(field), emit_store_barrier_(emit_store_barrier) {
2702 ASSERT(instance != NULL); 2690 SetInputAt(0, instance);
2703 ASSERT(value != NULL); 2691 SetInputAt(1, value);
2704 inputs_[0] = instance;
2705 inputs_[1] = value;
2706 } 2692 }
2707 2693
2708 DECLARE_INSTRUCTION(StoreInstanceField) 2694 DECLARE_INSTRUCTION(StoreInstanceField)
2709 virtual CompileType* ComputeInitialType() const; 2695 virtual CompileType* ComputeInitialType() const;
2710 2696
2711 const Field& field() const { return field_; } 2697 const Field& field() const { return field_; }
2712 2698
2713 Value* instance() const { return inputs_[0]; } 2699 Value* instance() const { return inputs_[0]; }
2714 Value* value() const { return inputs_[1]; } 2700 Value* value() const { return inputs_[1]; }
2715 bool ShouldEmitStoreBarrier() const { 2701 bool ShouldEmitStoreBarrier() const {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2753 2739
2754 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); 2740 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr);
2755 }; 2741 };
2756 2742
2757 2743
2758 class StoreStaticFieldInstr : public TemplateDefinition<1> { 2744 class StoreStaticFieldInstr : public TemplateDefinition<1> {
2759 public: 2745 public:
2760 StoreStaticFieldInstr(const Field& field, Value* value) 2746 StoreStaticFieldInstr(const Field& field, Value* value)
2761 : field_(field) { 2747 : field_(field) {
2762 ASSERT(field.IsZoneHandle()); 2748 ASSERT(field.IsZoneHandle());
2763 ASSERT(value != NULL); 2749 SetInputAt(0, value);
2764 inputs_[0] = value;
2765 } 2750 }
2766 2751
2767 DECLARE_INSTRUCTION(StoreStaticField); 2752 DECLARE_INSTRUCTION(StoreStaticField);
2768 virtual CompileType* ComputeInitialType() const; 2753 virtual CompileType* ComputeInitialType() const;
2769 2754
2770 const Field& field() const { return field_; } 2755 const Field& field() const { return field_; }
2771 Value* value() const { return inputs_[0]; } 2756 Value* value() const { return inputs_[0]; }
2772 2757
2773 virtual void PrintOperandsTo(BufferFormatter* f) const; 2758 virtual void PrintOperandsTo(BufferFormatter* f) const;
2774 2759
2775 virtual bool CanDeoptimize() const { return false; } 2760 virtual bool CanDeoptimize() const { return false; }
2776 2761
2777 virtual bool HasSideEffect() const { return true; } 2762 virtual bool HasSideEffect() const { return true; }
2778 2763
2779 private: 2764 private:
2780 const Field& field_; 2765 const Field& field_;
2781 2766
2782 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); 2767 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr);
2783 }; 2768 };
2784 2769
2785 2770
2786 class LoadIndexedInstr : public TemplateDefinition<2> { 2771 class LoadIndexedInstr : public TemplateDefinition<2> {
2787 public: 2772 public:
2788 LoadIndexedInstr(Value* array, 2773 LoadIndexedInstr(Value* array,
2789 Value* index, 2774 Value* index,
2790 intptr_t index_scale, 2775 intptr_t index_scale,
2791 intptr_t class_id, 2776 intptr_t class_id,
2792 intptr_t deopt_id) 2777 intptr_t deopt_id)
2793 : index_scale_(index_scale), class_id_(class_id) { 2778 : index_scale_(index_scale), class_id_(class_id) {
2794 ASSERT(array != NULL); 2779 SetInputAt(0, array);
2795 ASSERT(index != NULL); 2780 SetInputAt(1, index);
2796 inputs_[0] = array;
2797 inputs_[1] = index;
2798 deopt_id_ = deopt_id; 2781 deopt_id_ = deopt_id;
2799 } 2782 }
2800 2783
2801 DECLARE_INSTRUCTION(LoadIndexed) 2784 DECLARE_INSTRUCTION(LoadIndexed)
2802 virtual CompileType* ComputeInitialType() const; 2785 virtual CompileType* ComputeInitialType() const;
2803 2786
2804 Value* array() const { return inputs_[0]; } 2787 Value* array() const { return inputs_[0]; }
2805 Value* index() const { return inputs_[1]; } 2788 Value* index() const { return inputs_[1]; }
2806 intptr_t index_scale() const { return index_scale_; } 2789 intptr_t index_scale() const { return index_scale_; }
2807 intptr_t class_id() const { return class_id_; } 2790 intptr_t class_id() const { return class_id_; }
(...skipping 15 matching lines...) Expand all
2823 private: 2806 private:
2824 const intptr_t index_scale_; 2807 const intptr_t index_scale_;
2825 const intptr_t class_id_; 2808 const intptr_t class_id_;
2826 2809
2827 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); 2810 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr);
2828 }; 2811 };
2829 2812
2830 2813
2831 class StringFromCharCodeInstr : public TemplateDefinition<1> { 2814 class StringFromCharCodeInstr : public TemplateDefinition<1> {
2832 public: 2815 public:
2833 explicit StringFromCharCodeInstr(Value* char_code, 2816 StringFromCharCodeInstr(Value* char_code, intptr_t cid) : cid_(cid) {
2834 intptr_t cid) : cid_(cid) {
2835 ASSERT(char_code != NULL); 2817 ASSERT(char_code != NULL);
2836 ASSERT(char_code->definition()->IsLoadIndexed() && 2818 ASSERT(char_code->definition()->IsLoadIndexed() &&
2837 (char_code->definition()->AsLoadIndexed()->class_id() == 2819 (char_code->definition()->AsLoadIndexed()->class_id() ==
2838 kOneByteStringCid)); 2820 kOneByteStringCid));
2839 inputs_[0] = char_code; 2821 SetInputAt(0, char_code);
2840 } 2822 }
2841 2823
2842 DECLARE_INSTRUCTION(StringFromCharCode) 2824 DECLARE_INSTRUCTION(StringFromCharCode)
2843 virtual CompileType* ComputeInitialType() const; 2825 virtual CompileType* ComputeInitialType() const;
2844 2826
2845 Value* char_code() const { return inputs_[0]; } 2827 Value* char_code() const { return inputs_[0]; }
2846 2828
2847 virtual bool CanDeoptimize() const { return false; } 2829 virtual bool CanDeoptimize() const { return false; }
2848 2830
2849 virtual bool HasSideEffect() const { return false; } 2831 virtual bool HasSideEffect() const { return false; }
(...skipping 13 matching lines...) Expand all
2863 public: 2845 public:
2864 StoreIndexedInstr(Value* array, 2846 StoreIndexedInstr(Value* array,
2865 Value* index, 2847 Value* index,
2866 Value* value, 2848 Value* value,
2867 bool emit_store_barrier, 2849 bool emit_store_barrier,
2868 intptr_t class_id, 2850 intptr_t class_id,
2869 intptr_t deopt_id) 2851 intptr_t deopt_id)
2870 : emit_store_barrier_(emit_store_barrier), 2852 : emit_store_barrier_(emit_store_barrier),
2871 class_id_(class_id), 2853 class_id_(class_id),
2872 deopt_id_(deopt_id) { 2854 deopt_id_(deopt_id) {
2873 ASSERT(array != NULL); 2855 SetInputAt(0, array);
2874 ASSERT(index != NULL); 2856 SetInputAt(1, index);
2875 ASSERT(value != NULL); 2857 SetInputAt(2, value);
2876 inputs_[0] = array;
2877 inputs_[1] = index;
2878 inputs_[2] = value;
2879 } 2858 }
2880 2859
2881 DECLARE_INSTRUCTION(StoreIndexed) 2860 DECLARE_INSTRUCTION(StoreIndexed)
2882 2861
2883 Value* array() const { return inputs_[0]; } 2862 Value* array() const { return inputs_[0]; }
2884 Value* index() const { return inputs_[1]; } 2863 Value* index() const { return inputs_[1]; }
2885 Value* value() const { return inputs_[2]; } 2864 Value* value() const { return inputs_[2]; }
2886 intptr_t class_id() const { return class_id_; } 2865 intptr_t class_id() const { return class_id_; }
2887 2866
2888 bool ShouldEmitStoreBarrier() const { 2867 bool ShouldEmitStoreBarrier() const {
(...skipping 18 matching lines...) Expand all
2907 const intptr_t deopt_id_; 2886 const intptr_t deopt_id_;
2908 2887
2909 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); 2888 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr);
2910 }; 2889 };
2911 2890
2912 2891
2913 // Note overrideable, built-in: value? false : true. 2892 // Note overrideable, built-in: value? false : true.
2914 class BooleanNegateInstr : public TemplateDefinition<1> { 2893 class BooleanNegateInstr : public TemplateDefinition<1> {
2915 public: 2894 public:
2916 explicit BooleanNegateInstr(Value* value) { 2895 explicit BooleanNegateInstr(Value* value) {
2917 ASSERT(value != NULL); 2896 SetInputAt(0, value);
2918 inputs_[0] = value;
2919 } 2897 }
2920 2898
2921 DECLARE_INSTRUCTION(BooleanNegate) 2899 DECLARE_INSTRUCTION(BooleanNegate)
2922 virtual CompileType* ComputeInitialType() const; 2900 virtual CompileType* ComputeInitialType() const;
2923 2901
2924 Value* value() const { return inputs_[0]; } 2902 Value* value() const { return inputs_[0]; }
2925 2903
2926 virtual bool CanDeoptimize() const { return false; } 2904 virtual bool CanDeoptimize() const { return false; }
2927 2905
2928 virtual bool HasSideEffect() const { return false; } 2906 virtual bool HasSideEffect() const { return false; }
2929 2907
2930 private: 2908 private:
2931 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); 2909 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr);
2932 }; 2910 };
2933 2911
2934 2912
2935 class InstanceOfInstr : public TemplateDefinition<3> { 2913 class InstanceOfInstr : public TemplateDefinition<3> {
2936 public: 2914 public:
2937 InstanceOfInstr(intptr_t token_pos, 2915 InstanceOfInstr(intptr_t token_pos,
2938 Value* value, 2916 Value* value,
2939 Value* instantiator, 2917 Value* instantiator,
2940 Value* instantiator_type_arguments, 2918 Value* instantiator_type_arguments,
2941 const AbstractType& type, 2919 const AbstractType& type,
2942 bool negate_result) 2920 bool negate_result)
2943 : token_pos_(token_pos), 2921 : token_pos_(token_pos),
2944 type_(type), 2922 type_(type),
2945 negate_result_(negate_result) { 2923 negate_result_(negate_result) {
2946 ASSERT(value != NULL);
2947 ASSERT(instantiator != NULL);
2948 ASSERT(instantiator_type_arguments != NULL);
2949 ASSERT(!type.IsNull()); 2924 ASSERT(!type.IsNull());
2950 inputs_[0] = value; 2925 SetInputAt(0, value);
2951 inputs_[1] = instantiator; 2926 SetInputAt(1, instantiator);
2952 inputs_[2] = instantiator_type_arguments; 2927 SetInputAt(2, instantiator_type_arguments);
2953 } 2928 }
2954 2929
2955 DECLARE_INSTRUCTION(InstanceOf) 2930 DECLARE_INSTRUCTION(InstanceOf)
2956 virtual CompileType* ComputeInitialType() const; 2931 virtual CompileType* ComputeInitialType() const;
2957 2932
2958 Value* value() const { return inputs_[0]; } 2933 Value* value() const { return inputs_[0]; }
2959 Value* instantiator() const { return inputs_[1]; } 2934 Value* instantiator() const { return inputs_[1]; }
2960 Value* instantiator_type_arguments() const { return inputs_[2]; } 2935 Value* instantiator_type_arguments() const { return inputs_[2]; }
2961 2936
2962 bool negate_result() const { return negate_result_; } 2937 bool negate_result() const { return negate_result_; }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3017 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr); 2992 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr);
3018 }; 2993 };
3019 2994
3020 2995
3021 class AllocateObjectWithBoundsCheckInstr : public TemplateDefinition<2> { 2996 class AllocateObjectWithBoundsCheckInstr : public TemplateDefinition<2> {
3022 public: 2997 public:
3023 AllocateObjectWithBoundsCheckInstr(ConstructorCallNode* node, 2998 AllocateObjectWithBoundsCheckInstr(ConstructorCallNode* node,
3024 Value* type_arguments, 2999 Value* type_arguments,
3025 Value* instantiator) 3000 Value* instantiator)
3026 : ast_node_(*node) { 3001 : ast_node_(*node) {
3027 ASSERT(type_arguments != NULL); 3002 SetInputAt(0, type_arguments);
3028 ASSERT(instantiator != NULL); 3003 SetInputAt(1, instantiator);
3029 inputs_[0] = type_arguments;
3030 inputs_[1] = instantiator;
3031 } 3004 }
3032 3005
3033 DECLARE_INSTRUCTION(AllocateObjectWithBoundsCheck) 3006 DECLARE_INSTRUCTION(AllocateObjectWithBoundsCheck)
3034 3007
3035 const Function& constructor() const { return ast_node_.constructor(); } 3008 const Function& constructor() const { return ast_node_.constructor(); }
3036 intptr_t token_pos() const { return ast_node_.token_pos(); } 3009 intptr_t token_pos() const { return ast_node_.token_pos(); }
3037 3010
3038 virtual void PrintOperandsTo(BufferFormatter* f) const; 3011 virtual void PrintOperandsTo(BufferFormatter* f) const;
3039 3012
3040 virtual bool CanDeoptimize() const { return true; } 3013 virtual bool CanDeoptimize() const { return true; }
3041 3014
3042 virtual bool HasSideEffect() const { return true; } 3015 virtual bool HasSideEffect() const { return true; }
3043 3016
3044 private: 3017 private:
3045 const ConstructorCallNode& ast_node_; 3018 const ConstructorCallNode& ast_node_;
3046 3019
3047 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckInstr); 3020 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckInstr);
3048 }; 3021 };
3049 3022
3050 3023
3051 class CreateArrayInstr : public TemplateDefinition<1> { 3024 class CreateArrayInstr : public TemplateDefinition<1> {
3052 public: 3025 public:
3053 CreateArrayInstr(intptr_t token_pos, 3026 CreateArrayInstr(intptr_t token_pos,
3054 intptr_t num_elements, 3027 intptr_t num_elements,
3055 const AbstractType& type, 3028 const AbstractType& type,
3056 Value* element_type) 3029 Value* element_type)
3057 : token_pos_(token_pos), 3030 : token_pos_(token_pos),
3058 num_elements_(num_elements), 3031 num_elements_(num_elements),
3059 type_(type) { 3032 type_(type) {
3060 #if defined(DEBUG)
3061 ASSERT(element_type != NULL);
3062 ASSERT(type_.IsZoneHandle()); 3033 ASSERT(type_.IsZoneHandle());
3063 ASSERT(!type_.IsNull()); 3034 ASSERT(!type_.IsNull());
3064 ASSERT(type_.IsFinalized()); 3035 ASSERT(type_.IsFinalized());
3065 #endif 3036 SetInputAt(0, element_type);
3066 inputs_[0] = element_type;
3067 } 3037 }
3068 3038
3069 DECLARE_INSTRUCTION(CreateArray) 3039 DECLARE_INSTRUCTION(CreateArray)
3070 virtual CompileType* ComputeInitialType() const; 3040 virtual CompileType* ComputeInitialType() const;
3071 3041
3072 intptr_t num_elements() const { return num_elements_; } 3042 intptr_t num_elements() const { return num_elements_; }
3073 3043
3074 intptr_t token_pos() const { return token_pos_; } 3044 intptr_t token_pos() const { return token_pos_; }
3075 const AbstractType& type() const { return type_; } 3045 const AbstractType& type() const { return type_; }
3076 Value* element_type() const { return inputs_[0]; } 3046 Value* element_type() const { return inputs_[0]; }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3129 public: 3099 public:
3130 LoadFieldInstr(Value* value, 3100 LoadFieldInstr(Value* value,
3131 intptr_t offset_in_bytes, 3101 intptr_t offset_in_bytes,
3132 const AbstractType& type, 3102 const AbstractType& type,
3133 bool immutable = false) 3103 bool immutable = false)
3134 : offset_in_bytes_(offset_in_bytes), 3104 : offset_in_bytes_(offset_in_bytes),
3135 type_(type), 3105 type_(type),
3136 result_cid_(kDynamicCid), 3106 result_cid_(kDynamicCid),
3137 immutable_(immutable), 3107 immutable_(immutable),
3138 recognized_kind_(MethodRecognizer::kUnknown) { 3108 recognized_kind_(MethodRecognizer::kUnknown) {
3139 ASSERT(value != NULL);
3140 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. 3109 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance.
3141 inputs_[0] = value; 3110 SetInputAt(0, value);
3142 } 3111 }
3143 3112
3144 DECLARE_INSTRUCTION(LoadField) 3113 DECLARE_INSTRUCTION(LoadField)
3145 virtual CompileType* ComputeInitialType() const; 3114 virtual CompileType* ComputeInitialType() const;
3146 3115
3147 Value* value() const { return inputs_[0]; } 3116 Value* value() const { return inputs_[0]; }
3148 intptr_t offset_in_bytes() const { return offset_in_bytes_; } 3117 intptr_t offset_in_bytes() const { return offset_in_bytes_; }
3149 const AbstractType& type() const { return type_; } 3118 const AbstractType& type() const { return type_; }
3150 void set_result_cid(intptr_t value) { result_cid_ = value; } 3119 void set_result_cid(intptr_t value) { result_cid_ = value; }
3151 3120
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3187 }; 3156 };
3188 3157
3189 3158
3190 class StoreVMFieldInstr : public TemplateDefinition<2> { 3159 class StoreVMFieldInstr : public TemplateDefinition<2> {
3191 public: 3160 public:
3192 StoreVMFieldInstr(Value* dest, 3161 StoreVMFieldInstr(Value* dest,
3193 intptr_t offset_in_bytes, 3162 intptr_t offset_in_bytes,
3194 Value* value, 3163 Value* value,
3195 const AbstractType& type) 3164 const AbstractType& type)
3196 : offset_in_bytes_(offset_in_bytes), type_(type) { 3165 : offset_in_bytes_(offset_in_bytes), type_(type) {
3197 ASSERT(value != NULL);
3198 ASSERT(dest != NULL);
3199 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. 3166 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance.
3200 inputs_[0] = value; 3167 SetInputAt(0, value);
3201 inputs_[1] = dest; 3168 SetInputAt(1, dest);
3202 } 3169 }
3203 3170
3204 DECLARE_INSTRUCTION(StoreVMField) 3171 DECLARE_INSTRUCTION(StoreVMField)
3205 virtual CompileType* ComputeInitialType() const; 3172 virtual CompileType* ComputeInitialType() const;
3206 3173
3207 Value* value() const { return inputs_[0]; } 3174 Value* value() const { return inputs_[0]; }
3208 Value* dest() const { return inputs_[1]; } 3175 Value* dest() const { return inputs_[1]; }
3209 intptr_t offset_in_bytes() const { return offset_in_bytes_; } 3176 intptr_t offset_in_bytes() const { return offset_in_bytes_; }
3210 const AbstractType& type() const { return type_; } 3177 const AbstractType& type() const { return type_; }
3211 3178
(...skipping 12 matching lines...) Expand all
3224 3191
3225 3192
3226 class InstantiateTypeArgumentsInstr : public TemplateDefinition<1> { 3193 class InstantiateTypeArgumentsInstr : public TemplateDefinition<1> {
3227 public: 3194 public:
3228 InstantiateTypeArgumentsInstr(intptr_t token_pos, 3195 InstantiateTypeArgumentsInstr(intptr_t token_pos,
3229 const AbstractTypeArguments& type_arguments, 3196 const AbstractTypeArguments& type_arguments,
3230 Value* instantiator) 3197 Value* instantiator)
3231 : token_pos_(token_pos), 3198 : token_pos_(token_pos),
3232 type_arguments_(type_arguments) { 3199 type_arguments_(type_arguments) {
3233 ASSERT(type_arguments.IsZoneHandle()); 3200 ASSERT(type_arguments.IsZoneHandle());
3234 ASSERT(instantiator != NULL); 3201 SetInputAt(0, instantiator);
3235 inputs_[0] = instantiator;
3236 } 3202 }
3237 3203
3238 DECLARE_INSTRUCTION(InstantiateTypeArguments) 3204 DECLARE_INSTRUCTION(InstantiateTypeArguments)
3239 3205
3240 Value* instantiator() const { return inputs_[0]; } 3206 Value* instantiator() const { return inputs_[0]; }
3241 const AbstractTypeArguments& type_arguments() const { 3207 const AbstractTypeArguments& type_arguments() const {
3242 return type_arguments_; 3208 return type_arguments_;
3243 } 3209 }
3244 intptr_t token_pos() const { return token_pos_; } 3210 intptr_t token_pos() const { return token_pos_; }
3245 3211
(...skipping 12 matching lines...) Expand all
3258 3224
3259 3225
3260 class ExtractConstructorTypeArgumentsInstr : public TemplateDefinition<1> { 3226 class ExtractConstructorTypeArgumentsInstr : public TemplateDefinition<1> {
3261 public: 3227 public:
3262 ExtractConstructorTypeArgumentsInstr( 3228 ExtractConstructorTypeArgumentsInstr(
3263 intptr_t token_pos, 3229 intptr_t token_pos,
3264 const AbstractTypeArguments& type_arguments, 3230 const AbstractTypeArguments& type_arguments,
3265 Value* instantiator) 3231 Value* instantiator)
3266 : token_pos_(token_pos), 3232 : token_pos_(token_pos),
3267 type_arguments_(type_arguments) { 3233 type_arguments_(type_arguments) {
3268 ASSERT(instantiator != NULL); 3234 SetInputAt(0, instantiator);
3269 inputs_[0] = instantiator;
3270 } 3235 }
3271 3236
3272 DECLARE_INSTRUCTION(ExtractConstructorTypeArguments) 3237 DECLARE_INSTRUCTION(ExtractConstructorTypeArguments)
3273 3238
3274 Value* instantiator() const { return inputs_[0]; } 3239 Value* instantiator() const { return inputs_[0]; }
3275 const AbstractTypeArguments& type_arguments() const { 3240 const AbstractTypeArguments& type_arguments() const {
3276 return type_arguments_; 3241 return type_arguments_;
3277 } 3242 }
3278 intptr_t token_pos() const { return token_pos_; } 3243 intptr_t token_pos() const { return token_pos_; }
3279 3244
3280 virtual void PrintOperandsTo(BufferFormatter* f) const; 3245 virtual void PrintOperandsTo(BufferFormatter* f) const;
3281 3246
3282 virtual bool CanDeoptimize() const { return false; } 3247 virtual bool CanDeoptimize() const { return false; }
3283 3248
3284 virtual bool HasSideEffect() const { return false; } 3249 virtual bool HasSideEffect() const { return false; }
3285 3250
3286 private: 3251 private:
3287 const intptr_t token_pos_; 3252 const intptr_t token_pos_;
3288 const AbstractTypeArguments& type_arguments_; 3253 const AbstractTypeArguments& type_arguments_;
3289 3254
3290 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsInstr); 3255 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsInstr);
3291 }; 3256 };
3292 3257
3293 3258
3294 class ExtractConstructorInstantiatorInstr : public TemplateDefinition<1> { 3259 class ExtractConstructorInstantiatorInstr : public TemplateDefinition<1> {
3295 public: 3260 public:
3296 ExtractConstructorInstantiatorInstr(ConstructorCallNode* ast_node, 3261 ExtractConstructorInstantiatorInstr(ConstructorCallNode* ast_node,
3297 Value* instantiator) 3262 Value* instantiator)
3298 : ast_node_(*ast_node) { 3263 : ast_node_(*ast_node) {
3299 ASSERT(instantiator != NULL); 3264 SetInputAt(0, instantiator);
3300 inputs_[0] = instantiator;
3301 } 3265 }
3302 3266
3303 DECLARE_INSTRUCTION(ExtractConstructorInstantiator) 3267 DECLARE_INSTRUCTION(ExtractConstructorInstantiator)
3304 3268
3305 Value* instantiator() const { return inputs_[0]; } 3269 Value* instantiator() const { return inputs_[0]; }
3306 const AbstractTypeArguments& type_arguments() const { 3270 const AbstractTypeArguments& type_arguments() const {
3307 return ast_node_.type_arguments(); 3271 return ast_node_.type_arguments();
3308 } 3272 }
3309 const Function& constructor() const { return ast_node_.constructor(); } 3273 const Function& constructor() const { return ast_node_.constructor(); }
3310 intptr_t token_pos() const { return ast_node_.token_pos(); } 3274 intptr_t token_pos() const { return ast_node_.token_pos(); }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3343 const intptr_t token_pos_; 3307 const intptr_t token_pos_;
3344 const intptr_t num_context_variables_; 3308 const intptr_t num_context_variables_;
3345 3309
3346 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); 3310 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr);
3347 }; 3311 };
3348 3312
3349 3313
3350 class ChainContextInstr : public TemplateInstruction<1> { 3314 class ChainContextInstr : public TemplateInstruction<1> {
3351 public: 3315 public:
3352 explicit ChainContextInstr(Value* context_value) { 3316 explicit ChainContextInstr(Value* context_value) {
3353 ASSERT(context_value != NULL); 3317 SetInputAt(0, context_value);
3354 inputs_[0] = context_value;
3355 } 3318 }
3356 3319
3357 DECLARE_INSTRUCTION(ChainContext) 3320 DECLARE_INSTRUCTION(ChainContext)
3358 3321
3359 virtual intptr_t ArgumentCount() const { return 0; } 3322 virtual intptr_t ArgumentCount() const { return 0; }
3360 3323
3361 Value* context_value() const { return inputs_[0]; } 3324 Value* context_value() const { return inputs_[0]; }
3362 3325
3363 virtual bool CanDeoptimize() const { return false; } 3326 virtual bool CanDeoptimize() const { return false; }
3364 3327
3365 virtual bool HasSideEffect() const { return true; } 3328 virtual bool HasSideEffect() const { return true; }
3366 3329
3367 private: 3330 private:
3368 DISALLOW_COPY_AND_ASSIGN(ChainContextInstr); 3331 DISALLOW_COPY_AND_ASSIGN(ChainContextInstr);
3369 }; 3332 };
3370 3333
3371 3334
3372 class CloneContextInstr : public TemplateDefinition<1> { 3335 class CloneContextInstr : public TemplateDefinition<1> {
3373 public: 3336 public:
3374 CloneContextInstr(intptr_t token_pos, Value* context_value) 3337 CloneContextInstr(intptr_t token_pos, Value* context_value)
3375 : token_pos_(token_pos) { 3338 : token_pos_(token_pos) {
3376 ASSERT(context_value != NULL); 3339 SetInputAt(0, context_value);
3377 inputs_[0] = context_value;
3378 } 3340 }
3379 3341
3380 intptr_t token_pos() const { return token_pos_; } 3342 intptr_t token_pos() const { return token_pos_; }
3381 Value* context_value() const { return inputs_[0]; } 3343 Value* context_value() const { return inputs_[0]; }
3382 3344
3383 DECLARE_INSTRUCTION(CloneContext) 3345 DECLARE_INSTRUCTION(CloneContext)
3384 virtual CompileType* ComputeInitialType() const; 3346 virtual CompileType* ComputeInitialType() const;
3385 3347
3386 virtual bool CanDeoptimize() const { return true; } 3348 virtual bool CanDeoptimize() const { return true; }
3387 3349
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3419 3381
3420 DISALLOW_COPY_AND_ASSIGN(CatchEntryInstr); 3382 DISALLOW_COPY_AND_ASSIGN(CatchEntryInstr);
3421 }; 3383 };
3422 3384
3423 3385
3424 class CheckEitherNonSmiInstr : public TemplateInstruction<2> { 3386 class CheckEitherNonSmiInstr : public TemplateInstruction<2> {
3425 public: 3387 public:
3426 CheckEitherNonSmiInstr(Value* left, 3388 CheckEitherNonSmiInstr(Value* left,
3427 Value* right, 3389 Value* right,
3428 InstanceCallInstr* instance_call) { 3390 InstanceCallInstr* instance_call) {
3429 ASSERT(left != NULL); 3391 SetInputAt(0, left);
3430 ASSERT(right != NULL); 3392 SetInputAt(1, right);
3431 inputs_[0] = left;
3432 inputs_[1] = right;
3433 deopt_id_ = instance_call->deopt_id(); 3393 deopt_id_ = instance_call->deopt_id();
3434 } 3394 }
3435 3395
3436 DECLARE_INSTRUCTION(CheckEitherNonSmi) 3396 DECLARE_INSTRUCTION(CheckEitherNonSmi)
3437 3397
3438 virtual intptr_t ArgumentCount() const { return 0; } 3398 virtual intptr_t ArgumentCount() const { return 0; }
3439 3399
3440 virtual bool CanDeoptimize() const { return true; } 3400 virtual bool CanDeoptimize() const { return true; }
3441 3401
3442 virtual bool HasSideEffect() const { return false; } 3402 virtual bool HasSideEffect() const { return false; }
(...skipping 10 matching lines...) Expand all
3453 3413
3454 private: 3414 private:
3455 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr); 3415 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr);
3456 }; 3416 };
3457 3417
3458 3418
3459 class BoxDoubleInstr : public TemplateDefinition<1> { 3419 class BoxDoubleInstr : public TemplateDefinition<1> {
3460 public: 3420 public:
3461 BoxDoubleInstr(Value* value, InstanceCallInstr* instance_call) 3421 BoxDoubleInstr(Value* value, InstanceCallInstr* instance_call)
3462 : token_pos_((instance_call != NULL) ? instance_call->token_pos() : 0) { 3422 : token_pos_((instance_call != NULL) ? instance_call->token_pos() : 0) {
3463 ASSERT(value != NULL); 3423 SetInputAt(0, value);
3464 inputs_[0] = value;
3465 } 3424 }
3466 3425
3467 Value* value() const { return inputs_[0]; } 3426 Value* value() const { return inputs_[0]; }
3468 3427
3469 intptr_t token_pos() const { return token_pos_; } 3428 intptr_t token_pos() const { return token_pos_; }
3470 3429
3471 virtual bool CanDeoptimize() const { return false; } 3430 virtual bool CanDeoptimize() const { return false; }
3472 3431
3473 virtual bool HasSideEffect() const { return false; } 3432 virtual bool HasSideEffect() const { return false; }
3474 3433
(...skipping 11 matching lines...) Expand all
3486 private: 3445 private:
3487 const intptr_t token_pos_; 3446 const intptr_t token_pos_;
3488 3447
3489 DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr); 3448 DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr);
3490 }; 3449 };
3491 3450
3492 3451
3493 class BoxIntegerInstr : public TemplateDefinition<1> { 3452 class BoxIntegerInstr : public TemplateDefinition<1> {
3494 public: 3453 public:
3495 explicit BoxIntegerInstr(Value* value) { 3454 explicit BoxIntegerInstr(Value* value) {
3496 ASSERT(value != NULL); 3455 SetInputAt(0, value);
3497 inputs_[0] = value;
3498 } 3456 }
3499 3457
3500 Value* value() const { return inputs_[0]; } 3458 Value* value() const { return inputs_[0]; }
3501 3459
3502 virtual bool CanDeoptimize() const { return false; } 3460 virtual bool CanDeoptimize() const { return false; }
3503 3461
3504 virtual bool HasSideEffect() const { return false; } 3462 virtual bool HasSideEffect() const { return false; }
3505 3463
3506 virtual bool AffectedBySideEffect() const { return false; } 3464 virtual bool AffectedBySideEffect() const { return false; }
3507 virtual bool AttributesEqual(Instruction* other) const { return true; } 3465 virtual bool AttributesEqual(Instruction* other) const { return true; }
3508 3466
3509 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 3467 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3510 ASSERT(idx == 0); 3468 ASSERT(idx == 0);
3511 return kUnboxedMint; 3469 return kUnboxedMint;
3512 } 3470 }
3513 3471
3514 DECLARE_INSTRUCTION(BoxInteger) 3472 DECLARE_INSTRUCTION(BoxInteger)
3515 virtual CompileType* ComputeInitialType() const; 3473 virtual CompileType* ComputeInitialType() const;
3516 3474
3517 private: 3475 private:
3518 DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr); 3476 DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr);
3519 }; 3477 };
3520 3478
3521 3479
3522 class UnboxDoubleInstr : public TemplateDefinition<1> { 3480 class UnboxDoubleInstr : public TemplateDefinition<1> {
3523 public: 3481 public:
3524 UnboxDoubleInstr(Value* value, intptr_t deopt_id) { 3482 UnboxDoubleInstr(Value* value, intptr_t deopt_id) {
3525 ASSERT(value != NULL); 3483 SetInputAt(0, value);
3526 inputs_[0] = value;
3527 deopt_id_ = deopt_id; 3484 deopt_id_ = deopt_id;
3528 } 3485 }
3529 3486
3530 Value* value() const { return inputs_[0]; } 3487 Value* value() const { return inputs_[0]; }
3531 3488
3532 virtual bool CanDeoptimize() const { 3489 virtual bool CanDeoptimize() const {
3533 return (value()->Type()->ToCid() != kDoubleCid) 3490 return (value()->Type()->ToCid() != kDoubleCid)
3534 && (value()->Type()->ToCid() != kSmiCid); 3491 && (value()->Type()->ToCid() != kSmiCid);
3535 } 3492 }
3536 3493
(...skipping 10 matching lines...) Expand all
3547 virtual CompileType* ComputeInitialType() const; 3504 virtual CompileType* ComputeInitialType() const;
3548 3505
3549 private: 3506 private:
3550 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); 3507 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr);
3551 }; 3508 };
3552 3509
3553 3510
3554 class UnboxIntegerInstr : public TemplateDefinition<1> { 3511 class UnboxIntegerInstr : public TemplateDefinition<1> {
3555 public: 3512 public:
3556 UnboxIntegerInstr(Value* value, intptr_t deopt_id) { 3513 UnboxIntegerInstr(Value* value, intptr_t deopt_id) {
3557 ASSERT(value != NULL); 3514 SetInputAt(0, value);
3558 inputs_[0] = value;
3559 deopt_id_ = deopt_id; 3515 deopt_id_ = deopt_id;
3560 } 3516 }
3561 3517
3562 Value* value() const { return inputs_[0]; } 3518 Value* value() const { return inputs_[0]; }
3563 3519
3564 virtual bool CanDeoptimize() const { 3520 virtual bool CanDeoptimize() const {
3565 return (value()->Type()->ToCid() != kSmiCid) 3521 return (value()->Type()->ToCid() != kSmiCid)
3566 && (value()->Type()->ToCid() != kMintCid); 3522 && (value()->Type()->ToCid() != kMintCid);
3567 } 3523 }
3568 3524
(...skipping 12 matching lines...) Expand all
3581 DECLARE_INSTRUCTION(UnboxInteger) 3537 DECLARE_INSTRUCTION(UnboxInteger)
3582 3538
3583 private: 3539 private:
3584 DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr); 3540 DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr);
3585 }; 3541 };
3586 3542
3587 3543
3588 class MathSqrtInstr : public TemplateDefinition<1> { 3544 class MathSqrtInstr : public TemplateDefinition<1> {
3589 public: 3545 public:
3590 MathSqrtInstr(Value* value, StaticCallInstr* instance_call) { 3546 MathSqrtInstr(Value* value, StaticCallInstr* instance_call) {
3591 ASSERT(value != NULL); 3547 SetInputAt(0, value);
3592 inputs_[0] = value;
3593 deopt_id_ = instance_call->deopt_id(); 3548 deopt_id_ = instance_call->deopt_id();
3594 } 3549 }
3595 3550
3596 Value* value() const { return inputs_[0]; } 3551 Value* value() const { return inputs_[0]; }
3597 3552
3598 virtual bool CanDeoptimize() const { return false; } 3553 virtual bool CanDeoptimize() const { return false; }
3599 3554
3600 virtual bool HasSideEffect() const { return false; } 3555 virtual bool HasSideEffect() const { return false; }
3601 3556
3602 virtual bool AttributesEqual(Instruction* other) const { 3557 virtual bool AttributesEqual(Instruction* other) const {
(...skipping 23 matching lines...) Expand all
3626 }; 3581 };
3627 3582
3628 3583
3629 class BinaryDoubleOpInstr : public TemplateDefinition<2> { 3584 class BinaryDoubleOpInstr : public TemplateDefinition<2> {
3630 public: 3585 public:
3631 BinaryDoubleOpInstr(Token::Kind op_kind, 3586 BinaryDoubleOpInstr(Token::Kind op_kind,
3632 Value* left, 3587 Value* left,
3633 Value* right, 3588 Value* right,
3634 InstanceCallInstr* instance_call) 3589 InstanceCallInstr* instance_call)
3635 : op_kind_(op_kind) { 3590 : op_kind_(op_kind) {
3636 ASSERT(left != NULL); 3591 SetInputAt(0, left);
3637 ASSERT(right != NULL); 3592 SetInputAt(1, right);
3638 inputs_[0] = left;
3639 inputs_[1] = right;
3640 deopt_id_ = instance_call->deopt_id(); 3593 deopt_id_ = instance_call->deopt_id();
3641 } 3594 }
3642 3595
3643 Value* left() const { return inputs_[0]; } 3596 Value* left() const { return inputs_[0]; }
3644 Value* right() const { return inputs_[1]; } 3597 Value* right() const { return inputs_[1]; }
3645 3598
3646 Token::Kind op_kind() const { return op_kind_; } 3599 Token::Kind op_kind() const { return op_kind_; }
3647 3600
3648 virtual void PrintOperandsTo(BufferFormatter* f) const; 3601 virtual void PrintOperandsTo(BufferFormatter* f) const;
3649 3602
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3685 3638
3686 3639
3687 class BinaryMintOpInstr : public TemplateDefinition<2> { 3640 class BinaryMintOpInstr : public TemplateDefinition<2> {
3688 public: 3641 public:
3689 BinaryMintOpInstr(Token::Kind op_kind, 3642 BinaryMintOpInstr(Token::Kind op_kind,
3690 Value* left, 3643 Value* left,
3691 Value* right, 3644 Value* right,
3692 InstanceCallInstr* instance_call) 3645 InstanceCallInstr* instance_call)
3693 : op_kind_(op_kind), 3646 : op_kind_(op_kind),
3694 instance_call_(instance_call) { 3647 instance_call_(instance_call) {
3695 ASSERT(left != NULL); 3648 SetInputAt(0, left);
3696 ASSERT(right != NULL); 3649 SetInputAt(1, right);
3697 inputs_[0] = left;
3698 inputs_[1] = right;
3699 deopt_id_ = instance_call->deopt_id(); 3650 deopt_id_ = instance_call->deopt_id();
3700 } 3651 }
3701 3652
3702 Value* left() const { return inputs_[0]; } 3653 Value* left() const { return inputs_[0]; }
3703 Value* right() const { return inputs_[1]; } 3654 Value* right() const { return inputs_[1]; }
3704 3655
3705 Token::Kind op_kind() const { return op_kind_; } 3656 Token::Kind op_kind() const { return op_kind_; }
3706 3657
3707 InstanceCallInstr* instance_call() const { return instance_call_; } 3658 InstanceCallInstr* instance_call() const { return instance_call_; }
3708 3659
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3750 }; 3701 };
3751 3702
3752 3703
3753 class ShiftMintOpInstr : public TemplateDefinition<2> { 3704 class ShiftMintOpInstr : public TemplateDefinition<2> {
3754 public: 3705 public:
3755 ShiftMintOpInstr(Token::Kind op_kind, 3706 ShiftMintOpInstr(Token::Kind op_kind,
3756 Value* left, 3707 Value* left,
3757 Value* right, 3708 Value* right,
3758 InstanceCallInstr* instance_call) 3709 InstanceCallInstr* instance_call)
3759 : op_kind_(op_kind) { 3710 : op_kind_(op_kind) {
3760 ASSERT(left != NULL);
3761 ASSERT(right != NULL);
3762 ASSERT(op_kind == Token::kSHR || op_kind == Token::kSHL); 3711 ASSERT(op_kind == Token::kSHR || op_kind == Token::kSHL);
3763 inputs_[0] = left; 3712 SetInputAt(0, left);
3764 inputs_[1] = right; 3713 SetInputAt(1, right);
3765 deopt_id_ = instance_call->deopt_id(); 3714 deopt_id_ = instance_call->deopt_id();
3766 } 3715 }
3767 3716
3768 Value* left() const { return inputs_[0]; } 3717 Value* left() const { return inputs_[0]; }
3769 Value* right() const { return inputs_[1]; } 3718 Value* right() const { return inputs_[1]; }
3770 3719
3771 Token::Kind op_kind() const { return op_kind_; } 3720 Token::Kind op_kind() const { return op_kind_; }
3772 3721
3773 virtual void PrintOperandsTo(BufferFormatter* f) const; 3722 virtual void PrintOperandsTo(BufferFormatter* f) const;
3774 3723
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3807 DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr); 3756 DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr);
3808 }; 3757 };
3809 3758
3810 3759
3811 class UnaryMintOpInstr : public TemplateDefinition<1> { 3760 class UnaryMintOpInstr : public TemplateDefinition<1> {
3812 public: 3761 public:
3813 UnaryMintOpInstr(Token::Kind op_kind, 3762 UnaryMintOpInstr(Token::Kind op_kind,
3814 Value* value, 3763 Value* value,
3815 InstanceCallInstr* instance_call) 3764 InstanceCallInstr* instance_call)
3816 : op_kind_(op_kind) { 3765 : op_kind_(op_kind) {
3817 ASSERT(value != NULL);
3818 ASSERT(op_kind == Token::kBIT_NOT); 3766 ASSERT(op_kind == Token::kBIT_NOT);
3819 inputs_[0] = value; 3767 SetInputAt(0, value);
3820 deopt_id_ = instance_call->deopt_id(); 3768 deopt_id_ = instance_call->deopt_id();
3821 } 3769 }
3822 3770
3823 Value* value() const { return inputs_[0]; } 3771 Value* value() const { return inputs_[0]; }
3824 3772
3825 Token::Kind op_kind() const { return op_kind_; } 3773 Token::Kind op_kind() const { return op_kind_; }
3826 3774
3827 virtual void PrintOperandsTo(BufferFormatter* f) const; 3775 virtual void PrintOperandsTo(BufferFormatter* f) const;
3828 3776
3829 virtual bool CanDeoptimize() const { return false; } 3777 virtual bool CanDeoptimize() const { return false; }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3865 class BinarySmiOpInstr : public TemplateDefinition<2> { 3813 class BinarySmiOpInstr : public TemplateDefinition<2> {
3866 public: 3814 public:
3867 BinarySmiOpInstr(Token::Kind op_kind, 3815 BinarySmiOpInstr(Token::Kind op_kind,
3868 InstanceCallInstr* instance_call, 3816 InstanceCallInstr* instance_call,
3869 Value* left, 3817 Value* left,
3870 Value* right) 3818 Value* right)
3871 : op_kind_(op_kind), 3819 : op_kind_(op_kind),
3872 instance_call_(instance_call), 3820 instance_call_(instance_call),
3873 overflow_(true), 3821 overflow_(true),
3874 is_truncating_(false) { 3822 is_truncating_(false) {
3875 ASSERT(left != NULL); 3823 SetInputAt(0, left);
3876 ASSERT(right != NULL); 3824 SetInputAt(1, right);
3877 inputs_[0] = left;
3878 inputs_[1] = right;
3879 deopt_id_ = instance_call->deopt_id(); 3825 deopt_id_ = instance_call->deopt_id();
3880 } 3826 }
3881 3827
3882 Value* left() const { return inputs_[0]; } 3828 Value* left() const { return inputs_[0]; }
3883 Value* right() const { return inputs_[1]; } 3829 Value* right() const { return inputs_[1]; }
3884 3830
3885 Token::Kind op_kind() const { return op_kind_; } 3831 Token::Kind op_kind() const { return op_kind_; }
3886 3832
3887 InstanceCallInstr* instance_call() const { return instance_call_; } 3833 InstanceCallInstr* instance_call() const { return instance_call_; }
3888 3834
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3931 3877
3932 3878
3933 // Handles both Smi operations: BIT_OR and NEGATE. 3879 // Handles both Smi operations: BIT_OR and NEGATE.
3934 class UnarySmiOpInstr : public TemplateDefinition<1> { 3880 class UnarySmiOpInstr : public TemplateDefinition<1> {
3935 public: 3881 public:
3936 UnarySmiOpInstr(Token::Kind op_kind, 3882 UnarySmiOpInstr(Token::Kind op_kind,
3937 InstanceCallInstr* instance_call, 3883 InstanceCallInstr* instance_call,
3938 Value* value) 3884 Value* value)
3939 : op_kind_(op_kind) { 3885 : op_kind_(op_kind) {
3940 ASSERT((op_kind == Token::kNEGATE) || (op_kind == Token::kBIT_NOT)); 3886 ASSERT((op_kind == Token::kNEGATE) || (op_kind == Token::kBIT_NOT));
3941 ASSERT(value != NULL); 3887 SetInputAt(0, value);
3942 inputs_[0] = value;
3943 deopt_id_ = instance_call->deopt_id(); 3888 deopt_id_ = instance_call->deopt_id();
3944 } 3889 }
3945 3890
3946 Value* value() const { return inputs_[0]; } 3891 Value* value() const { return inputs_[0]; }
3947 Token::Kind op_kind() const { return op_kind_; } 3892 Token::Kind op_kind() const { return op_kind_; }
3948 3893
3949 virtual void PrintOperandsTo(BufferFormatter* f) const; 3894 virtual void PrintOperandsTo(BufferFormatter* f) const;
3950 3895
3951 DECLARE_INSTRUCTION(UnarySmiOp) 3896 DECLARE_INSTRUCTION(UnarySmiOp)
3952 virtual CompileType* ComputeInitialType() const; 3897 virtual CompileType* ComputeInitialType() const;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
4004 InstanceCallInstr* instance_call_; 3949 InstanceCallInstr* instance_call_;
4005 3950
4006 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); 3951 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr);
4007 }; 3952 };
4008 3953
4009 3954
4010 class DoubleToIntegerInstr : public TemplateDefinition<1> { 3955 class DoubleToIntegerInstr : public TemplateDefinition<1> {
4011 public: 3956 public:
4012 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) 3957 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call)
4013 : instance_call_(instance_call) { 3958 : instance_call_(instance_call) {
4014 ASSERT(value != NULL); 3959 SetInputAt(0, value);
4015 inputs_[0] = value;
4016 } 3960 }
4017 3961
4018 Value* value() const { return inputs_[0]; } 3962 Value* value() const { return inputs_[0]; }
4019 InstanceCallInstr* instance_call() const { return instance_call_; } 3963 InstanceCallInstr* instance_call() const { return instance_call_; }
4020 3964
4021 DECLARE_INSTRUCTION(DoubleToInteger) 3965 DECLARE_INSTRUCTION(DoubleToInteger)
4022 virtual CompileType* ComputeInitialType() const; 3966 virtual CompileType* ComputeInitialType() const;
4023 3967
4024 virtual intptr_t ArgumentCount() const { return 1; } 3968 virtual intptr_t ArgumentCount() const { return 1; }
4025 3969
4026 virtual bool CanDeoptimize() const { return true; } 3970 virtual bool CanDeoptimize() const { return true; }
4027 3971
4028 virtual bool HasSideEffect() const { return false; } 3972 virtual bool HasSideEffect() const { return false; }
4029 3973
4030 private: 3974 private:
4031 InstanceCallInstr* instance_call_; 3975 InstanceCallInstr* instance_call_;
4032 3976
4033 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr); 3977 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr);
4034 }; 3978 };
4035 3979
4036 3980
4037 // Similar to 'DoubleToIntegerInstr' but expects unboxed double as input 3981 // Similar to 'DoubleToIntegerInstr' but expects unboxed double as input
4038 // and creates a Smi. 3982 // and creates a Smi.
4039 class DoubleToSmiInstr : public TemplateDefinition<1> { 3983 class DoubleToSmiInstr : public TemplateDefinition<1> {
4040 public: 3984 public:
4041 DoubleToSmiInstr(Value* value, InstanceCallInstr* instance_call) { 3985 DoubleToSmiInstr(Value* value, InstanceCallInstr* instance_call) {
4042 ASSERT(value != NULL); 3986 SetInputAt(0, value);
4043 inputs_[0] = value;
4044 deopt_id_ = instance_call->deopt_id(); 3987 deopt_id_ = instance_call->deopt_id();
4045 } 3988 }
4046 3989
4047 Value* value() const { return inputs_[0]; } 3990 Value* value() const { return inputs_[0]; }
4048 3991
4049 DECLARE_INSTRUCTION(DoubleToSmi) 3992 DECLARE_INSTRUCTION(DoubleToSmi)
4050 virtual CompileType* ComputeInitialType() const; 3993 virtual CompileType* ComputeInitialType() const;
4051 3994
4052 virtual bool CanDeoptimize() const { return true; } 3995 virtual bool CanDeoptimize() const { return true; }
4053 3996
(...skipping 10 matching lines...) Expand all
4064 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr); 4007 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr);
4065 }; 4008 };
4066 4009
4067 4010
4068 class DoubleToDoubleInstr : public TemplateDefinition<1> { 4011 class DoubleToDoubleInstr : public TemplateDefinition<1> {
4069 public: 4012 public:
4070 DoubleToDoubleInstr(Value* value, 4013 DoubleToDoubleInstr(Value* value,
4071 InstanceCallInstr* instance_call, 4014 InstanceCallInstr* instance_call,
4072 MethodRecognizer::Kind recognized_kind) 4015 MethodRecognizer::Kind recognized_kind)
4073 : recognized_kind_(recognized_kind) { 4016 : recognized_kind_(recognized_kind) {
4074 ASSERT(value != NULL); 4017 SetInputAt(0, value);
4075 inputs_[0] = value;
4076 deopt_id_ = instance_call->deopt_id(); 4018 deopt_id_ = instance_call->deopt_id();
4077 } 4019 }
4078 4020
4079 Value* value() const { return inputs_[0]; } 4021 Value* value() const { return inputs_[0]; }
4080 4022
4081 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } 4023 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; }
4082 4024
4083 DECLARE_INSTRUCTION(DoubleToDouble) 4025 DECLARE_INSTRUCTION(DoubleToDouble)
4084 virtual CompileType* ComputeInitialType() const; 4026 virtual CompileType* ComputeInitialType() const;
4085 4027
(...skipping 16 matching lines...) Expand all
4102 const MethodRecognizer::Kind recognized_kind_; 4044 const MethodRecognizer::Kind recognized_kind_;
4103 4045
4104 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr); 4046 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr);
4105 }; 4047 };
4106 4048
4107 4049
4108 class InvokeMathCFunctionInstr : public Definition { 4050 class InvokeMathCFunctionInstr : public Definition {
4109 public: 4051 public:
4110 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs, 4052 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs,
4111 InstanceCallInstr* instance_call, 4053 InstanceCallInstr* instance_call,
4112 MethodRecognizer::Kind recognized_kind) 4054 MethodRecognizer::Kind recognized_kind);
4113 : inputs_(inputs), locs_(NULL), recognized_kind_(recognized_kind) {
4114 ASSERT(inputs_->length() == ArgumentCountFor(recognized_kind_));
4115 deopt_id_ = instance_call->deopt_id();
4116 }
4117 4055
4118 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_); 4056 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_);
4119 4057
4120 const RuntimeEntry& TargetFunction() const; 4058 const RuntimeEntry& TargetFunction() const;
4121 4059
4122 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } 4060 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; }
4123 4061
4124 DECLARE_INSTRUCTION(InvokeMathCFunction) 4062 DECLARE_INSTRUCTION(InvokeMathCFunction)
4125 virtual CompileType* ComputeInitialType() const; 4063 virtual CompileType* ComputeInitialType() const;
4126 virtual void PrintOperandsTo(BufferFormatter* f) const; 4064 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 14 matching lines...) Expand all
4141 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } 4079 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
4142 4080
4143 virtual intptr_t InputCount() const { 4081 virtual intptr_t InputCount() const {
4144 return inputs_->length(); 4082 return inputs_->length();
4145 } 4083 }
4146 4084
4147 virtual Value* InputAt(intptr_t i) const { 4085 virtual Value* InputAt(intptr_t i) const {
4148 return (*inputs_)[i]; 4086 return (*inputs_)[i];
4149 } 4087 }
4150 4088
4151 virtual void SetInputAt(intptr_t i, Value* value) {
4152 ASSERT(value != NULL);
4153 (*inputs_)[i] = value;
4154 }
4155
4156 // Returns a structure describing the location constraints required 4089 // Returns a structure describing the location constraints required
4157 // to emit native code for this definition. 4090 // to emit native code for this definition.
4158 LocationSummary* locs() { 4091 LocationSummary* locs() {
4159 if (locs_ == NULL) { 4092 if (locs_ == NULL) {
4160 locs_ = MakeLocationSummary(); 4093 locs_ = MakeLocationSummary();
4161 } 4094 }
4162 return locs_; 4095 return locs_;
4163 } 4096 }
4164 4097
4165 private: 4098 private:
4099 virtual void RawSetInputAt(intptr_t i, Value* value) {
4100 (*inputs_)[i] = value;
4101 }
4102
4166 ZoneGrowableArray<Value*>* inputs_; 4103 ZoneGrowableArray<Value*>* inputs_;
4167 4104
4168 LocationSummary* locs_; 4105 LocationSummary* locs_;
4169 4106
4170 const MethodRecognizer::Kind recognized_kind_; 4107 const MethodRecognizer::Kind recognized_kind_;
4171 4108
4172 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr); 4109 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr);
4173 }; 4110 };
4174 4111
4175 4112
(...skipping 26 matching lines...) Expand all
4202 private: 4139 private:
4203 const ICData& unary_checks_; 4140 const ICData& unary_checks_;
4204 4141
4205 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); 4142 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr);
4206 }; 4143 };
4207 4144
4208 4145
4209 class CheckSmiInstr : public TemplateInstruction<1> { 4146 class CheckSmiInstr : public TemplateInstruction<1> {
4210 public: 4147 public:
4211 CheckSmiInstr(Value* value, intptr_t original_deopt_id) { 4148 CheckSmiInstr(Value* value, intptr_t original_deopt_id) {
4212 ASSERT(value != NULL);
4213 ASSERT(original_deopt_id != Isolate::kNoDeoptId); 4149 ASSERT(original_deopt_id != Isolate::kNoDeoptId);
4214 inputs_[0] = value; 4150 SetInputAt(0, value);
4215 deopt_id_ = original_deopt_id; 4151 deopt_id_ = original_deopt_id;
4216 } 4152 }
4217 4153
4218 DECLARE_INSTRUCTION(CheckSmi) 4154 DECLARE_INSTRUCTION(CheckSmi)
4219 4155
4220 virtual intptr_t ArgumentCount() const { return 0; } 4156 virtual intptr_t ArgumentCount() const { return 0; }
4221 4157
4222 virtual bool CanDeoptimize() const { return true; } 4158 virtual bool CanDeoptimize() const { return true; }
4223 4159
4224 virtual bool HasSideEffect() const { return false; } 4160 virtual bool HasSideEffect() const { return false; }
(...skipping 11 matching lines...) Expand all
4236 }; 4172 };
4237 4173
4238 4174
4239 class CheckArrayBoundInstr : public TemplateInstruction<2> { 4175 class CheckArrayBoundInstr : public TemplateInstruction<2> {
4240 public: 4176 public:
4241 CheckArrayBoundInstr(Value* length, 4177 CheckArrayBoundInstr(Value* length,
4242 Value* index, 4178 Value* index,
4243 intptr_t array_type, 4179 intptr_t array_type,
4244 InstanceCallInstr* instance_call) 4180 InstanceCallInstr* instance_call)
4245 : array_type_(array_type) { 4181 : array_type_(array_type) {
4246 ASSERT(length != NULL); 4182 SetInputAt(0, length);
4247 ASSERT(index != NULL); 4183 SetInputAt(1, index);
4248 inputs_[0] = length;
4249 inputs_[1] = index;
4250 deopt_id_ = instance_call->deopt_id(); 4184 deopt_id_ = instance_call->deopt_id();
4251 } 4185 }
4252 4186
4253 DECLARE_INSTRUCTION(CheckArrayBound) 4187 DECLARE_INSTRUCTION(CheckArrayBound)
4254 4188
4255 virtual intptr_t ArgumentCount() const { return 0; } 4189 virtual intptr_t ArgumentCount() const { return 0; }
4256 4190
4257 virtual bool CanDeoptimize() const { return true; } 4191 virtual bool CanDeoptimize() const { return true; }
4258 4192
4259 virtual bool HasSideEffect() const { return false; } 4193 virtual bool HasSideEffect() const { return false; }
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
4503 ForwardInstructionIterator* current_iterator_; 4437 ForwardInstructionIterator* current_iterator_;
4504 4438
4505 private: 4439 private:
4506 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4440 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4507 }; 4441 };
4508 4442
4509 4443
4510 } // namespace dart 4444 } // namespace dart
4511 4445
4512 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4446 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698