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

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

Issue 944423002: Revert "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: Created 5 years, 9 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 Element element = elements[argument]; 3744 ast.LiteralString string = argument.asLiteralString();
3745 if (element == null || 3745 if (string == null) {
3746 element is! FieldElement ||
3747 element.enclosingClass != backend.jsGetNameEnum) {
3748 compiler.reportError( 3746 compiler.reportError(
3749 argument, MessageKind.GENERIC, 3747 argument, MessageKind.GENERIC,
3750 {'text': 'Error: Expected a JsGetName enum value.'}); 3748 {'text': 'Error: Expected a literal string.'});
3751 } 3749 }
3752 EnumClassElement enumClass = element.enclosingClass;
3753 int index = enumClass.enumValues.indexOf(element);
3754 stack.add( 3750 stack.add(
3755 addConstantString( 3751 addConstantString(
3756 backend.namer.getNameForJsGetName( 3752 backend.namer.getNameForJsGetName(
3757 argument, JsGetName.values[index]))); 3753 argument, string.dartString.slowToString())));
3758 } 3754 }
3759 3755
3760 void handleForeignJsEmbeddedGlobal(ast.Send node) { 3756 void handleForeignJsEmbeddedGlobal(ast.Send node) {
3761 List<ast.Node> arguments = node.arguments.toList(); 3757 List<ast.Node> arguments = node.arguments.toList();
3762 ast.Node globalNameNode; 3758 ast.Node globalNameNode;
3763 switch (arguments.length) { 3759 switch (arguments.length) {
3764 case 0: 3760 case 0:
3765 case 1: 3761 case 1:
3766 compiler.reportError( 3762 compiler.reportError(
3767 node, MessageKind.GENERIC, 3763 node, MessageKind.GENERIC,
(...skipping 3154 matching lines...) Expand 10 before | Expand all | Expand 10 after
6922 if (unaliased is TypedefType) throw 'unable to unalias $type'; 6918 if (unaliased is TypedefType) throw 'unable to unalias $type';
6923 unaliased.accept(this, builder); 6919 unaliased.accept(this, builder);
6924 } 6920 }
6925 6921
6926 void visitDynamicType(DynamicType type, SsaBuilder builder) { 6922 void visitDynamicType(DynamicType type, SsaBuilder builder) {
6927 JavaScriptBackend backend = builder.compiler.backend; 6923 JavaScriptBackend backend = builder.compiler.backend;
6928 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 6924 ClassElement cls = backend.findHelper('DynamicRuntimeType');
6929 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 6925 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
6930 } 6926 }
6931 } 6927 }
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