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

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

Issue 10919123: Reapply Issue 10911006. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 381 }
382 382
383 bool requiresNativeIsCheck(Element element) { 383 bool requiresNativeIsCheck(Element element) {
384 if (!element.isClass()) return false; 384 if (!element.isClass()) return false;
385 ClassElement cls = element; 385 ClassElement cls = element;
386 if (cls.isNative()) return true; 386 if (cls.isNative()) return true;
387 return isSupertypeOfNativeClass(element); 387 return isSupertypeOfNativeClass(element);
388 } 388 }
389 389
390 void emitIsChecks(Map<String, String> objectProperties) { 390 void emitIsChecks(Map<String, String> objectProperties) {
391 for (Element type in compiler.codegenWorld.isChecks) { 391 for (Element element in compiler.codegenWorld.checkedClasses) {
392 if (!requiresNativeIsCheck(type)) continue; 392 if (!requiresNativeIsCheck(element)) continue;
393 String name = compiler.namer.operatorIs(type); 393 String name = compiler.namer.operatorIs(element);
394 objectProperties[name] = 'function() { return false; }'; 394 objectProperties[name] = 'function() { return false; }';
395 } 395 }
396 } 396 }
397 397
398 void assembleCode(CodeBuffer targetBuffer) { 398 void assembleCode(CodeBuffer targetBuffer) {
399 if (nativeClasses.isEmpty()) return; 399 if (nativeClasses.isEmpty()) return;
400 emitDynamicDispatchMetadata(); 400 emitDynamicDispatchMetadata();
401 targetBuffer.add('$defineNativeClassName = ' 401 targetBuffer.add('$defineNativeClassName = '
402 '$defineNativeClassFunction;\n\n'); 402 '$defineNativeClassFunction;\n\n');
403 403
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 if (!first) targetBuffer.add(",\n"); 437 if (!first) targetBuffer.add(",\n");
438 targetBuffer.add(" $name: $function"); 438 targetBuffer.add(" $name: $function");
439 first = false; 439 first = false;
440 }); 440 });
441 targetBuffer.add("\n});\n\n"); 441 targetBuffer.add("\n});\n\n");
442 } 442 }
443 targetBuffer.add('$nativeBuffer'); 443 targetBuffer.add('$nativeBuffer');
444 targetBuffer.add('\n'); 444 targetBuffer.add('\n');
445 } 445 }
446 } 446 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/js_backend/emitter.dart ('k') | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698