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

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

Issue 10377166: Prepare to have more than one universe. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 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 StringBuffer nativeBuffer; 8 StringBuffer nativeBuffer;
9 9
10 // Classes that participate in dynamic dispatch. These are the 10 // Classes that participate in dynamic dispatch. These are the
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 353 }
354 354
355 bool requiresNativeIsCheck(Element element) { 355 bool requiresNativeIsCheck(Element element) {
356 if (!element.isClass()) return false; 356 if (!element.isClass()) return false;
357 ClassElement cls = element; 357 ClassElement cls = element;
358 if (cls.isNative()) return true; 358 if (cls.isNative()) return true;
359 return isSupertypeOfNativeClass(element); 359 return isSupertypeOfNativeClass(element);
360 } 360 }
361 361
362 void emitIsChecks(StringBuffer checkBuffer) { 362 void emitIsChecks(StringBuffer checkBuffer) {
363 for (Element type in compiler.universe.isChecks) { 363 for (Element type in compiler.codegenWorld.isChecks) {
364 if (!requiresNativeIsCheck(type)) continue; 364 if (!requiresNativeIsCheck(type)) continue;
365 String name = compiler.namer.operatorIs(type); 365 String name = compiler.namer.operatorIs(type);
366 checkBuffer.add("$defPropName(Object.prototype, '$name', "); 366 checkBuffer.add("$defPropName(Object.prototype, '$name', ");
367 checkBuffer.add('function() { return false; });\n'); 367 checkBuffer.add('function() { return false; });\n');
368 } 368 }
369 } 369 }
370 370
371 void assembleCode(StringBuffer targetBuffer) { 371 void assembleCode(StringBuffer targetBuffer) {
372 if (nativeClasses.isEmpty()) return; 372 if (nativeClasses.isEmpty()) return;
373 emitDynamicDispatchMetadata(); 373 emitDynamicDispatchMetadata();
(...skipping 11 matching lines...) Expand all
385 String toStringName = compiler.namer.instanceMethodName( 385 String toStringName = compiler.namer.instanceMethodName(
386 null, const SourceString('toString'), 0); 386 null, const SourceString('toString'), 0);
387 objectProperties.add("$defPropName(Object.prototype, '$toStringName', "); 387 objectProperties.add("$defPropName(Object.prototype, '$toStringName', ");
388 objectProperties.add( 388 objectProperties.add(
389 'function() { return $toStringHelperName(this); });\n'); 389 'function() { return $toStringHelperName(this); });\n');
390 390
391 targetBuffer.add('$defineNativeClassName = $defineNativeClassFunction;\n'); 391 targetBuffer.add('$defineNativeClassName = $defineNativeClassFunction;\n');
392 targetBuffer.add('$objectProperties$nativeBuffer\n'); 392 targetBuffer.add('$objectProperties$nativeBuffer\n');
393 } 393 }
394 } 394 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/enqueue.dart ('k') | dart/lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698