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

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

Issue 2619813005: Use entities in various ssa helpers. (Closed)
Patch Set: Fix comments. Created 3 years, 11 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 4
5 import '../compiler.dart' show Compiler; 5 import '../compiler.dart' show Compiler;
6 import '../constants/constant_system.dart'; 6 import '../constants/constant_system.dart';
7 import '../constants/values.dart'; 7 import '../constants/values.dart';
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart' show Name;
9 import '../elements/entities.dart';
9 import '../js_backend/js_backend.dart'; 10 import '../js_backend/js_backend.dart';
10 import '../types/types.dart'; 11 import '../types/types.dart';
11 import '../universe/call_structure.dart'; 12 import '../universe/call_structure.dart';
12 import '../universe/selector.dart'; 13 import '../universe/selector.dart';
13 import '../world.dart' show ClosedWorld; 14 import '../world.dart' show ClosedWorld;
14 import 'nodes.dart'; 15 import 'nodes.dart';
15 import 'types.dart'; 16 import 'types.dart';
16 17
17 /** 18 /**
18 * [InvokeDynamicSpecializer] and its subclasses are helpers to 19 * [InvokeDynamicSpecializer] and its subclasses are helpers to
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 } 379 }
379 return super.computeTypeFromInputTypes(instruction, compiler, closedWorld); 380 return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
380 } 381 }
381 382
382 BinaryOperation operation(ConstantSystem constantSystem) { 383 BinaryOperation operation(ConstantSystem constantSystem) {
383 return constantSystem.remainder; 384 return constantSystem.remainder;
384 } 385 }
385 386
386 HInstruction newBuiltinVariant( 387 HInstruction newBuiltinVariant(
387 HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) { 388 HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
388 JavaScriptBackend backend = compiler.backend;
389 return new HRemainder( 389 return new HRemainder(
390 instruction.inputs[1], 390 instruction.inputs[1],
391 instruction.inputs[2], 391 instruction.inputs[2],
392 instruction.selector, 392 instruction.selector,
393 computeTypeFromInputTypes(instruction, compiler, closedWorld)); 393 computeTypeFromInputTypes(instruction, compiler, closedWorld));
394 } 394 }
395 } 395 }
396 396
397 class MultiplySpecializer extends BinaryArithmeticSpecializer { 397 class MultiplySpecializer extends BinaryArithmeticSpecializer {
398 const MultiplySpecializer(); 398 const MultiplySpecializer();
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 const EqualsSpecializer(); 739 const EqualsSpecializer();
740 740
741 HInstruction tryConvertToBuiltin( 741 HInstruction tryConvertToBuiltin(
742 HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) { 742 HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
743 HInstruction left = instruction.inputs[1]; 743 HInstruction left = instruction.inputs[1];
744 HInstruction right = instruction.inputs[2]; 744 HInstruction right = instruction.inputs[2];
745 TypeMask instructionType = left.instructionType; 745 TypeMask instructionType = left.instructionType;
746 if (right.isConstantNull() || left.isPrimitiveOrNull(closedWorld)) { 746 if (right.isConstantNull() || left.isPrimitiveOrNull(closedWorld)) {
747 return newBuiltinVariant(instruction, closedWorld); 747 return newBuiltinVariant(instruction, closedWorld);
748 } 748 }
749 Iterable<Element> matches = 749 Iterable<MemberEntity> matches =
750 closedWorld.allFunctions.filter(instruction.selector, instructionType); 750 closedWorld.allFunctions.filter(instruction.selector, instructionType);
751 // This test relies the on `Object.==` and `Interceptor.==` always being 751 // This test relies the on `Object.==` and `Interceptor.==` always being
752 // implemented because if the selector matches by subtype, it still will be 752 // implemented because if the selector matches by subtype, it still will be
753 // a regular object or an interceptor. 753 // a regular object or an interceptor.
754 if (matches 754 if (matches
755 .every(closedWorld.backendClasses.isDefaultEqualityImplementation)) { 755 .every(closedWorld.backendClasses.isDefaultEqualityImplementation)) {
756 return newBuiltinVariant(instruction, closedWorld); 756 return newBuiltinVariant(instruction, closedWorld);
757 } 757 }
758 return null; 758 return null;
759 } 759 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) { 858 HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
859 HInstruction receiver = instruction.getDartReceiver(closedWorld); 859 HInstruction receiver = instruction.getDartReceiver(closedWorld);
860 if (receiver.isNumberOrNull(closedWorld)) { 860 if (receiver.isNumberOrNull(closedWorld)) {
861 // Even if there is no builtin equivalent instruction, we know the 861 // Even if there is no builtin equivalent instruction, we know the
862 // instruction does not have any side effect, and that it can be GVN'ed. 862 // instruction does not have any side effect, and that it can be GVN'ed.
863 clearAllSideEffects(instruction); 863 clearAllSideEffects(instruction);
864 } 864 }
865 return null; 865 return null;
866 } 866 }
867 } 867 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/interceptor_simplifier.dart ('k') | pkg/compiler/lib/src/ssa/loop_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698