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

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

Issue 10765007: Cleanups. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_builder.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) 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 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 1933
1934 1934
1935 class ForwardInstructionIterator : public ValueObject { 1935 class ForwardInstructionIterator : public ValueObject {
1936 public: 1936 public:
1937 explicit ForwardInstructionIterator(BlockEntryInstr* block_entry) 1937 explicit ForwardInstructionIterator(BlockEntryInstr* block_entry)
1938 : block_entry_(block_entry), current_(block_entry) { 1938 : block_entry_(block_entry), current_(block_entry) {
1939 Advance(); 1939 Advance();
1940 } 1940 }
1941 1941
1942 void Advance() { 1942 void Advance() {
1943 if (!Done()) current_ = current_->next(); 1943 ASSERT(!Done());
1944 current_ = current_->next();
1944 } 1945 }
1945 1946
1946 bool Done() const { 1947 bool Done() const {
1947 return current_ == block_entry_->last_instruction()->next(); 1948 return current_ == block_entry_->last_instruction()->next();
1948 } 1949 }
1949 1950
1950 void RemoveCurrentFromGraph() { 1951 // Removes 'current_' from graph and sets 'current_' to previous instruction.
1951 ASSERT(!current_->IsBlockEntry()); 1952 void RemoveCurrentFromGraph();
1952 ASSERT(!current_->IsBranch());
1953 ASSERT(!current_->IsThrow());
1954 ASSERT(!current_->IsReturn());
1955 ASSERT(!current_->IsReThrow());
1956 ASSERT(current_->previous() != NULL);
1957 Instruction* prev = current_->previous();
1958 Instruction* next = current_->next();
1959 prev->set_next(next);
1960 ASSERT(next != NULL);
1961 if (current_ != block_entry_->last_instruction()) {
1962 ASSERT(!next->IsBlockEntry());
1963 next->set_previous(prev);
1964 } else {
1965 ASSERT(current_->IsBind());
1966 // Removing the last instruction of a block.
1967 // Update last_instruction of the current basic block.
1968 block_entry_->set_last_instruction(prev);
1969 }
1970 // Reset successor and previous instruction to indicate
1971 // that the instruction is removed from the graph.
1972 current_->set_previous(NULL);
1973 current_->set_next(NULL);
1974 current_ = prev;
1975 }
1976 1953
1977 Instruction* Current() const { return current_; } 1954 Instruction* Current() const { return current_; }
1978 1955
1979 private: 1956 private:
1980 BlockEntryInstr* block_entry_; 1957 BlockEntryInstr* block_entry_;
1981 Instruction* current_; 1958 Instruction* current_;
1982 }; 1959 };
1983 1960
1984 1961
1985 class GraphEntryInstr : public BlockEntryInstr { 1962 class GraphEntryInstr : public BlockEntryInstr {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 virtual void RecordAssignedVars(BitVector* assigned_vars); 2136 virtual void RecordAssignedVars(BitVector* assigned_vars);
2160 2137
2161 virtual LocationSummary* locs() { 2138 virtual LocationSummary* locs() {
2162 return computation()->locs(); 2139 return computation()->locs();
2163 } 2140 }
2164 2141
2165 virtual void EmitNativeCode(FlowGraphCompiler* compiler); 2142 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
2166 2143
2167 private: 2144 private:
2168 Computation* computation_; 2145 Computation* computation_;
2169 bool is_used_; 2146 const bool is_used_;
2170 2147
2171 DISALLOW_COPY_AND_ASSIGN(BindInstr); 2148 DISALLOW_COPY_AND_ASSIGN(BindInstr);
2172 }; 2149 };
2173 2150
2174 2151
2175 class PhiInstr: public Definition { 2152 class PhiInstr : public Definition {
2176 public: 2153 public:
2177 explicit PhiInstr(intptr_t num_inputs) : inputs_(num_inputs) { 2154 explicit PhiInstr(intptr_t num_inputs) : inputs_(num_inputs) {
2178 for (intptr_t i = 0; i < num_inputs; ++i) { 2155 for (intptr_t i = 0; i < num_inputs; ++i) {
2179 inputs_.Add(NULL); 2156 inputs_.Add(NULL);
2180 } 2157 }
2181 } 2158 }
2182 2159
2183 DECLARE_INSTRUCTION(Phi) 2160 DECLARE_INSTRUCTION(Phi)
2184 2161
2185 private: 2162 private:
2186 GrowableArray<Value*> inputs_; 2163 GrowableArray<Value*> inputs_;
2187 2164
2188 DISALLOW_COPY_AND_ASSIGN(PhiInstr); 2165 DISALLOW_COPY_AND_ASSIGN(PhiInstr);
2189 }; 2166 };
2190 2167
2191 2168
2192 class ParameterInstr: public Definition { 2169 class ParameterInstr : public Definition {
2193 public: 2170 public:
2194 explicit ParameterInstr(intptr_t index) : index_(index) { } 2171 explicit ParameterInstr(intptr_t index) : index_(index) { }
2195 2172
2196 intptr_t index() const { return index_; } 2173 intptr_t index() const { return index_; }
2197 2174
2198 DECLARE_INSTRUCTION(Parameter) 2175 DECLARE_INSTRUCTION(Parameter)
2199 2176
2200 private: 2177 private:
2201 intptr_t index_; 2178 const intptr_t index_;
2202 2179
2203 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); 2180 DISALLOW_COPY_AND_ASSIGN(ParameterInstr);
2204 }; 2181 };
2205 2182
2206 2183
2207 class ReturnInstr : public InstructionWithInputs { 2184 class ReturnInstr : public InstructionWithInputs {
2208 public: 2185 public:
2209 ReturnInstr(intptr_t token_pos, Value* value) 2186 ReturnInstr(intptr_t token_pos, Value* value)
2210 : InstructionWithInputs(), token_pos_(token_pos), value_(value) { 2187 : InstructionWithInputs(), token_pos_(token_pos), value_(value) {
2211 ASSERT(value_ != NULL); 2188 ASSERT(value_ != NULL);
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
2435 const GrowableArray<BlockEntryInstr*>& block_order_; 2412 const GrowableArray<BlockEntryInstr*>& block_order_;
2436 2413
2437 private: 2414 private:
2438 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2415 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2439 }; 2416 };
2440 2417
2441 2418
2442 } // namespace dart 2419 } // namespace dart
2443 2420
2444 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2421 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698