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 3262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3273 #endif | 3273 #endif |
3274 | 3274 |
3275 | 3275 |
3276 LocationSummary* StaticCallInstr::MakeLocationSummary(Zone* zone, | 3276 LocationSummary* StaticCallInstr::MakeLocationSummary(Zone* zone, |
3277 bool optimizing) const { | 3277 bool optimizing) const { |
3278 return MakeCallSummary(zone); | 3278 return MakeCallSummary(zone); |
3279 } | 3279 } |
3280 | 3280 |
3281 | 3281 |
3282 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3282 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3283 #if !defined(TARGET_ARCH_DBC) | |
3284 const ICData* call_ic_data = NULL; | 3283 const ICData* call_ic_data = NULL; |
3285 if (!FLAG_propagate_ic_data || !compiler->is_optimizing() || | 3284 if (!FLAG_propagate_ic_data || !compiler->is_optimizing() || |
3286 (ic_data() == NULL)) { | 3285 (ic_data() == NULL)) { |
3287 const Array& arguments_descriptor = | 3286 const Array& arguments_descriptor = |
3288 Array::Handle(ArgumentsDescriptor::New(ArgumentCount(), | 3287 Array::Handle(ArgumentsDescriptor::New(ArgumentCount(), |
3289 argument_names())); | 3288 argument_names())); |
3290 MethodRecognizer::Kind recognized_kind = | 3289 MethodRecognizer::Kind recognized_kind = |
3291 MethodRecognizer::RecognizeKind(function()); | 3290 MethodRecognizer::RecognizeKind(function()); |
3292 int num_args_checked = 0; | 3291 int num_args_checked = 0; |
3293 switch (recognized_kind) { | 3292 switch (recognized_kind) { |
3294 case MethodRecognizer::kDoubleFromInteger: | 3293 case MethodRecognizer::kDoubleFromInteger: |
3295 case MethodRecognizer::kMathMin: | 3294 case MethodRecognizer::kMathMin: |
3296 case MethodRecognizer::kMathMax: | 3295 case MethodRecognizer::kMathMax: |
3297 num_args_checked = 2; | 3296 num_args_checked = 2; |
3298 break; | 3297 break; |
3299 default: | 3298 default: |
3300 break; | 3299 break; |
3301 } | 3300 } |
3302 call_ic_data = compiler->GetOrAddStaticCallICData(deopt_id(), | 3301 call_ic_data = compiler->GetOrAddStaticCallICData(deopt_id(), |
3303 function(), | 3302 function(), |
3304 arguments_descriptor, | 3303 arguments_descriptor, |
3305 num_args_checked); | 3304 num_args_checked); |
3306 } else { | 3305 } else { |
3307 call_ic_data = &ICData::ZoneHandle(ic_data()->raw()); | 3306 call_ic_data = &ICData::ZoneHandle(ic_data()->raw()); |
3308 } | 3307 } |
| 3308 |
| 3309 #if !defined(TARGET_ARCH_DBC) |
3309 compiler->GenerateStaticCall(deopt_id(), | 3310 compiler->GenerateStaticCall(deopt_id(), |
3310 token_pos(), | 3311 token_pos(), |
3311 function(), | 3312 function(), |
3312 ArgumentCount(), | 3313 ArgumentCount(), |
3313 argument_names(), | 3314 argument_names(), |
3314 locs(), | 3315 locs(), |
3315 *call_ic_data); | 3316 *call_ic_data); |
3316 #else | 3317 #else |
3317 const Array& arguments_descriptor = | 3318 const Array& arguments_descriptor = |
3318 (ic_data() == NULL) ? | 3319 (ic_data() == NULL) ? |
3319 Array::Handle(ArgumentsDescriptor::New(ArgumentCount(), | 3320 Array::Handle(ArgumentsDescriptor::New(ArgumentCount(), |
3320 argument_names())) : | 3321 argument_names())) : |
3321 Array::Handle(ic_data()->arguments_descriptor()); | 3322 Array::Handle(ic_data()->arguments_descriptor()); |
3322 const intptr_t argdesc_kidx = __ AddConstant(arguments_descriptor); | 3323 const intptr_t argdesc_kidx = __ AddConstant(arguments_descriptor); |
3323 | 3324 |
3324 __ PushConstant(function()); | |
3325 __ StaticCall(ArgumentCount(), argdesc_kidx); | |
3326 RawPcDescriptors::Kind kind = (compiler->is_optimizing()) | |
3327 ? RawPcDescriptors::kOther | |
3328 : RawPcDescriptors::kUnoptStaticCall; | |
3329 compiler->AddCurrentDescriptor(kind, deopt_id(), token_pos()); | |
3330 | |
3331 compiler->RecordAfterCall(this); | |
3332 | |
3333 if (compiler->is_optimizing()) { | 3325 if (compiler->is_optimizing()) { |
| 3326 __ PushConstant(function()); |
| 3327 __ StaticCall(ArgumentCount(), argdesc_kidx); |
| 3328 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, |
| 3329 deopt_id(), token_pos()); |
| 3330 compiler->RecordAfterCall(this); |
3334 __ PopLocal(locs()->out(0).reg()); | 3331 __ PopLocal(locs()->out(0).reg()); |
| 3332 } else { |
| 3333 const intptr_t ic_data_kidx = __ AddConstant(*call_ic_data); |
| 3334 __ PushConstant(ic_data_kidx); |
| 3335 __ IndirectStaticCall(ArgumentCount(), argdesc_kidx); |
| 3336 compiler->AddCurrentDescriptor(RawPcDescriptors::kUnoptStaticCall, |
| 3337 deopt_id(), token_pos()); |
| 3338 compiler->RecordAfterCall(this); |
3335 } | 3339 } |
3336 #endif // !defined(TARGET_ARCH_DBC) | 3340 #endif // !defined(TARGET_ARCH_DBC) |
3337 } | 3341 } |
3338 | 3342 |
3339 | 3343 |
3340 void AssertAssignableInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3344 void AssertAssignableInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3341 compiler->GenerateAssertAssignable(token_pos(), | 3345 compiler->GenerateAssertAssignable(token_pos(), |
3342 deopt_id(), | 3346 deopt_id(), |
3343 dst_type(), | 3347 dst_type(), |
3344 dst_name(), | 3348 dst_name(), |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3919 set_native_c_function(native_function); | 3923 set_native_c_function(native_function); |
3920 function().SetIsNativeAutoSetupScope(auto_setup_scope); | 3924 function().SetIsNativeAutoSetupScope(auto_setup_scope); |
3921 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); | 3925 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |
3922 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); | 3926 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |
3923 set_is_bootstrap_native(is_bootstrap_native); | 3927 set_is_bootstrap_native(is_bootstrap_native); |
3924 } | 3928 } |
3925 | 3929 |
3926 #undef __ | 3930 #undef __ |
3927 | 3931 |
3928 } // namespace dart | 3932 } // namespace dart |
OLD | NEW |