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

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: Rebase 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 3920 matching lines...) Expand 10 before | Expand all | Expand 10 after
3931 handleForeignDartClosureToJs(node, 'DART_CLOSURE_TO_JS'); 3931 handleForeignDartClosureToJs(node, 'DART_CLOSURE_TO_JS');
3932 } else if (name == 'RAW_DART_FUNCTION_REF') { 3932 } else if (name == 'RAW_DART_FUNCTION_REF') {
3933 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF'); 3933 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF');
3934 } else if (name == 'JS_SET_CURRENT_ISOLATE') { 3934 } else if (name == 'JS_SET_CURRENT_ISOLATE') {
3935 handleForeignSetCurrentIsolate(node); 3935 handleForeignSetCurrentIsolate(node);
3936 } else if (name == 'JS_OPERATOR_IS_PREFIX') { 3936 } else if (name == 'JS_OPERATOR_IS_PREFIX') {
3937 // TODO(floitsch): this should be a JS_NAME. 3937 // TODO(floitsch): this should be a JS_NAME.
3938 stack.add(addConstantString(backend.namer.operatorIsPrefix)); 3938 stack.add(addConstantString(backend.namer.operatorIsPrefix));
3939 } else if (name == 'JS_OBJECT_CLASS_NAME') { 3939 } else if (name == 'JS_OBJECT_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.objectClass); 3941 String name = backend.namer.runtimeTypeName(compiler.objectClass);
3942 stack.add(addConstantString(name)); 3942 stack.add(addConstantString(name));
3943 } else if (name == 'JS_NULL_CLASS_NAME') { 3943 } else if (name == 'JS_NULL_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.nullClass); 3945 String name = backend.namer.runtimeTypeName(compiler.nullClass);
3946 stack.add(addConstantString(name)); 3946 stack.add(addConstantString(name));
3947 } else if (name == 'JS_FUNCTION_CLASS_NAME') { 3947 } else if (name == 'JS_FUNCTION_CLASS_NAME') {
3948 // TODO(floitsch): this should be a JS_NAME. 3948 // TODO(floitsch): this should be a JS_NAME.
3949 String name = backend.namer.getRuntimeTypeName(compiler.functionClass); 3949 String name = backend.namer.runtimeTypeName(compiler.functionClass);
3950 stack.add(addConstantString(name)); 3950 stack.add(addConstantString(name));
3951 } else if (name == 'JS_OPERATOR_AS_PREFIX') { 3951 } else if (name == 'JS_OPERATOR_AS_PREFIX') {
3952 // TODO(floitsch): this should be a JS_NAME. 3952 // TODO(floitsch): this should be a JS_NAME.
3953 stack.add(addConstantString(backend.namer.operatorAsPrefix)); 3953 stack.add(addConstantString(backend.namer.operatorAsPrefix));
3954 } else if (name == 'JS_SIGNATURE_NAME') { 3954 } else if (name == 'JS_SIGNATURE_NAME') {
3955 // TODO(floitsch): this should be a JS_NAME. 3955 // TODO(floitsch): this should be a JS_NAME.
3956 stack.add(addConstantString(backend.namer.operatorSignature)); 3956 stack.add(addConstantString(backend.namer.operatorSignature));
3957 } else if (name == 'JS_TYPEDEF_TAG') { 3957 } else if (name == 'JS_TYPEDEF_TAG') {
3958 // TODO(floitsch): this should be a JS_NAME. 3958 // TODO(floitsch): this should be a JS_NAME.
3959 stack.add(addConstantString(backend.namer.typedefTag)); 3959 stack.add(addConstantString(backend.namer.typedefTag));
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
4136 4136
4137 HInstruction target = localsHandler.readThis(); 4137 HInstruction target = localsHandler.readThis();
4138 HConstant index = graph.addConstantInt( 4138 HConstant index = graph.addConstantInt(
4139 RuntimeTypes.getTypeVariableIndex(variable), 4139 RuntimeTypes.getTypeVariableIndex(variable),
4140 compiler); 4140 compiler);
4141 4141
4142 if (needsSubstitutionForTypeVariableAccess(cls)) { 4142 if (needsSubstitutionForTypeVariableAccess(cls)) {
4143 // TODO(ahe): Creating a string here is unfortunate. It is slow (due to 4143 // TODO(ahe): Creating a string here is unfortunate. It is slow (due to
4144 // string concatenation in the implementation), and may prevent 4144 // string concatenation in the implementation), and may prevent
4145 // segmentation of '$'. 4145 // segmentation of '$'.
4146 String substitutionNameString = backend.namer.getNameForRti(cls); 4146 String substitutionNameString = backend.namer.runtimeTypeName(cls);
4147 HInstruction substitutionName = graph.addConstantString( 4147 HInstruction substitutionName = graph.addConstantString(
4148 new ast.LiteralDartString(substitutionNameString), compiler); 4148 new ast.LiteralDartString(substitutionNameString), compiler);
4149 pushInvokeStatic(null, 4149 pushInvokeStatic(null,
4150 backend.getGetRuntimeTypeArgument(), 4150 backend.getGetRuntimeTypeArgument(),
4151 [target, substitutionName, index], 4151 [target, substitutionName, index],
4152 backend.dynamicType); 4152 backend.dynamicType);
4153 } else { 4153 } else {
4154 pushInvokeStatic(null, backend.getGetTypeArgumentByIndex(), 4154 pushInvokeStatic(null, backend.getGetTypeArgumentByIndex(),
4155 [target, index], 4155 [target, index],
4156 backend.dynamicType); 4156 backend.dynamicType);
(...skipping 2765 matching lines...) Expand 10 before | Expand all | Expand 10 after
6922 if (unaliased is TypedefType) throw 'unable to unalias $type'; 6922 if (unaliased is TypedefType) throw 'unable to unalias $type';
6923 unaliased.accept(this, builder); 6923 unaliased.accept(this, builder);
6924 } 6924 }
6925 6925
6926 void visitDynamicType(DynamicType type, SsaBuilder builder) { 6926 void visitDynamicType(DynamicType type, SsaBuilder builder) {
6927 JavaScriptBackend backend = builder.compiler.backend; 6927 JavaScriptBackend backend = builder.compiler.backend;
6928 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 6928 ClassElement cls = backend.findHelper('DynamicRuntimeType');
6929 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 6929 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
6930 } 6930 }
6931 } 6931 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart ('k') | pkg/compiler/lib/src/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698