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

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

Issue 2716593002: Propagate this-specialization to regular (megamorphic) calls (Closed)
Patch Set: Created 3 years, 10 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 #ifndef DART_PRECOMPILED_RUNTIME 4 #ifndef DART_PRECOMPILED_RUNTIME
5 #include "vm/jit_optimizer.h" 5 #include "vm/jit_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/branch_optimizer.h" 8 #include "vm/branch_optimizer.h"
9 #include "vm/cha.h" 9 #include "vm/cha.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 187 }
188 } 188 }
189 } 189 }
190 190
191 return false; 191 return false;
192 } 192 }
193 193
194 194
195 const ICData& JitOptimizer::TrySpecializeICData(const ICData& ic_data, 195 const ICData& JitOptimizer::TrySpecializeICData(const ICData& ic_data,
196 intptr_t cid) { 196 intptr_t cid) {
197 ASSERT(ic_data.NumArgsTested() == 1); 197 Zone* zone = Thread::Current()->zone();
198 if (ic_data.NumArgsTested() != 1) return ic_data;
198 199
199 if ((ic_data.NumberOfUsedChecks() == 1) && ic_data.HasReceiverClassId(cid)) { 200 if ((ic_data.NumberOfUsedChecks() == 1) && ic_data.HasReceiverClassId(cid)) {
200 return ic_data; // Nothing to do 201 return ic_data; // Nothing to do
201 } 202 }
202 203
204 intptr_t count = 1;
203 const Function& function = 205 const Function& function =
204 Function::Handle(Z, ic_data.GetTargetForReceiverClassId(cid)); 206 Function::Handle(zone, ic_data.GetTargetForReceiverClassId(cid, &count));
205 // TODO(fschneider): Try looking up the function on the class if it is 207 // TODO(fschneider): Try looking up the function on the class if it is
206 // not found in the ICData. 208 // not found in the ICData.
207 if (!function.IsNull()) { 209 if (!function.IsNull()) {
208 const ICData& new_ic_data = ICData::ZoneHandle( 210 const ICData& new_ic_data = ICData::ZoneHandle(
209 Z, ICData::New(Function::Handle(Z, ic_data.Owner()), 211 zone, ICData::New(Function::Handle(zone, ic_data.Owner()),
210 String::Handle(Z, ic_data.target_name()), 212 String::Handle(zone, ic_data.target_name()),
211 Object::empty_array(), // Dummy argument descriptor. 213 Object::empty_array(), // Dummy argument descriptor.
212 ic_data.deopt_id(), ic_data.NumArgsTested(), false)); 214 ic_data.deopt_id(), ic_data.NumArgsTested(), false));
213 new_ic_data.SetDeoptReasons(ic_data.DeoptReasons()); 215 new_ic_data.SetDeoptReasons(ic_data.DeoptReasons());
214 new_ic_data.AddReceiverCheck(cid, function); 216 new_ic_data.AddReceiverCheck(cid, function, count);
215 return new_ic_data; 217 return new_ic_data;
216 } 218 }
217 219
218 return ic_data; 220 return ic_data;
219 } 221 }
220 222
221 223
222 void JitOptimizer::SpecializePolymorphicInstanceCall( 224 void JitOptimizer::SpecializePolymorphicInstanceCall(
223 PolymorphicInstanceCallInstr* call) { 225 PolymorphicInstanceCallInstr* call) {
224 if (!FLAG_polymorphic_with_deopt) { 226 if (!FLAG_polymorphic_with_deopt) {
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 // Discard the environment from the original instruction because the store 1861 // Discard the environment from the original instruction because the store
1860 // can't deoptimize. 1862 // can't deoptimize.
1861 instr->RemoveEnvironment(); 1863 instr->RemoveEnvironment();
1862 ReplaceCall(instr, store); 1864 ReplaceCall(instr, store);
1863 return true; 1865 return true;
1864 } 1866 }
1865 1867
1866 1868
1867 } // namespace dart 1869 } // namespace dart
1868 #endif // DART_PRECOMPILED_RUNTIME 1870 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698