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 3027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3038 default: return NULL; | 3038 default: return NULL; |
3039 } | 3039 } |
3040 } | 3040 } |
3041 #else | 3041 #else |
3042 static void TryFastPathSmiOp( | 3042 static void TryFastPathSmiOp( |
3043 FlowGraphCompiler* compiler, ICData* call_ic_data, const String& name) { | 3043 FlowGraphCompiler* compiler, ICData* call_ic_data, const String& name) { |
3044 if (!FLAG_two_args_smi_icd) { | 3044 if (!FLAG_two_args_smi_icd) { |
3045 return; | 3045 return; |
3046 } | 3046 } |
3047 if (name.raw() == Symbols::Plus().raw()) { | 3047 if (name.raw() == Symbols::Plus().raw()) { |
3048 __ AddTOS(); | 3048 if (call_ic_data->AddSmiSmiCheckForFastSmiStubs()) { |
| 3049 __ AddTOS(); |
| 3050 } |
3049 } else if (name.raw() == Symbols::Minus().raw()) { | 3051 } else if (name.raw() == Symbols::Minus().raw()) { |
3050 __ SubTOS(); | 3052 if (call_ic_data->AddSmiSmiCheckForFastSmiStubs()) { |
| 3053 __ SubTOS(); |
| 3054 } |
3051 } else if (name.raw() == Symbols::EqualOperator().raw()) { | 3055 } else if (name.raw() == Symbols::EqualOperator().raw()) { |
3052 __ EqualTOS(); | 3056 if (call_ic_data->AddSmiSmiCheckForFastSmiStubs()) { |
| 3057 __ EqualTOS(); |
| 3058 } |
3053 } else if (name.raw() == Symbols::LAngleBracket().raw()) { | 3059 } else if (name.raw() == Symbols::LAngleBracket().raw()) { |
3054 __ LessThanTOS(); | 3060 if (call_ic_data->AddSmiSmiCheckForFastSmiStubs()) { |
| 3061 __ LessThanTOS(); |
| 3062 } |
3055 } else if (name.raw() == Symbols::RAngleBracket().raw()) { | 3063 } else if (name.raw() == Symbols::RAngleBracket().raw()) { |
3056 __ GreaterThanTOS(); | 3064 if (call_ic_data->AddSmiSmiCheckForFastSmiStubs()) { |
| 3065 __ GreaterThanTOS(); |
| 3066 } |
3057 } else if (name.raw() == Symbols::BitAnd().raw()) { | 3067 } else if (name.raw() == Symbols::BitAnd().raw()) { |
3058 __ BitAndTOS(); | 3068 if (call_ic_data->AddSmiSmiCheckForFastSmiStubs()) { |
| 3069 __ BitAndTOS(); |
| 3070 } |
3059 } else if (name.raw() == Symbols::BitOr().raw()) { | 3071 } else if (name.raw() == Symbols::BitOr().raw()) { |
3060 __ BitOrTOS(); | 3072 if (call_ic_data->AddSmiSmiCheckForFastSmiStubs()) { |
| 3073 __ BitOrTOS(); |
| 3074 } |
3061 } else if (name.raw() == Symbols::Star().raw()) { | 3075 } else if (name.raw() == Symbols::Star().raw()) { |
3062 __ MulTOS(); | 3076 if (call_ic_data->AddSmiSmiCheckForFastSmiStubs()) { |
3063 } else { | 3077 __ MulTOS(); |
3064 return; | 3078 } |
3065 } | 3079 } |
3066 bool is_smi_two_args_op = call_ic_data->AddSmiSmiCheckForFastSmiStubs(); | |
3067 ASSERT(is_smi_two_args_op); | |
3068 } | 3080 } |
3069 #endif | 3081 #endif |
3070 | 3082 |
3071 | 3083 |
3072 void InstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3084 void InstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3073 Zone* zone = compiler->zone(); | 3085 Zone* zone = compiler->zone(); |
3074 const ICData* call_ic_data = NULL; | 3086 const ICData* call_ic_data = NULL; |
3075 if (!FLAG_propagate_ic_data || !compiler->is_optimizing() || | 3087 if (!FLAG_propagate_ic_data || !compiler->is_optimizing() || |
3076 (ic_data() == NULL)) { | 3088 (ic_data() == NULL)) { |
3077 const Array& arguments_descriptor = | 3089 const Array& arguments_descriptor = |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3291 void AssertAssignableInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3303 void AssertAssignableInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3292 compiler->GenerateAssertAssignable(token_pos(), | 3304 compiler->GenerateAssertAssignable(token_pos(), |
3293 deopt_id(), | 3305 deopt_id(), |
3294 dst_type(), | 3306 dst_type(), |
3295 dst_name(), | 3307 dst_name(), |
3296 locs()); | 3308 locs()); |
3297 | 3309 |
3298 // DBC does not use LocationSummaries in the same way as other architectures. | 3310 // DBC does not use LocationSummaries in the same way as other architectures. |
3299 #if !defined(TARGET_ARCH_DBC) | 3311 #if !defined(TARGET_ARCH_DBC) |
3300 ASSERT(locs()->in(0).reg() == locs()->out(0).reg()); | 3312 ASSERT(locs()->in(0).reg() == locs()->out(0).reg()); |
3301 #else | |
3302 ASSERT(!compiler->is_optimizing() || | |
3303 (locs()->in(0).reg() == locs()->out(0).reg())); | |
3304 #endif // !defined(TARGET_ARCH_DBC) | 3313 #endif // !defined(TARGET_ARCH_DBC) |
3305 } | 3314 } |
3306 | 3315 |
3307 | 3316 |
3308 LocationSummary* DeoptimizeInstr::MakeLocationSummary(Zone* zone, | 3317 LocationSummary* DeoptimizeInstr::MakeLocationSummary(Zone* zone, |
3309 bool opt) const { | 3318 bool opt) const { |
3310 return new(zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); | 3319 return new(zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); |
3311 } | 3320 } |
3312 | 3321 |
3313 | 3322 |
3314 void DeoptimizeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3323 void DeoptimizeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3324 #if !defined(TARGET_ARCH_DBC) |
3315 __ Jump(compiler->AddDeoptStub(deopt_id(), deopt_reason_)); | 3325 __ Jump(compiler->AddDeoptStub(deopt_id(), deopt_reason_)); |
| 3326 #else |
| 3327 compiler->EmitDeopt(deopt_id(), deopt_reason_); |
| 3328 #endif |
3316 } | 3329 } |
3317 | 3330 |
3318 | 3331 |
3319 Environment* Environment::From(Zone* zone, | 3332 Environment* Environment::From(Zone* zone, |
3320 const GrowableArray<Definition*>& definitions, | 3333 const GrowableArray<Definition*>& definitions, |
3321 intptr_t fixed_parameter_count, | 3334 intptr_t fixed_parameter_count, |
3322 const ParsedFunction& parsed_function) { | 3335 const ParsedFunction& parsed_function) { |
3323 Environment* env = | 3336 Environment* env = |
3324 new(zone) Environment(definitions.length(), | 3337 new(zone) Environment(definitions.length(), |
3325 fixed_parameter_count, | 3338 fixed_parameter_count, |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3869 set_native_c_function(native_function); | 3882 set_native_c_function(native_function); |
3870 function().SetIsNativeAutoSetupScope(auto_setup_scope); | 3883 function().SetIsNativeAutoSetupScope(auto_setup_scope); |
3871 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); | 3884 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |
3872 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); | 3885 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |
3873 set_is_bootstrap_native(is_bootstrap_native); | 3886 set_is_bootstrap_native(is_bootstrap_native); |
3874 } | 3887 } |
3875 | 3888 |
3876 #undef __ | 3889 #undef __ |
3877 | 3890 |
3878 } // namespace dart | 3891 } // namespace dart |
OLD | NEW |