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

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

Issue 12540002: Implement a branch optimization pass. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 7 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/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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 Instruction* previous() const { return previous_; } 556 Instruction* previous() const { return previous_; }
557 void set_previous(Instruction* instr) { 557 void set_previous(Instruction* instr) {
558 ASSERT(!IsBlockEntry()); 558 ASSERT(!IsBlockEntry());
559 previous_ = instr; 559 previous_ = instr;
560 } 560 }
561 561
562 Instruction* next() const { return next_; } 562 Instruction* next() const { return next_; }
563 void set_next(Instruction* instr) { 563 void set_next(Instruction* instr) {
564 ASSERT(!IsGraphEntry()); 564 ASSERT(!IsGraphEntry());
565 ASSERT(!IsReturn()); 565 ASSERT(!IsReturn());
566 ASSERT(!IsControl()); 566 ASSERT(!IsControl() || (instr == NULL));
567 ASSERT(!IsPhi()); 567 ASSERT(!IsPhi());
568 ASSERT(instr == NULL || !instr->IsBlockEntry()); 568 ASSERT(instr == NULL || !instr->IsBlockEntry());
569 // TODO(fschneider): Also add Throw and ReThrow to the list of instructions 569 // TODO(fschneider): Also add Throw and ReThrow to the list of instructions
570 // that do not have a successor. Currently, the graph builder will continue 570 // that do not have a successor. Currently, the graph builder will continue
571 // to append instruction in case of a Throw inside an expression. This 571 // to append instruction in case of a Throw inside an expression. This
572 // condition should be handled in the graph builder 572 // condition should be handled in the graph builder
573 next_ = instr; 573 next_ = instr;
574 } 574 }
575 575
576 // Link together two instruction. 576 // Link together two instruction.
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 *type_ = new_type; 1305 *type_ = new_type;
1306 return true; 1306 return true;
1307 } 1307 }
1308 1308
1309 return false; 1309 return false;
1310 } 1310 }
1311 1311
1312 bool HasUses() const { 1312 bool HasUses() const {
1313 return (input_use_list_ != NULL) || (env_use_list_ != NULL); 1313 return (input_use_list_ != NULL) || (env_use_list_ != NULL);
1314 } 1314 }
1315 bool HasOnlyUse(Value* use) const;
1315 1316
1316 Value* input_use_list() const { return input_use_list_; } 1317 Value* input_use_list() const { return input_use_list_; }
1317 void set_input_use_list(Value* head) { input_use_list_ = head; } 1318 void set_input_use_list(Value* head) { input_use_list_ = head; }
1318 1319
1319 Value* env_use_list() const { return env_use_list_; } 1320 Value* env_use_list() const { return env_use_list_; }
1320 void set_env_use_list(Value* head) { env_use_list_ = head; } 1321 void set_env_use_list(Value* head) { env_use_list_ = head; }
1321 1322
1322 void AddInputUse(Value* value) { Value::AddToList(value, &input_use_list_); } 1323 void AddInputUse(Value* value) { Value::AddToList(value, &input_use_list_); }
1323 void AddEnvUse(Value* value) { Value::AddToList(value, &env_use_list_); } 1324 void AddEnvUse(Value* value) { Value::AddToList(value, &env_use_list_); }
1324 1325
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
2026 2027
2027 2028
2028 class ConstantInstr : public TemplateDefinition<0> { 2029 class ConstantInstr : public TemplateDefinition<0> {
2029 public: 2030 public:
2030 explicit ConstantInstr(const Object& value) 2031 explicit ConstantInstr(const Object& value)
2031 : value_(value) { } 2032 : value_(value) { }
2032 2033
2033 DECLARE_INSTRUCTION(Constant) 2034 DECLARE_INSTRUCTION(Constant)
2034 virtual CompileType ComputeType() const; 2035 virtual CompileType ComputeType() const;
2035 2036
2037 virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer);
2038
2036 const Object& value() const { return value_; } 2039 const Object& value() const { return value_; }
2037 2040
2038 virtual void PrintOperandsTo(BufferFormatter* f) const; 2041 virtual void PrintOperandsTo(BufferFormatter* f) const;
2039 2042
2040 virtual bool CanDeoptimize() const { return false; } 2043 virtual bool CanDeoptimize() const { return false; }
2041 2044
2042 virtual bool HasSideEffect() const { return false; } 2045 virtual bool HasSideEffect() const { return false; }
2043 2046
2044 virtual bool AttributesEqual(Instruction* other) const; 2047 virtual bool AttributesEqual(Instruction* other) const;
2045 virtual bool AffectedBySideEffect() const { return false; } 2048 virtual bool AffectedBySideEffect() const { return false; }
(...skipping 2453 matching lines...) Expand 10 before | Expand all | Expand 10 after
4499 ForwardInstructionIterator* current_iterator_; 4502 ForwardInstructionIterator* current_iterator_;
4500 4503
4501 private: 4504 private:
4502 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4505 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4503 }; 4506 };
4504 4507
4505 4508
4506 } // namespace dart 4509 } // namespace dart
4507 4510
4508 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4511 #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