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

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

Issue 335173002: Save ICData of unoptimized code in the function, thus preserving it across repated unoptimized comp… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/object.h » ('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/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 2237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 } 2248 }
2249 2249
2250 2250
2251 LocationSummary* InstanceCallInstr::MakeLocationSummary(Isolate* isolate, 2251 LocationSummary* InstanceCallInstr::MakeLocationSummary(Isolate* isolate,
2252 bool optimizing) const { 2252 bool optimizing) const {
2253 return MakeCallSummary(); 2253 return MakeCallSummary();
2254 } 2254 }
2255 2255
2256 2256
2257 void InstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2257 void InstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2258 ICData& call_ic_data = ICData::ZoneHandle(ic_data()->raw()); 2258 const ICData* call_ic_data = NULL;
2259 if (!FLAG_propagate_ic_data || !compiler->is_optimizing()) { 2259 if (!FLAG_propagate_ic_data || !compiler->is_optimizing()) {
2260 const Array& arguments_descriptor = 2260 const Array& arguments_descriptor =
2261 Array::Handle(ArgumentsDescriptor::New(ArgumentCount(), 2261 Array::Handle(ArgumentsDescriptor::New(ArgumentCount(),
2262 argument_names())); 2262 argument_names()));
2263 call_ic_data = ICData::New(compiler->parsed_function().function(), 2263 call_ic_data = compiler->GetOrAddInstanceCallICData(
2264 function_name(), 2264 deopt_id(), function_name(), arguments_descriptor,
2265 arguments_descriptor, 2265 checked_argument_count());
2266 deopt_id(), 2266 } else {
2267 checked_argument_count()); 2267 call_ic_data = &ICData::ZoneHandle(ic_data()->raw());
2268 } 2268 }
2269 if (compiler->is_optimizing()) { 2269 if (compiler->is_optimizing()) {
2270 ASSERT(HasICData()); 2270 ASSERT(HasICData());
2271 if (ic_data()->NumberOfChecks() > 0) { 2271 if (ic_data()->NumberOfChecks() > 0) {
2272 const ICData& unary_ic_data = 2272 const ICData& unary_ic_data =
2273 ICData::ZoneHandle(ic_data()->AsUnaryClassChecks()); 2273 ICData::ZoneHandle(ic_data()->AsUnaryClassChecks());
2274 compiler->GenerateInstanceCall(deopt_id(), 2274 compiler->GenerateInstanceCall(deopt_id(),
2275 token_pos(), 2275 token_pos(),
2276 ArgumentCount(), 2276 ArgumentCount(),
2277 argument_names(), 2277 argument_names(),
2278 locs(), 2278 locs(),
2279 unary_ic_data); 2279 unary_ic_data);
2280 } else { 2280 } else {
2281 // Call was not visited yet, use original ICData in order to populate it. 2281 // Call was not visited yet, use original ICData in order to populate it.
2282 compiler->GenerateInstanceCall(deopt_id(), 2282 compiler->GenerateInstanceCall(deopt_id(),
2283 token_pos(), 2283 token_pos(),
2284 ArgumentCount(), 2284 ArgumentCount(),
2285 argument_names(), 2285 argument_names(),
2286 locs(), 2286 locs(),
2287 call_ic_data); 2287 *call_ic_data);
2288 } 2288 }
2289 } else { 2289 } else {
2290 // Unoptimized code. 2290 // Unoptimized code.
2291 ASSERT(!HasICData()); 2291 ASSERT(!HasICData());
2292 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, 2292 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
2293 deopt_id(), 2293 deopt_id(),
2294 token_pos()); 2294 token_pos());
2295 compiler->GenerateInstanceCall(deopt_id(), 2295 compiler->GenerateInstanceCall(deopt_id(),
2296 token_pos(), 2296 token_pos(),
2297 ArgumentCount(), 2297 ArgumentCount(),
2298 argument_names(), 2298 argument_names(),
2299 locs(), 2299 locs(),
2300 call_ic_data); 2300 *call_ic_data);
2301 } 2301 }
2302 } 2302 }
2303 2303
2304 2304
2305 bool PolymorphicInstanceCallInstr::HasSingleRecognizedTarget() const { 2305 bool PolymorphicInstanceCallInstr::HasSingleRecognizedTarget() const {
2306 return ic_data().HasOneTarget() && 2306 return ic_data().HasOneTarget() &&
2307 (MethodRecognizer::RecognizeKind( 2307 (MethodRecognizer::RecognizeKind(
2308 Function::Handle(ic_data().GetTargetAt(0))) != 2308 Function::Handle(ic_data().GetTargetAt(0))) !=
2309 MethodRecognizer::kUnknown); 2309 MethodRecognizer::kUnknown);
2310 } 2310 }
(...skipping 11 matching lines...) Expand all
2322 } 2322 }
2323 2323
2324 2324
2325 LocationSummary* StaticCallInstr::MakeLocationSummary(Isolate* isolate, 2325 LocationSummary* StaticCallInstr::MakeLocationSummary(Isolate* isolate,
2326 bool optimizing) const { 2326 bool optimizing) const {
2327 return MakeCallSummary(); 2327 return MakeCallSummary();
2328 } 2328 }
2329 2329
2330 2330
2331 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2331 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2332 ICData& call_ic_data = ICData::ZoneHandle(ic_data()->raw()); 2332 const ICData* call_ic_data = NULL;
2333 if (!FLAG_propagate_ic_data || !compiler->is_optimizing()) { 2333 if (!FLAG_propagate_ic_data || !compiler->is_optimizing()) {
2334 const Array& arguments_descriptor = 2334 const Array& arguments_descriptor =
2335 Array::Handle(ArgumentsDescriptor::New(ArgumentCount(), 2335 Array::Handle(ArgumentsDescriptor::New(ArgumentCount(),
2336 argument_names())); 2336 argument_names()));
2337 // TODO(srdjan): Improve performance of function recognition. 2337 // TODO(srdjan): Improve performance of function recognition.
2338 MethodRecognizer::Kind recognized_kind = 2338 MethodRecognizer::Kind recognized_kind =
2339 MethodRecognizer::RecognizeKind(function()); 2339 MethodRecognizer::RecognizeKind(function());
2340 int num_args_checked = 0; 2340 int num_args_checked = 0;
2341 if ((recognized_kind == MethodRecognizer::kMathMin) || 2341 if ((recognized_kind == MethodRecognizer::kMathMin) ||
2342 (recognized_kind == MethodRecognizer::kMathMax)) { 2342 (recognized_kind == MethodRecognizer::kMathMax)) {
2343 num_args_checked = 2; 2343 num_args_checked = 2;
2344 } 2344 }
2345 call_ic_data = ICData::New(compiler->parsed_function().function(), 2345 call_ic_data = compiler->GetOrAddStaticCallICData(deopt_id(),
2346 String::Handle(function().name()), 2346 function(),
2347 arguments_descriptor, 2347 arguments_descriptor,
2348 deopt_id(), 2348 num_args_checked);
2349 num_args_checked); // No arguments checked. 2349 } else {
2350 call_ic_data.AddTarget(function()); 2350 call_ic_data = &ICData::ZoneHandle(ic_data()->raw());
2351 } 2351 }
2352 if (!compiler->is_optimizing()) { 2352 if (!compiler->is_optimizing()) {
2353 // Some static calls can be optimized by the optimizing compiler (e.g. sqrt) 2353 // Some static calls can be optimized by the optimizing compiler (e.g. sqrt)
2354 // and therefore need a deoptimization descriptor. 2354 // and therefore need a deoptimization descriptor.
2355 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, 2355 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
2356 deopt_id(), 2356 deopt_id(),
2357 token_pos()); 2357 token_pos());
2358 } 2358 }
2359 compiler->GenerateStaticCall(deopt_id(), 2359 compiler->GenerateStaticCall(deopt_id(),
2360 token_pos(), 2360 token_pos(),
2361 function(), 2361 function(),
2362 ArgumentCount(), 2362 ArgumentCount(),
2363 argument_names(), 2363 argument_names(),
2364 locs(), 2364 locs(),
2365 call_ic_data); 2365 *call_ic_data);
2366 } 2366 }
2367 2367
2368 2368
2369 void AssertAssignableInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2369 void AssertAssignableInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2370 compiler->GenerateAssertAssignable(token_pos(), 2370 compiler->GenerateAssertAssignable(token_pos(),
2371 deopt_id(), 2371 deopt_id(),
2372 dst_type(), 2372 dst_type(),
2373 dst_name(), 2373 dst_name(),
2374 locs()); 2374 locs());
2375 ASSERT(locs()->in(0).reg() == locs()->out(0).reg()); 2375 ASSERT(locs()->in(0).reg() == locs()->out(0).reg());
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
3589 case Token::kTRUNCDIV: return 0; 3589 case Token::kTRUNCDIV: return 0;
3590 case Token::kMOD: return 1; 3590 case Token::kMOD: return 1;
3591 default: UNIMPLEMENTED(); return -1; 3591 default: UNIMPLEMENTED(); return -1;
3592 } 3592 }
3593 } 3593 }
3594 3594
3595 3595
3596 #undef __ 3596 #undef __
3597 3597
3598 } // namespace dart 3598 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698