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

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

Issue 15724021: Move array and string related HType from const to a field in the backend. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart (revision 23812)
+++ sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart (working copy)
@@ -99,7 +99,8 @@
HInstruction index = instruction.inputs[2];
if (input == instruction.inputs[1] &&
index.instructionType.canBePrimitiveNumber(compiler)) {
- return HType.MUTABLE_ARRAY;
+ JavaScriptBackend backend = compiler.backend;
+ return backend.mutableArrayType;
}
// The index should be an int when the receiver is a string or array.
// However it turns out that inserting an integer check in the optimized
@@ -133,7 +134,8 @@
HInstruction index = instruction.inputs[2];
if (input == instruction.inputs[1] &&
index.instructionType.canBePrimitiveNumber(compiler)) {
- return HType.INDEXABLE_PRIMITIVE;
+ JavaScriptBackend backend = compiler.backend;
+ return backend.indexablePrimitiveType;
}
// The index should be an int when the receiver is a string or array.
// However it turns out that inserting an integer check in the optimized
@@ -182,7 +184,7 @@
Compiler compiler) {
// All bitwise operations on primitive types either produce an
// integer or throw an error.
- if (instruction.inputs[1].isPrimitiveOrNull()) return HType.INTEGER;
+ if (instruction.inputs[1].isPrimitiveOrNull(compiler)) return HType.INTEGER;
return super.computeTypeFromInputTypes(instruction, compiler);
}
@@ -399,7 +401,7 @@
// All bitwise operations on primitive types either produce an
// integer or throw an error.
HInstruction left = instruction.inputs[1];
- if (left.isPrimitiveOrNull()) return HType.INTEGER;
+ if (left.isPrimitiveOrNull(compiler)) return HType.INTEGER;
return super.computeTypeFromInputTypes(instruction, compiler);
}
@@ -502,7 +504,7 @@
HType computeTypeFromInputTypes(HInvokeDynamic instruction,
Compiler compiler) {
- if (instruction.inputs[1].instructionType.isPrimitiveOrNull()) {
+ if (instruction.inputs[1].instructionType.isPrimitiveOrNull(compiler)) {
return HType.BOOLEAN;
}
return super.computeTypeFromInputTypes(instruction, compiler);
@@ -557,12 +559,13 @@
return right.instructionType;
}
// String equality testing is much more common than array equality testing.
+ JavaScriptBackend backend = compiler.backend;
if (input == left && left.isIndexablePrimitive(compiler)) {
- return HType.READABLE_ARRAY;
+ return backend.readableArrayType;
}
// String equality testing is much more common than array equality testing.
if (input == right && right.isIndexablePrimitive(compiler)) {
- return HType.STRING;
+ return backend.stringType;
}
return HType.UNKNOWN;
}
@@ -572,7 +575,7 @@
HInstruction left = instruction.inputs[1];
HInstruction right = instruction.inputs[2];
HType instructionType = left.instructionType;
- if (right.isConstantNull() || instructionType.isPrimitiveOrNull()) {
+ if (right.isConstantNull() || instructionType.isPrimitiveOrNull(compiler)) {
return newBuiltinVariant(instruction);
}
Selector selector = instructionType.refine(instruction.selector, compiler);

Powered by Google App Engine
This is Rietveld 408576698