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

Side by Side Diff: lib/compiler/implementation/js_backend/native_emitter.dart

Issue 10978044: Avoid generating is$Object, and fix a typo in a condition. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/js_backend/emitter.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class NativeEmitter { 5 class NativeEmitter {
6 6
7 CodeEmitterTask emitter; 7 CodeEmitterTask emitter;
8 CodeBuffer nativeBuffer; 8 CodeBuffer nativeBuffer;
9 9
10 // Classes that participate in dynamic dispatch. These are the 10 // Classes that participate in dynamic dispatch. These are the
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 bool requiresNativeIsCheck(Element element) { 390 bool requiresNativeIsCheck(Element element) {
391 if (!element.isClass()) return false; 391 if (!element.isClass()) return false;
392 ClassElement cls = element; 392 ClassElement cls = element;
393 if (cls.isNative()) return true; 393 if (cls.isNative()) return true;
394 return isSupertypeOfNativeClass(element); 394 return isSupertypeOfNativeClass(element);
395 } 395 }
396 396
397 void emitIsChecks(Map<String, String> objectProperties) { 397 void emitIsChecks(Map<String, String> objectProperties) {
398 for (Element element in emitter.checkedClasses) { 398 for (Element element in emitter.checkedClasses) {
399 if (!requiresNativeIsCheck(element)) continue; 399 if (!requiresNativeIsCheck(element)) continue;
400 if (element.isObject(compiler)) return;
400 String name = backend.namer.operatorIs(element); 401 String name = backend.namer.operatorIs(element);
401 objectProperties[name] = 'function() { return false; }'; 402 objectProperties[name] = 'function() { return false; }';
402 } 403 }
403 } 404 }
404 405
405 void assembleCode(CodeBuffer targetBuffer) { 406 void assembleCode(CodeBuffer targetBuffer) {
406 if (nativeClasses.isEmpty()) return; 407 if (nativeClasses.isEmpty()) return;
407 emitDynamicDispatchMetadata(); 408 emitDynamicDispatchMetadata();
408 targetBuffer.add('$defineNativeClassName = ' 409 targetBuffer.add('$defineNativeClassName = '
409 '$defineNativeClassFunction;\n\n'); 410 '$defineNativeClassFunction;\n\n');
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 if (!first) targetBuffer.add(",\n"); 451 if (!first) targetBuffer.add(",\n");
451 targetBuffer.add(" $name: $function"); 452 targetBuffer.add(" $name: $function");
452 first = false; 453 first = false;
453 }); 454 });
454 targetBuffer.add("\n});\n\n"); 455 targetBuffer.add("\n});\n\n");
455 } 456 }
456 targetBuffer.add('$nativeBuffer'); 457 targetBuffer.add('$nativeBuffer');
457 targetBuffer.add('\n'); 458 targetBuffer.add('\n');
458 } 459 }
459 } 460 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/js_backend/emitter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698