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

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

Issue 891673003: dart2js: Refactoring, documentation, and a few bugfixes in Namer class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Bugfixes and test case repair 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
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 3916 matching lines...) Expand 10 before | Expand all | Expand 10 after
3927 handleForeignDartClosureToJs(node, 'DART_CLOSURE_TO_JS'); 3927 handleForeignDartClosureToJs(node, 'DART_CLOSURE_TO_JS');
3928 } else if (name == 'RAW_DART_FUNCTION_REF') { 3928 } else if (name == 'RAW_DART_FUNCTION_REF') {
3929 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF'); 3929 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF');
3930 } else if (name == 'JS_SET_CURRENT_ISOLATE') { 3930 } else if (name == 'JS_SET_CURRENT_ISOLATE') {
3931 handleForeignSetCurrentIsolate(node); 3931 handleForeignSetCurrentIsolate(node);
3932 } else if (name == 'JS_OPERATOR_IS_PREFIX') { 3932 } else if (name == 'JS_OPERATOR_IS_PREFIX') {
3933 // TODO(floitsch): this should be a JS_NAME. 3933 // TODO(floitsch): this should be a JS_NAME.
3934 stack.add(addConstantString(backend.namer.operatorIsPrefix)); 3934 stack.add(addConstantString(backend.namer.operatorIsPrefix));
3935 } else if (name == 'JS_OBJECT_CLASS_NAME') { 3935 } else if (name == 'JS_OBJECT_CLASS_NAME') {
3936 // TODO(floitsch): this should be a JS_NAME. 3936 // TODO(floitsch): this should be a JS_NAME.
3937 String name = backend.namer.getRuntimeTypeName(compiler.objectClass); 3937 String name = backend.namer.runtimeTypeName(compiler.objectClass);
3938 stack.add(addConstantString(name)); 3938 stack.add(addConstantString(name));
3939 } else if (name == 'JS_NULL_CLASS_NAME') { 3939 } else if (name == 'JS_NULL_CLASS_NAME') {
3940 // TODO(floitsch): this should be a JS_NAME. 3940 // TODO(floitsch): this should be a JS_NAME.
3941 String name = backend.namer.getRuntimeTypeName(compiler.nullClass); 3941 String name = backend.namer.runtimeTypeName(compiler.nullClass);
3942 stack.add(addConstantString(name)); 3942 stack.add(addConstantString(name));
3943 } else if (name == 'JS_FUNCTION_CLASS_NAME') { 3943 } else if (name == 'JS_FUNCTION_CLASS_NAME') {
3944 // TODO(floitsch): this should be a JS_NAME. 3944 // TODO(floitsch): this should be a JS_NAME.
3945 String name = backend.namer.getRuntimeTypeName(compiler.functionClass); 3945 String name = backend.namer.runtimeTypeName(compiler.functionClass);
3946 stack.add(addConstantString(name)); 3946 stack.add(addConstantString(name));
3947 } else if (name == 'JS_OPERATOR_AS_PREFIX') { 3947 } else if (name == 'JS_OPERATOR_AS_PREFIX') {
3948 // TODO(floitsch): this should be a JS_NAME. 3948 // TODO(floitsch): this should be a JS_NAME.
3949 stack.add(addConstantString(backend.namer.operatorAsPrefix)); 3949 stack.add(addConstantString(backend.namer.operatorAsPrefix));
3950 } else if (name == 'JS_SIGNATURE_NAME') { 3950 } else if (name == 'JS_SIGNATURE_NAME') {
3951 // TODO(floitsch): this should be a JS_NAME. 3951 // TODO(floitsch): this should be a JS_NAME.
3952 stack.add(addConstantString(backend.namer.operatorSignature)); 3952 stack.add(addConstantString(backend.namer.operatorSignature));
3953 } else if (name == 'JS_TYPEDEF_TAG') { 3953 } else if (name == 'JS_TYPEDEF_TAG') {
3954 // TODO(floitsch): this should be a JS_NAME. 3954 // TODO(floitsch): this should be a JS_NAME.
3955 stack.add(addConstantString(backend.namer.typedefTag)); 3955 stack.add(addConstantString(backend.namer.typedefTag));
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
4132 4132
4133 HInstruction target = localsHandler.readThis(); 4133 HInstruction target = localsHandler.readThis();
4134 HConstant index = graph.addConstantInt( 4134 HConstant index = graph.addConstantInt(
4135 RuntimeTypes.getTypeVariableIndex(variable), 4135 RuntimeTypes.getTypeVariableIndex(variable),
4136 compiler); 4136 compiler);
4137 4137
4138 if (needsSubstitutionForTypeVariableAccess(cls)) { 4138 if (needsSubstitutionForTypeVariableAccess(cls)) {
4139 // TODO(ahe): Creating a string here is unfortunate. It is slow (due to 4139 // TODO(ahe): Creating a string here is unfortunate. It is slow (due to
4140 // string concatenation in the implementation), and may prevent 4140 // string concatenation in the implementation), and may prevent
4141 // segmentation of '$'. 4141 // segmentation of '$'.
4142 String substitutionNameString = backend.namer.getNameForRti(cls); 4142 String substitutionNameString = backend.namer.runtimeTypeName(cls);
4143 HInstruction substitutionName = graph.addConstantString( 4143 HInstruction substitutionName = graph.addConstantString(
4144 new ast.LiteralDartString(substitutionNameString), compiler); 4144 new ast.LiteralDartString(substitutionNameString), compiler);
4145 pushInvokeStatic(null, 4145 pushInvokeStatic(null,
4146 backend.getGetRuntimeTypeArgument(), 4146 backend.getGetRuntimeTypeArgument(),
4147 [target, substitutionName, index], 4147 [target, substitutionName, index],
4148 backend.dynamicType); 4148 backend.dynamicType);
4149 } else { 4149 } else {
4150 pushInvokeStatic(null, backend.getGetTypeArgumentByIndex(), 4150 pushInvokeStatic(null, backend.getGetTypeArgumentByIndex(),
4151 [target, index], 4151 [target, index],
4152 backend.dynamicType); 4152 backend.dynamicType);
(...skipping 2765 matching lines...) Expand 10 before | Expand all | Expand 10 after
6918 if (unaliased is TypedefType) throw 'unable to unalias $type'; 6918 if (unaliased is TypedefType) throw 'unable to unalias $type';
6919 unaliased.accept(this, builder); 6919 unaliased.accept(this, builder);
6920 } 6920 }
6921 6921
6922 void visitDynamicType(DynamicType type, SsaBuilder builder) { 6922 void visitDynamicType(DynamicType type, SsaBuilder builder) {
6923 JavaScriptBackend backend = builder.compiler.backend; 6923 JavaScriptBackend backend = builder.compiler.backend;
6924 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 6924 ClassElement cls = backend.findHelper('DynamicRuntimeType');
6925 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 6925 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
6926 } 6926 }
6927 } 6927 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698