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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart

Issue 14416014: After a dynamic call, refine the receiver type by looking at the potential targets of that call. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/nodes.dart (revision 22031)
+++ sdk/lib/_internal/compiler/implementation/ssa/nodes.dart (working copy)
@@ -617,8 +617,8 @@
*/
void rewriteWithBetterUser(HInstruction from, HInstruction to) {
Link<HCheck> better = const Link<HCheck>();
- for (HInstruction user in to.usedBy) {
- if (user is HCheck && identical((user as HCheck).checkedInput, to)) {
+ for (var user in to.usedBy) {
+ if (user != from && user is HCheck && user.checkedInput == to) {
better = better.prepend(user);
}
}
@@ -930,6 +930,11 @@
return buffer.toString();
}
+ nonCheck(instruction) {
+ while (instruction is HCheck) instruction = instruction.checkedInput;
+ return instruction;
+ }
+
bool gvnEquals(HInstruction other) {
assert(useGvn() && other.useGvn());
// Check that the type and the flags match.
@@ -942,7 +947,9 @@
final List<HInstruction> otherInputs = other.inputs;
if (inputsLength != otherInputs.length) return false;
for (int i = 0; i < inputsLength; i++) {
- if (!identical(inputs[i], otherInputs[i])) return false;
+ if (nonCheck(inputs[i]) != nonCheck(otherInputs[i])) {
+ return false;
+ }
}
// Check that the data in the instruction matches.
return dataEquals(other);
@@ -952,7 +959,7 @@
int result = typeCode();
int length = inputs.length;
for (int i = 0; i < length; i++) {
- result = (result * 19) + (inputs[i].id) + (result >> 7);
+ result = (result * 19) + (nonCheck(inputs[i]).id) + (result >> 7);
}
return result;
}
@@ -1398,6 +1405,14 @@
}
toString() => 'invoke dynamic getter: $selector';
accept(HVisitor visitor) => visitor.visitInvokeDynamicGetter(this);
+
+ int typeCode() => HInstruction.FIELD_GET_TYPECODE;
+ bool typeEquals(other) => other is HFieldGet || other is HInvokeDynamicGetter;
+ bool dataEquals(other) {
+ return other is HFieldGet
+ ? other.element.name == selector.name
+ : super.dataEquals(other);
+ }
}
class HInvokeDynamicSetter extends HInvokeDynamicField {
@@ -1485,8 +1500,12 @@
accept(HVisitor visitor) => visitor.visitFieldGet(this);
int typeCode() => HInstruction.FIELD_GET_TYPECODE;
- bool typeEquals(other) => other is HFieldGet;
- bool dataEquals(HFieldGet other) => element == other.element;
+ bool typeEquals(other) => other is HFieldGet || other is HInvokeDynamicGetter;
+ bool dataEquals(other) {
+ return other is HInvokeDynamicGetter
+ ? element.name == other.selector.name
+ : element == other.element;
+ }
String toString() => "FieldGet $element";
}
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698