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

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

Issue 1190473004: Add flag polymorphic_with_deopt (default true) and handle case when false: use megamorphic instead … (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: r Created 5 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
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/constant_propagator.h" 8 #include "vm/constant_propagator.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 10 matching lines...) Expand all
21 #include "vm/regexp_assembler.h" 21 #include "vm/regexp_assembler.h"
22 #include "vm/resolver.h" 22 #include "vm/resolver.h"
23 #include "vm/scopes.h" 23 #include "vm/scopes.h"
24 #include "vm/stub_code.h" 24 #include "vm/stub_code.h"
25 #include "vm/symbols.h" 25 #include "vm/symbols.h"
26 26
27 #include "vm/il_printer.h" 27 #include "vm/il_printer.h"
28 28
29 namespace dart { 29 namespace dart {
30 30
31 DEFINE_FLAG(bool, ic_range_profiling, true,
32 "Generate special IC stubs collecting range information "
33 "for binary and unary arithmetic operations");
31 DEFINE_FLAG(bool, propagate_ic_data, true, 34 DEFINE_FLAG(bool, propagate_ic_data, true,
32 "Propagate IC data from unoptimized to optimized IC calls."); 35 "Propagate IC data from unoptimized to optimized IC calls.");
33 DEFINE_FLAG(bool, two_args_smi_icd, true, 36 DEFINE_FLAG(bool, two_args_smi_icd, true,
34 "Generate special IC stubs for two args Smi operations"); 37 "Generate special IC stubs for two args Smi operations");
35 DEFINE_FLAG(bool, ic_range_profiling, true,
36 "Generate special IC stubs collecting range information "
37 "for binary and unary arithmetic operations");
38 DEFINE_FLAG(bool, unbox_numeric_fields, true, 38 DEFINE_FLAG(bool, unbox_numeric_fields, true,
39 "Support unboxed double and float32x4 fields."); 39 "Support unboxed double and float32x4 fields.");
40 DECLARE_FLAG(bool, eliminate_type_checks); 40 DECLARE_FLAG(bool, eliminate_type_checks);
41 DECLARE_FLAG(bool, trace_optimization); 41 DECLARE_FLAG(bool, trace_optimization);
42 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); 42 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
43 43
44 Definition::Definition(intptr_t deopt_id) 44 Definition::Definition(intptr_t deopt_id)
45 : Instruction(deopt_id), 45 : Instruction(deopt_id),
46 range_(NULL), 46 range_(NULL),
47 type_(NULL), 47 type_(NULL),
(...skipping 3003 matching lines...) Expand 10 before | Expand all | Expand 10 after
3051 for (intptr_t i = 0; i < ic_data().NumberOfChecks(); ++i) { 3051 for (intptr_t i = 0; i < ic_data().NumberOfChecks(); ++i) {
3052 const Function& target = Function::Handle(ic_data().GetTargetAt(i)); 3052 const Function& target = Function::Handle(ic_data().GetTargetAt(i));
3053 if (!target.IsNoSuchMethodDispatcher() && 3053 if (!target.IsNoSuchMethodDispatcher() &&
3054 !target.IsInvokeFieldDispatcher()) { 3054 !target.IsInvokeFieldDispatcher()) {
3055 return false; 3055 return false;
3056 } 3056 }
3057 } 3057 }
3058 return true; 3058 return true;
3059 } 3059 }
3060 3060
3061 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3062 ASSERT(ic_data().NumArgsTested() == 1);
3063 if (!with_checks()) {
3064 ASSERT(ic_data().HasOneTarget());
3065 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0));
3066 compiler->GenerateStaticCall(deopt_id(),
3067 instance_call()->token_pos(),
3068 target,
3069 instance_call()->ArgumentCount(),
3070 instance_call()->argument_names(),
3071 locs(),
3072 ICData::Handle());
3073 return;
3074 }
3075
3076 compiler->EmitPolymorphicInstanceCall(ic_data(),
3077 instance_call()->ArgumentCount(),
3078 instance_call()->argument_names(),
3079 deopt_id(),
3080 instance_call()->token_pos(),
3081 locs());
3082 }
3083
3061 3084
3062 LocationSummary* StaticCallInstr::MakeLocationSummary(Zone* zone, 3085 LocationSummary* StaticCallInstr::MakeLocationSummary(Zone* zone,
3063 bool optimizing) const { 3086 bool optimizing) const {
3064 return MakeCallSummary(zone); 3087 return MakeCallSummary(zone);
3065 } 3088 }
3066 3089
3067 3090
3068 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3091 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3069 const ICData* call_ic_data = NULL; 3092 const ICData* call_ic_data = NULL;
3070 if (!FLAG_propagate_ic_data || !compiler->is_optimizing() || 3093 if (!FLAG_propagate_ic_data || !compiler->is_optimizing() ||
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
3613 case Token::kTRUNCDIV: return 0; 3636 case Token::kTRUNCDIV: return 0;
3614 case Token::kMOD: return 1; 3637 case Token::kMOD: return 1;
3615 default: UNIMPLEMENTED(); return -1; 3638 default: UNIMPLEMENTED(); return -1;
3616 } 3639 }
3617 } 3640 }
3618 3641
3619 3642
3620 #undef __ 3643 #undef __
3621 3644
3622 } // namespace dart 3645 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698