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/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 5 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
6 import '../common/names.dart' show Selectors; | 6 import '../common/names.dart' show Selectors; |
7 import '../common/tasks.dart' show CompilerTask; | 7 import '../common/tasks.dart' show CompilerTask; |
8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 // the field. This usually removes the demand for the call-through stub and | 510 // the field. This usually removes the demand for the call-through stub and |
511 // makes the field load available to further optimization, e.g. LICM. | 511 // makes the field load available to further optimization, e.g. LICM. |
512 | 512 |
513 if (element != null && | 513 if (element != null && |
514 element.isField && | 514 element.isField && |
515 element.name == node.selector.name) { | 515 element.name == node.selector.name) { |
516 FieldEntity field = element; | 516 FieldEntity field = element; |
517 if (!_nativeData.isNativeMember(field) && | 517 if (!_nativeData.isNativeMember(field) && |
518 !node.isCallOnInterceptor(_closedWorld)) { | 518 !node.isCallOnInterceptor(_closedWorld)) { |
519 HInstruction receiver = node.getDartReceiver(_closedWorld); | 519 HInstruction receiver = node.getDartReceiver(_closedWorld); |
520 TypeMask type = TypeMaskFactory.inferredTypeForElement( | 520 TypeMask type = TypeMaskFactory.inferredTypeForMember( |
521 field as Entity, _globalInferenceResults); | 521 field as Entity, _globalInferenceResults); |
522 HInstruction load = new HFieldGet(field, receiver, type); | 522 HInstruction load = new HFieldGet(field, receiver, type); |
523 node.block.addBefore(node, load); | 523 node.block.addBefore(node, load); |
524 Selector callSelector = new Selector.callClosureFrom(node.selector); | 524 Selector callSelector = new Selector.callClosureFrom(node.selector); |
525 List<HInstruction> inputs = <HInstruction>[load] | 525 List<HInstruction> inputs = <HInstruction>[load] |
526 ..addAll(node.inputs.skip(node.isInterceptedCall ? 2 : 1)); | 526 ..addAll(node.inputs.skip(node.isInterceptedCall ? 2 : 1)); |
527 HInstruction closureCall = | 527 HInstruction closureCall = |
528 new HInvokeClosure(callSelector, inputs, node.instructionType) | 528 new HInvokeClosure(callSelector, inputs, node.instructionType) |
529 ..sourceInformation = node.sourceInformation; | 529 ..sourceInformation = node.sourceInformation; |
530 node.block.addAfter(load, closureCall); | 530 node.block.addAfter(load, closureCall); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 } | 987 } |
988 | 988 |
989 HInstruction directFieldGet(HInstruction receiver, FieldEntity field) { | 989 HInstruction directFieldGet(HInstruction receiver, FieldEntity field) { |
990 bool isAssignable = !_closedWorld.fieldNeverChanges(field); | 990 bool isAssignable = !_closedWorld.fieldNeverChanges(field); |
991 | 991 |
992 TypeMask type; | 992 TypeMask type; |
993 if (_nativeData.isNativeClass(field.enclosingClass)) { | 993 if (_nativeData.isNativeClass(field.enclosingClass)) { |
994 type = TypeMaskFactory.fromNativeBehavior( | 994 type = TypeMaskFactory.fromNativeBehavior( |
995 _nativeData.getNativeFieldLoadBehavior(field), _closedWorld); | 995 _nativeData.getNativeFieldLoadBehavior(field), _closedWorld); |
996 } else { | 996 } else { |
997 type = TypeMaskFactory.inferredTypeForElement( | 997 type = TypeMaskFactory.inferredTypeForMember( |
998 field as Entity, _globalInferenceResults); | 998 field as Entity, _globalInferenceResults); |
999 } | 999 } |
1000 | 1000 |
1001 return new HFieldGet(field, receiver, type, isAssignable: isAssignable); | 1001 return new HFieldGet(field, receiver, type, isAssignable: isAssignable); |
1002 } | 1002 } |
1003 | 1003 |
1004 HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) { | 1004 HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) { |
1005 if (node.isInterceptedCall) { | 1005 if (node.isInterceptedCall) { |
1006 HInstruction folded = handleInterceptedCall(node); | 1006 HInstruction folded = handleInterceptedCall(node); |
1007 if (folded != node) return folded; | 1007 if (folded != node) return folded; |
(...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2820 | 2820 |
2821 keyedValues.forEach((receiver, values) { | 2821 keyedValues.forEach((receiver, values) { |
2822 result.keyedValues[receiver] = | 2822 result.keyedValues[receiver] = |
2823 new Map<HInstruction, HInstruction>.from(values); | 2823 new Map<HInstruction, HInstruction>.from(values); |
2824 }); | 2824 }); |
2825 | 2825 |
2826 result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 2826 result.nonEscapingReceivers.addAll(nonEscapingReceivers); |
2827 return result; | 2827 return result; |
2828 } | 2828 } |
2829 } | 2829 } |
OLD | NEW |