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 3065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3076 *call_ic_data); | 3076 *call_ic_data); |
3077 } | 3077 } |
3078 } else { | 3078 } else { |
3079 // Unoptimized code. | 3079 // Unoptimized code. |
3080 ASSERT(!HasICData()); | 3080 ASSERT(!HasICData()); |
3081 bool is_smi_two_args_op = false; | 3081 bool is_smi_two_args_op = false; |
3082 const StubEntry* stub_entry = TwoArgsSmiOpInlineCacheEntry(token_kind()); | 3082 const StubEntry* stub_entry = TwoArgsSmiOpInlineCacheEntry(token_kind()); |
3083 if (stub_entry != NULL) { | 3083 if (stub_entry != NULL) { |
3084 // We have a dedicated inline cache stub for this operation, add an | 3084 // We have a dedicated inline cache stub for this operation, add an |
3085 // an initial Smi/Smi check with count 0. | 3085 // an initial Smi/Smi check with count 0. |
3086 ASSERT(call_ic_data->NumArgsTested() == 2); | 3086 is_smi_two_args_op = call_ic_data->AddSmiSmiCheckForFastSmiStubs(); |
3087 const String& name = String::Handle(zone, call_ic_data->target_name()); | |
3088 const Class& smi_class = Class::Handle(zone, Smi::Class()); | |
3089 const Function& smi_op_target = Function::Handle(zone, | |
3090 Resolver::ResolveDynamicAnyArgs(zone, smi_class, name)); | |
3091 if (call_ic_data->NumberOfChecks() == 0) { | |
3092 GrowableArray<intptr_t> class_ids(2); | |
3093 class_ids.Add(kSmiCid); | |
3094 class_ids.Add(kSmiCid); | |
3095 call_ic_data->AddCheck(class_ids, smi_op_target); | |
3096 // 'AddCheck' sets the initial count to 1. | |
3097 call_ic_data->SetCountAt(0, 0); | |
3098 is_smi_two_args_op = true; | |
3099 } else if (call_ic_data->NumberOfChecks() == 1) { | |
3100 GrowableArray<intptr_t> class_ids(2); | |
3101 Function& target = Function::Handle(zone); | |
3102 call_ic_data->GetCheckAt(0, &class_ids, &target); | |
3103 if ((target.raw() == smi_op_target.raw()) && | |
3104 (class_ids[0] == kSmiCid) && (class_ids[1] == kSmiCid)) { | |
3105 is_smi_two_args_op = true; | |
3106 } | |
3107 } | |
3108 } | 3087 } |
3109 if (is_smi_two_args_op) { | 3088 if (is_smi_two_args_op) { |
3110 ASSERT(ArgumentCount() == 2); | 3089 ASSERT(ArgumentCount() == 2); |
3111 compiler->EmitInstanceCall(*stub_entry, *call_ic_data, ArgumentCount(), | 3090 compiler->EmitInstanceCall(*stub_entry, *call_ic_data, ArgumentCount(), |
3112 deopt_id(), token_pos(), locs()); | 3091 deopt_id(), token_pos(), locs()); |
3113 } else if (FLAG_ic_range_profiling && | 3092 } else if (FLAG_ic_range_profiling && |
3114 (Token::IsBinaryArithmeticOperator(token_kind()) || | 3093 (Token::IsBinaryArithmeticOperator(token_kind()) || |
3115 Token::IsUnaryArithmeticOperator(token_kind()))) { | 3094 Token::IsUnaryArithmeticOperator(token_kind()))) { |
3116 ASSERT(Token::IsUnaryArithmeticOperator(token_kind()) == | 3095 ASSERT(Token::IsUnaryArithmeticOperator(token_kind()) == |
3117 (ArgumentCount() == 1)); | 3096 (ArgumentCount() == 1)); |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3855 set_native_c_function(native_function); | 3834 set_native_c_function(native_function); |
3856 function().SetIsNativeAutoSetupScope(auto_setup_scope); | 3835 function().SetIsNativeAutoSetupScope(auto_setup_scope); |
3857 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); | 3836 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |
3858 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); | 3837 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |
3859 set_is_bootstrap_native(is_bootstrap_native); | 3838 set_is_bootstrap_native(is_bootstrap_native); |
3860 } | 3839 } |
3861 | 3840 |
3862 #undef __ | 3841 #undef __ |
3863 | 3842 |
3864 } // namespace dart | 3843 } // namespace dart |
OLD | NEW |