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

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

Issue 12091091: Move recording of definition used from the value to the definition. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Restored RemoveFromUseList to class Value. 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 Value* next_use() const { return next_use_; } 88 Value* next_use() const { return next_use_; }
89 void set_next_use(Value* next) { next_use_ = next; } 89 void set_next_use(Value* next) { next_use_ = next; }
90 90
91 Instruction* instruction() const { return instruction_; } 91 Instruction* instruction() const { return instruction_; }
92 void set_instruction(Instruction* instruction) { instruction_ = instruction; } 92 void set_instruction(Instruction* instruction) { instruction_ = instruction; }
93 93
94 intptr_t use_index() const { return use_index_; } 94 intptr_t use_index() const { return use_index_; }
95 void set_use_index(intptr_t index) { use_index_ = index; } 95 void set_use_index(intptr_t index) { use_index_ = index; }
96 96
97 void AddToInputUseList(); 97 static void AddToList(Value* value, Value** list);
98 void AddToEnvUseList(); 98 void RemoveFromUseList();
99
100 void RemoveFromInputUseList();
101 99
102 Value* Copy() { return new Value(definition_); } 100 Value* Copy() { return new Value(definition_); }
103 101
104 RawAbstractType* CompileType() const; 102 RawAbstractType* CompileType() const;
105 intptr_t ResultCid() const; 103 intptr_t ResultCid() const;
106 104
107 void PrintTo(BufferFormatter* f) const; 105 void PrintTo(BufferFormatter* f) const;
108 106
109 const char* DebugName() const { return "Value"; } 107 const char* DebugName() const { return "Value"; }
110 108
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 bool HasUses() const { 1100 bool HasUses() const {
1103 return (input_use_list_ != NULL) || (env_use_list_ != NULL); 1101 return (input_use_list_ != NULL) || (env_use_list_ != NULL);
1104 } 1102 }
1105 1103
1106 Value* input_use_list() const { return input_use_list_; } 1104 Value* input_use_list() const { return input_use_list_; }
1107 void set_input_use_list(Value* head) { input_use_list_ = head; } 1105 void set_input_use_list(Value* head) { input_use_list_ = head; }
1108 1106
1109 Value* env_use_list() const { return env_use_list_; } 1107 Value* env_use_list() const { return env_use_list_; }
1110 void set_env_use_list(Value* head) { env_use_list_ = head; } 1108 void set_env_use_list(Value* head) { env_use_list_ = head; }
1111 1109
1110 void AddInputUse(Value* value) { Value::AddToList(value, &input_use_list_); }
1111 void AddEnvUse(Value* value) { Value::AddToList(value, &env_use_list_); }
1112
1112 // Replace uses of this definition with uses of other definition or value. 1113 // Replace uses of this definition with uses of other definition or value.
1113 // Precondition: use lists must be properly calculated. 1114 // Precondition: use lists must be properly calculated.
1114 // Postcondition: use lists and use values are still valid. 1115 // Postcondition: use lists and use values are still valid.
1115 void ReplaceUsesWith(Definition* other); 1116 void ReplaceUsesWith(Definition* other);
1116 1117
1117 // Replace this definition and all uses with another definition. If 1118 // Replace this definition and all uses with another definition. If
1118 // replacing during iteration, pass the iterator so that the instruction 1119 // replacing during iteration, pass the iterator so that the instruction
1119 // can be replaced without affecting iteration order, otherwise pass a 1120 // can be replaced without affecting iteration order, otherwise pass a
1120 // NULL iterator. 1121 // NULL iterator.
1121 void ReplaceWith(Definition* other, ForwardInstructionIterator* iterator); 1122 void ReplaceWith(Definition* other, ForwardInstructionIterator* iterator);
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1803 1804
1804 Value* value() const { return inputs_[0]; } 1805 Value* value() const { return inputs_[0]; }
1805 Range* constraint() const { return constraint_; } 1806 Range* constraint() const { return constraint_; }
1806 1807
1807 virtual void InferRange(); 1808 virtual void InferRange();
1808 1809
1809 void AddDependency(Definition* defn) { 1810 void AddDependency(Definition* defn) {
1810 Value* val = new Value(defn); 1811 Value* val = new Value(defn);
1811 val->set_use_index(1); 1812 val->set_use_index(1);
1812 val->set_instruction(this); 1813 val->set_instruction(this);
1813 val->AddToInputUseList(); 1814 defn->AddInputUse(val);
1814 set_dependency(val); 1815 set_dependency(val);
1815 } 1816 }
1816 1817
1817 void RemoveDependency() { 1818 void RemoveDependency() {
1818 if (dependency() != NULL) { 1819 if (dependency() != NULL) {
1819 dependency()->RemoveFromInputUseList(); 1820 dependency()->RemoveFromUseList();
1820 set_dependency(NULL); 1821 set_dependency(NULL);
1821 } 1822 }
1822 } 1823 }
1823 1824
1824 private: 1825 private:
1825 Value* dependency() { 1826 Value* dependency() {
1826 return inputs_[1]; 1827 return inputs_[1];
1827 } 1828 }
1828 1829
1829 void set_dependency(Value* value) { 1830 void set_dependency(Value* value) {
(...skipping 2640 matching lines...) Expand 10 before | Expand all | Expand 10 after
4470 ForwardInstructionIterator* current_iterator_; 4471 ForwardInstructionIterator* current_iterator_;
4471 4472
4472 private: 4473 private:
4473 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4474 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4474 }; 4475 };
4475 4476
4476 4477
4477 } // namespace dart 4478 } // namespace dart
4478 4479
4479 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4480 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698