| 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" |
| (...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2184 }; | 2184 }; |
| 2185 | 2185 |
| 2186 | 2186 |
| 2187 // IndirectGotoInstr represents a dynamically computed jump. Only | 2187 // IndirectGotoInstr represents a dynamically computed jump. Only |
| 2188 // IndirectEntryInstr targets are valid targets of an indirect goto. The | 2188 // IndirectEntryInstr targets are valid targets of an indirect goto. The |
| 2189 // concrete target to jump to is given as a parameter to the indirect goto. | 2189 // concrete target to jump to is given as a parameter to the indirect goto. |
| 2190 // | 2190 // |
| 2191 // In order to preserve split-edge form, an indirect goto does not itself point | 2191 // In order to preserve split-edge form, an indirect goto does not itself point |
| 2192 // to its targets. Instead, for each possible target, the successors_ field | 2192 // to its targets. Instead, for each possible target, the successors_ field |
| 2193 // will contain an ordinary goto instruction that jumps to the target. | 2193 // will contain an ordinary goto instruction that jumps to the target. |
| 2194 // TODO(zerny): Implement direct support instead of embedding gotos. |
| 2194 // | 2195 // |
| 2195 // Byte offsets of all possible targets are stored in the offsets_ array. The | 2196 // Byte offsets of all possible targets are stored in the offsets_ array. The |
| 2196 // desired offset is looked up while the generated code is executing, and passed | 2197 // desired offset is looked up while the generated code is executing, and passed |
| 2197 // to IndirectGoto as an input. | 2198 // to IndirectGoto as an input. |
| 2198 class IndirectGotoInstr : public TemplateInstruction<1, NoThrow> { | 2199 class IndirectGotoInstr : public TemplateInstruction<1, NoThrow> { |
| 2199 public: | 2200 public: |
| 2200 IndirectGotoInstr(GrowableObjectArray* offsets, | 2201 IndirectGotoInstr(GrowableObjectArray* offsets, |
| 2201 Value* offset_from_start) | 2202 Value* offset_from_start) |
| 2202 : offsets_(*offsets) { | 2203 : offsets_(*offsets) { |
| 2203 SetInputAt(0, offset_from_start); | 2204 SetInputAt(0, offset_from_start); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2220 } | 2221 } |
| 2221 | 2222 |
| 2222 virtual bool CanDeoptimize() const { return false; } | 2223 virtual bool CanDeoptimize() const { return false; } |
| 2223 virtual bool CanBecomeDeoptimizationTarget() const { return false; } | 2224 virtual bool CanBecomeDeoptimizationTarget() const { return false; } |
| 2224 | 2225 |
| 2225 virtual EffectSet Effects() const { return EffectSet::None(); } | 2226 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 2226 | 2227 |
| 2227 virtual void PrintTo(BufferFormatter* f) const; | 2228 virtual void PrintTo(BufferFormatter* f) const; |
| 2228 | 2229 |
| 2229 const GrowableObjectArray& offsets() const { return offsets_; } | 2230 const GrowableObjectArray& offsets() const { return offsets_; } |
| 2230 void SetOffsetCount(Isolate* isolate, intptr_t count) { | 2231 void ComputeOffsetTable(Isolate* isolate); |
| 2231 if (offsets_.Capacity() < count) { | |
| 2232 offsets_.Grow(count, Heap::kOld); | |
| 2233 } | |
| 2234 if (offsets_.Length() < count) { | |
| 2235 offsets_.SetLength(count); | |
| 2236 } | |
| 2237 } | |
| 2238 void SetOffsetAt(Isolate* isolate, intptr_t index, intptr_t offset) { | |
| 2239 offsets_.SetAt(index, Smi::ZoneHandle(isolate, Smi::New(offset))); | |
| 2240 } | |
| 2241 | 2232 |
| 2242 private: | 2233 private: |
| 2243 GrowableArray<TargetEntryInstr*> successors_; | 2234 GrowableArray<TargetEntryInstr*> successors_; |
| 2244 GrowableObjectArray& offsets_; | 2235 GrowableObjectArray& offsets_; |
| 2245 }; | 2236 }; |
| 2246 | 2237 |
| 2247 | 2238 |
| 2248 class ComparisonInstr : public TemplateDefinition<2, NoThrow, Pure> { | 2239 class ComparisonInstr : public TemplateDefinition<2, NoThrow, Pure> { |
| 2249 public: | 2240 public: |
| 2250 Value* left() const { return inputs_[0]; } | 2241 Value* left() const { return inputs_[0]; } |
| (...skipping 5731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7982 Isolate* isolate, bool opt) const { \ | 7973 Isolate* isolate, bool opt) const { \ |
| 7983 UNIMPLEMENTED(); \ | 7974 UNIMPLEMENTED(); \ |
| 7984 return NULL; \ | 7975 return NULL; \ |
| 7985 } \ | 7976 } \ |
| 7986 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 7977 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
| 7987 | 7978 |
| 7988 | 7979 |
| 7989 } // namespace dart | 7980 } // namespace dart |
| 7990 | 7981 |
| 7991 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7982 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |