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 part of js_backend; | 5 part of js_backend; |
6 | 6 |
7 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
8 | 8 |
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); | 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 break; | 205 break; |
206 } | 206 } |
207 } | 207 } |
208 } | 208 } |
209 | 209 |
210 void markAsMustInline(FunctionElement element) { | 210 void markAsMustInline(FunctionElement element) { |
211 _cachedDecisions[element] = _mustInline; | 211 _cachedDecisions[element] = _mustInline; |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
| 215 enum SyntheticConstantKind { |
| 216 DUMMY_INTERCEPTOR, |
| 217 EMPTY_VALUE, |
| 218 TYPEVARIABLE_REFERENCE, |
| 219 } |
| 220 |
215 class JavaScriptBackend extends Backend { | 221 class JavaScriptBackend extends Backend { |
216 static final Uri DART_JS_HELPER = new Uri(scheme: 'dart', path: '_js_helper'); | 222 static final Uri DART_JS_HELPER = new Uri(scheme: 'dart', path: '_js_helper'); |
217 static final Uri DART_INTERCEPTORS = | 223 static final Uri DART_INTERCEPTORS = |
218 new Uri(scheme: 'dart', path: '_interceptors'); | 224 new Uri(scheme: 'dart', path: '_interceptors'); |
219 static final Uri DART_INTERNAL = | 225 static final Uri DART_INTERNAL = |
220 new Uri(scheme: 'dart', path: '_internal'); | 226 new Uri(scheme: 'dart', path: '_internal'); |
221 static final Uri DART_FOREIGN_HELPER = | 227 static final Uri DART_FOREIGN_HELPER = |
222 new Uri(scheme: 'dart', path: '_foreign_helper'); | 228 new Uri(scheme: 'dart', path: '_foreign_helper'); |
223 static final Uri DART_JS_MIRRORS = | 229 static final Uri DART_JS_MIRRORS = |
224 new Uri(scheme: 'dart', path: '_js_mirrors'); | 230 new Uri(scheme: 'dart', path: '_js_mirrors'); |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 return const WorldImpact(); | 1419 return const WorldImpact(); |
1414 } | 1420 } |
1415 } else { | 1421 } else { |
1416 // If the constant-handler was not able to produce a result we have to | 1422 // If the constant-handler was not able to produce a result we have to |
1417 // go through the builder (below) to generate the lazy initializer for | 1423 // go through the builder (below) to generate the lazy initializer for |
1418 // the static variable. | 1424 // the static variable. |
1419 // We also need to register the use of the cyclic-error helper. | 1425 // We also need to register the use of the cyclic-error helper. |
1420 compiler.enqueuer.codegen.registerStaticUse(getCyclicThrowHelper()); | 1426 compiler.enqueuer.codegen.registerStaticUse(getCyclicThrowHelper()); |
1421 } | 1427 } |
1422 } | 1428 } |
| 1429 |
1423 generatedCode[element] = functionCompiler.compile(work); | 1430 generatedCode[element] = functionCompiler.compile(work); |
1424 return const WorldImpact(); | 1431 return const WorldImpact(); |
1425 } | 1432 } |
1426 | 1433 |
1427 native.NativeEnqueuer nativeResolutionEnqueuer(Enqueuer world) { | 1434 native.NativeEnqueuer nativeResolutionEnqueuer(Enqueuer world) { |
1428 return new native.NativeResolutionEnqueuer(world, compiler); | 1435 return new native.NativeResolutionEnqueuer(world, compiler); |
1429 } | 1436 } |
1430 | 1437 |
1431 native.NativeEnqueuer nativeCodegenEnqueuer(Enqueuer world) { | 1438 native.NativeEnqueuer nativeCodegenEnqueuer(Enqueuer world) { |
1432 return new native.NativeCodegenEnqueuer(world, compiler, emitter); | 1439 return new native.NativeCodegenEnqueuer(world, compiler, emitter); |
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2965 } | 2972 } |
2966 } | 2973 } |
2967 | 2974 |
2968 /// Records that [constant] is used by the element behind [registry]. | 2975 /// Records that [constant] is used by the element behind [registry]. |
2969 class Dependency { | 2976 class Dependency { |
2970 final ConstantValue constant; | 2977 final ConstantValue constant; |
2971 final Element annotatedElement; | 2978 final Element annotatedElement; |
2972 | 2979 |
2973 const Dependency(this.constant, this.annotatedElement); | 2980 const Dependency(this.constant, this.annotatedElement); |
2974 } | 2981 } |
OLD | NEW |