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

Side by Side Diff: pkg/compiler/lib/src/ssa/optimize.dart

Issue 2045223002: Compute and cache element NativeBehavior during resolution. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Temporarily skip compilation subtest Created 4 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
OLDNEW
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 CodegenWorkItem; 5 import '../common/codegen.dart' show CodegenWorkItem;
6 import '../common/tasks.dart' show CompilerTask; 6 import '../common/tasks.dart' show CompilerTask;
7 import '../compiler.dart' show Compiler; 7 import '../compiler.dart' show Compiler;
8 import '../constants/constant_system.dart'; 8 import '../constants/constant_system.dart';
9 import '../constants/values.dart'; 9 import '../constants/values.dart';
10 import '../core_types.dart' show CoreClasses; 10 import '../core_types.dart' show CoreClasses;
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 canInline = false; 498 canInline = false;
499 } 499 }
500 } 500 }
501 }); 501 });
502 502
503 if (!canInline) return null; 503 if (!canInline) return null;
504 504
505 // Strengthen instruction type from annotations to help optimize 505 // Strengthen instruction type from annotations to help optimize
506 // dependent instructions. 506 // dependent instructions.
507 native.NativeBehavior nativeBehavior = 507 native.NativeBehavior nativeBehavior =
508 native.NativeBehavior.ofMethod(method, compiler); 508 backend.getNativeMethodBehavior(method);
509 TypeMask returnType = 509 TypeMask returnType =
510 TypeMaskFactory.fromNativeBehavior(nativeBehavior, compiler); 510 TypeMaskFactory.fromNativeBehavior(nativeBehavior, compiler);
511 HInvokeDynamicMethod result = 511 HInvokeDynamicMethod result =
512 new HInvokeDynamicMethod(node.selector, node.mask, inputs, returnType); 512 new HInvokeDynamicMethod(node.selector, node.mask, inputs, returnType);
513 result.element = method; 513 result.element = method;
514 return result; 514 return result;
515 } 515 }
516 516
517 HInstruction visitBoundsCheck(HBoundsCheck node) { 517 HInstruction visitBoundsCheck(HBoundsCheck node) {
518 HInstruction index = node.index; 518 HInstruction index = node.index;
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 if (field == null) return node; 862 if (field == null) return node;
863 return directFieldGet(receiver, field); 863 return directFieldGet(receiver, field);
864 } 864 }
865 865
866 HInstruction directFieldGet(HInstruction receiver, Element field) { 866 HInstruction directFieldGet(HInstruction receiver, Element field) {
867 bool isAssignable = !compiler.world.fieldNeverChanges(field); 867 bool isAssignable = !compiler.world.fieldNeverChanges(field);
868 868
869 TypeMask type; 869 TypeMask type;
870 if (backend.isNative(field.enclosingClass)) { 870 if (backend.isNative(field.enclosingClass)) {
871 type = TypeMaskFactory.fromNativeBehavior( 871 type = TypeMaskFactory.fromNativeBehavior(
872 native.NativeBehavior.ofFieldLoad(field, compiler), compiler); 872 backend.getNativeFieldLoadBehavior(field), compiler);
873 } else { 873 } else {
874 type = TypeMaskFactory.inferredTypeForElement(field, compiler); 874 type = TypeMaskFactory.inferredTypeForElement(field, compiler);
875 } 875 }
876 876
877 return new HFieldGet(field, receiver, type, isAssignable: isAssignable); 877 return new HFieldGet(field, receiver, type, isAssignable: isAssignable);
878 } 878 }
879 879
880 HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) { 880 HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) {
881 if (node.isInterceptedCall) { 881 if (node.isInterceptedCall) {
882 HInstruction folded = handleInterceptedCall(node); 882 HInstruction folded = handleInterceptedCall(node);
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 2381
2382 keyedValues.forEach((receiver, values) { 2382 keyedValues.forEach((receiver, values) {
2383 result.keyedValues[receiver] = 2383 result.keyedValues[receiver] =
2384 new Map<HInstruction, HInstruction>.from(values); 2384 new Map<HInstruction, HInstruction>.from(values);
2385 }); 2385 });
2386 2386
2387 result.nonEscapingReceivers.addAll(nonEscapingReceivers); 2387 result.nonEscapingReceivers.addAll(nonEscapingReceivers);
2388 return result; 2388 return result;
2389 } 2389 }
2390 } 2390 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/resolution.dart ('k') | tests/compiler/dart2js/serialization/compilation_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698