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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 229083002: Revert "Construct literal maps using factory constructor." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 Element jsArrayAdd; 95 Element jsArrayAdd;
96 Element jsStringSplit; 96 Element jsStringSplit;
97 Element jsStringToString; 97 Element jsStringToString;
98 Element jsStringOperatorAdd; 98 Element jsStringOperatorAdd;
99 Element objectEquals; 99 Element objectEquals;
100 100
101 ClassElement typeLiteralClass; 101 ClassElement typeLiteralClass;
102 ClassElement mapLiteralClass; 102 ClassElement mapLiteralClass;
103 ClassElement constMapLiteralClass; 103 ClassElement constMapLiteralClass;
104 ClassElement typeVariableClass; 104 ClassElement typeVariableClass;
105 Element mapLiteralConstructor;
106 Element mapLiteralConstructorEmpty;
107 105
108 ClassElement noSideEffectsClass; 106 ClassElement noSideEffectsClass;
109 ClassElement noThrowsClass; 107 ClassElement noThrowsClass;
110 ClassElement noInlineClass; 108 ClassElement noInlineClass;
111 ClassElement irRepresentationClass; 109 ClassElement irRepresentationClass;
112 110
113 Element getInterceptorMethod; 111 Element getInterceptorMethod;
114 Element interceptedNames; 112 Element interceptedNames;
115 113
116 /** 114 /**
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 } else if (cls == compiler.functionClass) { 721 } else if (cls == compiler.functionClass) {
724 enqueueClass(enqueuer, compiler.closureClass, elements); 722 enqueueClass(enqueuer, compiler.closureClass, elements);
725 } else if (cls == compiler.mapClass) { 723 } else if (cls == compiler.mapClass) {
726 // The backend will use a literal list to initialize the entries 724 // The backend will use a literal list to initialize the entries
727 // of the map. 725 // of the map.
728 enqueueClass(enqueuer, compiler.listClass, elements); 726 enqueueClass(enqueuer, compiler.listClass, elements);
729 enqueueClass(enqueuer, mapLiteralClass, elements); 727 enqueueClass(enqueuer, mapLiteralClass, elements);
730 // For map literals, the dependency between the implementation class 728 // For map literals, the dependency between the implementation class
731 // and [Map] is not visible, so we have to add it manually. 729 // and [Map] is not visible, so we have to add it manually.
732 rti.registerRtiDependency(mapLiteralClass, cls); 730 rti.registerRtiDependency(mapLiteralClass, cls);
731 enqueueInResolution(getMapMaker(), elements);
733 } else if (cls == compiler.boundClosureClass) { 732 } else if (cls == compiler.boundClosureClass) {
734 // TODO(ngeoffray): Move the bound closure class in the 733 // TODO(ngeoffray): Move the bound closure class in the
735 // backend. 734 // backend.
736 enqueueClass(enqueuer, compiler.boundClosureClass, elements); 735 enqueueClass(enqueuer, compiler.boundClosureClass, elements);
737 } else if (Elements.isNativeOrExtendsNative(cls)) { 736 } else if (Elements.isNativeOrExtendsNative(cls)) {
738 enqueue(enqueuer, getNativeInterceptorMethod, elements); 737 enqueue(enqueuer, getNativeInterceptorMethod, elements);
739 enqueueClass(enqueuer, jsInterceptorClass, compiler.globalDependencies); 738 enqueueClass(enqueuer, jsInterceptorClass, compiler.globalDependencies);
740 enqueueClass(enqueuer, jsPlainJavaScriptObjectClass, elements); 739 enqueueClass(enqueuer, jsPlainJavaScriptObjectClass, elements);
741 } else if (cls == mapLiteralClass) {
742 // For map literals, the dependency between the implementation class
743 // and [Map] is not visible, so we have to add it manually.
744 Element getFactory(String name, int arity) {
745 return mapLiteralClass.patch.lookupConstructor(
746 new Selector.callConstructor(
747 name, mapLiteralClass.getLibrary(), arity),
748 (element) {
749 compiler.internalError(mapLiteralClass,
750 "Map literal class $mapLiteralClass missing "
751 "'$name' constructor"
752 " ${mapLiteralClass.constructors}");
753 });
754 }
755 mapLiteralConstructor = getFactory('_literal', 1);
756 mapLiteralConstructorEmpty = getFactory('_empty', 0);
757 enqueueInResolution(mapLiteralConstructor, elements);
758 enqueueInResolution(mapLiteralConstructorEmpty, elements);
759 } 740 }
760 } 741 }
761 if (cls == compiler.closureClass) { 742 if (cls == compiler.closureClass) {
762 enqueue(enqueuer, 743 enqueue(enqueuer,
763 compiler.findHelper('closureFromTearOff'), 744 compiler.findHelper('closureFromTearOff'),
764 elements); 745 elements);
765 } 746 }
766 ClassElement result = null; 747 ClassElement result = null;
767 if (cls == compiler.stringClass || cls == jsStringClass) { 748 if (cls == compiler.stringClass || cls == jsStringClass) {
768 addInterceptors(jsStringClass, enqueuer, elements); 749 addInterceptors(jsStringClass, enqueuer, elements);
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 } 1441 }
1461 1442
1462 Element getClosureConverter() { 1443 Element getClosureConverter() {
1463 return compiler.findHelper('convertDartClosureToJS'); 1444 return compiler.findHelper('convertDartClosureToJS');
1464 } 1445 }
1465 1446
1466 Element getTraceFromException() { 1447 Element getTraceFromException() {
1467 return compiler.findHelper('getTraceFromException'); 1448 return compiler.findHelper('getTraceFromException');
1468 } 1449 }
1469 1450
1451 Element getMapMaker() {
1452 return compiler.findHelper('makeLiteralMap');
1453 }
1454
1470 Element getSetRuntimeTypeInfo() { 1455 Element getSetRuntimeTypeInfo() {
1471 return compiler.findHelper('setRuntimeTypeInfo'); 1456 return compiler.findHelper('setRuntimeTypeInfo');
1472 } 1457 }
1473 1458
1474 Element getGetRuntimeTypeInfo() { 1459 Element getGetRuntimeTypeInfo() {
1475 return compiler.findHelper('getRuntimeTypeInfo'); 1460 return compiler.findHelper('getRuntimeTypeInfo');
1476 } 1461 }
1477 1462
1478 Element getGetTypeArgumentByIndex() { 1463 Element getGetTypeArgumentByIndex() {
1479 return compiler.findHelper('getTypeArgumentByIndex'); 1464 return compiler.findHelper('getTypeArgumentByIndex');
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 } 1879 }
1895 } 1880 }
1896 1881
1897 /// Records that [constant] is used by [user.element]. 1882 /// Records that [constant] is used by [user.element].
1898 class Dependency { 1883 class Dependency {
1899 final Constant constant; 1884 final Constant constant;
1900 final TreeElements user; 1885 final TreeElements user;
1901 1886
1902 const Dependency(this.constant, this.user); 1887 const Dependency(this.constant, this.user);
1903 } 1888 }
1889
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698