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

Unified Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 1206873003: dart2js cps: Handle checks against mutable and extendable lists. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/codegen/glue.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/codegen/codegen.dart
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
index d7453dbf44427ebe325ca5bd2e62d4ffeb7dfa05..fcddc2bd2bbb5bc4dc1ebfaf87d08cc746282d73 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -337,6 +337,14 @@ class CodeGenerator extends tree_ir.StatementVisitor
glue.registerIsCheck(type, registry);
ClassElement clazz = type.element;
+ // Handle some special checks against classes that exist only in
+ // the compile-time class hierarchy, not at runtime.
+ if (clazz == glue.jsExtendableArrayClass) {
+ return js.js(r'!#.fixed$length', <js.Expression>[value]);
+ } else if (clazz == glue.jsMutableArrayClass) {
+ return js.js(r'!#.immutable$list', <js.Expression>[value]);
+ }
+
// We use one of the two helpers:
//
// checkSubtype(value, $isT, typeArgs, $asT)
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/codegen/glue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698