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

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

Issue 10880079: Emit deoptimization information at static calls (preparation for full deoptimization). … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 class Computation : public ZoneAllocated { 135 class Computation : public ZoneAllocated {
136 public: 136 public:
137 Computation() : deopt_id_(Isolate::kNoDeoptId), ic_data_(NULL), locs_(NULL) { 137 Computation() : deopt_id_(Isolate::kNoDeoptId), ic_data_(NULL), locs_(NULL) {
138 Isolate* isolate = Isolate::Current(); 138 Isolate* isolate = Isolate::Current();
139 deopt_id_ = isolate->GetNextDeoptId(); 139 deopt_id_ = isolate->GetNextDeoptId();
140 ic_data_ = isolate->GetICDataForDeoptId(deopt_id_); 140 ic_data_ = isolate->GetICDataForDeoptId(deopt_id_);
141 } 141 }
142 142
143 // Unique id used for deoptimization. 143 // Unique id used for deoptimization.
144 intptr_t deopt_id() const { return deopt_id_; } 144 intptr_t deopt_id() const {
145 ASSERT(CanDeoptimize());
146 return deopt_id_;
147 }
145 148
146 const ICData* ic_data() const { return ic_data_; } 149 const ICData* ic_data() const { return ic_data_; }
147 void set_ic_data(const ICData* value) { ic_data_ = value; } 150 void set_ic_data(const ICData* value) { ic_data_ = value; }
148 bool HasICData() const { 151 bool HasICData() const {
149 return (ic_data() != NULL) && !ic_data()->IsNull(); 152 return (ic_data() != NULL) && !ic_data()->IsNull();
150 } 153 }
151 154
152 // Visiting support. 155 // Visiting support.
153 virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr) = 0; 156 virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr) = 0;
154 157
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 bool is_eliminated() const { 555 bool is_eliminated() const {
553 return is_eliminated_; 556 return is_eliminated_;
554 } 557 }
555 void eliminate() { 558 void eliminate() {
556 ASSERT(!is_eliminated_); 559 ASSERT(!is_eliminated_);
557 is_eliminated_ = true; 560 is_eliminated_ = true;
558 } 561 }
559 562
560 virtual void PrintOperandsTo(BufferFormatter* f) const; 563 virtual void PrintOperandsTo(BufferFormatter* f) const;
561 564
562 virtual bool CanDeoptimize() const { return false; } 565 virtual bool CanDeoptimize() const { return true; }
563 virtual intptr_t ResultCid() const { return kDynamicCid; } 566 virtual intptr_t ResultCid() const { return kDynamicCid; }
564 567
565 private: 568 private:
566 const intptr_t token_pos_; 569 const intptr_t token_pos_;
567 const intptr_t try_index_; 570 const intptr_t try_index_;
568 const AbstractType& dst_type_; 571 const AbstractType& dst_type_;
569 const String& dst_name_; 572 const String& dst_name_;
570 bool is_eliminated_; 573 bool is_eliminated_;
571 574
572 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp); 575 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp);
(...skipping 21 matching lines...) Expand all
594 bool is_eliminated() const { 597 bool is_eliminated() const {
595 return is_eliminated_; 598 return is_eliminated_;
596 } 599 }
597 void eliminate() { 600 void eliminate() {
598 ASSERT(!is_eliminated_); 601 ASSERT(!is_eliminated_);
599 is_eliminated_ = true; 602 is_eliminated_ = true;
600 } 603 }
601 604
602 virtual void PrintOperandsTo(BufferFormatter* f) const; 605 virtual void PrintOperandsTo(BufferFormatter* f) const;
603 606
604 virtual bool CanDeoptimize() const { return false; } 607 virtual bool CanDeoptimize() const { return true; }
605 virtual intptr_t ResultCid() const { return kBoolCid; } 608 virtual intptr_t ResultCid() const { return kBoolCid; }
606 609
607 private: 610 private:
608 const intptr_t token_pos_; 611 const intptr_t token_pos_;
609 const intptr_t try_index_; 612 const intptr_t try_index_;
610 bool is_eliminated_; 613 bool is_eliminated_;
611 614
612 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp); 615 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp);
613 }; 616 };
614 617
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 Token::Kind token_kind() const { return token_kind_; } 720 Token::Kind token_kind() const { return token_kind_; }
718 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 721 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
719 PushArgumentInstr* ArgumentAt(intptr_t index) const { 722 PushArgumentInstr* ArgumentAt(intptr_t index) const {
720 return (*arguments_)[index]; 723 return (*arguments_)[index];
721 } 724 }
722 const Array& argument_names() const { return argument_names_; } 725 const Array& argument_names() const { return argument_names_; }
723 intptr_t checked_argument_count() const { return checked_argument_count_; } 726 intptr_t checked_argument_count() const { return checked_argument_count_; }
724 727
725 virtual void PrintOperandsTo(BufferFormatter* f) const; 728 virtual void PrintOperandsTo(BufferFormatter* f) const;
726 729
727 virtual bool CanDeoptimize() const { return false; } 730 virtual bool CanDeoptimize() const { return true; }
728 virtual intptr_t ResultCid() const { return kDynamicCid; } 731 virtual intptr_t ResultCid() const { return kDynamicCid; }
729 732
730 private: 733 private:
731 const intptr_t token_pos_; 734 const intptr_t token_pos_;
732 const intptr_t try_index_; 735 const intptr_t try_index_;
733 const String& function_name_; 736 const String& function_name_;
734 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. 737 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL.
735 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; 738 ZoneGrowableArray<PushArgumentInstr*>* const arguments_;
736 const Array& argument_names_; 739 const Array& argument_names_;
737 const intptr_t checked_argument_count_; 740 const intptr_t checked_argument_count_;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 921 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
919 PushArgumentInstr* ArgumentAt(intptr_t index) const { 922 PushArgumentInstr* ArgumentAt(intptr_t index) const {
920 return (*arguments_)[index]; 923 return (*arguments_)[index];
921 } 924 }
922 925
923 MethodRecognizer::Kind recognized() const { return recognized_; } 926 MethodRecognizer::Kind recognized() const { return recognized_; }
924 void set_recognized(MethodRecognizer::Kind kind) { recognized_ = kind; } 927 void set_recognized(MethodRecognizer::Kind kind) { recognized_ = kind; }
925 928
926 virtual void PrintOperandsTo(BufferFormatter* f) const; 929 virtual void PrintOperandsTo(BufferFormatter* f) const;
927 930
928 virtual bool CanDeoptimize() const { return false; } 931 virtual bool CanDeoptimize() const { return true; }
929 virtual intptr_t ResultCid() const { return kDynamicCid; } 932 virtual intptr_t ResultCid() const { return kDynamicCid; }
930 933
931 private: 934 private:
932 const intptr_t token_pos_; 935 const intptr_t token_pos_;
933 const intptr_t try_index_; 936 const intptr_t try_index_;
934 const Function& function_; 937 const Function& function_;
935 const Array& argument_names_; 938 const Array& argument_names_;
936 ZoneGrowableArray<PushArgumentInstr*>* arguments_; 939 ZoneGrowableArray<PushArgumentInstr*>* arguments_;
937 MethodRecognizer::Kind recognized_; 940 MethodRecognizer::Kind recognized_;
938 941
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 Value* instantiator() const { return inputs_[1]; } 1262 Value* instantiator() const { return inputs_[1]; }
1260 Value* instantiator_type_arguments() const { return inputs_[2]; } 1263 Value* instantiator_type_arguments() const { return inputs_[2]; }
1261 1264
1262 bool negate_result() const { return negate_result_; } 1265 bool negate_result() const { return negate_result_; }
1263 const AbstractType& type() const { return type_; } 1266 const AbstractType& type() const { return type_; }
1264 intptr_t token_pos() const { return token_pos_; } 1267 intptr_t token_pos() const { return token_pos_; }
1265 intptr_t try_index() const { return try_index_; } 1268 intptr_t try_index() const { return try_index_; }
1266 1269
1267 virtual void PrintOperandsTo(BufferFormatter* f) const; 1270 virtual void PrintOperandsTo(BufferFormatter* f) const;
1268 1271
1269 virtual bool CanDeoptimize() const { return false; } 1272 virtual bool CanDeoptimize() const { return true; }
1270 virtual intptr_t ResultCid() const { return kBoolCid; } 1273 virtual intptr_t ResultCid() const { return kBoolCid; }
1271 1274
1272 private: 1275 private:
1273 const intptr_t token_pos_; 1276 const intptr_t token_pos_;
1274 const intptr_t try_index_; 1277 const intptr_t try_index_;
1275 Value* value_; 1278 Value* value_;
1276 Value* instantiator_; 1279 Value* instantiator_;
1277 Value* type_arguments_; 1280 Value* type_arguments_;
1278 const AbstractType& type_; 1281 const AbstractType& type_;
1279 const bool negate_result_; 1282 const bool negate_result_;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 } 1334 }
1332 1335
1333 DECLARE_COMPUTATION(AllocateObjectWithBoundsCheck) 1336 DECLARE_COMPUTATION(AllocateObjectWithBoundsCheck)
1334 1337
1335 const Function& constructor() const { return ast_node_.constructor(); } 1338 const Function& constructor() const { return ast_node_.constructor(); }
1336 intptr_t token_pos() const { return ast_node_.token_pos(); } 1339 intptr_t token_pos() const { return ast_node_.token_pos(); }
1337 intptr_t try_index() const { return try_index_; } 1340 intptr_t try_index() const { return try_index_; }
1338 1341
1339 virtual void PrintOperandsTo(BufferFormatter* f) const; 1342 virtual void PrintOperandsTo(BufferFormatter* f) const;
1340 1343
1341 virtual bool CanDeoptimize() const { return false; } 1344 virtual bool CanDeoptimize() const { return true; }
1342 virtual intptr_t ResultCid() const { return kDynamicCid; } 1345 virtual intptr_t ResultCid() const { return kDynamicCid; }
1343 1346
1344 private: 1347 private:
1345 const ConstructorCallNode& ast_node_; 1348 const ConstructorCallNode& ast_node_;
1346 const intptr_t try_index_; 1349 const intptr_t try_index_;
1347 1350
1348 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp); 1351 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp);
1349 }; 1352 };
1350 1353
1351 1354
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 1525
1523 Value* instantiator() const { return inputs_[0]; } 1526 Value* instantiator() const { return inputs_[0]; }
1524 const AbstractTypeArguments& type_arguments() const { 1527 const AbstractTypeArguments& type_arguments() const {
1525 return type_arguments_; 1528 return type_arguments_;
1526 } 1529 }
1527 intptr_t token_pos() const { return token_pos_; } 1530 intptr_t token_pos() const { return token_pos_; }
1528 intptr_t try_index() const { return try_index_; } 1531 intptr_t try_index() const { return try_index_; }
1529 1532
1530 virtual void PrintOperandsTo(BufferFormatter* f) const; 1533 virtual void PrintOperandsTo(BufferFormatter* f) const;
1531 1534
1532 virtual bool CanDeoptimize() const { return false; } 1535 virtual bool CanDeoptimize() const { return true; }
1533 virtual intptr_t ResultCid() const { return kDynamicCid; } 1536 virtual intptr_t ResultCid() const { return kDynamicCid; }
1534 1537
1535 private: 1538 private:
1536 const intptr_t token_pos_; 1539 const intptr_t token_pos_;
1537 const intptr_t try_index_; 1540 const intptr_t try_index_;
1538 const AbstractTypeArguments& type_arguments_; 1541 const AbstractTypeArguments& type_arguments_;
1539 1542
1540 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsComp); 1543 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsComp);
1541 }; 1544 };
1542 1545
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 ASSERT(context_value != NULL); 1667 ASSERT(context_value != NULL);
1665 inputs_[0] = context_value; 1668 inputs_[0] = context_value;
1666 } 1669 }
1667 1670
1668 intptr_t token_pos() const { return token_pos_; } 1671 intptr_t token_pos() const { return token_pos_; }
1669 intptr_t try_index() const { return try_index_; } 1672 intptr_t try_index() const { return try_index_; }
1670 Value* context_value() const { return inputs_[0]; } 1673 Value* context_value() const { return inputs_[0]; }
1671 1674
1672 DECLARE_COMPUTATION(CloneContext) 1675 DECLARE_COMPUTATION(CloneContext)
1673 1676
1674 virtual bool CanDeoptimize() const { return false; } 1677 virtual bool CanDeoptimize() const { return true; }
1675 virtual intptr_t ResultCid() const { return kIllegalCid; } 1678 virtual intptr_t ResultCid() const { return kIllegalCid; }
1676 1679
1677 private: 1680 private:
1678 const intptr_t token_pos_; 1681 const intptr_t token_pos_;
1679 const intptr_t try_index_; 1682 const intptr_t try_index_;
1680 1683
1681 DISALLOW_COPY_AND_ASSIGN(CloneContextComp); 1684 DISALLOW_COPY_AND_ASSIGN(CloneContextComp);
1682 }; 1685 };
1683 1686
1684 1687
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1988 public: 1991 public:
1989 CheckStackOverflowComp(intptr_t token_pos, intptr_t try_index) 1992 CheckStackOverflowComp(intptr_t token_pos, intptr_t try_index)
1990 : token_pos_(token_pos), 1993 : token_pos_(token_pos),
1991 try_index_(try_index) {} 1994 try_index_(try_index) {}
1992 1995
1993 intptr_t token_pos() const { return token_pos_; } 1996 intptr_t token_pos() const { return token_pos_; }
1994 intptr_t try_index() const { return try_index_; } 1997 intptr_t try_index() const { return try_index_; }
1995 1998
1996 DECLARE_COMPUTATION(CheckStackOverflow) 1999 DECLARE_COMPUTATION(CheckStackOverflow)
1997 2000
1998 virtual bool CanDeoptimize() const { return false; } 2001 virtual bool CanDeoptimize() const { return true; }
1999 virtual intptr_t ResultCid() const { return kIllegalCid; } 2002 virtual intptr_t ResultCid() const { return kIllegalCid; }
2000 2003
2001 private: 2004 private:
2002 const intptr_t token_pos_; 2005 const intptr_t token_pos_;
2003 const intptr_t try_index_; 2006 const intptr_t try_index_;
2004 2007
2005 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowComp); 2008 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowComp);
2006 }; 2009 };
2007 2010
2008 2011
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after
3390 ForwardInstructionIterator* current_iterator_; 3393 ForwardInstructionIterator* current_iterator_;
3391 3394
3392 private: 3395 private:
3393 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 3396 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
3394 }; 3397 };
3395 3398
3396 3399
3397 } // namespace dart 3400 } // namespace dart
3398 3401
3399 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 3402 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698