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

Side by Side Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 929313002: Use an enum in embedded_names as input to JS_GET_NAME. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase + comments 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
« no previous file with comments | « pkg/compiler/lib/src/js_backend/namer.dart ('k') | pkg/compiler/lib/src/ssa/ssa.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 ssa; 5 part of ssa;
6 6
7 class SsaFunctionCompiler implements FunctionCompiler { 7 class SsaFunctionCompiler implements FunctionCompiler {
8 SsaCodeGeneratorTask generator; 8 SsaCodeGeneratorTask generator;
9 SsaBuilderTask builder; 9 SsaBuilderTask builder;
10 SsaOptimizerTask optimizer; 10 SsaOptimizerTask optimizer;
(...skipping 3723 matching lines...) Expand 10 before | Expand all | Expand 10 after
3734 argument = arguments[0]; 3734 argument = arguments[0];
3735 break; 3735 break;
3736 default: 3736 default:
3737 for (int i = 1; i < arguments.length; i++) { 3737 for (int i = 1; i < arguments.length; i++) {
3738 compiler.reportError( 3738 compiler.reportError(
3739 arguments[i], MessageKind.GENERIC, 3739 arguments[i], MessageKind.GENERIC,
3740 {'text': 'Error: Extra argument to JS_GET_NAME.'}); 3740 {'text': 'Error: Extra argument to JS_GET_NAME.'});
3741 } 3741 }
3742 return; 3742 return;
3743 } 3743 }
3744 ast.LiteralString string = argument.asLiteralString(); 3744 Element element = elements[argument];
3745 if (string == null) { 3745 if (element == null ||
3746 element is! FieldElement ||
3747 element.enclosingClass != backend.jsGetNameEnum) {
3746 compiler.reportError( 3748 compiler.reportError(
3747 argument, MessageKind.GENERIC, 3749 argument, MessageKind.GENERIC,
3748 {'text': 'Error: Expected a literal string.'}); 3750 {'text': 'Error: Expected a JsGetName enum value.'});
3749 } 3751 }
3752 EnumClassElement enumClass = element.enclosingClass;
3753 int index = enumClass.enumValues.indexOf(element);
3750 stack.add( 3754 stack.add(
3751 addConstantString( 3755 addConstantString(
3752 backend.namer.getNameForJsGetName( 3756 backend.namer.getNameForJsGetName(
3753 argument, string.dartString.slowToString()))); 3757 argument, JsGetName.values[index])));
3754 } 3758 }
3755 3759
3756 void handleForeignJsEmbeddedGlobal(ast.Send node) { 3760 void handleForeignJsEmbeddedGlobal(ast.Send node) {
3757 List<ast.Node> arguments = node.arguments.toList(); 3761 List<ast.Node> arguments = node.arguments.toList();
3758 ast.Node globalNameNode; 3762 ast.Node globalNameNode;
3759 switch (arguments.length) { 3763 switch (arguments.length) {
3760 case 0: 3764 case 0:
3761 case 1: 3765 case 1:
3762 compiler.reportError( 3766 compiler.reportError(
3763 node, MessageKind.GENERIC, 3767 node, MessageKind.GENERIC,
(...skipping 3154 matching lines...) Expand 10 before | Expand all | Expand 10 after
6918 if (unaliased is TypedefType) throw 'unable to unalias $type'; 6922 if (unaliased is TypedefType) throw 'unable to unalias $type';
6919 unaliased.accept(this, builder); 6923 unaliased.accept(this, builder);
6920 } 6924 }
6921 6925
6922 void visitDynamicType(DynamicType type, SsaBuilder builder) { 6926 void visitDynamicType(DynamicType type, SsaBuilder builder) {
6923 JavaScriptBackend backend = builder.compiler.backend; 6927 JavaScriptBackend backend = builder.compiler.backend;
6924 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 6928 ClassElement cls = backend.findHelper('DynamicRuntimeType');
6925 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 6929 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
6926 } 6930 }
6927 } 6931 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/namer.dart ('k') | pkg/compiler/lib/src/ssa/ssa.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698