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

Unified Diff: pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart

Issue 1531453004: Indexer one-shot fast path adjustment (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
diff --git a/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
index 2eabee093631d2fcf74a6d1e7a3a4329a1800287..3d3270c4de2fd8c4b765c7c24507fffd5015d213 100644
--- a/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
@@ -217,17 +217,22 @@ class InterceptorStubGenerator {
} else if (selector.isIndex || selector.isIndexSet) {
// For an index operation, this code generates:
//
- // if (receiver.constructor == Array || typeof receiver == "string") {
- // if (a0 >>> 0 === a0 && a0 < receiver.length) {
- // return receiver[a0];
+ // if (typeof a0 === "number") {
+ // if (receiver.constructor == Array ||
+ // typeof receiver == "string") {
+ // if (a0 >>> 0 === a0 && a0 < receiver.length) {
+ // return receiver[a0];
+ // }
// }
// }
//
// For an index set operation, this code generates:
//
- // if (receiver.constructor == Array && !receiver.immutable$list) {
- // if (a0 >>> 0 === a0 && a0 < receiver.length) {
- // return receiver[a0] = a1;
+ // if (typeof a0 === "number") {
+ // if (receiver.constructor == Array && !receiver.immutable$list) {
+ // if (a0 >>> 0 === a0 && a0 < receiver.length) {
+ // return receiver[a0] = a1;
+ // }
// }
// }
bool containsArray = classes.contains(helpers.jsArrayClass);
@@ -270,9 +275,10 @@ class InterceptorStubGenerator {
}
return js.statement('''
- if (#)
- if ((a0 >>> 0) === a0 && a0 < receiver.length)
- return receiver[a0];
+ if (typeof a0 === "number")
+ if (#)
+ if ((a0 >>> 0) === a0 && a0 < receiver.length)
+ return receiver[a0];
''', typeCheck);
} else {
jsAst.Expression typeCheck;
@@ -285,9 +291,10 @@ class InterceptorStubGenerator {
}
return js.statement(r'''
- if (# && !receiver.immutable$list &&
- (a0 >>> 0) === a0 && a0 < receiver.length)
- return receiver[a0] = a1;
+ if (typeof a0 === "number")
+ if (# && !receiver.immutable$list &&
+ (a0 >>> 0) === a0 && a0 < receiver.length)
+ return receiver[a0] = a1;
''', typeCheck);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698