| OLD | NEW |
| 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" |
| 11 #include "vm/handles_impl.h" | 11 #include "vm/handles_impl.h" |
| 12 #include "vm/locations.h" | 12 #include "vm/locations.h" |
| 13 #include "vm/object.h" | 13 #include "vm/object.h" |
| 14 | 14 |
| 15 namespace dart { | 15 namespace dart { |
| 16 | 16 |
| 17 class BitVector; | 17 class BitVector; |
| 18 class BlockEntryInstr; | 18 class BlockEntryInstr; |
| 19 class BufferFormatter; | 19 class BufferFormatter; |
| 20 class ComparisonInstr; | 20 class ComparisonInstr; |
| 21 class ControlInstruction; | 21 class ControlInstruction; |
| 22 class Definition; | 22 class Definition; |
| 23 class Environment; | 23 class Environment; |
| 24 class FlowGraphCompiler; | 24 class FlowGraphCompiler; |
| 25 class FlowGraphOptimizer; |
| 25 class FlowGraphVisitor; | 26 class FlowGraphVisitor; |
| 26 class Instruction; | 27 class Instruction; |
| 27 class LocalVariable; | 28 class LocalVariable; |
| 29 class ParsedFunction; |
| 28 class Range; | 30 class Range; |
| 29 class FlowGraphOptimizer; | |
| 30 | 31 |
| 31 | 32 |
| 32 // TODO(srdjan): Unify with INTRINSIC_LIST. | 33 // TODO(srdjan): Unify with INTRINSIC_LIST. |
| 33 // (class-name, function-name, recognized enum, fingerprint). | 34 // (class-name, function-name, recognized enum, fingerprint). |
| 34 // See intrinsifier for fingerprint computation. | 35 // See intrinsifier for fingerprint computation. |
| 35 #define RECOGNIZED_LIST(V) \ | 36 #define RECOGNIZED_LIST(V) \ |
| 36 V(_ObjectArray, get:length, ObjectArrayLength, 405297088) \ | 37 V(_ObjectArray, get:length, ObjectArrayLength, 405297088) \ |
| 37 V(_ImmutableArray, get:length, ImmutableArrayLength, 433698233) \ | 38 V(_ImmutableArray, get:length, ImmutableArrayLength, 433698233) \ |
| 38 V(_ByteArrayBase, get:length, ByteArrayBaseLength, 1098081765) \ | 39 V(_ByteArrayBase, get:length, ByteArrayBaseLength, 1098081765) \ |
| 39 V(_ByteArrayBase, _getInt8, ByteArrayBaseGetInt8, 261365835) \ | 40 V(_ByteArrayBase, _getInt8, ByteArrayBaseGetInt8, 261365835) \ |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 Instruction* Current() const { return current_; } | 999 Instruction* Current() const { return current_; } |
| 999 | 1000 |
| 1000 private: | 1001 private: |
| 1001 BlockEntryInstr* block_entry_; | 1002 BlockEntryInstr* block_entry_; |
| 1002 Instruction* current_; | 1003 Instruction* current_; |
| 1003 }; | 1004 }; |
| 1004 | 1005 |
| 1005 | 1006 |
| 1006 class GraphEntryInstr : public BlockEntryInstr { | 1007 class GraphEntryInstr : public BlockEntryInstr { |
| 1007 public: | 1008 public: |
| 1008 explicit GraphEntryInstr(TargetEntryInstr* normal_entry); | 1009 GraphEntryInstr(const ParsedFunction& parsed_function, |
| 1010 TargetEntryInstr* normal_entry); |
| 1009 | 1011 |
| 1010 DECLARE_INSTRUCTION(GraphEntry) | 1012 DECLARE_INSTRUCTION(GraphEntry) |
| 1011 | 1013 |
| 1012 virtual intptr_t PredecessorCount() const { return 0; } | 1014 virtual intptr_t PredecessorCount() const { return 0; } |
| 1013 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { | 1015 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { |
| 1014 UNREACHABLE(); | 1016 UNREACHABLE(); |
| 1015 return NULL; | 1017 return NULL; |
| 1016 } | 1018 } |
| 1017 virtual intptr_t SuccessorCount() const; | 1019 virtual intptr_t SuccessorCount() const; |
| 1018 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; | 1020 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; |
| 1019 | 1021 |
| 1020 void AddCatchEntry(TargetEntryInstr* entry) { catch_entries_.Add(entry); } | 1022 void AddCatchEntry(TargetEntryInstr* entry) { catch_entries_.Add(entry); } |
| 1021 | 1023 |
| 1022 virtual void PrepareEntry(FlowGraphCompiler* compiler); | 1024 virtual void PrepareEntry(FlowGraphCompiler* compiler); |
| 1023 | 1025 |
| 1024 GrowableArray<Definition*>* initial_definitions() { | 1026 GrowableArray<Definition*>* initial_definitions() { |
| 1025 return &initial_definitions_; | 1027 return &initial_definitions_; |
| 1026 } | 1028 } |
| 1027 ConstantInstr* constant_null(); | 1029 ConstantInstr* constant_null(); |
| 1028 | 1030 |
| 1029 intptr_t spill_slot_count() const { return spill_slot_count_; } | 1031 intptr_t spill_slot_count() const { return spill_slot_count_; } |
| 1030 void set_spill_slot_count(intptr_t count) { | 1032 void set_spill_slot_count(intptr_t count) { |
| 1031 ASSERT(count >= 0); | 1033 ASSERT(count >= 0); |
| 1032 spill_slot_count_ = count; | 1034 spill_slot_count_ = count; |
| 1033 } | 1035 } |
| 1034 | 1036 |
| 1035 TargetEntryInstr* normal_entry() const { return normal_entry_; } | 1037 TargetEntryInstr* normal_entry() const { return normal_entry_; } |
| 1036 | 1038 |
| 1039 const ParsedFunction& parsed_function() const { |
| 1040 return parsed_function_; |
| 1041 } |
| 1042 |
| 1037 virtual void PrintTo(BufferFormatter* f) const; | 1043 virtual void PrintTo(BufferFormatter* f) const; |
| 1038 | 1044 |
| 1039 private: | 1045 private: |
| 1040 virtual void ClearPredecessors() {} | 1046 virtual void ClearPredecessors() {} |
| 1041 virtual void AddPredecessor(BlockEntryInstr* predecessor) { UNREACHABLE(); } | 1047 virtual void AddPredecessor(BlockEntryInstr* predecessor) { UNREACHABLE(); } |
| 1042 | 1048 |
| 1049 const ParsedFunction& parsed_function_; |
| 1043 TargetEntryInstr* normal_entry_; | 1050 TargetEntryInstr* normal_entry_; |
| 1044 GrowableArray<TargetEntryInstr*> catch_entries_; | 1051 GrowableArray<TargetEntryInstr*> catch_entries_; |
| 1045 GrowableArray<Definition*> initial_definitions_; | 1052 GrowableArray<Definition*> initial_definitions_; |
| 1046 intptr_t spill_slot_count_; | 1053 intptr_t spill_slot_count_; |
| 1047 | 1054 |
| 1048 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); | 1055 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); |
| 1049 }; | 1056 }; |
| 1050 | 1057 |
| 1051 | 1058 |
| 1052 class JoinEntryInstr : public BlockEntryInstr { | 1059 class JoinEntryInstr : public BlockEntryInstr { |
| (...skipping 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4455 ForwardInstructionIterator* current_iterator_; | 4462 ForwardInstructionIterator* current_iterator_; |
| 4456 | 4463 |
| 4457 private: | 4464 private: |
| 4458 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4465 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4459 }; | 4466 }; |
| 4460 | 4467 |
| 4461 | 4468 |
| 4462 } // namespace dart | 4469 } // namespace dart |
| 4463 | 4470 |
| 4464 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4471 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |