OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import '../common_elements.dart' show CommonElements; | 5 import '../common_elements.dart' show CommonElements; |
6 import '../elements/entities.dart'; | 6 import '../elements/entities.dart'; |
7 import '../options.dart'; | 7 import '../options.dart'; |
8 import '../types/types.dart'; | 8 import '../types/types.dart'; |
9 import '../universe/selector.dart' show Selector; | 9 import '../universe/selector.dart' show Selector; |
10 import '../world.dart' show ClosedWorld; | 10 import '../world.dart' show ClosedWorld; |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 addAllUsersBut(instruction, instruction.inputs[2]); | 363 addAllUsersBut(instruction, instruction.inputs[2]); |
364 } | 364 } |
365 } | 365 } |
366 }); | 366 }); |
367 } | 367 } |
368 | 368 |
369 HInstruction receiver = instruction.getDartReceiver(closedWorld); | 369 HInstruction receiver = instruction.getDartReceiver(closedWorld); |
370 TypeMask receiverType = receiver.instructionType; | 370 TypeMask receiverType = receiver.instructionType; |
371 instruction.mask = receiverType; | 371 instruction.mask = receiverType; |
372 | 372 |
373 // Try to specialize the receiver after this call by instering a refinement | 373 // Try to specialize the receiver after this call by inserting a refinement |
374 // node (HTypeKnown). There are two potentially expensive tests - are there | 374 // node (HTypeKnown). There are two potentially expensive tests - are there |
375 // any uses of the receiver dominated by and following this call?, and what | 375 // any uses of the receiver dominated by and following this call?, and what |
376 // is the refined type? The first is expensive if the receiver has many | 376 // is the refined type? The first is expensive if the receiver has many |
377 // uses, the second is expensive if many classes implement the selector. So | 377 // uses, the second is expensive if many classes implement the selector. So |
378 // we try to do the least expensive test first. | 378 // we try to do the least expensive test first. |
379 const int _MAX_QUICK_USERS = 50; | 379 const int _MAX_QUICK_USERS = 50; |
380 if (!instruction.selector.isClosureCall) { | 380 if (!instruction.selector.isClosureCall) { |
381 TypeMask newType; | 381 TypeMask newType; |
382 TypeMask computeNewType() { | 382 TypeMask computeNewType() { |
383 newType = closedWorld.computeReceiverType( | 383 newType = closedWorld.computeReceiverType( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 uses.replaceWith(converted); | 416 uses.replaceWith(converted); |
417 addDependentInstructionsToWorkList(converted); | 417 addDependentInstructionsToWorkList(converted); |
418 } | 418 } |
419 } | 419 } |
420 } | 420 } |
421 | 421 |
422 return instruction.specializer | 422 return instruction.specializer |
423 .computeTypeFromInputTypes(instruction, results, options, closedWorld); | 423 .computeTypeFromInputTypes(instruction, results, options, closedWorld); |
424 } | 424 } |
425 } | 425 } |
OLD | NEW |