Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: runtime/vm/intermediate_language.cc

Issue 2015113002: DBC: Collect type feedback for fastpath smi ops (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add comment Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/object_dbc_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3020 matching lines...) Expand 10 before | Expand all | Expand 10 after
3031 if (!FLAG_two_args_smi_icd) { 3031 if (!FLAG_two_args_smi_icd) {
3032 return 0; 3032 return 0;
3033 } 3033 }
3034 switch (kind) { 3034 switch (kind) {
3035 case Token::kADD: return StubCode::SmiAddInlineCache_entry(); 3035 case Token::kADD: return StubCode::SmiAddInlineCache_entry();
3036 case Token::kSUB: return StubCode::SmiSubInlineCache_entry(); 3036 case Token::kSUB: return StubCode::SmiSubInlineCache_entry();
3037 case Token::kEQ: return StubCode::SmiEqualInlineCache_entry(); 3037 case Token::kEQ: return StubCode::SmiEqualInlineCache_entry();
3038 default: return NULL; 3038 default: return NULL;
3039 } 3039 }
3040 } 3040 }
3041 #else
3042 static void TryFastPathSmiOp(
3043 FlowGraphCompiler* compiler, ICData* call_ic_data, const String& name) {
3044 if (!FLAG_two_args_smi_icd) {
3045 return;
3046 }
3047 if (name.raw() == Symbols::Plus().raw()) {
3048 __ AddTOS();
3049 } else if (name.raw() == Symbols::Minus().raw()) {
3050 __ SubTOS();
3051 } else if (name.raw() == Symbols::EqualOperator().raw()) {
3052 __ EqualTOS();
3053 } else if (name.raw() == Symbols::LAngleBracket().raw()) {
3054 __ LessThanTOS();
3055 } else if (name.raw() == Symbols::RAngleBracket().raw()) {
3056 __ GreaterThanTOS();
3057 } else if (name.raw() == Symbols::BitAnd().raw()) {
3058 __ BitAndTOS();
3059 } else if (name.raw() == Symbols::BitOr().raw()) {
3060 __ BitOrTOS();
3061 } else if (name.raw() == Symbols::Star().raw()) {
3062 __ MulTOS();
3063 } else {
3064 return;
3065 }
3066 bool is_smi_two_args_op = call_ic_data->AddSmiSmiCheckForFastSmiStubs();
3067 ASSERT(is_smi_two_args_op);
3068 }
3041 #endif 3069 #endif
3042 3070
3043 3071
3044 void InstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3072 void InstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3045 Zone* zone = compiler->zone(); 3073 Zone* zone = compiler->zone();
3046 const ICData* call_ic_data = NULL; 3074 const ICData* call_ic_data = NULL;
3047 if (!FLAG_propagate_ic_data || !compiler->is_optimizing() || 3075 if (!FLAG_propagate_ic_data || !compiler->is_optimizing() ||
3048 (ic_data() == NULL)) { 3076 (ic_data() == NULL)) {
3049 const Array& arguments_descriptor = 3077 const Array& arguments_descriptor =
3050 Array::Handle(zone, ArgumentsDescriptor::New(ArgumentCount(), 3078 Array::Handle(zone, ArgumentsDescriptor::New(ArgumentCount(),
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3103 deopt_id(), token_pos(), locs()); 3131 deopt_id(), token_pos(), locs());
3104 } else { 3132 } else {
3105 compiler->GenerateInstanceCall(deopt_id(), 3133 compiler->GenerateInstanceCall(deopt_id(),
3106 token_pos(), 3134 token_pos(),
3107 ArgumentCount(), 3135 ArgumentCount(),
3108 locs(), 3136 locs(),
3109 *call_ic_data); 3137 *call_ic_data);
3110 } 3138 }
3111 } 3139 }
3112 #else 3140 #else
3113 call_ic_data = &ICData::ZoneHandle(call_ic_data->Original()); 3141 ICData* ic_data = &ICData::ZoneHandle(call_ic_data->Original());
3114 3142
3115 // Emit smi fast path instruction. If fast-path succeeds it skips the next 3143 // Emit smi fast path instruction. If fast-path succeeds it skips the next
3116 // instruction otherwise it falls through. 3144 // instruction otherwise it falls through.
3117 if (function_name().raw() == Symbols::Plus().raw()) { 3145 TryFastPathSmiOp(compiler, ic_data, function_name());
3118 __ AddTOS();
3119 } else if (function_name().raw() == Symbols::EqualOperator().raw()) {
3120 __ EqualTOS();
3121 } else if (function_name().raw() == Symbols::LAngleBracket().raw()) {
3122 __ LessThanTOS();
3123 } else if (function_name().raw() == Symbols::RAngleBracket().raw()) {
3124 __ GreaterThanTOS();
3125 } else if (function_name().raw() == Symbols::BitAnd().raw()) {
3126 __ BitAndTOS();
3127 } else if (function_name().raw() == Symbols::BitOr().raw()) {
3128 __ BitOrTOS();
3129 } else if (function_name().raw() == Symbols::Star().raw()) {
3130 __ MulTOS();
3131 }
3132 3146
3133 const intptr_t call_ic_data_kidx = __ AddConstant(*call_ic_data); 3147 const intptr_t call_ic_data_kidx = __ AddConstant(*call_ic_data);
3134 switch (call_ic_data->NumArgsTested()) { 3148 switch (ic_data->NumArgsTested()) {
3135 case 1: 3149 case 1:
3136 if (compiler->is_optimizing()) { 3150 if (compiler->is_optimizing()) {
3137 __ InstanceCall1Opt(ArgumentCount(), call_ic_data_kidx); 3151 __ InstanceCall1Opt(ArgumentCount(), call_ic_data_kidx);
3138 } else { 3152 } else {
3139 __ InstanceCall1(ArgumentCount(), call_ic_data_kidx); 3153 __ InstanceCall1(ArgumentCount(), call_ic_data_kidx);
3140 } 3154 }
3141 break; 3155 break;
3142 case 2: 3156 case 2:
3143 if (compiler->is_optimizing()) { 3157 if (compiler->is_optimizing()) {
3144 __ InstanceCall2Opt(ArgumentCount(), call_ic_data_kidx); 3158 __ InstanceCall2Opt(ArgumentCount(), call_ic_data_kidx);
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
3855 set_native_c_function(native_function); 3869 set_native_c_function(native_function);
3856 function().SetIsNativeAutoSetupScope(auto_setup_scope); 3870 function().SetIsNativeAutoSetupScope(auto_setup_scope);
3857 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); 3871 Dart_NativeEntryResolver resolver = library.native_entry_resolver();
3858 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); 3872 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver);
3859 set_is_bootstrap_native(is_bootstrap_native); 3873 set_is_bootstrap_native(is_bootstrap_native);
3860 } 3874 }
3861 3875
3862 #undef __ 3876 #undef __
3863 3877
3864 } // namespace dart 3878 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/object_dbc_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698