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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 490 |
491 // M is a single argument macro. It is applied to each concrete instruction | 491 // M is a single argument macro. It is applied to each concrete instruction |
492 // type name. The concrete instruction classes are the name with Instr | 492 // type name. The concrete instruction classes are the name with Instr |
493 // concatenated. | 493 // concatenated. |
494 #define FOR_EACH_INSTRUCTION(M) \ | 494 #define FOR_EACH_INSTRUCTION(M) \ |
495 M(GraphEntry) \ | 495 M(GraphEntry) \ |
496 M(JoinEntry) \ | 496 M(JoinEntry) \ |
497 M(TargetEntry) \ | 497 M(TargetEntry) \ |
498 M(CatchBlockEntry) \ | 498 M(CatchBlockEntry) \ |
499 M(Phi) \ | 499 M(Phi) \ |
| 500 M(Redefinition) \ |
500 M(Parameter) \ | 501 M(Parameter) \ |
501 M(ParallelMove) \ | 502 M(ParallelMove) \ |
502 M(PushArgument) \ | 503 M(PushArgument) \ |
503 M(Return) \ | 504 M(Return) \ |
504 M(Throw) \ | 505 M(Throw) \ |
505 M(ReThrow) \ | 506 M(ReThrow) \ |
506 M(Goto) \ | 507 M(Goto) \ |
507 M(Branch) \ | 508 M(Branch) \ |
508 M(AssertAssignable) \ | 509 M(AssertAssignable) \ |
509 M(AssertBoolean) \ | 510 M(AssertBoolean) \ |
(...skipping 17 matching lines...) Expand all Loading... |
527 M(StoreStaticField) \ | 528 M(StoreStaticField) \ |
528 M(BooleanNegate) \ | 529 M(BooleanNegate) \ |
529 M(InstanceOf) \ | 530 M(InstanceOf) \ |
530 M(CreateArray) \ | 531 M(CreateArray) \ |
531 M(CreateClosure) \ | 532 M(CreateClosure) \ |
532 M(AllocateObject) \ | 533 M(AllocateObject) \ |
533 M(AllocateObjectWithBoundsCheck) \ | 534 M(AllocateObjectWithBoundsCheck) \ |
534 M(LoadField) \ | 535 M(LoadField) \ |
535 M(StoreVMField) \ | 536 M(StoreVMField) \ |
536 M(LoadUntagged) \ | 537 M(LoadUntagged) \ |
| 538 M(LoadClassId) \ |
537 M(InstantiateTypeArguments) \ | 539 M(InstantiateTypeArguments) \ |
538 M(ExtractConstructorTypeArguments) \ | 540 M(ExtractConstructorTypeArguments) \ |
539 M(ExtractConstructorInstantiator) \ | 541 M(ExtractConstructorInstantiator) \ |
540 M(AllocateContext) \ | 542 M(AllocateContext) \ |
541 M(ChainContext) \ | 543 M(ChainContext) \ |
542 M(CloneContext) \ | 544 M(CloneContext) \ |
543 M(CatchEntry) \ | 545 M(CatchEntry) \ |
544 M(BinarySmiOp) \ | 546 M(BinarySmiOp) \ |
545 M(UnarySmiOp) \ | 547 M(UnarySmiOp) \ |
546 M(CheckStackOverflow) \ | 548 M(CheckStackOverflow) \ |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 friend class InvokeMathCFunctionInstr; | 871 friend class InvokeMathCFunctionInstr; |
870 friend class FlowGraphOptimizer; | 872 friend class FlowGraphOptimizer; |
871 friend class LoadIndexedInstr; | 873 friend class LoadIndexedInstr; |
872 friend class StoreIndexedInstr; | 874 friend class StoreIndexedInstr; |
873 friend class StoreInstanceFieldInstr; | 875 friend class StoreInstanceFieldInstr; |
874 friend class ControlInstruction; | 876 friend class ControlInstruction; |
875 friend class ComparisonInstr; | 877 friend class ComparisonInstr; |
876 friend class TargetEntryInstr; | 878 friend class TargetEntryInstr; |
877 friend class JoinEntryInstr; | 879 friend class JoinEntryInstr; |
878 friend class InstanceOfInstr; | 880 friend class InstanceOfInstr; |
| 881 friend class PolymorphicInstanceCallInstr; |
| 882 friend class SmiToDoubleInstr; |
| 883 friend class DoubleToIntegerInstr; |
| 884 friend class BranchSimplifier; |
879 | 885 |
880 virtual void RawSetInputAt(intptr_t i, Value* value) = 0; | 886 virtual void RawSetInputAt(intptr_t i, Value* value) = 0; |
881 | 887 |
882 intptr_t deopt_id_; | 888 intptr_t deopt_id_; |
883 intptr_t lifetime_position_; // Position used by register allocator. | 889 intptr_t lifetime_position_; // Position used by register allocator. |
884 Instruction* previous_; | 890 Instruction* previous_; |
885 Instruction* next_; | 891 Instruction* next_; |
886 Environment* env_; | 892 Environment* env_; |
887 intptr_t expr_id_; | 893 intptr_t expr_id_; |
888 | 894 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 void set_postorder_number(intptr_t number) { postorder_number_ = number; } | 1043 void set_postorder_number(intptr_t number) { postorder_number_ = number; } |
1038 | 1044 |
1039 intptr_t block_id() const { return block_id_; } | 1045 intptr_t block_id() const { return block_id_; } |
1040 | 1046 |
1041 void set_start_pos(intptr_t pos) { start_pos_ = pos; } | 1047 void set_start_pos(intptr_t pos) { start_pos_ = pos; } |
1042 intptr_t start_pos() const { return start_pos_; } | 1048 intptr_t start_pos() const { return start_pos_; } |
1043 void set_end_pos(intptr_t pos) { end_pos_ = pos; } | 1049 void set_end_pos(intptr_t pos) { end_pos_ = pos; } |
1044 intptr_t end_pos() const { return end_pos_; } | 1050 intptr_t end_pos() const { return end_pos_; } |
1045 | 1051 |
1046 BlockEntryInstr* dominator() const { return dominator_; } | 1052 BlockEntryInstr* dominator() const { return dominator_; } |
1047 void set_dominator(BlockEntryInstr* instr) { dominator_ = instr; } | |
1048 | 1053 |
1049 const GrowableArray<BlockEntryInstr*>& dominated_blocks() { | 1054 const GrowableArray<BlockEntryInstr*>& dominated_blocks() { |
1050 return dominated_blocks_; | 1055 return dominated_blocks_; |
1051 } | 1056 } |
1052 | 1057 |
1053 void AddDominatedBlock(BlockEntryInstr* block) { | 1058 void AddDominatedBlock(BlockEntryInstr* block) { |
| 1059 block->set_dominator(this); |
1054 dominated_blocks_.Add(block); | 1060 dominated_blocks_.Add(block); |
1055 } | 1061 } |
1056 void ClearDominatedBlocks() { dominated_blocks_.Clear(); } | 1062 void ClearDominatedBlocks() { dominated_blocks_.Clear(); } |
1057 | 1063 |
1058 bool Dominates(BlockEntryInstr* other) const; | 1064 bool Dominates(BlockEntryInstr* other) const; |
1059 | 1065 |
1060 Instruction* last_instruction() const { return last_instruction_; } | 1066 Instruction* last_instruction() const { return last_instruction_; } |
1061 void set_last_instruction(Instruction* instr) { last_instruction_ = instr; } | 1067 void set_last_instruction(Instruction* instr) { last_instruction_ = instr; } |
1062 | 1068 |
1063 ParallelMoveInstr* parallel_move() const { | 1069 ParallelMoveInstr* parallel_move() const { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 last_instruction_(NULL), | 1150 last_instruction_(NULL), |
1145 parallel_move_(NULL), | 1151 parallel_move_(NULL), |
1146 loop_info_(NULL) { } | 1152 loop_info_(NULL) { } |
1147 | 1153 |
1148 private: | 1154 private: |
1149 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } | 1155 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } |
1150 | 1156 |
1151 virtual void ClearPredecessors() = 0; | 1157 virtual void ClearPredecessors() = 0; |
1152 virtual void AddPredecessor(BlockEntryInstr* predecessor) = 0; | 1158 virtual void AddPredecessor(BlockEntryInstr* predecessor) = 0; |
1153 | 1159 |
| 1160 void set_dominator(BlockEntryInstr* instr) { dominator_ = instr; } |
| 1161 |
1154 intptr_t block_id_; | 1162 intptr_t block_id_; |
1155 const intptr_t try_index_; | 1163 const intptr_t try_index_; |
1156 intptr_t preorder_number_; | 1164 intptr_t preorder_number_; |
1157 intptr_t postorder_number_; | 1165 intptr_t postorder_number_; |
1158 // Starting and ending lifetime positions for this block. Used by | 1166 // Starting and ending lifetime positions for this block. Used by |
1159 // the linear scan register allocator. | 1167 // the linear scan register allocator. |
1160 intptr_t start_pos_; | 1168 intptr_t start_pos_; |
1161 intptr_t end_pos_; | 1169 intptr_t end_pos_; |
1162 BlockEntryInstr* dominator_; // Immediate dominator, NULL for graph entry. | 1170 BlockEntryInstr* dominator_; // Immediate dominator, NULL for graph entry. |
1163 // TODO(fschneider): Optimize the case of one child to save space. | 1171 // TODO(fschneider): Optimize the case of one child to save space. |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 | 1310 |
1303 virtual void PrintTo(BufferFormatter* f) const; | 1311 virtual void PrintTo(BufferFormatter* f) const; |
1304 | 1312 |
1305 virtual EffectSet Effects() const { return EffectSet::None(); } | 1313 virtual EffectSet Effects() const { return EffectSet::None(); } |
1306 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 1314 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
1307 | 1315 |
1308 private: | 1316 private: |
1309 // Classes that have access to predecessors_ when inlining. | 1317 // Classes that have access to predecessors_ when inlining. |
1310 friend class BlockEntryInstr; | 1318 friend class BlockEntryInstr; |
1311 friend class InlineExitCollector; | 1319 friend class InlineExitCollector; |
| 1320 friend class PolymorphicInliner; |
1312 | 1321 |
1313 // Direct access to phis_ in order to resize it due to phi elimination. | 1322 // Direct access to phis_ in order to resize it due to phi elimination. |
1314 friend class ConstantPropagator; | 1323 friend class ConstantPropagator; |
1315 | 1324 |
1316 virtual void ClearPredecessors() { predecessors_.Clear(); } | 1325 virtual void ClearPredecessors() { predecessors_.Clear(); } |
1317 virtual void AddPredecessor(BlockEntryInstr* predecessor); | 1326 virtual void AddPredecessor(BlockEntryInstr* predecessor); |
1318 | 1327 |
1319 GrowableArray<BlockEntryInstr*> predecessors_; | 1328 GrowableArray<BlockEntryInstr*> predecessors_; |
1320 ZoneGrowableArray<PhiInstr*>* phis_; | 1329 ZoneGrowableArray<PhiInstr*>* phis_; |
1321 | 1330 |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1993 DISALLOW_COPY_AND_ASSIGN(BranchInstr); | 2002 DISALLOW_COPY_AND_ASSIGN(BranchInstr); |
1994 }; | 2003 }; |
1995 | 2004 |
1996 | 2005 |
1997 class StoreContextInstr : public TemplateInstruction<1> { | 2006 class StoreContextInstr : public TemplateInstruction<1> { |
1998 public: | 2007 public: |
1999 explicit StoreContextInstr(Value* value) { | 2008 explicit StoreContextInstr(Value* value) { |
2000 SetInputAt(0, value); | 2009 SetInputAt(0, value); |
2001 } | 2010 } |
2002 | 2011 |
2003 DECLARE_INSTRUCTION(StoreContext); | 2012 DECLARE_INSTRUCTION(StoreContext) |
2004 | 2013 |
2005 virtual intptr_t ArgumentCount() const { return 0; } | 2014 virtual intptr_t ArgumentCount() const { return 0; } |
2006 | 2015 |
2007 Value* value() const { return inputs_[0]; } | 2016 Value* value() const { return inputs_[0]; } |
2008 | 2017 |
2009 virtual bool CanDeoptimize() const { return false; } | 2018 virtual bool CanDeoptimize() const { return false; } |
2010 | 2019 |
2011 virtual EffectSet Effects() const { return EffectSet::None(); } | 2020 virtual EffectSet Effects() const { return EffectSet::None(); } |
2012 | 2021 |
2013 private: | 2022 private: |
(...skipping 25 matching lines...) Expand all Loading... |
2039 friend class BranchInstr; | 2048 friend class BranchInstr; |
2040 | 2049 |
2041 virtual void RawSetInputAt(intptr_t i, Value* value) { | 2050 virtual void RawSetInputAt(intptr_t i, Value* value) { |
2042 inputs_[i] = value; | 2051 inputs_[i] = value; |
2043 } | 2052 } |
2044 | 2053 |
2045 LocationSummary* locs_; | 2054 LocationSummary* locs_; |
2046 }; | 2055 }; |
2047 | 2056 |
2048 | 2057 |
| 2058 class RedefinitionInstr : public TemplateDefinition<1> { |
| 2059 public: |
| 2060 explicit RedefinitionInstr(Value* value) { |
| 2061 SetInputAt(0, value); |
| 2062 } |
| 2063 |
| 2064 DECLARE_INSTRUCTION(Redefinition) |
| 2065 |
| 2066 Value* value() const { return inputs_[0]; } |
| 2067 |
| 2068 virtual CompileType ComputeType() const; |
| 2069 virtual bool RecomputeType(); |
| 2070 |
| 2071 virtual bool CanDeoptimize() const { return false; } |
| 2072 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
| 2073 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 2074 |
| 2075 private: |
| 2076 DISALLOW_COPY_AND_ASSIGN(RedefinitionInstr); |
| 2077 }; |
| 2078 |
| 2079 |
2049 class RangeBoundary : public ValueObject { | 2080 class RangeBoundary : public ValueObject { |
2050 public: | 2081 public: |
2051 enum Kind { kUnknown, kSymbol, kConstant }; | 2082 enum Kind { kUnknown, kSymbol, kConstant }; |
2052 | 2083 |
2053 RangeBoundary() : kind_(kUnknown), value_(0), offset_(0) { } | 2084 RangeBoundary() : kind_(kUnknown), value_(0), offset_(0) { } |
2054 | 2085 |
2055 RangeBoundary(const RangeBoundary& other) | 2086 RangeBoundary(const RangeBoundary& other) |
2056 : ValueObject(), | 2087 : ValueObject(), |
2057 kind_(other.kind_), | 2088 kind_(other.kind_), |
2058 value_(other.value_), | 2089 value_(other.value_), |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2539 | 2570 |
2540 class PolymorphicInstanceCallInstr : public TemplateDefinition<0> { | 2571 class PolymorphicInstanceCallInstr : public TemplateDefinition<0> { |
2541 public: | 2572 public: |
2542 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, | 2573 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, |
2543 const ICData& ic_data, | 2574 const ICData& ic_data, |
2544 bool with_checks) | 2575 bool with_checks) |
2545 : instance_call_(instance_call), | 2576 : instance_call_(instance_call), |
2546 ic_data_(ic_data), | 2577 ic_data_(ic_data), |
2547 with_checks_(with_checks) { | 2578 with_checks_(with_checks) { |
2548 ASSERT(instance_call_ != NULL); | 2579 ASSERT(instance_call_ != NULL); |
| 2580 deopt_id_ = instance_call->deopt_id(); |
2549 } | 2581 } |
2550 | 2582 |
2551 InstanceCallInstr* instance_call() const { return instance_call_; } | 2583 InstanceCallInstr* instance_call() const { return instance_call_; } |
2552 bool with_checks() const { return with_checks_; } | 2584 bool with_checks() const { return with_checks_; } |
2553 | 2585 |
2554 virtual intptr_t ArgumentCount() const { | 2586 virtual intptr_t ArgumentCount() const { |
2555 return instance_call()->ArgumentCount(); | 2587 return instance_call()->ArgumentCount(); |
2556 } | 2588 } |
2557 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 2589 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
2558 return instance_call()->PushArgumentAt(index); | 2590 return instance_call()->PushArgumentAt(index); |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3145 const Field& field_; | 3177 const Field& field_; |
3146 | 3178 |
3147 DISALLOW_COPY_AND_ASSIGN(GuardFieldInstr); | 3179 DISALLOW_COPY_AND_ASSIGN(GuardFieldInstr); |
3148 }; | 3180 }; |
3149 | 3181 |
3150 | 3182 |
3151 class LoadStaticFieldInstr : public TemplateDefinition<0> { | 3183 class LoadStaticFieldInstr : public TemplateDefinition<0> { |
3152 public: | 3184 public: |
3153 explicit LoadStaticFieldInstr(const Field& field) : field_(field) {} | 3185 explicit LoadStaticFieldInstr(const Field& field) : field_(field) {} |
3154 | 3186 |
3155 DECLARE_INSTRUCTION(LoadStaticField); | 3187 DECLARE_INSTRUCTION(LoadStaticField) |
3156 virtual CompileType ComputeType() const; | 3188 virtual CompileType ComputeType() const; |
3157 | 3189 |
3158 const Field& field() const { return field_; } | 3190 const Field& field() const { return field_; } |
3159 | 3191 |
3160 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3192 virtual void PrintOperandsTo(BufferFormatter* f) const; |
3161 | 3193 |
3162 virtual bool CanDeoptimize() const { return false; } | 3194 virtual bool CanDeoptimize() const { return false; } |
3163 | 3195 |
3164 virtual bool AllowsCSE() const { return field_.is_final(); } | 3196 virtual bool AllowsCSE() const { return field_.is_final(); } |
3165 virtual EffectSet Effects() const { return EffectSet::None(); } | 3197 virtual EffectSet Effects() const { return EffectSet::None(); } |
3166 virtual EffectSet Dependencies() const; | 3198 virtual EffectSet Dependencies() const; |
3167 virtual bool AttributesEqual(Instruction* other) const; | 3199 virtual bool AttributesEqual(Instruction* other) const; |
3168 | 3200 |
3169 private: | 3201 private: |
3170 const Field& field_; | 3202 const Field& field_; |
3171 | 3203 |
3172 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); | 3204 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); |
3173 }; | 3205 }; |
3174 | 3206 |
3175 | 3207 |
3176 class StoreStaticFieldInstr : public TemplateDefinition<1> { | 3208 class StoreStaticFieldInstr : public TemplateDefinition<1> { |
3177 public: | 3209 public: |
3178 StoreStaticFieldInstr(const Field& field, Value* value) | 3210 StoreStaticFieldInstr(const Field& field, Value* value) |
3179 : field_(field) { | 3211 : field_(field) { |
3180 ASSERT(field.IsZoneHandle()); | 3212 ASSERT(field.IsZoneHandle()); |
3181 SetInputAt(0, value); | 3213 SetInputAt(0, value); |
3182 } | 3214 } |
3183 | 3215 |
3184 DECLARE_INSTRUCTION(StoreStaticField); | 3216 DECLARE_INSTRUCTION(StoreStaticField) |
3185 virtual CompileType* ComputeInitialType() const; | 3217 virtual CompileType* ComputeInitialType() const; |
3186 | 3218 |
3187 const Field& field() const { return field_; } | 3219 const Field& field() const { return field_; } |
3188 Value* value() const { return inputs_[0]; } | 3220 Value* value() const { return inputs_[0]; } |
3189 | 3221 |
3190 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3222 virtual void PrintOperandsTo(BufferFormatter* f) const; |
3191 | 3223 |
3192 virtual bool CanDeoptimize() const { return false; } | 3224 virtual bool CanDeoptimize() const { return false; } |
3193 | 3225 |
3194 // Currently CSE/LICM don't operate on any instructions that can be affected | 3226 // Currently CSE/LICM don't operate on any instructions that can be affected |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3567 const Function& function_; | 3599 const Function& function_; |
3568 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | 3600 ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
3569 intptr_t token_pos_; | 3601 intptr_t token_pos_; |
3570 | 3602 |
3571 DISALLOW_COPY_AND_ASSIGN(CreateClosureInstr); | 3603 DISALLOW_COPY_AND_ASSIGN(CreateClosureInstr); |
3572 }; | 3604 }; |
3573 | 3605 |
3574 | 3606 |
3575 class LoadUntaggedInstr : public TemplateDefinition<1> { | 3607 class LoadUntaggedInstr : public TemplateDefinition<1> { |
3576 public: | 3608 public: |
3577 explicit LoadUntaggedInstr(Value* object, intptr_t offset) : offset_(offset) { | 3609 LoadUntaggedInstr(Value* object, intptr_t offset) : offset_(offset) { |
3578 SetInputAt(0, object); | 3610 SetInputAt(0, object); |
3579 } | 3611 } |
3580 | 3612 |
3581 virtual Representation representation() const { | 3613 virtual Representation representation() const { |
3582 return kUntagged; | 3614 return kUntagged; |
3583 } | 3615 } |
3584 DECLARE_INSTRUCTION(LoadUntagged) | 3616 DECLARE_INSTRUCTION(LoadUntagged) |
3585 virtual CompileType ComputeType() const; | 3617 virtual CompileType ComputeType() const; |
3586 | 3618 |
3587 Value* object() const { return inputs_[0]; } | 3619 Value* object() const { return inputs_[0]; } |
3588 intptr_t offset() const { return offset_; } | 3620 intptr_t offset() const { return offset_; } |
3589 | 3621 |
3590 virtual bool CanDeoptimize() const { return false; } | 3622 virtual bool CanDeoptimize() const { return false; } |
3591 | 3623 |
3592 // This instruction must not be moved without the indexed access that | 3624 // This instruction must not be moved without the indexed access that |
3593 // depends on it (e.g. out of loops). GC may cause collect | 3625 // depends on it (e.g. out of loops). GC may cause collect |
3594 // the array while the external data-array is still accessed. | 3626 // the array while the external data-array is still accessed. |
3595 virtual bool AllowsCSE() const { return false; } | 3627 virtual bool AllowsCSE() const { return false; } |
3596 virtual EffectSet Effects() const { return EffectSet::None(); } | 3628 virtual EffectSet Effects() const { return EffectSet::None(); } |
3597 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 3629 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
3598 virtual bool AttributesEqual(Instruction* other) const { return true; } | 3630 virtual bool AttributesEqual(Instruction* other) const { return true; } |
3599 | 3631 |
3600 private: | 3632 private: |
3601 intptr_t offset_; | 3633 intptr_t offset_; |
3602 | 3634 |
3603 DISALLOW_COPY_AND_ASSIGN(LoadUntaggedInstr); | 3635 DISALLOW_COPY_AND_ASSIGN(LoadUntaggedInstr); |
3604 }; | 3636 }; |
3605 | 3637 |
3606 | 3638 |
| 3639 class LoadClassIdInstr : public TemplateDefinition<1> { |
| 3640 public: |
| 3641 explicit LoadClassIdInstr(Value* object) { |
| 3642 SetInputAt(0, object); |
| 3643 } |
| 3644 |
| 3645 virtual Representation representation() const { |
| 3646 return kTagged; |
| 3647 } |
| 3648 DECLARE_INSTRUCTION(LoadClassId) |
| 3649 virtual CompileType ComputeType() const; |
| 3650 |
| 3651 Value* object() const { return inputs_[0]; } |
| 3652 |
| 3653 virtual bool CanDeoptimize() const { return false; } |
| 3654 |
| 3655 virtual bool AllowsCSE() const { return true; } |
| 3656 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 3657 virtual EffectSet Dependencies() const { |
| 3658 return EffectSet::Externalization(); |
| 3659 } |
| 3660 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3661 |
| 3662 private: |
| 3663 DISALLOW_COPY_AND_ASSIGN(LoadClassIdInstr); |
| 3664 }; |
| 3665 |
| 3666 |
3607 class LoadFieldInstr : public TemplateDefinition<1> { | 3667 class LoadFieldInstr : public TemplateDefinition<1> { |
3608 public: | 3668 public: |
3609 LoadFieldInstr(Value* instance, | 3669 LoadFieldInstr(Value* instance, |
3610 intptr_t offset_in_bytes, | 3670 intptr_t offset_in_bytes, |
3611 const AbstractType& type, | 3671 const AbstractType& type, |
3612 bool immutable = false) | 3672 bool immutable = false) |
3613 : offset_in_bytes_(offset_in_bytes), | 3673 : offset_in_bytes_(offset_in_bytes), |
3614 type_(type), | 3674 type_(type), |
3615 result_cid_(kDynamicCid), | 3675 result_cid_(kDynamicCid), |
3616 immutable_(immutable), | 3676 immutable_(immutable), |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3817 }; | 3877 }; |
3818 | 3878 |
3819 | 3879 |
3820 class AllocateContextInstr : public TemplateDefinition<0> { | 3880 class AllocateContextInstr : public TemplateDefinition<0> { |
3821 public: | 3881 public: |
3822 AllocateContextInstr(intptr_t token_pos, | 3882 AllocateContextInstr(intptr_t token_pos, |
3823 intptr_t num_context_variables) | 3883 intptr_t num_context_variables) |
3824 : token_pos_(token_pos), | 3884 : token_pos_(token_pos), |
3825 num_context_variables_(num_context_variables) {} | 3885 num_context_variables_(num_context_variables) {} |
3826 | 3886 |
3827 DECLARE_INSTRUCTION(AllocateContext); | 3887 DECLARE_INSTRUCTION(AllocateContext) |
3828 virtual CompileType ComputeType() const; | 3888 virtual CompileType ComputeType() const; |
3829 | 3889 |
3830 intptr_t token_pos() const { return token_pos_; } | 3890 intptr_t token_pos() const { return token_pos_; } |
3831 intptr_t num_context_variables() const { return num_context_variables_; } | 3891 intptr_t num_context_variables() const { return num_context_variables_; } |
3832 | 3892 |
3833 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3893 virtual void PrintOperandsTo(BufferFormatter* f) const; |
3834 | 3894 |
3835 virtual bool CanDeoptimize() const { return false; } | 3895 virtual bool CanDeoptimize() const { return false; } |
3836 | 3896 |
3837 virtual EffectSet Effects() const { return EffectSet::None(); } | 3897 virtual EffectSet Effects() const { return EffectSet::None(); } |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4130 SetInputAt(0, value); | 4190 SetInputAt(0, value); |
4131 deopt_id_ = deopt_id; | 4191 deopt_id_ = deopt_id; |
4132 } | 4192 } |
4133 | 4193 |
4134 Value* value() const { return inputs_[0]; } | 4194 Value* value() const { return inputs_[0]; } |
4135 | 4195 |
4136 virtual bool CanDeoptimize() const { | 4196 virtual bool CanDeoptimize() const { |
4137 return (value()->Type()->ToCid() != kUint32x4Cid); | 4197 return (value()->Type()->ToCid() != kUint32x4Cid); |
4138 } | 4198 } |
4139 | 4199 |
4140 virtual bool HasSideEffect() const { return false; } | |
4141 | |
4142 virtual Representation representation() const { | 4200 virtual Representation representation() const { |
4143 return kUnboxedUint32x4; | 4201 return kUnboxedUint32x4; |
4144 } | 4202 } |
4145 | 4203 |
4146 virtual bool AllowsCSE() const { return true; } | 4204 virtual bool AllowsCSE() const { return true; } |
4147 virtual EffectSet Effects() const { return EffectSet::None(); } | 4205 virtual EffectSet Effects() const { return EffectSet::None(); } |
4148 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 4206 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
4149 virtual bool AttributesEqual(Instruction* other) const { return true; } | 4207 virtual bool AttributesEqual(Instruction* other) const { return true; } |
4150 | 4208 |
4151 DECLARE_INSTRUCTION(UnboxUint32x4) | 4209 DECLARE_INSTRUCTION(UnboxUint32x4) |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5226 private: | 5284 private: |
5227 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); | 5285 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); |
5228 }; | 5286 }; |
5229 | 5287 |
5230 | 5288 |
5231 class DoubleToIntegerInstr : public TemplateDefinition<1> { | 5289 class DoubleToIntegerInstr : public TemplateDefinition<1> { |
5232 public: | 5290 public: |
5233 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) | 5291 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) |
5234 : instance_call_(instance_call) { | 5292 : instance_call_(instance_call) { |
5235 SetInputAt(0, value); | 5293 SetInputAt(0, value); |
| 5294 deopt_id_ = instance_call->deopt_id(); |
5236 } | 5295 } |
5237 | 5296 |
5238 Value* value() const { return inputs_[0]; } | 5297 Value* value() const { return inputs_[0]; } |
5239 InstanceCallInstr* instance_call() const { return instance_call_; } | 5298 InstanceCallInstr* instance_call() const { return instance_call_; } |
5240 | 5299 |
5241 DECLARE_INSTRUCTION(DoubleToInteger) | 5300 DECLARE_INSTRUCTION(DoubleToInteger) |
5242 virtual CompileType ComputeType() const; | 5301 virtual CompileType ComputeType() const; |
5243 | 5302 |
5244 virtual intptr_t ArgumentCount() const { return 1; } | 5303 virtual intptr_t ArgumentCount() const { return 1; } |
5245 | 5304 |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5722 ForwardInstructionIterator* current_iterator_; | 5781 ForwardInstructionIterator* current_iterator_; |
5723 | 5782 |
5724 private: | 5783 private: |
5725 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 5784 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
5726 }; | 5785 }; |
5727 | 5786 |
5728 | 5787 |
5729 } // namespace dart | 5788 } // namespace dart |
5730 | 5789 |
5731 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 5790 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |