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

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

Issue 806973002: Cleanup access to Instruction's fields (especially deopt_id_). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 env_(NULL), 612 env_(NULL),
613 locs_(NULL), 613 locs_(NULL),
614 place_id_(kNoPlaceId) { } 614 place_id_(kNoPlaceId) { }
615 615
616 virtual ~Instruction() { } 616 virtual ~Instruction() { }
617 617
618 virtual Tag tag() const = 0; 618 virtual Tag tag() const = 0;
619 619
620 intptr_t deopt_id() const { 620 intptr_t deopt_id() const {
621 ASSERT(CanDeoptimize() || CanBecomeDeoptimizationTarget()); 621 ASSERT(CanDeoptimize() || CanBecomeDeoptimizationTarget());
622 return deopt_id_; 622 return GetDeoptId();
623 } 623 }
624 624
625 const ICData* GetICData( 625 const ICData* GetICData(
626 const ZoneGrowableArray<const ICData*>& ic_data_array) const; 626 const ZoneGrowableArray<const ICData*>& ic_data_array) const;
627 627
628 virtual intptr_t token_pos() const { return Scanner::kNoSourcePos; } 628 virtual intptr_t token_pos() const { return Scanner::kNoSourcePos; }
629 629
630 virtual intptr_t InputCount() const = 0; 630 virtual intptr_t InputCount() const = 0;
631 virtual Value* InputAt(intptr_t i) const = 0; 631 virtual Value* InputAt(intptr_t i) const = 0;
632 void SetInputAt(intptr_t i, Value* value) { 632 void SetInputAt(intptr_t i, Value* value) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 710
711 DECLARE_INSTRUCTION_TYPE_CHECK(Definition, Definition) 711 DECLARE_INSTRUCTION_TYPE_CHECK(Definition, Definition)
712 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) 712 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK)
713 FOR_EACH_ABSTRACT_INSTRUCTION(INSTRUCTION_TYPE_CHECK) 713 FOR_EACH_ABSTRACT_INSTRUCTION(INSTRUCTION_TYPE_CHECK)
714 714
715 #undef INSTRUCTION_TYPE_CHECK 715 #undef INSTRUCTION_TYPE_CHECK
716 #undef DECLARE_INSTRUCTION_TYPE_CHECK 716 #undef DECLARE_INSTRUCTION_TYPE_CHECK
717 717
718 // Returns structure describing location constraints required 718 // Returns structure describing location constraints required
719 // to emit native code for this instruction. 719 // to emit native code for this instruction.
720 virtual LocationSummary* locs() { 720 LocationSummary* locs() {
721 ASSERT(locs_ != NULL); 721 ASSERT(locs_ != NULL);
722 return locs_; 722 return locs_;
723 } 723 }
724 724
725 bool HasLocs() const { return locs_ != NULL; }
726
725 virtual LocationSummary* MakeLocationSummary(Isolate* isolate, 727 virtual LocationSummary* MakeLocationSummary(Isolate* isolate,
726 bool is_optimizing) const = 0; 728 bool is_optimizing) const = 0;
727 729
728 void InitializeLocationSummary(Isolate* isolate, bool optimizing) { 730 void InitializeLocationSummary(Isolate* isolate, bool optimizing) {
729 ASSERT(locs_ == NULL); 731 ASSERT(locs_ == NULL);
730 locs_ = MakeLocationSummary(isolate, optimizing); 732 locs_ = MakeLocationSummary(isolate, optimizing);
731 } 733 }
732 734
733 static LocationSummary* MakeCallSummary(Isolate* isolate); 735 static LocationSummary* MakeCallSummary(Isolate* isolate);
734 736
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 } 843 }
842 844
843 void InheritDeoptTargetAfter(FlowGraph* flow_graph, 845 void InheritDeoptTargetAfter(FlowGraph* flow_graph,
844 Definition* call, 846 Definition* call,
845 Definition* result); 847 Definition* result);
846 848
847 virtual bool MayThrow() const = 0; 849 virtual bool MayThrow() const = 0;
848 850
849 bool IsDominatedBy(Instruction* dom); 851 bool IsDominatedBy(Instruction* dom);
850 852
853 void ClearEnv() { env_ = NULL; }
854
851 protected: 855 protected:
856 // GetDeoptId and/or CopyDeoptIdFrom.
857 friend class CallSiteInliner;
858 friend class LICM;
859 friend class ComparisonInstr;
860 friend class Scheduler;
861 friend class BlockEntryInstr;
862
852 // Fetch deopt id without checking if this computation can deoptimize. 863 // Fetch deopt id without checking if this computation can deoptimize.
853 intptr_t GetDeoptId() const { 864 intptr_t GetDeoptId() const {
854 return deopt_id_; 865 return deopt_id_;
855 } 866 }
856 867
868 void CopyDeoptIdFrom(const Instruction& instr) {
869 deopt_id_ = instr.deopt_id_;
870 }
871
857 private: 872 private:
858 friend class FlowGraphPrinter;
859 friend class Definition; // Needed for InsertBefore, InsertAfter.
860 friend class CallSiteInliner;
861
862 // deopt_id_ write access.
863 friend class ComparisonInstr;
864 friend class LICM;
865 friend class Scheduler;
866 friend class BlockEntryInstr;
867 friend class BranchSimplifier;
868
869 virtual void RawSetInputAt(intptr_t i, Value* value) = 0; 873 virtual void RawSetInputAt(intptr_t i, Value* value) = 0;
870 874
871 enum { 875 enum {
872 kNoPlaceId = -1 876 kNoPlaceId = -1
873 }; 877 };
874 878
875 intptr_t deopt_id_; 879 intptr_t deopt_id_;
876 intptr_t lifetime_position_; // Position used by register allocator. 880 intptr_t lifetime_position_; // Position used by register allocator.
877 Instruction* previous_; 881 Instruction* previous_;
878 Instruction* next_; 882 Instruction* next_;
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
2233 Token::Kind kind() const { return kind_; } 2237 Token::Kind kind() const { return kind_; }
2234 2238
2235 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0; 2239 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0;
2236 2240
2237 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2241 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
2238 BranchInstr* branch) = 0; 2242 BranchInstr* branch) = 0;
2239 2243
2240 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, 2244 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
2241 BranchLabels labels) = 0; 2245 BranchLabels labels) = 0;
2242 2246
2243 void SetDeoptId(intptr_t deopt_id) { 2247 void SetDeoptId(const Instruction& instr) {
Cutch 2014/12/16 16:49:30 Why not unify this with CopyDeoptIdFrom?
srdjan 2014/12/16 16:54:06 CopyDeoptId is protected, few classes can do it. H
2244 deopt_id_ = deopt_id; 2248 CopyDeoptIdFrom(instr);
2245 } 2249 }
2246 2250
2247 // Operation class id is computed from collected ICData. 2251 // Operation class id is computed from collected ICData.
2248 void set_operation_cid(intptr_t value) { operation_cid_ = value; } 2252 void set_operation_cid(intptr_t value) { operation_cid_ = value; }
2249 intptr_t operation_cid() const { return operation_cid_; } 2253 intptr_t operation_cid() const { return operation_cid_; }
2250 2254
2251 void NegateComparison() { 2255 void NegateComparison() {
2252 kind_ = Token::NegateComparison(kind_); 2256 kind_ = Token::NegateComparison(kind_);
2253 } 2257 }
2254 2258
(...skipping 5747 matching lines...) Expand 10 before | Expand all | Expand 10 after
8002 Isolate* isolate, bool opt) const { \ 8006 Isolate* isolate, bool opt) const { \
8003 UNIMPLEMENTED(); \ 8007 UNIMPLEMENTED(); \
8004 return NULL; \ 8008 return NULL; \
8005 } \ 8009 } \
8006 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8010 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8007 8011
8008 8012
8009 } // namespace dart 8013 } // namespace dart
8010 8014
8011 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 8015 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698