| 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 20 matching lines...) Expand all Loading... |
| 31 class FlowGraphCompiler; | 31 class FlowGraphCompiler; |
| 32 class FlowGraphVisitor; | 32 class FlowGraphVisitor; |
| 33 class Instruction; | 33 class Instruction; |
| 34 class LocalVariable; | 34 class LocalVariable; |
| 35 class ParsedFunction; | 35 class ParsedFunction; |
| 36 class Range; | 36 class Range; |
| 37 class RangeAnalysis; | 37 class RangeAnalysis; |
| 38 class RangeBoundary; | 38 class RangeBoundary; |
| 39 class UnboxIntegerInstr; | 39 class UnboxIntegerInstr; |
| 40 | 40 |
| 41 // These token positions are used to classify instructions that can't be | |
| 42 // directly tied to an actual source position. | |
| 43 #define CLASSIFYING_TOKEN_POSITIONS(V) \ | |
| 44 V(Private, -2) \ | |
| 45 V(Box, -3) \ | |
| 46 V(ParallelMove, -4) \ | |
| 47 V(TempMove, -5) \ | |
| 48 V(Constant, -6) \ | |
| 49 V(PushArgument, -7) \ | |
| 50 V(ControlFlow, -8) \ | |
| 51 V(Context, -9) | |
| 52 | |
| 53 // COMPILE_ASSERT that all CLASSIFYING_TOKEN_POSITIONS are less than | |
| 54 // Scanner::kNoSourcePos. | |
| 55 #define SANITY_CHECK_VALUES(name, value) \ | |
| 56 COMPILE_ASSERT(value < Scanner::kNoSourcePos); | |
| 57 CLASSIFYING_TOKEN_POSITIONS(SANITY_CHECK_VALUES); | |
| 58 #undef SANITY_CHECK_VALUES | |
| 59 | |
| 60 class ClassifyingTokenPositions : public AllStatic { | |
| 61 public: | |
| 62 #define DEFINE_VALUES(name, value) \ | |
| 63 static const intptr_t k##name = value; | |
| 64 CLASSIFYING_TOKEN_POSITIONS(DEFINE_VALUES); | |
| 65 #undef DEFINE_VALUES | |
| 66 | |
| 67 static const char* ToCString(intptr_t token_pos) { | |
| 68 ASSERT(token_pos < 0); | |
| 69 switch (token_pos) { | |
| 70 case Scanner::kNoSourcePos: return "NoSource"; | |
| 71 #define DEFINE_CASE(name, value) \ | |
| 72 case value: return #name; | |
| 73 CLASSIFYING_TOKEN_POSITIONS(DEFINE_CASE); | |
| 74 #undef DEFINE_CASE | |
| 75 default: | |
| 76 UNIMPLEMENTED(); | |
| 77 return NULL; | |
| 78 } | |
| 79 } | |
| 80 }; | |
| 81 | |
| 82 // CompileType describes type of the value produced by the definition. | 41 // CompileType describes type of the value produced by the definition. |
| 83 // | 42 // |
| 84 // It captures the following properties: | 43 // It captures the following properties: |
| 85 // - whether value can potentially be null or it is definitely not null; | 44 // - whether value can potentially be null or it is definitely not null; |
| 86 // - concrete class id of the value or kDynamicCid if unknown statically; | 45 // - concrete class id of the value or kDynamicCid if unknown statically; |
| 87 // - abstract super type of the value, concrete type of the value in runtime | 46 // - abstract super type of the value, concrete type of the value in runtime |
| 88 // is guaranteed to be sub type of this type. | 47 // is guaranteed to be sub type of this type. |
| 89 // | 48 // |
| 90 // Values of CompileType form a lattice with a None type as a bottom and a | 49 // Values of CompileType form a lattice with a None type as a bottom and a |
| 91 // nullable Dynamic type as a top element. Method Union provides a join | 50 // nullable Dynamic type as a top element. Method Union provides a join |
| (...skipping 3212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3304 | 3263 |
| 3305 AliasIdentity identity_; | 3264 AliasIdentity identity_; |
| 3306 | 3265 |
| 3307 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); | 3266 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); |
| 3308 }; | 3267 }; |
| 3309 | 3268 |
| 3310 | 3269 |
| 3311 class LoadLocalInstr : public TemplateDefinition<0, NoThrow> { | 3270 class LoadLocalInstr : public TemplateDefinition<0, NoThrow> { |
| 3312 public: | 3271 public: |
| 3313 LoadLocalInstr(const LocalVariable& local, | 3272 LoadLocalInstr(const LocalVariable& local, |
| 3314 intptr_t token_pos = Scanner::kNoSourcePos) | 3273 intptr_t token_pos) |
| 3315 : local_(local), is_last_(false), token_pos_(token_pos) { } | 3274 : local_(local), is_last_(false), token_pos_(token_pos) { } |
| 3316 | 3275 |
| 3317 DECLARE_INSTRUCTION(LoadLocal) | 3276 DECLARE_INSTRUCTION(LoadLocal) |
| 3318 virtual CompileType ComputeType() const; | 3277 virtual CompileType ComputeType() const; |
| 3319 | 3278 |
| 3320 const LocalVariable& local() const { return local_; } | 3279 const LocalVariable& local() const { return local_; } |
| 3321 | 3280 |
| 3322 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3281 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3323 | 3282 |
| 3324 virtual bool CanDeoptimize() const { return false; } | 3283 virtual bool CanDeoptimize() const { return false; } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3420 Value* value_; | 3379 Value* value_; |
| 3421 | 3380 |
| 3422 DISALLOW_COPY_AND_ASSIGN(DropTempsInstr); | 3381 DISALLOW_COPY_AND_ASSIGN(DropTempsInstr); |
| 3423 }; | 3382 }; |
| 3424 | 3383 |
| 3425 | 3384 |
| 3426 class StoreLocalInstr : public TemplateDefinition<1, NoThrow> { | 3385 class StoreLocalInstr : public TemplateDefinition<1, NoThrow> { |
| 3427 public: | 3386 public: |
| 3428 StoreLocalInstr(const LocalVariable& local, | 3387 StoreLocalInstr(const LocalVariable& local, |
| 3429 Value* value, | 3388 Value* value, |
| 3430 intptr_t token_pos = Scanner::kNoSourcePos) | 3389 intptr_t token_pos) |
| 3431 : local_(local), is_dead_(false), is_last_(false), token_pos_(token_pos) { | 3390 : local_(local), is_dead_(false), is_last_(false), token_pos_(token_pos) { |
| 3432 SetInputAt(0, value); | 3391 SetInputAt(0, value); |
| 3433 } | 3392 } |
| 3434 | 3393 |
| 3435 DECLARE_INSTRUCTION(StoreLocal) | 3394 DECLARE_INSTRUCTION(StoreLocal) |
| 3436 virtual CompileType ComputeType() const; | 3395 virtual CompileType ComputeType() const; |
| 3437 | 3396 |
| 3438 const LocalVariable& local() const { return local_; } | 3397 const LocalVariable& local() const { return local_; } |
| 3439 Value* value() const { return inputs_[0]; } | 3398 Value* value() const { return inputs_[0]; } |
| 3440 | 3399 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3749 const intptr_t token_pos_; | 3708 const intptr_t token_pos_; |
| 3750 | 3709 |
| 3751 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); | 3710 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); |
| 3752 }; | 3711 }; |
| 3753 | 3712 |
| 3754 | 3713 |
| 3755 class StoreStaticFieldInstr : public TemplateDefinition<1, NoThrow> { | 3714 class StoreStaticFieldInstr : public TemplateDefinition<1, NoThrow> { |
| 3756 public: | 3715 public: |
| 3757 StoreStaticFieldInstr(const Field& field, | 3716 StoreStaticFieldInstr(const Field& field, |
| 3758 Value* value, | 3717 Value* value, |
| 3759 intptr_t token_pos = Scanner::kNoSourcePos) | 3718 intptr_t token_pos) |
| 3760 : field_(field), | 3719 : field_(field), |
| 3761 token_pos_(token_pos) { | 3720 token_pos_(token_pos) { |
| 3762 ASSERT(field.IsZoneHandle()); | 3721 ASSERT(field.IsZoneHandle()); |
| 3763 SetInputAt(kValuePos, value); | 3722 SetInputAt(kValuePos, value); |
| 3764 } | 3723 } |
| 3765 | 3724 |
| 3766 enum { | 3725 enum { |
| 3767 kValuePos = 0 | 3726 kValuePos = 0 |
| 3768 }; | 3727 }; |
| 3769 | 3728 |
| (...skipping 4445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8215 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8174 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
| 8216 UNIMPLEMENTED(); \ | 8175 UNIMPLEMENTED(); \ |
| 8217 return NULL; \ | 8176 return NULL; \ |
| 8218 } \ | 8177 } \ |
| 8219 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8178 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
| 8220 | 8179 |
| 8221 | 8180 |
| 8222 } // namespace dart | 8181 } // namespace dart |
| 8223 | 8182 |
| 8224 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 8183 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |