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

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

Issue 10161022: Fix performance regression on some benchmarks: add an extendable array type where push and pop can … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/tracer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/nodes.dart
===================================================================
--- lib/compiler/implementation/ssa/nodes.dart (revision 6831)
+++ lib/compiler/implementation/ssa/nodes.dart (working copy)
@@ -678,7 +678,8 @@
static final int FLAG_READABLE_ARRAY = FLAG_STRING << 1;
// FLAG_WRITABLE_ARRAY implies FLAG_READABLE_ARRAY.
static final int FLAG_WRITEABLE_ARRAY = FLAG_READABLE_ARRAY << 1;
- static final int FLAG_DOUBLE = FLAG_WRITEABLE_ARRAY << 1;
+ static final int FLAG_EXTENDABLE_ARRAY = FLAG_WRITEABLE_ARRAY << 1;
+ static final int FLAG_DOUBLE = FLAG_EXTENDABLE_ARRAY << 1;
static final int FLAG_NON_PRIMITIVE = FLAG_DOUBLE << 1;
static final HType CONFLICTING = const HType(FLAG_CONFLICTING);
@@ -686,12 +687,15 @@
static final HType BOOLEAN = const HType(FLAG_BOOLEAN);
static final HType STRING = const HType(FLAG_STRING);
static final HType READABLE_ARRAY = const HType(FLAG_READABLE_ARRAY);
- static final HType MUTABLE_ARRAY =
- const HType(FLAG_READABLE_ARRAY | FLAG_WRITEABLE_ARRAY);
+ static final HType MUTABLE_ARRAY = const HType(
+ FLAG_READABLE_ARRAY | FLAG_WRITEABLE_ARRAY);
+ static final HType EXTENDABLE_ARRAY = const HType(
+ FLAG_READABLE_ARRAY | FLAG_WRITEABLE_ARRAY | FLAG_EXTENDABLE_ARRAY);
static final HType INTEGER = const HType(FLAG_INTEGER);
static final HType DOUBLE = const HType(FLAG_DOUBLE);
- static final HType STRING_OR_ARRAY =
- const HType(FLAG_STRING | FLAG_READABLE_ARRAY | FLAG_WRITEABLE_ARRAY);
+ static final HType STRING_OR_ARRAY = const HType(
+ FLAG_STRING | FLAG_READABLE_ARRAY | FLAG_WRITEABLE_ARRAY
+ | FLAG_EXTENDABLE_ARRAY);
static final HType NUMBER = const HType(FLAG_DOUBLE | FLAG_INTEGER);
bool isConflicting() => this === CONFLICTING;
@@ -701,7 +705,8 @@
bool isDouble() => this === DOUBLE;
bool isString() => this === STRING;
bool isArray() => (this.flag & FLAG_READABLE_ARRAY) != 0;
- bool isMutableArray() => this === MUTABLE_ARRAY;
+ bool isMutableArray() => this === MUTABLE_ARRAY || this === EXTENDABLE_ARRAY;
+ bool isExtendableArray() => this === EXTENDABLE_ARRAY;
bool isNumber() => (this.flag & (FLAG_INTEGER | FLAG_DOUBLE)) != 0;
bool isStringOrArray() =>
(this.flag & (FLAG_STRING | FLAG_READABLE_ARRAY)) != 0;
@@ -718,6 +723,7 @@
if (flag === STRING.flag) return STRING;
if (flag === READABLE_ARRAY.flag) return READABLE_ARRAY;
if (flag === MUTABLE_ARRAY.flag) return MUTABLE_ARRAY;
+ if (flag === EXTENDABLE_ARRAY.flag) return EXTENDABLE_ARRAY;
if (flag === NUMBER.flag) return NUMBER;
if (flag === STRING_OR_ARRAY.flag) return STRING_OR_ARRAY;
unreachable();
@@ -731,6 +737,7 @@
if (isDouble()) return 'double';
if (isString()) return 'string';
if (isMutableArray()) return 'mutable array';
+ if (isExtendableArray()) return 'extendable array';
if (isArray()) return 'array';
if (isNumber()) return 'number';
if (isStringOrArray()) return 'string or array';
@@ -819,6 +826,7 @@
// All isFunctions work on the propagated types.
bool isArray() => propagatedType.isArray();
bool isMutableArray() => propagatedType.isMutableArray();
+ bool isExtendableArray() => propagatedType.isExtendableArray();
bool isBoolean() => propagatedType.isBoolean();
bool isInteger() => propagatedType.isInteger();
bool isDouble() => propagatedType.isDouble();
@@ -1211,10 +1219,10 @@
if (isLengthGetterOnStringOrArray()) {
return 'length';
} else if (name == const SourceString('add')
- && inputs[1].isMutableArray()) {
+ && inputs[1].isExtendableArray()) {
return 'push';
} else if (name == const SourceString('removeLast')
- && inputs[1].isMutableArray()) {
+ && inputs[1].isExtendableArray()) {
return 'pop';
}
return null;
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698