| 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 /** | 7 /** |
| 8 * A special element for the extra parameter taken by intercepted | 8 * A special element for the extra parameter taken by intercepted |
| 9 * methods. We need to override [Element.computeType] because our | 9 * methods. We need to override [Element.computeType] because our |
| 10 * optimizers may look at its declared type. | 10 * optimizers may look at its declared type. |
| (...skipping 2992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3003 if (!node.arguments.isEmpty) { | 3003 if (!node.arguments.isEmpty) { |
| 3004 compiler.cancel('Too many arguments', | 3004 compiler.cancel('Too many arguments', |
| 3005 node: node.argumentsNode); | 3005 node: node.argumentsNode); |
| 3006 } | 3006 } |
| 3007 String constructorName = backend.namer.isolateName; | 3007 String constructorName = backend.namer.isolateName; |
| 3008 push(new HForeign(new DartString.literal("new $constructorName"), | 3008 push(new HForeign(new DartString.literal("new $constructorName"), |
| 3009 HType.UNKNOWN, | 3009 HType.UNKNOWN, |
| 3010 <HInstruction>[])); | 3010 <HInstruction>[])); |
| 3011 } | 3011 } |
| 3012 | 3012 |
| 3013 void handleForeignDartObjectJsConstructorFunction(Send node) { |
| 3014 if (!node.arguments.isEmpty) { |
| 3015 compiler.cancel('Too many arguments', node: node.argumentsNode); |
| 3016 } |
| 3017 String jsClassReference = backend.namer.isolateAccess(compiler.objectClass); |
| 3018 push(new HForeign(new DartString.literal(jsClassReference), |
| 3019 HType.UNKNOWN, |
| 3020 <HInstruction>[])); |
| 3021 } |
| 3022 |
| 3013 visitForeignSend(Send node) { | 3023 visitForeignSend(Send node) { |
| 3014 Selector selector = elements.getSelector(node); | 3024 Selector selector = elements.getSelector(node); |
| 3015 SourceString name = selector.name; | 3025 SourceString name = selector.name; |
| 3016 if (name == const SourceString('JS')) { | 3026 if (name == const SourceString('JS')) { |
| 3017 handleForeignJs(node); | 3027 handleForeignJs(node); |
| 3018 } else if (name == const SourceString('JS_CURRENT_ISOLATE')) { | 3028 } else if (name == const SourceString('JS_CURRENT_ISOLATE')) { |
| 3019 handleForeignJsCurrentIsolate(node); | 3029 handleForeignJsCurrentIsolate(node); |
| 3020 } else if (name == const SourceString('JS_CALL_IN_ISOLATE')) { | 3030 } else if (name == const SourceString('JS_CALL_IN_ISOLATE')) { |
| 3021 handleForeignJsCallInIsolate(node); | 3031 handleForeignJsCallInIsolate(node); |
| 3022 } else if (name == const SourceString('DART_CLOSURE_TO_JS')) { | 3032 } else if (name == const SourceString('DART_CLOSURE_TO_JS')) { |
| 3023 handleForeignDartClosureToJs(node, 'DART_CLOSURE_TO_JS'); | 3033 handleForeignDartClosureToJs(node, 'DART_CLOSURE_TO_JS'); |
| 3024 } else if (name == const SourceString('RAW_DART_FUNCTION_REF')) { | 3034 } else if (name == const SourceString('RAW_DART_FUNCTION_REF')) { |
| 3025 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF'); | 3035 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF'); |
| 3026 } else if (name == const SourceString('JS_SET_CURRENT_ISOLATE')) { | 3036 } else if (name == const SourceString('JS_SET_CURRENT_ISOLATE')) { |
| 3027 handleForeignSetCurrentIsolate(node); | 3037 handleForeignSetCurrentIsolate(node); |
| 3028 } else if (name == const SourceString('JS_CREATE_ISOLATE')) { | 3038 } else if (name == const SourceString('JS_CREATE_ISOLATE')) { |
| 3029 handleForeignCreateIsolate(node); | 3039 handleForeignCreateIsolate(node); |
| 3030 } else if (name == const SourceString('JS_OPERATOR_IS_PREFIX')) { | 3040 } else if (name == const SourceString('JS_OPERATOR_IS_PREFIX')) { |
| 3031 stack.add(addConstantString(node, backend.namer.operatorIsPrefix())); | 3041 stack.add(addConstantString(node, backend.namer.operatorIsPrefix())); |
| 3032 } else if (name == const SourceString('JS_OPERATOR_AS_PREFIX')) { | 3042 } else if (name == const SourceString('JS_OPERATOR_AS_PREFIX')) { |
| 3033 stack.add(addConstantString(node, backend.namer.operatorAsPrefix())); | 3043 stack.add(addConstantString(node, backend.namer.operatorAsPrefix())); |
| 3044 } else if (name == const SourceString('JS_DART_OBJECT_CONSTRUCTOR')) { |
| 3045 handleForeignDartObjectJsConstructorFunction(node); |
| 3034 } else { | 3046 } else { |
| 3035 throw "Unknown foreign: ${selector}"; | 3047 throw "Unknown foreign: ${selector}"; |
| 3036 } | 3048 } |
| 3037 } | 3049 } |
| 3038 | 3050 |
| 3039 generateSuperNoSuchMethodSend(Send node) { | 3051 generateSuperNoSuchMethodSend(Send node) { |
| 3040 Selector selector = elements.getSelector(node); | 3052 Selector selector = elements.getSelector(node); |
| 3041 SourceString name = selector.name; | 3053 SourceString name = selector.name; |
| 3042 | 3054 |
| 3043 ClassElement cls = currentElement.getEnclosingClass(); | 3055 ClassElement cls = currentElement.getEnclosingClass(); |
| (...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5064 new HSubGraphBlockInformation(elseBranch.graph)); | 5076 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5065 | 5077 |
| 5066 HBasicBlock conditionStartBlock = conditionBranch.block; | 5078 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5067 conditionStartBlock.setBlockFlow(info, joinBlock); | 5079 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5068 SubGraph conditionGraph = conditionBranch.graph; | 5080 SubGraph conditionGraph = conditionBranch.graph; |
| 5069 HIf branch = conditionGraph.end.last; | 5081 HIf branch = conditionGraph.end.last; |
| 5070 assert(branch is HIf); | 5082 assert(branch is HIf); |
| 5071 branch.blockInformation = conditionStartBlock.blockFlow; | 5083 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5072 } | 5084 } |
| 5073 } | 5085 } |
| OLD | NEW |