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

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

Issue 10447088: Add a new magic element type for annotating types that have Javascript array behavior. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « lib/compiler/implementation/native_handler.dart ('k') | lib/compiler/implementation/warnings.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/codegen.dart
===================================================================
--- lib/compiler/implementation/ssa/codegen.dart (revision 8591)
+++ lib/compiler/implementation/ssa/codegen.dart (working copy)
@@ -2285,6 +2285,7 @@
}
void checkType(HInstruction input, Element element) {
+ world.registerIsCheck(element);
bool requiresNativeIsCheck =
backend.emitter.nativeEmitter.requiresNativeIsCheck(element);
if (!requiresNativeIsCheck) buffer.add('!!');
@@ -2335,7 +2336,6 @@
} else if (element.kind === ElementKind.TYPEDEF) {
compiler.unimplemented("visitIs for typedefs", instruction: node);
}
- world.registerIsCheck(type.element);
LibraryElement coreLibrary = compiler.coreLibrary;
ClassElement objectClass = compiler.objectClass;
HInstruction input = node.expression;
@@ -2511,6 +2511,7 @@
void visitTypeGuard(HTypeGuard node) {
addIndentation();
HInstruction input = node.guarded;
+ Element indexingBehavior = compiler.jsIndexingBehaviorInterface;
if (node.isInteger()) {
buffer.add('if (');
checkInt(input, '!==');
@@ -2543,17 +2544,21 @@
} else if (node.isMutableArray()) {
buffer.add('if (');
checkObject(input, '!==');
- buffer.add('||');
+ buffer.add(' || ');
checkArray(input, '!==');
- buffer.add('||');
+ buffer.add(' || ');
checkImmutableArray(input);
+ buffer.add(' || !');
+ checkType(input, indexingBehavior);
buffer.add(') ');
bailout(node, 'Not a mutable array');
} else if (node.isReadableArray()) {
buffer.add('if (');
checkObject(input, '!==');
- buffer.add('||');
+ buffer.add(' || ');
checkArray(input, '!==');
+ buffer.add(' || !');
+ checkType(input, indexingBehavior);
buffer.add(') ');
bailout(node, 'Not an array');
} else if (node.isIndexablePrimitive()) {
@@ -2561,8 +2566,10 @@
checkString(input, '!==');
buffer.add(' && (');
checkObject(input, '!==');
- buffer.add('||');
+ buffer.add(' || ');
checkArray(input, '!==');
+ buffer.add(' || !');
+ checkType(input, indexingBehavior);
buffer.add(')) ');
bailout(node, 'Not a string or array');
} else {
« no previous file with comments | « lib/compiler/implementation/native_handler.dart ('k') | lib/compiler/implementation/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698