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

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

Issue 235013002: Fix polymorphic inlining of method dispatchers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
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/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 30 matching lines...) Expand all
41 type_(NULL), 41 type_(NULL),
42 temp_index_(-1), 42 temp_index_(-1),
43 ssa_temp_index_(-1), 43 ssa_temp_index_(-1),
44 input_use_list_(NULL), 44 input_use_list_(NULL),
45 env_use_list_(NULL), 45 env_use_list_(NULL),
46 use_kind_(kValue), // Phis and parameters rely on this default. 46 use_kind_(kValue), // Phis and parameters rely on this default.
47 constant_value_(Object::ZoneHandle(ConstantPropagator::Unknown())) { 47 constant_value_(Object::ZoneHandle(ConstantPropagator::Unknown())) {
48 } 48 }
49 49
50 50
51 Definition* Definition::OriginalDefinition() {
52 Definition* defn = this;
53 while (defn->IsRedefinition() || defn->IsAssertAssignable()) {
54 if (defn->IsRedefinition()) {
55 defn = defn->AsRedefinition()->value()->definition();
56 } else {
57 defn = defn->AsAssertAssignable()->value()->definition();
58 }
59 }
60 return defn;
61 }
62
63
51 ICData* Instruction::GetICData(const Array& ic_data_array) const { 64 ICData* Instruction::GetICData(const Array& ic_data_array) const {
52 ICData& ic_data = ICData::ZoneHandle(); 65 ICData& ic_data = ICData::ZoneHandle();
53 // The deopt_id can be outside the range of the IC data array for 66 // The deopt_id can be outside the range of the IC data array for
54 // computations added in the optimizing compiler. 67 // computations added in the optimizing compiler.
55 if (!ic_data_array.IsNull() && (deopt_id_ < ic_data_array.Length())) { 68 if (!ic_data_array.IsNull() && (deopt_id_ < ic_data_array.Length())) {
56 ic_data ^= ic_data_array.At(deopt_id_); 69 ic_data ^= ic_data_array.At(deopt_id_);
57 } 70 }
58 return &ic_data; 71 return &ic_data;
59 } 72 }
60 73
(...skipping 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after
2153 2166
2154 2167
2155 bool PolymorphicInstanceCallInstr::HasSingleRecognizedTarget() const { 2168 bool PolymorphicInstanceCallInstr::HasSingleRecognizedTarget() const {
2156 return ic_data().HasOneTarget() && 2169 return ic_data().HasOneTarget() &&
2157 (MethodRecognizer::RecognizeKind( 2170 (MethodRecognizer::RecognizeKind(
2158 Function::Handle(ic_data().GetTargetAt(0))) != 2171 Function::Handle(ic_data().GetTargetAt(0))) !=
2159 MethodRecognizer::kUnknown); 2172 MethodRecognizer::kUnknown);
2160 } 2173 }
2161 2174
2162 2175
2163 bool PolymorphicInstanceCallInstr::HasSingleDispatcherTarget() const { 2176 bool PolymorphicInstanceCallInstr::HasOnlyDispatcherTargets() const {
2164 if (!ic_data().HasOneTarget()) return false; 2177 for (intptr_t i = 0; i < ic_data().NumberOfChecks(); ++i) {
2165 const Function& target = Function::Handle(ic_data().GetTargetAt(0)); 2178 const Function& target = Function::Handle(ic_data().GetTargetAt(i));
srdjan 2014/04/11 17:01:04 'Allocate' handle outside the loop.
2166 return target.IsNoSuchMethodDispatcher() || target.IsInvokeFieldDispatcher(); 2179 if (!target.IsNoSuchMethodDispatcher() &&
2180 !target.IsInvokeFieldDispatcher()) {
2181 return false;
2182 }
2183 }
2184 return true;
2167 } 2185 }
2168 2186
2169 2187
2170 LocationSummary* StaticCallInstr::MakeLocationSummary(bool optimizing) const { 2188 LocationSummary* StaticCallInstr::MakeLocationSummary(bool optimizing) const {
2171 return MakeCallSummary(); 2189 return MakeCallSummary();
2172 } 2190 }
2173 2191
2174 2192
2175 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2193 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2176 if (!compiler->is_optimizing()) { 2194 if (!compiler->is_optimizing()) {
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
3251 case Token::kTRUNCDIV: return 0; 3269 case Token::kTRUNCDIV: return 0;
3252 case Token::kMOD: return 1; 3270 case Token::kMOD: return 1;
3253 default: UNIMPLEMENTED(); return -1; 3271 default: UNIMPLEMENTED(); return -1;
3254 } 3272 }
3255 } 3273 }
3256 3274
3257 3275
3258 #undef __ 3276 #undef __
3259 3277
3260 } // namespace dart 3278 } // namespace dart
OLDNEW
« runtime/vm/flow_graph_inliner.cc ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698