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

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

Issue 253013006: Add flag —source-lines which emits appropriate source lines as code comments. Added token_pos to … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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
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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 } 823 }
824 824
825 ICData* GetICData(const Array& ic_data_array) const; 825 ICData* GetICData(const Array& ic_data_array) const;
826 826
827 bool IsBlockEntry() { return (AsBlockEntry() != NULL); } 827 bool IsBlockEntry() { return (AsBlockEntry() != NULL); }
828 virtual BlockEntryInstr* AsBlockEntry() { return NULL; } 828 virtual BlockEntryInstr* AsBlockEntry() { return NULL; }
829 829
830 bool IsDefinition() { return (AsDefinition() != NULL); } 830 bool IsDefinition() { return (AsDefinition() != NULL); }
831 virtual Definition* AsDefinition() { return NULL; } 831 virtual Definition* AsDefinition() { return NULL; }
832 832
833 virtual intptr_t token_pos() const { return kNoTokenPos; }
834
833 virtual intptr_t InputCount() const = 0; 835 virtual intptr_t InputCount() const = 0;
834 virtual Value* InputAt(intptr_t i) const = 0; 836 virtual Value* InputAt(intptr_t i) const = 0;
835 void SetInputAt(intptr_t i, Value* value) { 837 void SetInputAt(intptr_t i, Value* value) {
836 ASSERT(value != NULL); 838 ASSERT(value != NULL);
837 value->set_instruction(this); 839 value->set_instruction(this);
838 value->set_use_index(i); 840 value->set_use_index(i);
839 RawSetInputAt(i, value); 841 RawSetInputAt(i, value);
840 } 842 }
841 843
842 // Remove all inputs (including in the environment) from their 844 // Remove all inputs (including in the environment) from their
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2108 public: 2110 public:
2109 ReturnInstr(intptr_t token_pos, Value* value) 2111 ReturnInstr(intptr_t token_pos, Value* value)
2110 : token_pos_(token_pos) { 2112 : token_pos_(token_pos) {
2111 SetInputAt(0, value); 2113 SetInputAt(0, value);
2112 } 2114 }
2113 2115
2114 DECLARE_INSTRUCTION(Return) 2116 DECLARE_INSTRUCTION(Return)
2115 2117
2116 virtual intptr_t ArgumentCount() const { return 0; } 2118 virtual intptr_t ArgumentCount() const { return 0; }
2117 2119
2118 intptr_t token_pos() const { return token_pos_; } 2120 virtual intptr_t token_pos() const { return token_pos_; }
2119 Value* value() const { return inputs_[0]; } 2121 Value* value() const { return inputs_[0]; }
2120 2122
2121 virtual bool CanBecomeDeoptimizationTarget() const { 2123 virtual bool CanBecomeDeoptimizationTarget() const {
2122 // Return instruction might turn into a Goto instruction after inlining. 2124 // Return instruction might turn into a Goto instruction after inlining.
2123 // Every Goto must have an environment. 2125 // Every Goto must have an environment.
2124 return true; 2126 return true;
2125 } 2127 }
2126 2128
2127 virtual bool CanDeoptimize() const { return false; } 2129 virtual bool CanDeoptimize() const { return false; }
2128 2130
2129 virtual EffectSet Effects() const { return EffectSet::None(); } 2131 virtual EffectSet Effects() const { return EffectSet::None(); }
2130 2132
2131 virtual bool MayThrow() const { return false; } 2133 virtual bool MayThrow() const { return false; }
2132 2134
2133 private: 2135 private:
2134 const intptr_t token_pos_; 2136 const intptr_t token_pos_;
2135 2137
2136 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); 2138 DISALLOW_COPY_AND_ASSIGN(ReturnInstr);
2137 }; 2139 };
2138 2140
2139 2141
2140 class ThrowInstr : public TemplateInstruction<0> { 2142 class ThrowInstr : public TemplateInstruction<0> {
2141 public: 2143 public:
2142 explicit ThrowInstr(intptr_t token_pos) : token_pos_(token_pos) { } 2144 explicit ThrowInstr(intptr_t token_pos) : token_pos_(token_pos) { }
2143 2145
2144 DECLARE_INSTRUCTION(Throw) 2146 DECLARE_INSTRUCTION(Throw)
2145 2147
2146 virtual intptr_t ArgumentCount() const { return 1; } 2148 virtual intptr_t ArgumentCount() const { return 1; }
2147 2149
2148 intptr_t token_pos() const { return token_pos_; } 2150 virtual intptr_t token_pos() const { return token_pos_; }
2149 2151
2150 virtual bool CanDeoptimize() const { return true; } 2152 virtual bool CanDeoptimize() const { return true; }
2151 2153
2152 virtual EffectSet Effects() const { return EffectSet::None(); } 2154 virtual EffectSet Effects() const { return EffectSet::None(); }
2153 2155
2154 virtual bool MayThrow() const { return true; } 2156 virtual bool MayThrow() const { return true; }
2155 2157
2156 private: 2158 private:
2157 const intptr_t token_pos_; 2159 const intptr_t token_pos_;
2158 2160
2159 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); 2161 DISALLOW_COPY_AND_ASSIGN(ThrowInstr);
2160 }; 2162 };
2161 2163
2162 2164
2163 class ReThrowInstr : public TemplateInstruction<0> { 2165 class ReThrowInstr : public TemplateInstruction<0> {
2164 public: 2166 public:
2165 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the 2167 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the
2166 // rethrow has been artifically generated by the parser. 2168 // rethrow has been artifically generated by the parser.
2167 ReThrowInstr(intptr_t token_pos, intptr_t catch_try_index) 2169 ReThrowInstr(intptr_t token_pos, intptr_t catch_try_index)
2168 : token_pos_(token_pos), catch_try_index_(catch_try_index) {} 2170 : token_pos_(token_pos), catch_try_index_(catch_try_index) {}
2169 2171
2170 DECLARE_INSTRUCTION(ReThrow) 2172 DECLARE_INSTRUCTION(ReThrow)
2171 2173
2172 virtual intptr_t ArgumentCount() const { return 2; } 2174 virtual intptr_t ArgumentCount() const { return 2; }
2173 2175
2174 intptr_t token_pos() const { return token_pos_; } 2176 virtual intptr_t token_pos() const { return token_pos_; }
2175 intptr_t catch_try_index() const { return catch_try_index_; } 2177 intptr_t catch_try_index() const { return catch_try_index_; }
2176 2178
2177 virtual bool CanDeoptimize() const { return true; } 2179 virtual bool CanDeoptimize() const { return true; }
2178 2180
2179 virtual EffectSet Effects() const { return EffectSet::None(); } 2181 virtual EffectSet Effects() const { return EffectSet::None(); }
2180 2182
2181 virtual bool MayThrow() const { return true; } 2183 virtual bool MayThrow() const { return true; }
2182 2184
2183 private: 2185 private:
2184 const intptr_t token_pos_; 2186 const intptr_t token_pos_;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 }; 2278 };
2277 2279
2278 2280
2279 class ComparisonInstr : public TemplateDefinition<2> { 2281 class ComparisonInstr : public TemplateDefinition<2> {
2280 public: 2282 public:
2281 Value* left() const { return inputs_[0]; } 2283 Value* left() const { return inputs_[0]; }
2282 Value* right() const { return inputs_[1]; } 2284 Value* right() const { return inputs_[1]; }
2283 2285
2284 virtual ComparisonInstr* AsComparison() { return this; } 2286 virtual ComparisonInstr* AsComparison() { return this; }
2285 2287
2286 intptr_t token_pos() const { return token_pos_; } 2288 virtual intptr_t token_pos() const { return token_pos_; }
2287 Token::Kind kind() const { return kind_; } 2289 Token::Kind kind() const { return kind_; }
2288 2290
2289 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0; 2291 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0;
2290 2292
2291 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2293 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
2292 BranchInstr* branch) = 0; 2294 BranchInstr* branch) = 0;
2293 2295
2294 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, 2296 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
2295 BranchLabels labels) = 0; 2297 BranchLabels labels) = 0;
2296 2298
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2343 DECLARE_INSTRUCTION(Branch) 2345 DECLARE_INSTRUCTION(Branch)
2344 2346
2345 virtual intptr_t ArgumentCount() const { 2347 virtual intptr_t ArgumentCount() const {
2346 return comparison()->ArgumentCount(); 2348 return comparison()->ArgumentCount();
2347 } 2349 }
2348 2350
2349 intptr_t InputCount() const { return comparison()->InputCount(); } 2351 intptr_t InputCount() const { return comparison()->InputCount(); }
2350 2352
2351 Value* InputAt(intptr_t i) const { return comparison()->InputAt(i); } 2353 Value* InputAt(intptr_t i) const { return comparison()->InputAt(i); }
2352 2354
2355 virtual intptr_t token_pos() const { return comparison_->token_pos(); }
2356
2353 virtual bool CanDeoptimize() const { 2357 virtual bool CanDeoptimize() const {
2354 // Branches need a deoptimization info in checked mode if they 2358 // Branches need a deoptimization info in checked mode if they
2355 // can throw a type check error. 2359 // can throw a type check error.
2356 return comparison()->CanDeoptimize() || is_checked(); 2360 return comparison()->CanDeoptimize() || is_checked();
2357 } 2361 }
2358 2362
2359 virtual bool CanBecomeDeoptimizationTarget() const { 2363 virtual bool CanBecomeDeoptimizationTarget() const {
2360 return comparison()->CanBecomeDeoptimizationTarget(); 2364 return comparison()->CanBecomeDeoptimizationTarget();
2361 } 2365 }
2362 2366
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2759 } 2763 }
2760 2764
2761 DECLARE_INSTRUCTION(AssertAssignable) 2765 DECLARE_INSTRUCTION(AssertAssignable)
2762 virtual CompileType* ComputeInitialType() const; 2766 virtual CompileType* ComputeInitialType() const;
2763 virtual bool RecomputeType(); 2767 virtual bool RecomputeType();
2764 2768
2765 Value* value() const { return inputs_[0]; } 2769 Value* value() const { return inputs_[0]; }
2766 Value* instantiator() const { return inputs_[1]; } 2770 Value* instantiator() const { return inputs_[1]; }
2767 Value* instantiator_type_arguments() const { return inputs_[2]; } 2771 Value* instantiator_type_arguments() const { return inputs_[2]; }
2768 2772
2769 intptr_t token_pos() const { return token_pos_; } 2773 virtual intptr_t token_pos() const { return token_pos_; }
2770 const AbstractType& dst_type() const { return dst_type_; } 2774 const AbstractType& dst_type() const { return dst_type_; }
2771 void set_dst_type(const AbstractType& dst_type) { 2775 void set_dst_type(const AbstractType& dst_type) {
2772 dst_type_ = dst_type.raw(); 2776 dst_type_ = dst_type.raw();
2773 } 2777 }
2774 const String& dst_name() const { return dst_name_; } 2778 const String& dst_name() const { return dst_name_; }
2775 2779
2776 virtual void PrintOperandsTo(BufferFormatter* f) const; 2780 virtual void PrintOperandsTo(BufferFormatter* f) const;
2777 2781
2778 virtual bool CanDeoptimize() const { return true; } 2782 virtual bool CanDeoptimize() const { return true; }
2779 2783
(...skipping 18 matching lines...) Expand all
2798 class AssertBooleanInstr : public TemplateDefinition<1> { 2802 class AssertBooleanInstr : public TemplateDefinition<1> {
2799 public: 2803 public:
2800 AssertBooleanInstr(intptr_t token_pos, Value* value) 2804 AssertBooleanInstr(intptr_t token_pos, Value* value)
2801 : token_pos_(token_pos) { 2805 : token_pos_(token_pos) {
2802 SetInputAt(0, value); 2806 SetInputAt(0, value);
2803 } 2807 }
2804 2808
2805 DECLARE_INSTRUCTION(AssertBoolean) 2809 DECLARE_INSTRUCTION(AssertBoolean)
2806 virtual CompileType ComputeType() const; 2810 virtual CompileType ComputeType() const;
2807 2811
2808 intptr_t token_pos() const { return token_pos_; } 2812 virtual intptr_t token_pos() const { return token_pos_; }
2809 Value* value() const { return inputs_[0]; } 2813 Value* value() const { return inputs_[0]; }
2810 2814
2811 virtual void PrintOperandsTo(BufferFormatter* f) const; 2815 virtual void PrintOperandsTo(BufferFormatter* f) const;
2812 2816
2813 virtual bool CanDeoptimize() const { return true; } 2817 virtual bool CanDeoptimize() const { return true; }
2814 2818
2815 virtual Definition* Canonicalize(FlowGraph* flow_graph); 2819 virtual Definition* Canonicalize(FlowGraph* flow_graph);
2816 2820
2817 virtual bool AllowsCSE() const { return true; } 2821 virtual bool AllowsCSE() const { return true; }
2818 virtual EffectSet Effects() const { return EffectSet::None(); } 2822 virtual EffectSet Effects() const { return EffectSet::None(); }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2853 class ClosureCallInstr : public TemplateDefinition<0> { 2857 class ClosureCallInstr : public TemplateDefinition<0> {
2854 public: 2858 public:
2855 ClosureCallInstr(ClosureCallNode* node, 2859 ClosureCallInstr(ClosureCallNode* node,
2856 ZoneGrowableArray<PushArgumentInstr*>* arguments) 2860 ZoneGrowableArray<PushArgumentInstr*>* arguments)
2857 : ast_node_(*node), 2861 : ast_node_(*node),
2858 arguments_(arguments) { } 2862 arguments_(arguments) { }
2859 2863
2860 DECLARE_INSTRUCTION(ClosureCall) 2864 DECLARE_INSTRUCTION(ClosureCall)
2861 2865
2862 const Array& argument_names() const { return ast_node_.arguments()->names(); } 2866 const Array& argument_names() const { return ast_node_.arguments()->names(); }
2863 intptr_t token_pos() const { return ast_node_.token_pos(); } 2867 virtual intptr_t token_pos() const { return ast_node_.token_pos(); }
2864 2868
2865 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 2869 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
2866 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { 2870 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
2867 return (*arguments_)[index]; 2871 return (*arguments_)[index];
2868 } 2872 }
2869 2873
2870 // TODO(kmillikin): implement exact call counts for closure calls. 2874 // TODO(kmillikin): implement exact call counts for closure calls.
2871 virtual intptr_t CallCount() const { return 1; } 2875 virtual intptr_t CallCount() const { return 1; }
2872 2876
2873 virtual void PrintOperandsTo(BufferFormatter* f) const; 2877 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2920 DECLARE_INSTRUCTION(InstanceCall) 2924 DECLARE_INSTRUCTION(InstanceCall)
2921 2925
2922 const ICData* ic_data() const { return ic_data_; } 2926 const ICData* ic_data() const { return ic_data_; }
2923 bool HasICData() const { 2927 bool HasICData() const {
2924 return (ic_data() != NULL) && !ic_data()->IsNull(); 2928 return (ic_data() != NULL) && !ic_data()->IsNull();
2925 } 2929 }
2926 2930
2927 // ICData can be replaced by optimizer. 2931 // ICData can be replaced by optimizer.
2928 void set_ic_data(const ICData* value) { ic_data_ = value; } 2932 void set_ic_data(const ICData* value) { ic_data_ = value; }
2929 2933
2930 intptr_t token_pos() const { return token_pos_; } 2934 virtual intptr_t token_pos() const { return token_pos_; }
2931 const String& function_name() const { return function_name_; } 2935 const String& function_name() const { return function_name_; }
2932 Token::Kind token_kind() const { return token_kind_; } 2936 Token::Kind token_kind() const { return token_kind_; }
2933 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 2937 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
2934 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { 2938 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
2935 return (*arguments_)[index]; 2939 return (*arguments_)[index];
2936 } 2940 }
2937 const Array& argument_names() const { return argument_names_; } 2941 const Array& argument_names() const { return argument_names_; }
2938 intptr_t checked_argument_count() const { return checked_argument_count_; } 2942 intptr_t checked_argument_count() const { return checked_argument_count_; }
2939 2943
2940 virtual void PrintOperandsTo(BufferFormatter* f) const; 2944 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 28 matching lines...) Expand all
2969 bool with_checks) 2973 bool with_checks)
2970 : instance_call_(instance_call), 2974 : instance_call_(instance_call),
2971 ic_data_(ic_data), 2975 ic_data_(ic_data),
2972 with_checks_(with_checks) { 2976 with_checks_(with_checks) {
2973 ASSERT(instance_call_ != NULL); 2977 ASSERT(instance_call_ != NULL);
2974 deopt_id_ = instance_call->deopt_id(); 2978 deopt_id_ = instance_call->deopt_id();
2975 } 2979 }
2976 2980
2977 InstanceCallInstr* instance_call() const { return instance_call_; } 2981 InstanceCallInstr* instance_call() const { return instance_call_; }
2978 bool with_checks() const { return with_checks_; } 2982 bool with_checks() const { return with_checks_; }
2983 virtual intptr_t token_pos() const { return instance_call_->token_pos(); }
2979 2984
2980 virtual intptr_t ArgumentCount() const { 2985 virtual intptr_t ArgumentCount() const {
2981 return instance_call()->ArgumentCount(); 2986 return instance_call()->ArgumentCount();
2982 } 2987 }
2983 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { 2988 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
2984 return instance_call()->PushArgumentAt(index); 2989 return instance_call()->PushArgumentAt(index);
2985 } 2990 }
2986 2991
2987 bool HasSingleRecognizedTarget() const; 2992 bool HasSingleRecognizedTarget() const;
2988 2993
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
3392 bool HasICData() const { 3397 bool HasICData() const {
3393 return (ic_data() != NULL) && !ic_data()->IsNull(); 3398 return (ic_data() != NULL) && !ic_data()->IsNull();
3394 } 3399 }
3395 3400
3396 DECLARE_INSTRUCTION(StaticCall) 3401 DECLARE_INSTRUCTION(StaticCall)
3397 virtual CompileType ComputeType() const; 3402 virtual CompileType ComputeType() const;
3398 3403
3399 // Accessors forwarded to the AST node. 3404 // Accessors forwarded to the AST node.
3400 const Function& function() const { return function_; } 3405 const Function& function() const { return function_; }
3401 const Array& argument_names() const { return argument_names_; } 3406 const Array& argument_names() const { return argument_names_; }
3402 intptr_t token_pos() const { return token_pos_; } 3407 virtual intptr_t token_pos() const { return token_pos_; }
3403 3408
3404 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 3409 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
3405 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { 3410 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
3406 return (*arguments_)[index]; 3411 return (*arguments_)[index];
3407 } 3412 }
3408 3413
3409 virtual intptr_t CallCount() const { return ic_data()->AggregateCount(); } 3414 virtual intptr_t CallCount() const { return ic_data()->AggregateCount(); }
3410 3415
3411 virtual void PrintOperandsTo(BufferFormatter* f) const; 3416 virtual void PrintOperandsTo(BufferFormatter* f) const;
3412 3417
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
3608 }; 3613 };
3609 3614
3610 3615
3611 class NativeCallInstr : public TemplateDefinition<0> { 3616 class NativeCallInstr : public TemplateDefinition<0> {
3612 public: 3617 public:
3613 explicit NativeCallInstr(NativeBodyNode* node) 3618 explicit NativeCallInstr(NativeBodyNode* node)
3614 : ast_node_(*node) {} 3619 : ast_node_(*node) {}
3615 3620
3616 DECLARE_INSTRUCTION(NativeCall) 3621 DECLARE_INSTRUCTION(NativeCall)
3617 3622
3618 intptr_t token_pos() const { return ast_node_.token_pos(); } 3623 virtual intptr_t token_pos() const { return ast_node_.token_pos(); }
3619 3624
3620 const Function& function() const { return ast_node_.function(); } 3625 const Function& function() const { return ast_node_.function(); }
3621 3626
3622 const String& native_name() const { 3627 const String& native_name() const {
3623 return ast_node_.native_c_function_name(); 3628 return ast_node_.native_c_function_name();
3624 } 3629 }
3625 3630
3626 NativeFunction native_c_function() const { 3631 NativeFunction native_c_function() const {
3627 return ast_node_.native_c_function(); 3632 return ast_node_.native_c_function();
3628 } 3633 }
(...skipping 23 matching lines...) Expand all
3652 class DebugStepCheckInstr : public TemplateInstruction<0> { 3657 class DebugStepCheckInstr : public TemplateInstruction<0> {
3653 public: 3658 public:
3654 DebugStepCheckInstr(intptr_t token_pos, 3659 DebugStepCheckInstr(intptr_t token_pos,
3655 PcDescriptors::Kind stub_kind) 3660 PcDescriptors::Kind stub_kind)
3656 : token_pos_(token_pos), 3661 : token_pos_(token_pos),
3657 stub_kind_(stub_kind) { 3662 stub_kind_(stub_kind) {
3658 } 3663 }
3659 3664
3660 DECLARE_INSTRUCTION(DebugStepCheck) 3665 DECLARE_INSTRUCTION(DebugStepCheck)
3661 3666
3662 intptr_t token_pos() const { return token_pos_; } 3667 virtual intptr_t token_pos() const { return token_pos_; }
3663 virtual bool MayThrow() const { return false; } 3668 virtual bool MayThrow() const { return false; }
3664 virtual bool CanDeoptimize() const { return false; } 3669 virtual bool CanDeoptimize() const { return false; }
3665 virtual EffectSet Effects() const { return EffectSet::All(); } 3670 virtual EffectSet Effects() const { return EffectSet::All(); }
3666 virtual intptr_t ArgumentCount() const { return 0; } 3671 virtual intptr_t ArgumentCount() const { return 0; }
3667 virtual Instruction* Canonicalize(FlowGraph* flow_graph); 3672 virtual Instruction* Canonicalize(FlowGraph* flow_graph);
3668 3673
3669 private: 3674 private:
3670 const intptr_t token_pos_; 3675 const intptr_t token_pos_;
3671 const PcDescriptors::Kind stub_kind_; 3676 const PcDescriptors::Kind stub_kind_;
3672 3677
3673 DISALLOW_COPY_AND_ASSIGN(DebugStepCheckInstr); 3678 DISALLOW_COPY_AND_ASSIGN(DebugStepCheckInstr);
3674 }; 3679 };
3675 3680
3676 3681
3677 enum StoreBarrierType { 3682 enum StoreBarrierType {
3678 kNoStoreBarrier, 3683 kNoStoreBarrier,
3679 kEmitStoreBarrier 3684 kEmitStoreBarrier
3680 }; 3685 };
3681 3686
3682 3687
3683 class StoreInstanceFieldInstr : public TemplateDefinition<2> { 3688 class StoreInstanceFieldInstr : public TemplateDefinition<2> {
3684 public: 3689 public:
3685 StoreInstanceFieldInstr(const Field& field, 3690 StoreInstanceFieldInstr(const Field& field,
3686 Value* instance, 3691 Value* instance,
3687 Value* value, 3692 Value* value,
3688 StoreBarrierType emit_store_barrier, 3693 StoreBarrierType emit_store_barrier,
3694 intptr_t token_pos,
3689 bool is_initialization = false) 3695 bool is_initialization = false)
3690 : field_(field), 3696 : field_(field),
3691 offset_in_bytes_(field.Offset()), 3697 offset_in_bytes_(field.Offset()),
3692 emit_store_barrier_(emit_store_barrier), 3698 emit_store_barrier_(emit_store_barrier),
3699 token_pos_(token_pos),
3693 is_initialization_(is_initialization) { 3700 is_initialization_(is_initialization) {
3694 SetInputAt(kInstancePos, instance); 3701 SetInputAt(kInstancePos, instance);
3695 SetInputAt(kValuePos, value); 3702 SetInputAt(kValuePos, value);
3696 } 3703 }
3697 3704
3698 StoreInstanceFieldInstr(intptr_t offset_in_bytes, 3705 StoreInstanceFieldInstr(intptr_t offset_in_bytes,
3699 Value* instance, 3706 Value* instance,
3700 Value* value, 3707 Value* value,
3701 StoreBarrierType emit_store_barrier, 3708 StoreBarrierType emit_store_barrier,
3709 intptr_t token_pos,
3702 bool is_initialization = false) 3710 bool is_initialization = false)
3703 : field_(Field::Handle()), 3711 : field_(Field::Handle()),
3704 offset_in_bytes_(offset_in_bytes), 3712 offset_in_bytes_(offset_in_bytes),
3705 emit_store_barrier_(emit_store_barrier), 3713 emit_store_barrier_(emit_store_barrier),
3714 token_pos_(token_pos),
3706 is_initialization_(is_initialization) { 3715 is_initialization_(is_initialization) {
3707 SetInputAt(kInstancePos, instance); 3716 SetInputAt(kInstancePos, instance);
3708 SetInputAt(kValuePos, value); 3717 SetInputAt(kValuePos, value);
3709 } 3718 }
3710 3719
3711 DECLARE_INSTRUCTION(StoreInstanceField) 3720 DECLARE_INSTRUCTION(StoreInstanceField)
3712 3721
3713 enum { 3722 enum {
3714 kInstancePos = 0, 3723 kInstancePos = 0,
3715 kValuePos = 1 3724 kValuePos = 1
3716 }; 3725 };
3717 3726
3718 Value* instance() const { return inputs_[kInstancePos]; } 3727 Value* instance() const { return inputs_[kInstancePos]; }
3719 Value* value() const { return inputs_[kValuePos]; } 3728 Value* value() const { return inputs_[kValuePos]; }
3729 virtual intptr_t token_pos() const { return token_pos_; }
3720 3730
3721 virtual CompileType* ComputeInitialType() const; 3731 virtual CompileType* ComputeInitialType() const;
3722 3732
3723 const Field& field() const { return field_; } 3733 const Field& field() const { return field_; }
3724 intptr_t offset_in_bytes() const { return offset_in_bytes_; } 3734 intptr_t offset_in_bytes() const { return offset_in_bytes_; }
3725 3735
3726 bool ShouldEmitStoreBarrier() const { 3736 bool ShouldEmitStoreBarrier() const {
3727 return value()->NeedsStoreBuffer() 3737 return value()->NeedsStoreBuffer()
3728 && (emit_store_barrier_ == kEmitStoreBarrier); 3738 && (emit_store_barrier_ == kEmitStoreBarrier);
3729 } 3739 }
(...skipping 26 matching lines...) Expand all
3756 bool CanValueBeSmi() const { 3766 bool CanValueBeSmi() const {
3757 const intptr_t cid = value()->Type()->ToNullableCid(); 3767 const intptr_t cid = value()->Type()->ToNullableCid();
3758 // Write barrier is skipped for nullable and non-nullable smis. 3768 // Write barrier is skipped for nullable and non-nullable smis.
3759 ASSERT(cid != kSmiCid); 3769 ASSERT(cid != kSmiCid);
3760 return (cid == kDynamicCid); 3770 return (cid == kDynamicCid);
3761 } 3771 }
3762 3772
3763 const Field& field_; 3773 const Field& field_;
3764 intptr_t offset_in_bytes_; 3774 intptr_t offset_in_bytes_;
3765 const StoreBarrierType emit_store_barrier_; 3775 const StoreBarrierType emit_store_barrier_;
3776 const intptr_t token_pos_;
3766 const bool is_initialization_; // Marks stores in the constructor. 3777 const bool is_initialization_; // Marks stores in the constructor.
3767 3778
3768 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); 3779 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr);
3769 }; 3780 };
3770 3781
3771 3782
3772 class GuardFieldInstr : public TemplateInstruction<1> { 3783 class GuardFieldInstr : public TemplateInstruction<1> {
3773 public: 3784 public:
3774 GuardFieldInstr(Value* value, 3785 GuardFieldInstr(Value* value,
3775 const Field& field, 3786 const Field& field,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
3879 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); 3890 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr);
3880 }; 3891 };
3881 3892
3882 3893
3883 class LoadIndexedInstr : public TemplateDefinition<2> { 3894 class LoadIndexedInstr : public TemplateDefinition<2> {
3884 public: 3895 public:
3885 LoadIndexedInstr(Value* array, 3896 LoadIndexedInstr(Value* array,
3886 Value* index, 3897 Value* index,
3887 intptr_t index_scale, 3898 intptr_t index_scale,
3888 intptr_t class_id, 3899 intptr_t class_id,
3889 intptr_t deopt_id) 3900 intptr_t deopt_id,
3890 : index_scale_(index_scale), class_id_(class_id) { 3901 intptr_t token_pos)
3902 : index_scale_(index_scale),
3903 class_id_(class_id),
3904 token_pos_(token_pos) {
3891 SetInputAt(0, array); 3905 SetInputAt(0, array);
3892 SetInputAt(1, index); 3906 SetInputAt(1, index);
3893 deopt_id_ = deopt_id; 3907 deopt_id_ = deopt_id;
3894 } 3908 }
3895 3909
3910 intptr_t token_pos() const { return token_pos_; }
3911
3896 DECLARE_INSTRUCTION(LoadIndexed) 3912 DECLARE_INSTRUCTION(LoadIndexed)
3897 virtual CompileType ComputeType() const; 3913 virtual CompileType ComputeType() const;
3898 3914
3899 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 3915 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3900 ASSERT(idx == 0 || idx == 1); 3916 ASSERT(idx == 0 || idx == 1);
3901 // The array may be tagged or untagged (for external arrays). 3917 // The array may be tagged or untagged (for external arrays).
3902 if (idx == 0) return kNoRepresentation; 3918 if (idx == 0) return kNoRepresentation;
3903 return kTagged; 3919 return kTagged;
3904 } 3920 }
3905 3921
(...skipping 17 matching lines...) Expand all
3923 virtual bool AllowsCSE() const { return false; } 3939 virtual bool AllowsCSE() const { return false; }
3924 virtual EffectSet Effects() const { return EffectSet::None(); } 3940 virtual EffectSet Effects() const { return EffectSet::None(); }
3925 virtual EffectSet Dependencies() const; 3941 virtual EffectSet Dependencies() const;
3926 virtual bool AttributesEqual(Instruction* other) const; 3942 virtual bool AttributesEqual(Instruction* other) const;
3927 3943
3928 virtual bool MayThrow() const { return false; } 3944 virtual bool MayThrow() const { return false; }
3929 3945
3930 private: 3946 private:
3931 const intptr_t index_scale_; 3947 const intptr_t index_scale_;
3932 const intptr_t class_id_; 3948 const intptr_t class_id_;
3949 const intptr_t token_pos_;
3933 3950
3934 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); 3951 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr);
3935 }; 3952 };
3936 3953
3937 3954
3938 class StringFromCharCodeInstr : public TemplateDefinition<1> { 3955 class StringFromCharCodeInstr : public TemplateDefinition<1> {
3939 public: 3956 public:
3940 StringFromCharCodeInstr(Value* char_code, intptr_t cid) : cid_(cid) { 3957 StringFromCharCodeInstr(Value* char_code, intptr_t cid) : cid_(cid) {
3941 ASSERT(char_code != NULL); 3958 ASSERT(char_code != NULL);
3942 ASSERT(char_code->definition()->IsLoadIndexed()); 3959 ASSERT(char_code->definition()->IsLoadIndexed());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
3999 4016
4000 4017
4001 class StringInterpolateInstr : public TemplateDefinition<1> { 4018 class StringInterpolateInstr : public TemplateDefinition<1> {
4002 public: 4019 public:
4003 StringInterpolateInstr(Value* value, intptr_t token_pos) 4020 StringInterpolateInstr(Value* value, intptr_t token_pos)
4004 : token_pos_(token_pos), function_(Function::Handle()) { 4021 : token_pos_(token_pos), function_(Function::Handle()) {
4005 SetInputAt(0, value); 4022 SetInputAt(0, value);
4006 } 4023 }
4007 4024
4008 Value* value() const { return inputs_[0]; } 4025 Value* value() const { return inputs_[0]; }
4009 intptr_t token_pos() const { return token_pos_; } 4026 virtual intptr_t token_pos() const { return token_pos_; }
4010 4027
4011 virtual CompileType ComputeType() const; 4028 virtual CompileType ComputeType() const;
4012 // Issues a static call to Dart code whihc calls toString on objects. 4029 // Issues a static call to Dart code whihc calls toString on objects.
4013 virtual EffectSet Effects() const { return EffectSet::All(); } 4030 virtual EffectSet Effects() const { return EffectSet::All(); }
4014 virtual bool CanDeoptimize() const { return true; } 4031 virtual bool CanDeoptimize() const { return true; }
4015 virtual bool MayThrow() const { return true; } 4032 virtual bool MayThrow() const { return true; }
4016 4033
4017 const Function& CallFunction() const; 4034 const Function& CallFunction() const;
4018 4035
4019 virtual Definition* Canonicalize(FlowGraph* flow_graph); 4036 virtual Definition* Canonicalize(FlowGraph* flow_graph);
4020 4037
4021 DECLARE_INSTRUCTION(StringInterpolate) 4038 DECLARE_INSTRUCTION(StringInterpolate)
4022 4039
4023 private: 4040 private:
4024 const intptr_t token_pos_; 4041 const intptr_t token_pos_;
4025 Function& function_; 4042 Function& function_;
4026 4043
4027 DISALLOW_COPY_AND_ASSIGN(StringInterpolateInstr); 4044 DISALLOW_COPY_AND_ASSIGN(StringInterpolateInstr);
4028 }; 4045 };
4029 4046
4030 4047
4031 class StoreIndexedInstr : public TemplateDefinition<3> { 4048 class StoreIndexedInstr : public TemplateDefinition<3> {
4032 public: 4049 public:
4033 StoreIndexedInstr(Value* array, 4050 StoreIndexedInstr(Value* array,
4034 Value* index, 4051 Value* index,
4035 Value* value, 4052 Value* value,
4036 StoreBarrierType emit_store_barrier, 4053 StoreBarrierType emit_store_barrier,
4037 intptr_t index_scale, 4054 intptr_t index_scale,
4038 intptr_t class_id, 4055 intptr_t class_id,
4039 intptr_t deopt_id) 4056 intptr_t deopt_id,
4057 intptr_t token_pos)
4040 : emit_store_barrier_(emit_store_barrier), 4058 : emit_store_barrier_(emit_store_barrier),
4041 index_scale_(index_scale), 4059 index_scale_(index_scale),
4042 class_id_(class_id) { 4060 class_id_(class_id),
4061 token_pos_(token_pos) {
4043 SetInputAt(kArrayPos, array); 4062 SetInputAt(kArrayPos, array);
4044 SetInputAt(kIndexPos, index); 4063 SetInputAt(kIndexPos, index);
4045 SetInputAt(kValuePos, value); 4064 SetInputAt(kValuePos, value);
4046 deopt_id_ = deopt_id; 4065 deopt_id_ = deopt_id;
4047 } 4066 }
4048 4067
4049 DECLARE_INSTRUCTION(StoreIndexed) 4068 DECLARE_INSTRUCTION(StoreIndexed)
4050 4069
4051 enum { 4070 enum {
4052 kArrayPos = 0, 4071 kArrayPos = 0,
(...skipping 28 matching lines...) Expand all
4081 } 4100 }
4082 4101
4083 virtual EffectSet Effects() const { return EffectSet::None(); } 4102 virtual EffectSet Effects() const { return EffectSet::None(); }
4084 4103
4085 virtual bool MayThrow() const { return false; } 4104 virtual bool MayThrow() const { return false; }
4086 4105
4087 private: 4106 private:
4088 const StoreBarrierType emit_store_barrier_; 4107 const StoreBarrierType emit_store_barrier_;
4089 const intptr_t index_scale_; 4108 const intptr_t index_scale_;
4090 const intptr_t class_id_; 4109 const intptr_t class_id_;
4110 const intptr_t token_pos_;
4091 4111
4092 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); 4112 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr);
4093 }; 4113 };
4094 4114
4095 4115
4096 // Note overrideable, built-in: value ? false : true. 4116 // Note overrideable, built-in: value ? false : true.
4097 class BooleanNegateInstr : public TemplateDefinition<1> { 4117 class BooleanNegateInstr : public TemplateDefinition<1> {
4098 public: 4118 public:
4099 explicit BooleanNegateInstr(Value* value) { 4119 explicit BooleanNegateInstr(Value* value) {
4100 SetInputAt(0, value); 4120 SetInputAt(0, value);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
4139 4159
4140 DECLARE_INSTRUCTION(InstanceOf) 4160 DECLARE_INSTRUCTION(InstanceOf)
4141 virtual CompileType ComputeType() const; 4161 virtual CompileType ComputeType() const;
4142 4162
4143 Value* value() const { return inputs_[0]; } 4163 Value* value() const { return inputs_[0]; }
4144 Value* instantiator() const { return inputs_[1]; } 4164 Value* instantiator() const { return inputs_[1]; }
4145 Value* instantiator_type_arguments() const { return inputs_[2]; } 4165 Value* instantiator_type_arguments() const { return inputs_[2]; }
4146 4166
4147 bool negate_result() const { return negate_result_; } 4167 bool negate_result() const { return negate_result_; }
4148 const AbstractType& type() const { return type_; } 4168 const AbstractType& type() const { return type_; }
4149 intptr_t token_pos() const { return token_pos_; } 4169 virtual intptr_t token_pos() const { return token_pos_; }
4150 4170
4151 virtual void PrintOperandsTo(BufferFormatter* f) const; 4171 virtual void PrintOperandsTo(BufferFormatter* f) const;
4152 4172
4153 virtual bool CanDeoptimize() const { return true; } 4173 virtual bool CanDeoptimize() const { return true; }
4154 4174
4155 virtual EffectSet Effects() const { return EffectSet::None(); } 4175 virtual EffectSet Effects() const { return EffectSet::None(); }
4156 4176
4157 virtual bool MayThrow() const { return true; } 4177 virtual bool MayThrow() const { return true; }
4158 4178
4159 private: 4179 private:
(...skipping 24 matching lines...) Expand all
4184 4204
4185 DECLARE_INSTRUCTION(AllocateObject) 4205 DECLARE_INSTRUCTION(AllocateObject)
4186 virtual CompileType ComputeType() const; 4206 virtual CompileType ComputeType() const;
4187 4207
4188 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 4208 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
4189 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { 4209 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
4190 return (*arguments_)[index]; 4210 return (*arguments_)[index];
4191 } 4211 }
4192 4212
4193 const Class& cls() const { return cls_; } 4213 const Class& cls() const { return cls_; }
4194 intptr_t token_pos() const { return token_pos_; } 4214 virtual intptr_t token_pos() const { return token_pos_; }
4195 4215
4196 const Function& closure_function() const { return closure_function_; } 4216 const Function& closure_function() const { return closure_function_; }
4197 void set_closure_function(const Function& function) { 4217 void set_closure_function(const Function& function) {
4198 closure_function_ ^= function.raw(); 4218 closure_function_ ^= function.raw();
4199 } 4219 }
4200 4220
4201 virtual void PrintOperandsTo(BufferFormatter* f) const; 4221 virtual void PrintOperandsTo(BufferFormatter* f) const;
4202 4222
4203 virtual bool CanDeoptimize() const { return false; } 4223 virtual bool CanDeoptimize() const { return false; }
4204 4224
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
4304 4324
4305 enum { 4325 enum {
4306 kElementTypePos = 0, 4326 kElementTypePos = 0,
4307 kLengthPos = 1 4327 kLengthPos = 1
4308 }; 4328 };
4309 4329
4310 DECLARE_INSTRUCTION(CreateArray) 4330 DECLARE_INSTRUCTION(CreateArray)
4311 virtual CompileType ComputeType() const; 4331 virtual CompileType ComputeType() const;
4312 4332
4313 4333
4314 intptr_t token_pos() const { return token_pos_; } 4334 virtual intptr_t token_pos() const { return token_pos_; }
4315 Value* element_type() const { return inputs_[kElementTypePos]; } 4335 Value* element_type() const { return inputs_[kElementTypePos]; }
4316 Value* num_elements() const { return inputs_[kLengthPos]; } 4336 Value* num_elements() const { return inputs_[kLengthPos]; }
4317 4337
4318 virtual void PrintOperandsTo(BufferFormatter* f) const; 4338 virtual void PrintOperandsTo(BufferFormatter* f) const;
4319 4339
4320 virtual bool CanDeoptimize() const { return false; } 4340 virtual bool CanDeoptimize() const { return false; }
4321 4341
4322 virtual EffectSet Effects() const { return EffectSet::None(); } 4342 virtual EffectSet Effects() const { return EffectSet::None(); }
4323 4343
4324 virtual bool MayThrow() const { return false; } 4344 virtual bool MayThrow() const { return false; }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
4396 private: 4416 private:
4397 DISALLOW_COPY_AND_ASSIGN(LoadClassIdInstr); 4417 DISALLOW_COPY_AND_ASSIGN(LoadClassIdInstr);
4398 }; 4418 };
4399 4419
4400 4420
4401 class LoadFieldInstr : public TemplateDefinition<1> { 4421 class LoadFieldInstr : public TemplateDefinition<1> {
4402 public: 4422 public:
4403 LoadFieldInstr(Value* instance, 4423 LoadFieldInstr(Value* instance,
4404 intptr_t offset_in_bytes, 4424 intptr_t offset_in_bytes,
4405 const AbstractType& type, 4425 const AbstractType& type,
4426 intptr_t token_pos,
4406 bool immutable = false) 4427 bool immutable = false)
4407 : offset_in_bytes_(offset_in_bytes), 4428 : offset_in_bytes_(offset_in_bytes),
4408 type_(type), 4429 type_(type),
4409 result_cid_(kDynamicCid), 4430 result_cid_(kDynamicCid),
4410 immutable_(immutable), 4431 immutable_(immutable),
4411 recognized_kind_(MethodRecognizer::kUnknown), 4432 recognized_kind_(MethodRecognizer::kUnknown),
4412 field_(NULL) { 4433 field_(NULL),
4434 token_pos_(token_pos) {
4413 ASSERT(offset_in_bytes >= 0); 4435 ASSERT(offset_in_bytes >= 0);
4414 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. 4436 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance.
4415 SetInputAt(0, instance); 4437 SetInputAt(0, instance);
4416 } 4438 }
4417 4439
4418 LoadFieldInstr(Value* instance, 4440 LoadFieldInstr(Value* instance,
4419 const Field* field, 4441 const Field* field,
4420 const AbstractType& type, 4442 const AbstractType& type,
4443 intptr_t token_pos,
4421 bool immutable = false) 4444 bool immutable = false)
4422 : offset_in_bytes_(field->Offset()), 4445 : offset_in_bytes_(field->Offset()),
4423 type_(type), 4446 type_(type),
4424 result_cid_(kDynamicCid), 4447 result_cid_(kDynamicCid),
4425 immutable_(immutable), 4448 immutable_(immutable),
4426 recognized_kind_(MethodRecognizer::kUnknown), 4449 recognized_kind_(MethodRecognizer::kUnknown),
4427 field_(field) { 4450 field_(field),
4451 token_pos_(token_pos) {
4428 ASSERT(field->IsZoneHandle()); 4452 ASSERT(field->IsZoneHandle());
4429 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. 4453 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance.
4430 SetInputAt(0, instance); 4454 SetInputAt(0, instance);
4431 } 4455 }
4432 4456
4433 Value* instance() const { return inputs_[0]; } 4457 Value* instance() const { return inputs_[0]; }
4434 intptr_t offset_in_bytes() const { return offset_in_bytes_; } 4458 intptr_t offset_in_bytes() const { return offset_in_bytes_; }
4435 const AbstractType& type() const { return type_; } 4459 const AbstractType& type() const { return type_; }
4436 void set_result_cid(intptr_t value) { result_cid_ = value; } 4460 void set_result_cid(intptr_t value) { result_cid_ = value; }
4437 intptr_t result_cid() const { return result_cid_; } 4461 intptr_t result_cid() const { return result_cid_; }
4462 virtual intptr_t token_pos() const { return token_pos_; }
4438 4463
4439 const Field* field() const { return field_; } 4464 const Field* field() const { return field_; }
4440 4465
4441 virtual Representation representation() const; 4466 virtual Representation representation() const;
4442 4467
4443 bool IsUnboxedLoad() const; 4468 bool IsUnboxedLoad() const;
4444 4469
4445 bool IsPotentialUnboxedLoad() const; 4470 bool IsPotentialUnboxedLoad() const;
4446 4471
4447 void set_recognized_kind(MethodRecognizer::Kind kind) { 4472 void set_recognized_kind(MethodRecognizer::Kind kind) {
(...skipping 26 matching lines...) Expand all
4474 virtual EffectSet Dependencies() const; 4499 virtual EffectSet Dependencies() const;
4475 virtual bool AttributesEqual(Instruction* other) const; 4500 virtual bool AttributesEqual(Instruction* other) const;
4476 4501
4477 virtual bool MayThrow() const { return false; } 4502 virtual bool MayThrow() const { return false; }
4478 4503
4479 private: 4504 private:
4480 const intptr_t offset_in_bytes_; 4505 const intptr_t offset_in_bytes_;
4481 const AbstractType& type_; 4506 const AbstractType& type_;
4482 intptr_t result_cid_; 4507 intptr_t result_cid_;
4483 const bool immutable_; 4508 const bool immutable_;
4484
4485 MethodRecognizer::Kind recognized_kind_; 4509 MethodRecognizer::Kind recognized_kind_;
4486
4487 const Field* field_; 4510 const Field* field_;
4511 const intptr_t token_pos_;
4488 4512
4489 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); 4513 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr);
4490 }; 4514 };
4491 4515
4492 4516
4493 class InstantiateTypeInstr : public TemplateDefinition<1> { 4517 class InstantiateTypeInstr : public TemplateDefinition<1> {
4494 public: 4518 public:
4495 InstantiateTypeInstr(intptr_t token_pos, 4519 InstantiateTypeInstr(intptr_t token_pos,
4496 const AbstractType& type, 4520 const AbstractType& type,
4497 const Class& instantiator_class, 4521 const Class& instantiator_class,
4498 Value* instantiator) 4522 Value* instantiator)
4499 : token_pos_(token_pos), 4523 : token_pos_(token_pos),
4500 type_(type), 4524 type_(type),
4501 instantiator_class_(instantiator_class) { 4525 instantiator_class_(instantiator_class) {
4502 ASSERT(type.IsZoneHandle()); 4526 ASSERT(type.IsZoneHandle());
4503 SetInputAt(0, instantiator); 4527 SetInputAt(0, instantiator);
4504 } 4528 }
4505 4529
4506 DECLARE_INSTRUCTION(InstantiateType) 4530 DECLARE_INSTRUCTION(InstantiateType)
4507 4531
4508 Value* instantiator() const { return inputs_[0]; } 4532 Value* instantiator() const { return inputs_[0]; }
4509 const AbstractType& type() const { return type_; 4533 const AbstractType& type() const { return type_;
4510 } 4534 }
4511 const Class& instantiator_class() const { return instantiator_class_; } 4535 const Class& instantiator_class() const { return instantiator_class_; }
4512 intptr_t token_pos() const { return token_pos_; } 4536 virtual intptr_t token_pos() const { return token_pos_; }
4513 4537
4514 virtual void PrintOperandsTo(BufferFormatter* f) const; 4538 virtual void PrintOperandsTo(BufferFormatter* f) const;
4515 4539
4516 virtual bool CanDeoptimize() const { return true; } 4540 virtual bool CanDeoptimize() const { return true; }
4517 4541
4518 virtual EffectSet Effects() const { return EffectSet::None(); } 4542 virtual EffectSet Effects() const { return EffectSet::None(); }
4519 4543
4520 virtual bool MayThrow() const { return true; } 4544 virtual bool MayThrow() const { return true; }
4521 4545
4522 private: 4546 private:
(...skipping 18 matching lines...) Expand all
4541 SetInputAt(0, instantiator); 4565 SetInputAt(0, instantiator);
4542 } 4566 }
4543 4567
4544 DECLARE_INSTRUCTION(InstantiateTypeArguments) 4568 DECLARE_INSTRUCTION(InstantiateTypeArguments)
4545 4569
4546 Value* instantiator() const { return inputs_[0]; } 4570 Value* instantiator() const { return inputs_[0]; }
4547 const TypeArguments& type_arguments() const { 4571 const TypeArguments& type_arguments() const {
4548 return type_arguments_; 4572 return type_arguments_;
4549 } 4573 }
4550 const Class& instantiator_class() const { return instantiator_class_; } 4574 const Class& instantiator_class() const { return instantiator_class_; }
4551 intptr_t token_pos() const { return token_pos_; } 4575 virtual intptr_t token_pos() const { return token_pos_; }
4552 4576
4553 virtual void PrintOperandsTo(BufferFormatter* f) const; 4577 virtual void PrintOperandsTo(BufferFormatter* f) const;
4554 4578
4555 virtual bool CanDeoptimize() const { return true; } 4579 virtual bool CanDeoptimize() const { return true; }
4556 4580
4557 virtual EffectSet Effects() const { return EffectSet::None(); } 4581 virtual EffectSet Effects() const { return EffectSet::None(); }
4558 4582
4559 virtual bool MayThrow() const { return true; } 4583 virtual bool MayThrow() const { return true; }
4560 4584
4561 virtual Definition* Canonicalize(FlowGraph* flow_graph); 4585 virtual Definition* Canonicalize(FlowGraph* flow_graph);
(...skipping 10 matching lines...) Expand all
4572 class AllocateContextInstr : public TemplateDefinition<0> { 4596 class AllocateContextInstr : public TemplateDefinition<0> {
4573 public: 4597 public:
4574 AllocateContextInstr(intptr_t token_pos, 4598 AllocateContextInstr(intptr_t token_pos,
4575 intptr_t num_context_variables) 4599 intptr_t num_context_variables)
4576 : token_pos_(token_pos), 4600 : token_pos_(token_pos),
4577 num_context_variables_(num_context_variables) {} 4601 num_context_variables_(num_context_variables) {}
4578 4602
4579 DECLARE_INSTRUCTION(AllocateContext) 4603 DECLARE_INSTRUCTION(AllocateContext)
4580 virtual CompileType ComputeType() const; 4604 virtual CompileType ComputeType() const;
4581 4605
4582 intptr_t token_pos() const { return token_pos_; } 4606 virtual intptr_t token_pos() const { return token_pos_; }
4583 intptr_t num_context_variables() const { return num_context_variables_; } 4607 intptr_t num_context_variables() const { return num_context_variables_; }
4584 4608
4585 virtual void PrintOperandsTo(BufferFormatter* f) const; 4609 virtual void PrintOperandsTo(BufferFormatter* f) const;
4586 4610
4587 virtual bool CanDeoptimize() const { return false; } 4611 virtual bool CanDeoptimize() const { return false; }
4588 4612
4589 virtual EffectSet Effects() const { return EffectSet::None(); } 4613 virtual EffectSet Effects() const { return EffectSet::None(); }
4590 4614
4591 virtual bool MayThrow() const { return false; } 4615 virtual bool MayThrow() const { return false; }
4592 4616
4593 private: 4617 private:
4594 const intptr_t token_pos_; 4618 const intptr_t token_pos_;
4595 const intptr_t num_context_variables_; 4619 const intptr_t num_context_variables_;
4596 4620
4597 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); 4621 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr);
4598 }; 4622 };
4599 4623
4600 4624
4601 class CloneContextInstr : public TemplateDefinition<1> { 4625 class CloneContextInstr : public TemplateDefinition<1> {
4602 public: 4626 public:
4603 CloneContextInstr(intptr_t token_pos, Value* context_value) 4627 CloneContextInstr(intptr_t token_pos, Value* context_value)
4604 : token_pos_(token_pos) { 4628 : token_pos_(token_pos) {
4605 SetInputAt(0, context_value); 4629 SetInputAt(0, context_value);
4606 } 4630 }
4607 4631
4608 intptr_t token_pos() const { return token_pos_; } 4632 virtual intptr_t token_pos() const { return token_pos_; }
4609 Value* context_value() const { return inputs_[0]; } 4633 Value* context_value() const { return inputs_[0]; }
4610 4634
4611 DECLARE_INSTRUCTION(CloneContext) 4635 DECLARE_INSTRUCTION(CloneContext)
4612 virtual CompileType ComputeType() const; 4636 virtual CompileType ComputeType() const;
4613 4637
4614 virtual bool CanDeoptimize() const { return true; } 4638 virtual bool CanDeoptimize() const { return true; }
4615 4639
4616 virtual EffectSet Effects() const { return EffectSet::None(); } 4640 virtual EffectSet Effects() const { return EffectSet::None(); }
4617 4641
4618 virtual bool MayThrow() const { return false; } 4642 virtual bool MayThrow() const { return false; }
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
5121 5145
5122 DISALLOW_COPY_AND_ASSIGN(MathMinMaxInstr); 5146 DISALLOW_COPY_AND_ASSIGN(MathMinMaxInstr);
5123 }; 5147 };
5124 5148
5125 5149
5126 class BinaryDoubleOpInstr : public TemplateDefinition<2> { 5150 class BinaryDoubleOpInstr : public TemplateDefinition<2> {
5127 public: 5151 public:
5128 BinaryDoubleOpInstr(Token::Kind op_kind, 5152 BinaryDoubleOpInstr(Token::Kind op_kind,
5129 Value* left, 5153 Value* left,
5130 Value* right, 5154 Value* right,
5131 intptr_t deopt_id) 5155 intptr_t deopt_id,
5132 : op_kind_(op_kind) { 5156 intptr_t token_pos)
5157 : op_kind_(op_kind), token_pos_(token_pos) {
5133 SetInputAt(0, left); 5158 SetInputAt(0, left);
5134 SetInputAt(1, right); 5159 SetInputAt(1, right);
5135 // Overriden generated deopt_id. 5160 // Overriden generated deopt_id.
5136 deopt_id_ = deopt_id; 5161 deopt_id_ = deopt_id;
5137 } 5162 }
5138 5163
5139 Value* left() const { return inputs_[0]; } 5164 Value* left() const { return inputs_[0]; }
5140 Value* right() const { return inputs_[1]; } 5165 Value* right() const { return inputs_[1]; }
5141 5166
5142 Token::Kind op_kind() const { return op_kind_; } 5167 Token::Kind op_kind() const { return op_kind_; }
5143 5168
5169 virtual intptr_t token_pos() const { return token_pos_; }
5170
5144 virtual void PrintOperandsTo(BufferFormatter* f) const; 5171 virtual void PrintOperandsTo(BufferFormatter* f) const;
5145 5172
5146 virtual bool CanDeoptimize() const { return false; } 5173 virtual bool CanDeoptimize() const { return false; }
5147 5174
5148 virtual Representation representation() const { 5175 virtual Representation representation() const {
5149 return kUnboxedDouble; 5176 return kUnboxedDouble;
5150 } 5177 }
5151 5178
5152 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5179 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5153 ASSERT((idx == 0) || (idx == 1)); 5180 ASSERT((idx == 0) || (idx == 1));
(...skipping 15 matching lines...) Expand all
5169 virtual EffectSet Effects() const { return EffectSet::None(); } 5196 virtual EffectSet Effects() const { return EffectSet::None(); }
5170 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5197 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5171 virtual bool AttributesEqual(Instruction* other) const { 5198 virtual bool AttributesEqual(Instruction* other) const {
5172 return op_kind() == other->AsBinaryDoubleOp()->op_kind(); 5199 return op_kind() == other->AsBinaryDoubleOp()->op_kind();
5173 } 5200 }
5174 5201
5175 virtual bool MayThrow() const { return false; } 5202 virtual bool MayThrow() const { return false; }
5176 5203
5177 private: 5204 private:
5178 const Token::Kind op_kind_; 5205 const Token::Kind op_kind_;
5206 const intptr_t token_pos_;
5179 5207
5180 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); 5208 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr);
5181 }; 5209 };
5182 5210
5183 5211
5184 class BinaryFloat32x4OpInstr : public TemplateDefinition<2> { 5212 class BinaryFloat32x4OpInstr : public TemplateDefinition<2> {
5185 public: 5213 public:
5186 BinaryFloat32x4OpInstr(Token::Kind op_kind, 5214 BinaryFloat32x4OpInstr(Token::Kind op_kind,
5187 Value* left, 5215 Value* left,
5188 Value* right, 5216 Value* right,
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
6901 6929
6902 DISALLOW_COPY_AND_ASSIGN(UnaryMintOpInstr); 6930 DISALLOW_COPY_AND_ASSIGN(UnaryMintOpInstr);
6903 }; 6931 };
6904 6932
6905 6933
6906 class BinarySmiOpInstr : public TemplateDefinition<2> { 6934 class BinarySmiOpInstr : public TemplateDefinition<2> {
6907 public: 6935 public:
6908 BinarySmiOpInstr(Token::Kind op_kind, 6936 BinarySmiOpInstr(Token::Kind op_kind,
6909 Value* left, 6937 Value* left,
6910 Value* right, 6938 Value* right,
6911 intptr_t deopt_id) 6939 intptr_t deopt_id,
6940 intptr_t token_pos)
6912 : op_kind_(op_kind), 6941 : op_kind_(op_kind),
6913 overflow_(true), 6942 overflow_(true),
6914 is_truncating_(false) { 6943 is_truncating_(false),
6944 token_pos_(token_pos) {
6915 SetInputAt(0, left); 6945 SetInputAt(0, left);
6916 SetInputAt(1, right); 6946 SetInputAt(1, right);
6917 // Override generated deopt-id. 6947 // Override generated deopt-id.
6918 deopt_id_ = deopt_id; 6948 deopt_id_ = deopt_id;
6919 } 6949 }
6920 6950
6921 Value* left() const { return inputs_[0]; } 6951 Value* left() const { return inputs_[0]; }
6922 Value* right() const { return inputs_[1]; } 6952 Value* right() const { return inputs_[1]; }
6923 6953
6954 virtual intptr_t token_pos() const { return token_pos_; }
6924 Token::Kind op_kind() const { return op_kind_; } 6955 Token::Kind op_kind() const { return op_kind_; }
6925 6956
6926 void set_overflow(bool overflow) { overflow_ = overflow; } 6957 void set_overflow(bool overflow) { overflow_ = overflow; }
6927 6958
6928 void set_is_truncating(bool value) { is_truncating_ = value; } 6959 void set_is_truncating(bool value) { is_truncating_ = value; }
6929 bool is_truncating() const { return is_truncating_; } 6960 bool is_truncating() const { return is_truncating_; }
6930 6961
6931 virtual void PrintOperandsTo(BufferFormatter* f) const; 6962 virtual void PrintOperandsTo(BufferFormatter* f) const;
6932 6963
6933 DECLARE_INSTRUCTION(BinarySmiOp) 6964 DECLARE_INSTRUCTION(BinarySmiOp)
(...skipping 15 matching lines...) Expand all
6949 // Returns true if right is a non-zero Smi constant which absolute value is 6980 // Returns true if right is a non-zero Smi constant which absolute value is
6950 // a power of two. 6981 // a power of two.
6951 bool RightIsPowerOfTwoConstant() const; 6982 bool RightIsPowerOfTwoConstant() const;
6952 6983
6953 virtual bool MayThrow() const { return false; } 6984 virtual bool MayThrow() const { return false; }
6954 6985
6955 private: 6986 private:
6956 const Token::Kind op_kind_; 6987 const Token::Kind op_kind_;
6957 bool overflow_; 6988 bool overflow_;
6958 bool is_truncating_; 6989 bool is_truncating_;
6990 const intptr_t token_pos_;
6959 6991
6960 DISALLOW_COPY_AND_ASSIGN(BinarySmiOpInstr); 6992 DISALLOW_COPY_AND_ASSIGN(BinarySmiOpInstr);
6961 }; 6993 };
6962 6994
6963 6995
6964 // Handles both Smi operations: BIT_OR and NEGATE. 6996 // Handles both Smi operations: BIT_OR and NEGATE.
6965 class UnarySmiOpInstr : public TemplateDefinition<1> { 6997 class UnarySmiOpInstr : public TemplateDefinition<1> {
6966 public: 6998 public:
6967 UnarySmiOpInstr(Token::Kind op_kind, 6999 UnarySmiOpInstr(Token::Kind op_kind,
6968 Value* value, 7000 Value* value,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
7050 7082
7051 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr); 7083 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr);
7052 }; 7084 };
7053 7085
7054 7086
7055 class CheckStackOverflowInstr : public TemplateInstruction<0> { 7087 class CheckStackOverflowInstr : public TemplateInstruction<0> {
7056 public: 7088 public:
7057 CheckStackOverflowInstr(intptr_t token_pos, intptr_t loop_depth) 7089 CheckStackOverflowInstr(intptr_t token_pos, intptr_t loop_depth)
7058 : token_pos_(token_pos), loop_depth_(loop_depth) {} 7090 : token_pos_(token_pos), loop_depth_(loop_depth) {}
7059 7091
7060 intptr_t token_pos() const { return token_pos_; } 7092 virtual intptr_t token_pos() const { return token_pos_; }
7061 bool in_loop() const { return loop_depth_ > 0; } 7093 bool in_loop() const { return loop_depth_ > 0; }
7062 intptr_t loop_depth() const { return loop_depth_; } 7094 intptr_t loop_depth() const { return loop_depth_; }
7063 7095
7064 DECLARE_INSTRUCTION(CheckStackOverflow) 7096 DECLARE_INSTRUCTION(CheckStackOverflow)
7065 7097
7066 virtual intptr_t ArgumentCount() const { return 0; } 7098 virtual intptr_t ArgumentCount() const { return 0; }
7067 7099
7068 virtual bool CanDeoptimize() const { return true; } 7100 virtual bool CanDeoptimize() const { return true; }
7069 7101
7070 virtual EffectSet Effects() const { return EffectSet::None(); } 7102 virtual EffectSet Effects() const { return EffectSet::None(); }
7071 7103
7072 virtual bool MayThrow() const { return false; } 7104 virtual bool MayThrow() const { return false; }
7073 7105
7074 virtual void PrintOperandsTo(BufferFormatter* f) const; 7106 virtual void PrintOperandsTo(BufferFormatter* f) const;
7075 7107
7076 private: 7108 private:
7077 const intptr_t token_pos_; 7109 const intptr_t token_pos_;
7078 const intptr_t loop_depth_; 7110 const intptr_t loop_depth_;
7079 7111
7080 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr); 7112 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr);
7081 }; 7113 };
7082 7114
7083 7115
7084 class SmiToDoubleInstr : public TemplateDefinition<1> { 7116 class SmiToDoubleInstr : public TemplateDefinition<1> {
7085 public: 7117 public:
7086 explicit SmiToDoubleInstr(Value* value) { 7118 SmiToDoubleInstr(Value* value, intptr_t token_pos)
7119 : token_pos_(token_pos) {
7087 SetInputAt(0, value); 7120 SetInputAt(0, value);
7088 } 7121 }
7089 7122
7090 Value* value() const { return inputs_[0]; } 7123 Value* value() const { return inputs_[0]; }
7124 virtual intptr_t token_pos() const { return token_pos_; }
7091 7125
7092 DECLARE_INSTRUCTION(SmiToDouble) 7126 DECLARE_INSTRUCTION(SmiToDouble)
7093 virtual CompileType ComputeType() const; 7127 virtual CompileType ComputeType() const;
7094 7128
7095 virtual Representation representation() const { 7129 virtual Representation representation() const {
7096 return kUnboxedDouble; 7130 return kUnboxedDouble;
7097 } 7131 }
7098 7132
7099 virtual intptr_t ArgumentCount() const { return 1; } 7133 virtual intptr_t ArgumentCount() const { return 1; }
7100 7134
7101 virtual bool CanDeoptimize() const { return false; } 7135 virtual bool CanDeoptimize() const { return false; }
7102 7136
7103 virtual bool AllowsCSE() const { return true; } 7137 virtual bool AllowsCSE() const { return true; }
7104 virtual EffectSet Effects() const { return EffectSet::None(); } 7138 virtual EffectSet Effects() const { return EffectSet::None(); }
7105 virtual EffectSet Dependencies() const { return EffectSet::None(); } 7139 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7106 virtual bool AttributesEqual(Instruction* other) const { return true; } 7140 virtual bool AttributesEqual(Instruction* other) const { return true; }
7107 7141
7108 virtual bool MayThrow() const { return false; } 7142 virtual bool MayThrow() const { return false; }
7109 7143
7110 private: 7144 private:
7145 const intptr_t token_pos_;
7146
7111 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); 7147 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr);
7112 }; 7148 };
7113 7149
7114 7150
7115 class DoubleToIntegerInstr : public TemplateDefinition<1> { 7151 class DoubleToIntegerInstr : public TemplateDefinition<1> {
7116 public: 7152 public:
7117 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) 7153 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call)
7118 : instance_call_(instance_call) { 7154 : instance_call_(instance_call) {
7119 SetInputAt(0, value); 7155 SetInputAt(0, value);
7120 deopt_id_ = instance_call->deopt_id(); 7156 deopt_id_ = instance_call->deopt_id();
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
7304 7340
7305 private: 7341 private:
7306 DISALLOW_COPY_AND_ASSIGN(FloatToDoubleInstr); 7342 DISALLOW_COPY_AND_ASSIGN(FloatToDoubleInstr);
7307 }; 7343 };
7308 7344
7309 7345
7310 class InvokeMathCFunctionInstr : public Definition { 7346 class InvokeMathCFunctionInstr : public Definition {
7311 public: 7347 public:
7312 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs, 7348 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs,
7313 intptr_t original_deopt_id, 7349 intptr_t original_deopt_id,
7314 MethodRecognizer::Kind recognized_kind); 7350 MethodRecognizer::Kind recognized_kind,
7351 intptr_t token_pos);
7315 7352
7316 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_); 7353 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_);
7317 7354
7318 const RuntimeEntry& TargetFunction() const; 7355 const RuntimeEntry& TargetFunction() const;
7319 7356
7320 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } 7357 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; }
7321 7358
7359 virtual intptr_t token_pos() const { return token_pos_; }
7360
7322 DECLARE_INSTRUCTION(InvokeMathCFunction) 7361 DECLARE_INSTRUCTION(InvokeMathCFunction)
7323 virtual CompileType ComputeType() const; 7362 virtual CompileType ComputeType() const;
7324 virtual void PrintOperandsTo(BufferFormatter* f) const; 7363 virtual void PrintOperandsTo(BufferFormatter* f) const;
7325 7364
7326 virtual bool CanDeoptimize() const { return false; } 7365 virtual bool CanDeoptimize() const { return false; }
7327 7366
7328 virtual Representation representation() const { 7367 virtual Representation representation() const {
7329 return kUnboxedDouble; 7368 return kUnboxedDouble;
7330 } 7369 }
7331 7370
(...skipping 24 matching lines...) Expand all
7356 7395
7357 private: 7396 private:
7358 static const intptr_t kSavedSpTempIndex = 0; 7397 static const intptr_t kSavedSpTempIndex = 0;
7359 static const intptr_t kObjectTempIndex = 1; 7398 static const intptr_t kObjectTempIndex = 1;
7360 static const intptr_t kDoubleTempIndex = 2; 7399 static const intptr_t kDoubleTempIndex = 2;
7361 virtual void RawSetInputAt(intptr_t i, Value* value) { 7400 virtual void RawSetInputAt(intptr_t i, Value* value) {
7362 (*inputs_)[i] = value; 7401 (*inputs_)[i] = value;
7363 } 7402 }
7364 7403
7365 ZoneGrowableArray<Value*>* inputs_; 7404 ZoneGrowableArray<Value*>* inputs_;
7366
7367 const MethodRecognizer::Kind recognized_kind_; 7405 const MethodRecognizer::Kind recognized_kind_;
7406 const intptr_t token_pos_;
7368 7407
7369 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr); 7408 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr);
7370 }; 7409 };
7371 7410
7372 7411
7373 class ExtractNthOutputInstr : public TemplateDefinition<1> { 7412 class ExtractNthOutputInstr : public TemplateDefinition<1> {
7374 public: 7413 public:
7375 // Extract the Nth output register from value. 7414 // Extract the Nth output register from value.
7376 ExtractNthOutputInstr(Value* value, 7415 ExtractNthOutputInstr(Value* value,
7377 intptr_t n, 7416 intptr_t n,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
7525 ZoneGrowableArray<Value*>* inputs_; 7564 ZoneGrowableArray<Value*>* inputs_;
7526 MergedMathInstr::Kind kind_; 7565 MergedMathInstr::Kind kind_;
7527 DISALLOW_COPY_AND_ASSIGN(MergedMathInstr); 7566 DISALLOW_COPY_AND_ASSIGN(MergedMathInstr);
7528 }; 7567 };
7529 7568
7530 7569
7531 class CheckClassInstr : public TemplateInstruction<1> { 7570 class CheckClassInstr : public TemplateInstruction<1> {
7532 public: 7571 public:
7533 CheckClassInstr(Value* value, 7572 CheckClassInstr(Value* value,
7534 intptr_t deopt_id, 7573 intptr_t deopt_id,
7535 const ICData& unary_checks); 7574 const ICData& unary_checks,
7575 intptr_t token_pos);
7536 7576
7537 DECLARE_INSTRUCTION(CheckClass) 7577 DECLARE_INSTRUCTION(CheckClass)
7538 7578
7539 virtual intptr_t ArgumentCount() const { return 0; } 7579 virtual intptr_t ArgumentCount() const { return 0; }
7540 7580
7541 virtual bool CanDeoptimize() const { return true; } 7581 virtual bool CanDeoptimize() const { return true; }
7542 7582
7583 virtual intptr_t token_pos() const { return token_pos_; }
7584
7543 Value* value() const { return inputs_[0]; } 7585 Value* value() const { return inputs_[0]; }
7544 7586
7545 const ICData& unary_checks() const { return unary_checks_; } 7587 const ICData& unary_checks() const { return unary_checks_; }
7546 7588
7547 virtual Instruction* Canonicalize(FlowGraph* flow_graph); 7589 virtual Instruction* Canonicalize(FlowGraph* flow_graph);
7548 7590
7549 virtual void PrintOperandsTo(BufferFormatter* f) const; 7591 virtual void PrintOperandsTo(BufferFormatter* f) const;
7550 7592
7551 bool IsNullCheck() const; 7593 bool IsNullCheck() const;
7552 7594
7553 virtual bool AllowsCSE() const { return true; } 7595 virtual bool AllowsCSE() const { return true; }
7554 virtual EffectSet Effects() const { return EffectSet::None(); } 7596 virtual EffectSet Effects() const { return EffectSet::None(); }
7555 virtual EffectSet Dependencies() const; 7597 virtual EffectSet Dependencies() const;
7556 virtual bool AttributesEqual(Instruction* other) const; 7598 virtual bool AttributesEqual(Instruction* other) const;
7557 7599
7558 virtual bool MayThrow() const { return false; } 7600 virtual bool MayThrow() const { return false; }
7559 7601
7560 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } 7602 void set_licm_hoisted(bool value) { licm_hoisted_ = value; }
7561 7603
7562 private: 7604 private:
7563 const ICData& unary_checks_; 7605 const ICData& unary_checks_;
7564 bool licm_hoisted_; 7606 bool licm_hoisted_;
7607 const intptr_t token_pos_;
7565 7608
7566 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); 7609 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr);
7567 }; 7610 };
7568 7611
7569 7612
7570 class CheckSmiInstr : public TemplateInstruction<1> { 7613 class CheckSmiInstr : public TemplateInstruction<1> {
7571 public: 7614 public:
7572 CheckSmiInstr(Value* value, intptr_t original_deopt_id) { 7615 CheckSmiInstr(Value* value, intptr_t original_deopt_id, intptr_t token_pos)
7616 : token_pos_(token_pos) {
7573 ASSERT(original_deopt_id != Isolate::kNoDeoptId); 7617 ASSERT(original_deopt_id != Isolate::kNoDeoptId);
7574 SetInputAt(0, value); 7618 SetInputAt(0, value);
7575 deopt_id_ = original_deopt_id; 7619 deopt_id_ = original_deopt_id;
7576 } 7620 }
7577 7621
7578 Value* value() const { return inputs_[0]; } 7622 Value* value() const { return inputs_[0]; }
7623 virtual intptr_t token_pos() const { return token_pos_; }
7579 7624
7580 DECLARE_INSTRUCTION(CheckSmi) 7625 DECLARE_INSTRUCTION(CheckSmi)
7581 7626
7582 virtual intptr_t ArgumentCount() const { return 0; } 7627 virtual intptr_t ArgumentCount() const { return 0; }
7583 7628
7584 virtual bool CanDeoptimize() const { return true; } 7629 virtual bool CanDeoptimize() const { return true; }
7585 7630
7586 virtual Instruction* Canonicalize(FlowGraph* flow_graph); 7631 virtual Instruction* Canonicalize(FlowGraph* flow_graph);
7587 7632
7588 virtual bool AllowsCSE() const { return true; } 7633 virtual bool AllowsCSE() const { return true; }
7589 virtual EffectSet Effects() const { return EffectSet::None(); } 7634 virtual EffectSet Effects() const { return EffectSet::None(); }
7590 virtual EffectSet Dependencies() const { return EffectSet::None(); } 7635 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7591 virtual bool AttributesEqual(Instruction* other) const { return true; } 7636 virtual bool AttributesEqual(Instruction* other) const { return true; }
7592 7637
7593 virtual bool MayThrow() const { return false; } 7638 virtual bool MayThrow() const { return false; }
7594 7639
7595 private: 7640 private:
7641 const intptr_t token_pos_;
7642
7596 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); 7643 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr);
7597 }; 7644 };
7598 7645
7599 7646
7600 class CheckArrayBoundInstr : public TemplateInstruction<2> { 7647 class CheckArrayBoundInstr : public TemplateInstruction<2> {
7601 public: 7648 public:
7602 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) { 7649 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) {
7603 SetInputAt(kLengthPos, length); 7650 SetInputAt(kLengthPos, length);
7604 SetInputAt(kIndexPos, index); 7651 SetInputAt(kIndexPos, index);
7605 // Override generated deopt-id. 7652 // Override generated deopt-id.
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
7861 ForwardInstructionIterator* current_iterator_; 7908 ForwardInstructionIterator* current_iterator_;
7862 7909
7863 private: 7910 private:
7864 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 7911 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
7865 }; 7912 };
7866 7913
7867 7914
7868 } // namespace dart 7915 } // namespace dart
7869 7916
7870 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 7917 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698