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