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

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

Powered by Google App Engine
This is Rietveld 408576698