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

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

Issue 949733003: Share the JavaScript based LinkedHashMap implementation between constant maps and the LinkedHashMap… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 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 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR");
10 10
(...skipping 2652 matching lines...) Expand 10 before | Expand all | Expand 10 after
2663 void onSuperNoSuchMethod(Registry registry) { 2663 void onSuperNoSuchMethod(Registry registry) {
2664 assert(registry.isForResolution); 2664 assert(registry.isForResolution);
2665 registerBackendStaticInvocation( 2665 registerBackendStaticInvocation(
2666 backend.getCreateInvocationMirror(), registry); 2666 backend.getCreateInvocationMirror(), registry);
2667 registerBackendStaticInvocation( 2667 registerBackendStaticInvocation(
2668 backend.compiler.objectClass.lookupLocalMember(Compiler.NO_SUCH_METHOD), 2668 backend.compiler.objectClass.lookupLocalMember(Compiler.NO_SUCH_METHOD),
2669 registry); 2669 registry);
2670 registerBackendInstantiation(backend.compiler.listClass, registry); 2670 registerBackendInstantiation(backend.compiler.listClass, registry);
2671 } 2671 }
2672 2672
2673 void onConstantMap(Registry registry) { 2673 void onMapLiteral(ResolutionRegistry registry,
2674 DartType type,
2675 bool isConstant) {
2674 assert(registry.isForResolution); 2676 assert(registry.isForResolution);
2675 void enqueue(String name) { 2677 void enqueue(String name) {
2676 Element e = backend.find(backend.jsHelperLibrary, name); 2678 Element e = backend.find(backend.jsHelperLibrary, name);
2677 registerBackendInstantiation(e, registry); 2679 registerBackendInstantiation(e, registry);
2678 } 2680 }
2679 2681
2680 enqueue(JavaScriptMapConstant.DART_CLASS); 2682 if (isConstant) {
2681 enqueue(JavaScriptMapConstant.DART_PROTO_CLASS); 2683 enqueue(JavaScriptMapConstant.DART_CLASS);
2682 enqueue(JavaScriptMapConstant.DART_STRING_CLASS); 2684 enqueue(JavaScriptMapConstant.DART_PROTO_CLASS);
2683 enqueue(JavaScriptMapConstant.DART_GENERAL_CLASS); 2685 enqueue(JavaScriptMapConstant.DART_STRING_CLASS);
2686 enqueue(JavaScriptMapConstant.DART_GENERAL_CLASS);
2687 } else {
2688 registry.registerInstantiatedType(type);
2689 }
2684 } 2690 }
2685 2691
2686 /// Called when resolving the `Symbol` constructor. 2692 /// Called when resolving the `Symbol` constructor.
2687 void onSymbolConstructor(Registry registry) { 2693 void onSymbolConstructor(Registry registry) {
2688 assert(registry.isForResolution); 2694 assert(registry.isForResolution);
2689 // Make sure that _internals.Symbol.validated is registered. 2695 // Make sure that _internals.Symbol.validated is registered.
2690 assert(backend.compiler.symbolValidatedConstructor != null); 2696 assert(backend.compiler.symbolValidatedConstructor != null);
2691 registerBackendStaticInvocation( 2697 registerBackendStaticInvocation(
2692 backend.compiler.symbolValidatedConstructor, registry); 2698 backend.compiler.symbolValidatedConstructor, registry);
2693 } 2699 }
2694 } 2700 }
2695 2701
2696 /// Records that [constant] is used by the element behind [registry]. 2702 /// Records that [constant] is used by the element behind [registry].
2697 class Dependency { 2703 class Dependency {
2698 final ConstantValue constant; 2704 final ConstantValue constant;
2699 final Element annotatedElement; 2705 final Element annotatedElement;
2700 2706
2701 const Dependency(this.constant, this.annotatedElement); 2707 const Dependency(this.constant, this.annotatedElement);
2702 } 2708 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698