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 3735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3746 compiler.reportError( | 3746 compiler.reportError( |
3747 argument, MessageKind.GENERIC, | 3747 argument, MessageKind.GENERIC, |
3748 {'text': 'Error: Expected a literal string.'}); | 3748 {'text': 'Error: Expected a literal string.'}); |
3749 } | 3749 } |
3750 stack.add( | 3750 stack.add( |
3751 addConstantString( | 3751 addConstantString( |
3752 backend.namer.getNameForJsGetName( | 3752 backend.namer.getNameForJsGetName( |
3753 argument, string.dartString.slowToString()))); | 3753 argument, string.dartString.slowToString()))); |
3754 } | 3754 } |
3755 | 3755 |
| 3756 void handleForeignJsCompilerMacro(ast.Send node) { |
| 3757 throw new UnimplementedError("handleForeignJsCompilerMacro"); |
| 3758 } |
| 3759 |
3756 void handleForeignJsEmbeddedGlobal(ast.Send node) { | 3760 void handleForeignJsEmbeddedGlobal(ast.Send node) { |
3757 List<ast.Node> arguments = node.arguments.toList(); | 3761 List<ast.Node> arguments = node.arguments.toList(); |
3758 ast.Node globalNameNode; | 3762 ast.Node globalNameNode; |
3759 switch (arguments.length) { | 3763 switch (arguments.length) { |
3760 case 0: | 3764 case 0: |
3761 case 1: | 3765 case 1: |
3762 compiler.reportError( | 3766 compiler.reportError( |
3763 node, MessageKind.GENERIC, | 3767 node, MessageKind.GENERIC, |
3764 {'text': 'Error: Expected two arguments to JS_EMBEDDED_GLOBAL.'}); | 3768 {'text': 'Error: Expected two arguments to JS_EMBEDDED_GLOBAL.'}); |
3765 return; | 3769 return; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3982 } else if (name == 'JS_IS_INDEXABLE_FIELD_NAME') { | 3986 } else if (name == 'JS_IS_INDEXABLE_FIELD_NAME') { |
3983 // TODO(floitsch): this should be a JS_NAME. | 3987 // TODO(floitsch): this should be a JS_NAME. |
3984 Element element = backend.findHelper('JavaScriptIndexingBehavior'); | 3988 Element element = backend.findHelper('JavaScriptIndexingBehavior'); |
3985 stack.add(addConstantString(backend.namer.operatorIs(element))); | 3989 stack.add(addConstantString(backend.namer.operatorIs(element))); |
3986 } else if (name == 'JS_CURRENT_ISOLATE') { | 3990 } else if (name == 'JS_CURRENT_ISOLATE') { |
3987 handleForeignJsCurrentIsolate(node); | 3991 handleForeignJsCurrentIsolate(node); |
3988 } else if (name == 'JS_GET_NAME') { | 3992 } else if (name == 'JS_GET_NAME') { |
3989 handleForeignJsGetName(node); | 3993 handleForeignJsGetName(node); |
3990 } else if (name == 'JS_EMBEDDED_GLOBAL') { | 3994 } else if (name == 'JS_EMBEDDED_GLOBAL') { |
3991 handleForeignJsEmbeddedGlobal(node); | 3995 handleForeignJsEmbeddedGlobal(node); |
| 3996 } else if (name == 'JS_COMPILER_MACRO') { |
| 3997 handleForeignJsCompilerMacro(node); |
3992 } else if (name == 'JS_GET_FLAG') { | 3998 } else if (name == 'JS_GET_FLAG') { |
3993 handleForeingJsGetFlag(node); | 3999 handleForeingJsGetFlag(node); |
3994 } else if (name == 'JS_EFFECT') { | 4000 } else if (name == 'JS_EFFECT') { |
3995 stack.add(graph.addConstantNull(compiler)); | 4001 stack.add(graph.addConstantNull(compiler)); |
3996 } else if (name == 'JS_INTERCEPTOR_CONSTANT') { | 4002 } else if (name == 'JS_INTERCEPTOR_CONSTANT') { |
3997 handleJsInterceptorConstant(node); | 4003 handleJsInterceptorConstant(node); |
3998 } else if (name == 'JS_STRING_CONCAT') { | 4004 } else if (name == 'JS_STRING_CONCAT') { |
3999 handleJsStringConcat(node); | 4005 handleJsStringConcat(node); |
4000 } else { | 4006 } else { |
4001 throw "Unknown foreign: ${selector}"; | 4007 throw "Unknown foreign: ${selector}"; |
(...skipping 2916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6918 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6924 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
6919 unaliased.accept(this, builder); | 6925 unaliased.accept(this, builder); |
6920 } | 6926 } |
6921 | 6927 |
6922 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6928 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
6923 JavaScriptBackend backend = builder.compiler.backend; | 6929 JavaScriptBackend backend = builder.compiler.backend; |
6924 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 6930 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
6925 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 6931 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
6926 } | 6932 } |
6927 } | 6933 } |
OLD | NEW |