OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/constant_propagator.h" | 10 #include "vm/constant_propagator.h" |
(...skipping 2960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2971 | 2971 |
2972 // Spread class-ids to preceding classes where a lookup yields the same | 2972 // Spread class-ids to preceding classes where a lookup yields the same |
2973 // method. A polymorphic target is not really the same method since its | 2973 // method. A polymorphic target is not really the same method since its |
2974 // behaviour depends on the receiver class-id, so we don't spread the | 2974 // behaviour depends on the receiver class-id, so we don't spread the |
2975 // class-ids in that case. | 2975 // class-ids in that case. |
2976 for (int idx = 0; idx < length; idx++) { | 2976 for (int idx = 0; idx < length; idx++) { |
2977 int lower_limit_cid = (idx == 0) ? -1 : targets[idx - 1].cid_end; | 2977 int lower_limit_cid = (idx == 0) ? -1 : targets[idx - 1].cid_end; |
2978 const Function& target = *targets.TargetAt(idx)->target; | 2978 const Function& target = *targets.TargetAt(idx)->target; |
2979 if (MethodRecognizer::PolymorphicTarget(target)) continue; | 2979 if (MethodRecognizer::PolymorphicTarget(target)) continue; |
2980 for (int i = targets[idx].cid_start - 1; i > lower_limit_cid; i--) { | 2980 for (int i = targets[idx].cid_start - 1; i > lower_limit_cid; i--) { |
2981 if (FlowGraphCompiler::LookupMethodFor(i, name, args_desc, &fn) && | 2981 bool class_is_abstract = false; |
| 2982 if (FlowGraphCompiler::LookupMethodFor(i, name, args_desc, &fn, |
| 2983 &class_is_abstract) && |
2982 fn.raw() == target.raw()) { | 2984 fn.raw() == target.raw()) { |
2983 targets[idx].cid_start = i; | 2985 if (!class_is_abstract) { |
| 2986 targets[idx].cid_start = i; |
| 2987 } |
2984 } else { | 2988 } else { |
2985 break; | 2989 break; |
2986 } | 2990 } |
2987 } | 2991 } |
2988 } | 2992 } |
2989 // Spread class-ids to following classes where a lookup yields the same | 2993 // Spread class-ids to following classes where a lookup yields the same |
2990 // method. | 2994 // method. |
2991 for (int idx = 0; idx < length; idx++) { | 2995 for (int idx = 0; idx < length; idx++) { |
2992 int upper_limit_cid = | 2996 int upper_limit_cid = |
2993 (idx == length - 1) ? 1000000000 : targets[idx + 1].cid_start; | 2997 (idx == length - 1) ? 1000000000 : targets[idx + 1].cid_start; |
2994 const Function& target = *targets.TargetAt(idx)->target; | 2998 const Function& target = *targets.TargetAt(idx)->target; |
2995 if (MethodRecognizer::PolymorphicTarget(target)) continue; | 2999 if (MethodRecognizer::PolymorphicTarget(target)) continue; |
2996 for (int i = targets[idx].cid_end + 1; i < upper_limit_cid; i++) { | 3000 for (int i = targets[idx].cid_end + 1; i < upper_limit_cid; i++) { |
2997 if (FlowGraphCompiler::LookupMethodFor(i, name, args_desc, &fn) && | 3001 bool class_is_abstract = false; |
| 3002 if (FlowGraphCompiler::LookupMethodFor(i, name, args_desc, &fn, |
| 3003 &class_is_abstract) && |
2998 fn.raw() == target.raw()) { | 3004 fn.raw() == target.raw()) { |
2999 targets[idx].cid_end = i; | 3005 if (!class_is_abstract) { |
| 3006 targets[idx].cid_end = i; |
| 3007 } |
3000 } else { | 3008 } else { |
3001 break; | 3009 break; |
3002 } | 3010 } |
3003 } | 3011 } |
3004 } | 3012 } |
3005 targets.MergeIntoRanges(); | 3013 targets.MergeIntoRanges(); |
3006 return &targets; | 3014 return &targets; |
3007 } | 3015 } |
3008 | 3016 |
3009 | 3017 |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3878 } | 3886 } |
3879 | 3887 |
3880 | 3888 |
3881 ComparisonInstr* DoubleTestOpInstr::CopyWithNewOperands(Value* new_left, | 3889 ComparisonInstr* DoubleTestOpInstr::CopyWithNewOperands(Value* new_left, |
3882 Value* new_right) { | 3890 Value* new_right) { |
3883 UNREACHABLE(); | 3891 UNREACHABLE(); |
3884 return NULL; | 3892 return NULL; |
3885 } | 3893 } |
3886 | 3894 |
3887 | 3895 |
| 3896 ComparisonInstr* SmiRangeComparisonInstr::CopyWithNewOperands( |
| 3897 Value* new_left, |
| 3898 Value* new_right) { |
| 3899 UNREACHABLE(); |
| 3900 return NULL; |
| 3901 } |
| 3902 |
| 3903 |
3888 ComparisonInstr* EqualityCompareInstr::CopyWithNewOperands(Value* new_left, | 3904 ComparisonInstr* EqualityCompareInstr::CopyWithNewOperands(Value* new_left, |
3889 Value* new_right) { | 3905 Value* new_right) { |
3890 return new EqualityCompareInstr(token_pos(), kind(), new_left, new_right, | 3906 return new EqualityCompareInstr(token_pos(), kind(), new_left, new_right, |
3891 operation_cid(), deopt_id()); | 3907 operation_cid(), deopt_id()); |
3892 } | 3908 } |
3893 | 3909 |
3894 | 3910 |
3895 ComparisonInstr* RelationalOpInstr::CopyWithNewOperands(Value* new_left, | 3911 ComparisonInstr* RelationalOpInstr::CopyWithNewOperands(Value* new_left, |
3896 Value* new_right) { | 3912 Value* new_right) { |
3897 return new RelationalOpInstr(token_pos(), kind(), new_left, new_right, | 3913 return new RelationalOpInstr(token_pos(), kind(), new_left, new_right, |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4393 "native function '%s' (%" Pd " arguments) cannot be found", | 4409 "native function '%s' (%" Pd " arguments) cannot be found", |
4394 native_name().ToCString(), function().NumParameters()); | 4410 native_name().ToCString(), function().NumParameters()); |
4395 } | 4411 } |
4396 set_is_auto_scope(auto_setup_scope); | 4412 set_is_auto_scope(auto_setup_scope); |
4397 set_native_c_function(native_function); | 4413 set_native_c_function(native_function); |
4398 } | 4414 } |
4399 | 4415 |
4400 #undef __ | 4416 #undef __ |
4401 | 4417 |
4402 } // namespace dart | 4418 } // namespace dart |
OLD | NEW |