Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #library('native'); | 5 #library('native'); |
| 6 #import('dart:uri'); | 6 #import('dart:uri'); |
| 7 #import('leg.dart'); | 7 #import('leg.dart'); |
| 8 #import('elements/elements.dart'); | 8 #import('elements/elements.dart'); |
| 9 #import('scanner/scannerlib.dart'); | 9 #import('scanner/scannerlib.dart'); |
| 10 #import('ssa/ssa.dart'); | 10 #import('ssa/ssa.dart'); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 // Resolve to setup the inheritance. | 52 // Resolve to setup the inheritance. |
| 53 classElement.ensureResolved(compiler); | 53 classElement.ensureResolved(compiler); |
| 54 // Add the information that this class is a subtype of | 54 // Add the information that this class is a subtype of |
| 55 // its supertypes. The code emitter and the ssa builder use that | 55 // its supertypes. The code emitter and the ssa builder use that |
| 56 // information. | 56 // information. |
| 57 addSubtypes(classElement, emitter.nativeEmitter); | 57 addSubtypes(classElement, emitter.nativeEmitter); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 if (hasNativeClass) { | 61 if (hasNativeClass) { |
| 62 compiler.registerStaticUse(compiler.findHelper( | 62 final worlds = [compiler.enqueuer.resolution, compiler.enqueuer.codegen]; |
|
ngeoffray
2012/05/23 11:48:59
Could 'worlds' be placed in compiler instead?
ahe
2012/05/23 12:00:30
I'm not really sure about this yet.
| |
| 63 const SourceString('dynamicFunction'))); | 63 for (Universe world in worlds) { |
| 64 compiler.registerStaticUse(compiler.findHelper( | 64 world.registerStaticUse(compiler.findHelper( |
| 65 const SourceString('dynamicSetMetadata'))); | 65 const SourceString('dynamicFunction'))); |
| 66 compiler.registerStaticUse(compiler.findHelper( | 66 world.registerStaticUse(compiler.findHelper( |
| 67 const SourceString('defineProperty'))); | 67 const SourceString('dynamicSetMetadata'))); |
| 68 compiler.registerStaticUse(compiler.findHelper( | 68 world.registerStaticUse(compiler.findHelper( |
| 69 const SourceString('toStringForNativeObject'))); | 69 const SourceString('defineProperty'))); |
| 70 world.registerStaticUse(compiler.findHelper( | |
| 71 const SourceString('toStringForNativeObject'))); | |
| 72 } | |
| 70 } | 73 } |
| 71 } | 74 } |
| 72 | 75 |
| 73 void maybeEnableNative(Compiler compiler, | 76 void maybeEnableNative(Compiler compiler, |
| 74 LibraryElement library, | 77 LibraryElement library, |
| 75 Uri uri) { | 78 Uri uri) { |
| 76 String libraryName = uri.toString(); | 79 String libraryName = uri.toString(); |
| 77 if (library.script.name.contains('dart/frog/tests/frog_native') | 80 if (library.script.name.contains('dart/frog/tests/frog_native') |
| 78 || libraryName == 'dart:dom_deprecated' | 81 || libraryName == 'dart:dom_deprecated' |
| 79 || libraryName == 'dart:isolate' | 82 || libraryName == 'dart:isolate' |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 String parameters) { | 350 String parameters) { |
| 348 buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty"); | 351 buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty"); |
| 349 buffer.add("('$methodName')) {\n"); | 352 buffer.add("('$methodName')) {\n"); |
| 350 buffer.add(" $code"); | 353 buffer.add(" $code"); |
| 351 buffer.add(" } else {\n"); | 354 buffer.add(" } else {\n"); |
| 352 buffer.add(" return Object.prototype.$methodName.call(this"); | 355 buffer.add(" return Object.prototype.$methodName.call(this"); |
| 353 buffer.add(parameters == '' ? '' : ', $parameters'); | 356 buffer.add(parameters == '' ? '' : ', $parameters'); |
| 354 buffer.add(");\n"); | 357 buffer.add(");\n"); |
| 355 buffer.add(" }\n"); | 358 buffer.add(" }\n"); |
| 356 } | 359 } |
| OLD | NEW |