| 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 3864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3875 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF'); | 3875 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF'); |
| 3876 } else if (name == 'JS_SET_CURRENT_ISOLATE') { | 3876 } else if (name == 'JS_SET_CURRENT_ISOLATE') { |
| 3877 handleForeignSetCurrentIsolate(node); | 3877 handleForeignSetCurrentIsolate(node); |
| 3878 } else if (name == 'JS_CREATE_ISOLATE') { | 3878 } else if (name == 'JS_CREATE_ISOLATE') { |
| 3879 handleForeignCreateIsolate(node); | 3879 handleForeignCreateIsolate(node); |
| 3880 } else if (name == 'JS_OPERATOR_IS_PREFIX') { | 3880 } else if (name == 'JS_OPERATOR_IS_PREFIX') { |
| 3881 // TODO(floitsch): this should be a JS_NAME. | 3881 // TODO(floitsch): this should be a JS_NAME. |
| 3882 stack.add(addConstantString(backend.namer.operatorIsPrefix)); | 3882 stack.add(addConstantString(backend.namer.operatorIsPrefix)); |
| 3883 } else if (name == 'JS_OBJECT_CLASS_NAME') { | 3883 } else if (name == 'JS_OBJECT_CLASS_NAME') { |
| 3884 // TODO(floitsch): this should be a JS_NAME. | 3884 // TODO(floitsch): this should be a JS_NAME. |
| 3885 String name = backend.namer.runtimeTypeName(compiler.objectClass); | 3885 String name = backend.namer.getRuntimeTypeName(compiler.objectClass); |
| 3886 stack.add(addConstantString(name)); | 3886 stack.add(addConstantString(name)); |
| 3887 } else if (name == 'JS_NULL_CLASS_NAME') { | 3887 } else if (name == 'JS_NULL_CLASS_NAME') { |
| 3888 // TODO(floitsch): this should be a JS_NAME. | 3888 // TODO(floitsch): this should be a JS_NAME. |
| 3889 String name = backend.namer.runtimeTypeName(compiler.nullClass); | 3889 String name = backend.namer.getRuntimeTypeName(compiler.nullClass); |
| 3890 stack.add(addConstantString(name)); | 3890 stack.add(addConstantString(name)); |
| 3891 } else if (name == 'JS_FUNCTION_CLASS_NAME') { | 3891 } else if (name == 'JS_FUNCTION_CLASS_NAME') { |
| 3892 // TODO(floitsch): this should be a JS_NAME. | 3892 // TODO(floitsch): this should be a JS_NAME. |
| 3893 String name = backend.namer.runtimeTypeName(compiler.functionClass); | 3893 String name = backend.namer.getRuntimeTypeName(compiler.functionClass); |
| 3894 stack.add(addConstantString(name)); | 3894 stack.add(addConstantString(name)); |
| 3895 } else if (name == 'JS_OPERATOR_AS_PREFIX') { | 3895 } else if (name == 'JS_OPERATOR_AS_PREFIX') { |
| 3896 // TODO(floitsch): this should be a JS_NAME. | 3896 // TODO(floitsch): this should be a JS_NAME. |
| 3897 stack.add(addConstantString(backend.namer.operatorAsPrefix)); | 3897 stack.add(addConstantString(backend.namer.operatorAsPrefix)); |
| 3898 } else if (name == 'JS_SIGNATURE_NAME') { | 3898 } else if (name == 'JS_SIGNATURE_NAME') { |
| 3899 // TODO(floitsch): this should be a JS_NAME. | 3899 // TODO(floitsch): this should be a JS_NAME. |
| 3900 stack.add(addConstantString(backend.namer.operatorSignature)); | 3900 stack.add(addConstantString(backend.namer.operatorSignature)); |
| 3901 } else if (name == 'JS_TYPEDEF_TAG') { | 3901 } else if (name == 'JS_TYPEDEF_TAG') { |
| 3902 // TODO(floitsch): this should be a JS_NAME. | 3902 // TODO(floitsch): this should be a JS_NAME. |
| 3903 stack.add(addConstantString(backend.namer.typedefTag)); | 3903 stack.add(addConstantString(backend.namer.typedefTag)); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4080 | 4080 |
| 4081 HInstruction target = localsHandler.readThis(); | 4081 HInstruction target = localsHandler.readThis(); |
| 4082 HConstant index = graph.addConstantInt( | 4082 HConstant index = graph.addConstantInt( |
| 4083 RuntimeTypes.getTypeVariableIndex(variable), | 4083 RuntimeTypes.getTypeVariableIndex(variable), |
| 4084 compiler); | 4084 compiler); |
| 4085 | 4085 |
| 4086 if (needsSubstitutionForTypeVariableAccess(cls)) { | 4086 if (needsSubstitutionForTypeVariableAccess(cls)) { |
| 4087 // TODO(ahe): Creating a string here is unfortunate. It is slow (due to | 4087 // TODO(ahe): Creating a string here is unfortunate. It is slow (due to |
| 4088 // string concatenation in the implementation), and may prevent | 4088 // string concatenation in the implementation), and may prevent |
| 4089 // segmentation of '$'. | 4089 // segmentation of '$'. |
| 4090 String substitutionNameString = backend.namer.runtimeTypeName(cls); | 4090 String substitutionNameString = backend.namer.getNameForRti(cls); |
| 4091 HInstruction substitutionName = graph.addConstantString( | 4091 HInstruction substitutionName = graph.addConstantString( |
| 4092 new ast.LiteralDartString(substitutionNameString), compiler); | 4092 new ast.LiteralDartString(substitutionNameString), compiler); |
| 4093 pushInvokeStatic(null, | 4093 pushInvokeStatic(null, |
| 4094 backend.getGetRuntimeTypeArgument(), | 4094 backend.getGetRuntimeTypeArgument(), |
| 4095 [target, substitutionName, index], | 4095 [target, substitutionName, index], |
| 4096 backend.dynamicType); | 4096 backend.dynamicType); |
| 4097 } else { | 4097 } else { |
| 4098 pushInvokeStatic(null, backend.getGetTypeArgumentByIndex(), | 4098 pushInvokeStatic(null, backend.getGetTypeArgumentByIndex(), |
| 4099 [target, index], | 4099 [target, index], |
| 4100 backend.dynamicType); | 4100 backend.dynamicType); |
| (...skipping 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6670 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6670 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 6671 unaliased.accept(this, builder); | 6671 unaliased.accept(this, builder); |
| 6672 } | 6672 } |
| 6673 | 6673 |
| 6674 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6674 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 6675 JavaScriptBackend backend = builder.compiler.backend; | 6675 JavaScriptBackend backend = builder.compiler.backend; |
| 6676 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 6676 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
| 6677 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 6677 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
| 6678 } | 6678 } |
| 6679 } | 6679 } |
| OLD | NEW |