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

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

Issue 982873004: Thread/Isolate refactoring: new(Isolate) -> new(Zone) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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_type_propagator.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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 intptr_t use_index() const { return use_index_; } 310 intptr_t use_index() const { return use_index_; }
311 void set_use_index(intptr_t index) { use_index_ = index; } 311 void set_use_index(intptr_t index) { use_index_ = index; }
312 312
313 static void AddToList(Value* value, Value** list); 313 static void AddToList(Value* value, Value** list);
314 void RemoveFromUseList(); 314 void RemoveFromUseList();
315 315
316 // Change the definition after use lists have been computed. 316 // Change the definition after use lists have been computed.
317 inline void BindTo(Definition* definition); 317 inline void BindTo(Definition* definition);
318 inline void BindToEnvironment(Definition* definition); 318 inline void BindToEnvironment(Definition* definition);
319 319
320 Value* Copy(Isolate* isolate) { return new(isolate) Value(definition_); } 320 Value* Copy(Zone* zone) { return new(zone) Value(definition_); }
321 321
322 // This function must only be used when the new Value is dominated by 322 // This function must only be used when the new Value is dominated by
323 // the original Value. 323 // the original Value.
324 Value* CopyWithType() { 324 Value* CopyWithType() {
325 Value* copy = new Value(definition_); 325 Value* copy = new Value(definition_);
326 copy->reaching_type_ = reaching_type_; 326 copy->reaching_type_ = reaching_type_;
327 return copy; 327 return copy;
328 } 328 }
329 329
330 CompileType* Type(); 330 CompileType* Type();
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 bool Equals(Instruction* other) const; 834 bool Equals(Instruction* other) const;
835 835
836 // Compare attributes of a instructions (except input operands and tag). 836 // Compare attributes of a instructions (except input operands and tag).
837 // All instructions that participate in CSE have to override this function. 837 // All instructions that participate in CSE have to override this function.
838 // This function can assume that the argument has the same type as this. 838 // This function can assume that the argument has the same type as this.
839 virtual bool AttributesEqual(Instruction* other) const { 839 virtual bool AttributesEqual(Instruction* other) const {
840 UNREACHABLE(); 840 UNREACHABLE();
841 return false; 841 return false;
842 } 842 }
843 843
844 virtual void InheritDeoptTarget(Isolate* isolate, Instruction* other); 844 virtual void InheritDeoptTarget(Zone* zone, Instruction* other);
845 845
846 bool NeedsEnvironment() const { 846 bool NeedsEnvironment() const {
847 return CanDeoptimize() || CanBecomeDeoptimizationTarget(); 847 return CanDeoptimize() || CanBecomeDeoptimizationTarget();
848 } 848 }
849 849
850 virtual bool CanBecomeDeoptimizationTarget() const { 850 virtual bool CanBecomeDeoptimizationTarget() const {
851 return false; 851 return false;
852 } 852 }
853 853
854 void InheritDeoptTargetAfter(FlowGraph* flow_graph, 854 void InheritDeoptTargetAfter(FlowGraph* flow_graph,
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2228 } 2228 }
2229 2229
2230 virtual bool CanDeoptimize() const { return false; } 2230 virtual bool CanDeoptimize() const { return false; }
2231 virtual bool CanBecomeDeoptimizationTarget() const { return false; } 2231 virtual bool CanBecomeDeoptimizationTarget() const { return false; }
2232 2232
2233 virtual EffectSet Effects() const { return EffectSet::None(); } 2233 virtual EffectSet Effects() const { return EffectSet::None(); }
2234 2234
2235 virtual void PrintTo(BufferFormatter* f) const; 2235 virtual void PrintTo(BufferFormatter* f) const;
2236 2236
2237 Value* offset() const { return inputs_[0]; } 2237 Value* offset() const { return inputs_[0]; }
2238 void ComputeOffsetTable(Isolate* isolate); 2238 void ComputeOffsetTable();
2239 2239
2240 private: 2240 private:
2241 GrowableArray<TargetEntryInstr*> successors_; 2241 GrowableArray<TargetEntryInstr*> successors_;
2242 TypedData& offsets_; 2242 TypedData& offsets_;
2243 }; 2243 };
2244 2244
2245 2245
2246 class ComparisonInstr : public TemplateDefinition<2, NoThrow, Pure> { 2246 class ComparisonInstr : public TemplateDefinition<2, NoThrow, Pure> {
2247 public: 2247 public:
2248 Value* left() const { return inputs_[0]; } 2248 Value* left() const { return inputs_[0]; }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2378 } 2378 }
2379 2379
2380 void set_constant_target(TargetEntryInstr* target) { 2380 void set_constant_target(TargetEntryInstr* target) {
2381 ASSERT(target == true_successor() || target == false_successor()); 2381 ASSERT(target == true_successor() || target == false_successor());
2382 constant_target_ = target; 2382 constant_target_ = target;
2383 } 2383 }
2384 TargetEntryInstr* constant_target() const { 2384 TargetEntryInstr* constant_target() const {
2385 return constant_target_; 2385 return constant_target_;
2386 } 2386 }
2387 2387
2388 virtual void InheritDeoptTarget(Isolate* isolate, Instruction* other); 2388 virtual void InheritDeoptTarget(Zone* zone, Instruction* other);
2389 2389
2390 virtual bool MayThrow() const { 2390 virtual bool MayThrow() const {
2391 return comparison()->MayThrow(); 2391 return comparison()->MayThrow();
2392 } 2392 }
2393 2393
2394 TargetEntryInstr* true_successor() const { return true_successor_; } 2394 TargetEntryInstr* true_successor() const { return true_successor_; }
2395 TargetEntryInstr* false_successor() const { return false_successor_; } 2395 TargetEntryInstr* false_successor() const { return false_successor_; }
2396 2396
2397 TargetEntryInstr** true_successor_address() { return &true_successor_; } 2397 TargetEntryInstr** true_successor_address() { return &true_successor_; }
2398 TargetEntryInstr** false_successor_address() { return &false_successor_; } 2398 TargetEntryInstr** false_successor_address() { return &false_successor_; }
(...skipping 5514 matching lines...) Expand 10 before | Expand all | Expand 10 after
7913 void SkipDone() { 7913 void SkipDone() {
7914 while (!Done() && iterator_.Done()) { 7914 while (!Done() && iterator_.Done()) {
7915 iterator_ = ShallowIterator(iterator_.environment()->outer()); 7915 iterator_ = ShallowIterator(iterator_.environment()->outer());
7916 } 7916 }
7917 } 7917 }
7918 7918
7919 ShallowIterator iterator_; 7919 ShallowIterator iterator_;
7920 }; 7920 };
7921 7921
7922 // Construct an environment by constructing uses from an array of definitions. 7922 // Construct an environment by constructing uses from an array of definitions.
7923 static Environment* From(Isolate* isolate, 7923 static Environment* From(Zone* zone,
7924 const GrowableArray<Definition*>& definitions, 7924 const GrowableArray<Definition*>& definitions,
7925 intptr_t fixed_parameter_count, 7925 intptr_t fixed_parameter_count,
7926 const ParsedFunction& parsed_function); 7926 const ParsedFunction& parsed_function);
7927 7927
7928 void set_locations(Location* locations) { 7928 void set_locations(Location* locations) {
7929 ASSERT(locations_ == NULL); 7929 ASSERT(locations_ == NULL);
7930 locations_ = locations; 7930 locations_ = locations;
7931 } 7931 }
7932 7932
7933 void set_deopt_id(intptr_t deopt_id) { deopt_id_ = deopt_id; } 7933 void set_deopt_id(intptr_t deopt_id) { deopt_id_ = deopt_id; }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
7974 for (Environment::DeepIterator it(this); !it.Done(); it.Advance()) { 7974 for (Environment::DeepIterator it(this); !it.Done(); it.Advance()) {
7975 if (it.CurrentValue()->definition()->IsPushArgument()) { 7975 if (it.CurrentValue()->definition()->IsPushArgument()) {
7976 count++; 7976 count++;
7977 } 7977 }
7978 } 7978 }
7979 return count; 7979 return count;
7980 } 7980 }
7981 7981
7982 const Code& code() const { return parsed_function_.code(); } 7982 const Code& code() const { return parsed_function_.code(); }
7983 7983
7984 Environment* DeepCopy(Isolate* isolate) const { 7984 Environment* DeepCopy(Zone* zone) const {
7985 return DeepCopy(isolate, Length()); 7985 return DeepCopy(zone, Length());
7986 } 7986 }
7987 7987
7988 void DeepCopyTo(Isolate* isolate, Instruction* instr) const; 7988 void DeepCopyTo(Zone* zone, Instruction* instr) const;
7989 void DeepCopyToOuter(Isolate* isolate, Instruction* instr) const; 7989 void DeepCopyToOuter(Zone* zone, Instruction* instr) const;
7990 7990
7991 void DeepCopyAfterTo(Isolate* isolate, 7991 void DeepCopyAfterTo(Zone* zone,
7992 Instruction* instr, 7992 Instruction* instr,
7993 intptr_t argc, 7993 intptr_t argc,
7994 Definition* dead, 7994 Definition* dead,
7995 Definition* result) const; 7995 Definition* result) const;
7996 7996
7997 void PrintTo(BufferFormatter* f) const; 7997 void PrintTo(BufferFormatter* f) const;
7998 const char* ToCString() const; 7998 const char* ToCString() const;
7999 7999
8000 // Deep copy an environment. The 'length' parameter may be less than the 8000 // Deep copy an environment. The 'length' parameter may be less than the
8001 // environment's length in order to drop values (e.g., passed arguments) 8001 // environment's length in order to drop values (e.g., passed arguments)
8002 // from the copy. 8002 // from the copy.
8003 Environment* DeepCopy(Isolate* isolate, intptr_t length) const; 8003 Environment* DeepCopy(Zone* zone, intptr_t length) const;
8004 8004
8005 private: 8005 private:
8006 friend class ShallowIterator; 8006 friend class ShallowIterator;
8007 8007
8008 Environment(intptr_t length, 8008 Environment(intptr_t length,
8009 intptr_t fixed_parameter_count, 8009 intptr_t fixed_parameter_count,
8010 intptr_t deopt_id, 8010 intptr_t deopt_id,
8011 const ParsedFunction& parsed_function, 8011 const ParsedFunction& parsed_function,
8012 Environment* outer) 8012 Environment* outer)
8013 : values_(length), 8013 : values_(length),
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
8068 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ 8068 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \
8069 UNIMPLEMENTED(); \ 8069 UNIMPLEMENTED(); \
8070 return NULL; \ 8070 return NULL; \
8071 } \ 8071 } \
8072 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8072 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8073 8073
8074 8074
8075 } // namespace dart 8075 } // namespace dart
8076 8076
8077 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 8077 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698