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