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 3092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3103 deopt_id(), token_pos(), locs()); | 3103 deopt_id(), token_pos(), locs()); |
3104 } else { | 3104 } else { |
3105 compiler->GenerateInstanceCall(deopt_id(), | 3105 compiler->GenerateInstanceCall(deopt_id(), |
3106 token_pos(), | 3106 token_pos(), |
3107 ArgumentCount(), | 3107 ArgumentCount(), |
3108 locs(), | 3108 locs(), |
3109 *call_ic_data); | 3109 *call_ic_data); |
3110 } | 3110 } |
3111 } | 3111 } |
3112 #else | 3112 #else |
| 3113 call_ic_data = &ICData::ZoneHandle(call_ic_data->Original()); |
| 3114 |
3113 // Emit smi fast path instruction. If fast-path succeeds it skips the next | 3115 // Emit smi fast path instruction. If fast-path succeeds it skips the next |
3114 // instruction otherwise it falls through. | 3116 // instruction otherwise it falls through. |
3115 if (function_name().raw() == Symbols::Plus().raw()) { | 3117 if (function_name().raw() == Symbols::Plus().raw()) { |
3116 __ AddTOS(); | 3118 __ AddTOS(); |
3117 } else if (function_name().raw() == Symbols::EqualOperator().raw()) { | 3119 } else if (function_name().raw() == Symbols::EqualOperator().raw()) { |
3118 __ EqualTOS(); | 3120 __ EqualTOS(); |
3119 } else if (function_name().raw() == Symbols::LAngleBracket().raw()) { | 3121 } else if (function_name().raw() == Symbols::LAngleBracket().raw()) { |
3120 __ LessThanTOS(); | 3122 __ LessThanTOS(); |
3121 } else if (function_name().raw() == Symbols::RAngleBracket().raw()) { | 3123 } else if (function_name().raw() == Symbols::RAngleBracket().raw()) { |
3122 __ GreaterThanTOS(); | 3124 __ GreaterThanTOS(); |
3123 } else if (function_name().raw() == Symbols::BitAnd().raw()) { | 3125 } else if (function_name().raw() == Symbols::BitAnd().raw()) { |
3124 __ BitAndTOS(); | 3126 __ BitAndTOS(); |
3125 } else if (function_name().raw() == Symbols::BitOr().raw()) { | 3127 } else if (function_name().raw() == Symbols::BitOr().raw()) { |
3126 __ BitOrTOS(); | 3128 __ BitOrTOS(); |
3127 } else if (function_name().raw() == Symbols::Star().raw()) { | 3129 } else if (function_name().raw() == Symbols::Star().raw()) { |
3128 __ MulTOS(); | 3130 __ MulTOS(); |
3129 } | 3131 } |
3130 | 3132 |
3131 const intptr_t call_ic_data_kidx = __ AddConstant(*call_ic_data); | 3133 const intptr_t call_ic_data_kidx = __ AddConstant(*call_ic_data); |
3132 switch (call_ic_data->NumArgsTested()) { | 3134 switch (call_ic_data->NumArgsTested()) { |
3133 case 1: | 3135 case 1: |
3134 __ InstanceCall(ArgumentCount(), call_ic_data_kidx); | 3136 if (compiler->is_optimizing()) { |
| 3137 __ InstanceCall1Opt(ArgumentCount(), call_ic_data_kidx); |
| 3138 } else { |
| 3139 __ InstanceCall1(ArgumentCount(), call_ic_data_kidx); |
| 3140 } |
3135 break; | 3141 break; |
3136 case 2: | 3142 case 2: |
3137 __ InstanceCall2(ArgumentCount(), call_ic_data_kidx); | 3143 if (compiler->is_optimizing()) { |
3138 break; | 3144 __ InstanceCall2Opt(ArgumentCount(), call_ic_data_kidx); |
3139 case 3: | 3145 } else { |
3140 __ InstanceCall3(ArgumentCount(), call_ic_data_kidx); | 3146 __ InstanceCall2(ArgumentCount(), call_ic_data_kidx); |
| 3147 } |
3141 break; | 3148 break; |
3142 default: | 3149 default: |
3143 UNIMPLEMENTED(); | 3150 UNIMPLEMENTED(); |
3144 break; | 3151 break; |
3145 } | 3152 } |
3146 compiler->AddCurrentDescriptor(RawPcDescriptors::kIcCall, | 3153 compiler->AddCurrentDescriptor(RawPcDescriptors::kIcCall, |
3147 deopt_id(), | 3154 deopt_id(), |
3148 token_pos()); | 3155 token_pos()); |
| 3156 compiler->RecordAfterCall(this); |
| 3157 |
| 3158 if (compiler->is_optimizing()) { |
| 3159 __ PopLocal(locs()->out(0).reg()); |
| 3160 } |
3149 #endif // !defined(TARGET_ARCH_DBC) | 3161 #endif // !defined(TARGET_ARCH_DBC) |
3150 } | 3162 } |
3151 | 3163 |
3152 | 3164 |
3153 bool PolymorphicInstanceCallInstr::HasSingleRecognizedTarget() const { | 3165 bool PolymorphicInstanceCallInstr::HasSingleRecognizedTarget() const { |
3154 return ic_data().HasOneTarget() && | 3166 return ic_data().HasOneTarget() && |
3155 (MethodRecognizer::RecognizeKind( | 3167 (MethodRecognizer::RecognizeKind( |
3156 Function::Handle(ic_data().GetTargetAt(0))) != | 3168 Function::Handle(ic_data().GetTargetAt(0))) != |
3157 MethodRecognizer::kUnknown); | 3169 MethodRecognizer::kUnknown); |
3158 } | 3170 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3245 Array::Handle(ArgumentsDescriptor::New(ArgumentCount(), | 3257 Array::Handle(ArgumentsDescriptor::New(ArgumentCount(), |
3246 argument_names())) : | 3258 argument_names())) : |
3247 Array::Handle(ic_data()->arguments_descriptor()); | 3259 Array::Handle(ic_data()->arguments_descriptor()); |
3248 const intptr_t argdesc_kidx = __ AddConstant(arguments_descriptor); | 3260 const intptr_t argdesc_kidx = __ AddConstant(arguments_descriptor); |
3249 | 3261 |
3250 __ PushConstant(function()); | 3262 __ PushConstant(function()); |
3251 __ StaticCall(ArgumentCount(), argdesc_kidx); | 3263 __ StaticCall(ArgumentCount(), argdesc_kidx); |
3252 compiler->AddCurrentDescriptor(RawPcDescriptors::kUnoptStaticCall, | 3264 compiler->AddCurrentDescriptor(RawPcDescriptors::kUnoptStaticCall, |
3253 deopt_id(), | 3265 deopt_id(), |
3254 token_pos()); | 3266 token_pos()); |
| 3267 |
| 3268 compiler->RecordAfterCall(this); |
| 3269 |
| 3270 if (compiler->is_optimizing()) { |
| 3271 __ PopLocal(locs()->out(0).reg()); |
| 3272 } |
3255 #endif // !defined(TARGET_ARCH_DBC) | 3273 #endif // !defined(TARGET_ARCH_DBC) |
3256 } | 3274 } |
3257 | 3275 |
3258 | 3276 |
3259 void AssertAssignableInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3277 void AssertAssignableInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3260 compiler->GenerateAssertAssignable(token_pos(), | 3278 compiler->GenerateAssertAssignable(token_pos(), |
3261 deopt_id(), | 3279 deopt_id(), |
3262 dst_type(), | 3280 dst_type(), |
3263 dst_name(), | 3281 dst_name(), |
3264 locs()); | 3282 locs()); |
3265 | 3283 |
3266 // DBC does not use LocationSummaries in the same way as other architectures. | 3284 // DBC does not use LocationSummaries in the same way as other architectures. |
3267 #if !defined(TARGET_ARCH_DBC) | 3285 #if !defined(TARGET_ARCH_DBC) |
3268 ASSERT(locs()->in(0).reg() == locs()->out(0).reg()); | 3286 ASSERT(locs()->in(0).reg() == locs()->out(0).reg()); |
3269 #endif | 3287 #else |
| 3288 ASSERT(!compiler->is_optimizing() || |
| 3289 (locs()->in(0).reg() == locs()->out(0).reg())); |
| 3290 #endif // !defined(TARGET_ARCH_DBC) |
3270 } | 3291 } |
3271 | 3292 |
3272 | 3293 |
3273 LocationSummary* DeoptimizeInstr::MakeLocationSummary(Zone* zone, | 3294 LocationSummary* DeoptimizeInstr::MakeLocationSummary(Zone* zone, |
3274 bool opt) const { | 3295 bool opt) const { |
3275 return new(zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); | 3296 return new(zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); |
3276 } | 3297 } |
3277 | 3298 |
3278 | 3299 |
3279 void DeoptimizeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3300 void DeoptimizeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3834 set_native_c_function(native_function); | 3855 set_native_c_function(native_function); |
3835 function().SetIsNativeAutoSetupScope(auto_setup_scope); | 3856 function().SetIsNativeAutoSetupScope(auto_setup_scope); |
3836 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); | 3857 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |
3837 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); | 3858 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |
3838 set_is_bootstrap_native(is_bootstrap_native); | 3859 set_is_bootstrap_native(is_bootstrap_native); |
3839 } | 3860 } |
3840 | 3861 |
3841 #undef __ | 3862 #undef __ |
3842 | 3863 |
3843 } // namespace dart | 3864 } // namespace dart |
OLD | NEW |