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

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1927963002: Support compilation of Hello World (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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
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 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 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 if (kind == ElementKind.TYPEDEF) { 1467 if (kind == ElementKind.TYPEDEF) {
1468 return const WorldImpact(); 1468 return const WorldImpact();
1469 } 1469 }
1470 if (element.isConstructor && 1470 if (element.isConstructor &&
1471 element.enclosingClass == helpers.jsNullClass) { 1471 element.enclosingClass == helpers.jsNullClass) {
1472 // Work around a problem compiling JSNull's constructor. 1472 // Work around a problem compiling JSNull's constructor.
1473 return const CodegenImpact(); 1473 return const CodegenImpact();
1474 } 1474 }
1475 if (kind.category == ElementCategory.VARIABLE) { 1475 if (kind.category == ElementCategory.VARIABLE) {
1476 VariableElement variableElement = element; 1476 VariableElement variableElement = element;
1477 ConstantValue initialValue = 1477 ConstantExpression constant = variableElement.constant;
1478 constants.getConstantValue(variableElement.constant); 1478 if (constant != null) {
1479 if (initialValue != null) { 1479 ConstantValue initialValue = constants.getConstantValue(constant);
1480 registerCompileTimeConstant(initialValue, work.registry); 1480 registerCompileTimeConstant(initialValue, work.registry);
1481 addCompileTimeConstantForEmission(initialValue); 1481 addCompileTimeConstantForEmission(initialValue);
1482 // We don't need to generate code for static or top-level 1482 // We don't need to generate code for static or top-level
1483 // variables. For instance variables, we may need to generate 1483 // variables. For instance variables, we may need to generate
1484 // the checked setter. 1484 // the checked setter.
1485 if (Elements.isStaticOrTopLevel(element)) { 1485 if (Elements.isStaticOrTopLevel(element)) {
1486 return impactTransformer 1486 return impactTransformer
1487 .transformCodegenImpact(work.registry.worldImpact); 1487 .transformCodegenImpact(work.registry.worldImpact);
1488 } 1488 }
1489 } else { 1489 } else {
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 1844
1845 void onLibraryCreated(LibraryElement library) { 1845 void onLibraryCreated(LibraryElement library) {
1846 helpers.onLibraryCreated(library); 1846 helpers.onLibraryCreated(library);
1847 } 1847 }
1848 1848
1849 Future onLibraryScanned(LibraryElement library, LibraryLoader loader) { 1849 Future onLibraryScanned(LibraryElement library, LibraryLoader loader) {
1850 return super.onLibraryScanned(library, loader).then((_) { 1850 return super.onLibraryScanned(library, loader).then((_) {
1851 if (library.isPlatformLibrary && 1851 if (library.isPlatformLibrary &&
1852 // Don't patch library currently disallowed. 1852 // Don't patch library currently disallowed.
1853 !library.isSynthesized && 1853 !library.isSynthesized &&
1854 !library.isPatched) { 1854 !library.isPatched &&
1855 // Don't patch deserialized libraries.
1856 !compiler.serialization.isDeserialized(library)) {
1855 // Apply patch, if any. 1857 // Apply patch, if any.
1856 Uri patchUri = compiler.resolvePatchUri(library.canonicalUri.path); 1858 Uri patchUri = compiler.resolvePatchUri(library.canonicalUri.path);
1857 if (patchUri != null) { 1859 if (patchUri != null) {
1858 return compiler.patchParser.patchLibrary(loader, patchUri, library); 1860 return compiler.patchParser.patchLibrary(loader, patchUri, library);
1859 } 1861 }
1860 } 1862 }
1861 }).then((_) { 1863 }).then((_) {
1862 helpers.onLibraryScanned(library); 1864 helpers.onLibraryScanned(library);
1863 Uri uri = library.canonicalUri; 1865 Uri uri = library.canonicalUri;
1864 if (uri == Uris.dart_html) { 1866 if (uri == Uris.dart_html) {
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
3019 3021
3020 @override 3022 @override
3021 void onImpactUsed(ImpactUseCase impactUse) { 3023 void onImpactUsed(ImpactUseCase impactUse) {
3022 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { 3024 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) {
3023 // TODO(johnniwinther): Allow emptying when serialization has been 3025 // TODO(johnniwinther): Allow emptying when serialization has been
3024 // performed. 3026 // performed.
3025 resolution.emptyCache(); 3027 resolution.emptyCache();
3026 } 3028 }
3027 } 3029 }
3028 } 3030 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698