| 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 2951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2962 | 2962 |
| 2963 List<HInstruction> inputs = <HInstruction>[]; | 2963 List<HInstruction> inputs = <HInstruction>[]; |
| 2964 addGenericSendArgumentsToList(link.tail.tail, inputs); | 2964 addGenericSendArgumentsToList(link.tail.tail, inputs); |
| 2965 | 2965 |
| 2966 HType ssaType = new HType.fromNativeBehavior(nativeBehavior, compiler); | 2966 HType ssaType = new HType.fromNativeBehavior(nativeBehavior, compiler); |
| 2967 push(new HForeign(nativeBehavior.codeAst, ssaType, inputs, | 2967 push(new HForeign(nativeBehavior.codeAst, ssaType, inputs, |
| 2968 effects: nativeBehavior.sideEffects)); | 2968 effects: nativeBehavior.sideEffects)); |
| 2969 return; | 2969 return; |
| 2970 } | 2970 } |
| 2971 | 2971 |
| 2972 void handleForeignJsCurrentIsolate(Send node) { | 2972 void handleForeignJsCurrentIsolateContext(Send node) { |
| 2973 if (!node.arguments.isEmpty) { | 2973 if (!node.arguments.isEmpty) { |
| 2974 compiler.cancel( | 2974 compiler.cancel( |
| 2975 'Too many arguments to JS_CURRENT_ISOLATE', node: node); | 2975 'Too many arguments to JS_CURRENT_ISOLATE_CONTEXT', node: node); |
| 2976 } | 2976 } |
| 2977 | 2977 |
| 2978 if (!compiler.hasIsolateSupport()) { | 2978 if (!compiler.hasIsolateSupport()) { |
| 2979 // If the isolate library is not used, we just generate code | 2979 // If the isolate library is not used, we just generate code |
| 2980 // to fetch the current isolate. | 2980 // to fetch the current isolate. |
| 2981 String name = backend.namer.CURRENT_ISOLATE; | 2981 String name = backend.namer.CURRENT_ISOLATE; |
| 2982 push(new HForeign(new js.LiteralString(name), | 2982 push(new HForeign(new js.LiteralString(name), |
| 2983 HType.UNKNOWN, | 2983 HType.UNKNOWN, |
| 2984 <HInstruction>[])); | 2984 <HInstruction>[])); |
| 2985 } else { | 2985 } else { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3084 void handleForeignDartObjectJsConstructorFunction(Send node) { | 3084 void handleForeignDartObjectJsConstructorFunction(Send node) { |
| 3085 if (!node.arguments.isEmpty) { | 3085 if (!node.arguments.isEmpty) { |
| 3086 compiler.cancel('Too many arguments', node: node.argumentsNode); | 3086 compiler.cancel('Too many arguments', node: node.argumentsNode); |
| 3087 } | 3087 } |
| 3088 String jsClassReference = backend.namer.isolateAccess(compiler.objectClass); | 3088 String jsClassReference = backend.namer.isolateAccess(compiler.objectClass); |
| 3089 push(new HForeign(new js.LiteralString(jsClassReference), | 3089 push(new HForeign(new js.LiteralString(jsClassReference), |
| 3090 HType.UNKNOWN, | 3090 HType.UNKNOWN, |
| 3091 <HInstruction>[])); | 3091 <HInstruction>[])); |
| 3092 } | 3092 } |
| 3093 | 3093 |
| 3094 void handleForeignJsCurrentIsolate(Send node) { |
| 3095 if (!node.arguments.isEmpty) { |
| 3096 compiler.cancel('Too many arguments', node: node.argumentsNode); |
| 3097 } |
| 3098 push(new HForeign(new js.LiteralString(backend.namer.CURRENT_ISOLATE), |
| 3099 HType.UNKNOWN, |
| 3100 <HInstruction>[])); |
| 3101 } |
| 3102 |
| 3094 visitForeignSend(Send node) { | 3103 visitForeignSend(Send node) { |
| 3095 Selector selector = elements.getSelector(node); | 3104 Selector selector = elements.getSelector(node); |
| 3096 SourceString name = selector.name; | 3105 SourceString name = selector.name; |
| 3097 if (name == const SourceString('JS')) { | 3106 if (name == const SourceString('JS')) { |
| 3098 handleForeignJs(node); | 3107 handleForeignJs(node); |
| 3099 } else if (name == const SourceString('JS_CURRENT_ISOLATE')) { | 3108 } else if (name == const SourceString('JS_CURRENT_ISOLATE_CONTEXT')) { |
| 3100 handleForeignJsCurrentIsolate(node); | 3109 handleForeignJsCurrentIsolateContext(node); |
| 3101 } else if (name == const SourceString('JS_CALL_IN_ISOLATE')) { | 3110 } else if (name == const SourceString('JS_CALL_IN_ISOLATE')) { |
| 3102 handleForeignJsCallInIsolate(node); | 3111 handleForeignJsCallInIsolate(node); |
| 3103 } else if (name == const SourceString('DART_CLOSURE_TO_JS')) { | 3112 } else if (name == const SourceString('DART_CLOSURE_TO_JS')) { |
| 3104 handleForeignDartClosureToJs(node, 'DART_CLOSURE_TO_JS'); | 3113 handleForeignDartClosureToJs(node, 'DART_CLOSURE_TO_JS'); |
| 3105 } else if (name == const SourceString('RAW_DART_FUNCTION_REF')) { | 3114 } else if (name == const SourceString('RAW_DART_FUNCTION_REF')) { |
| 3106 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF'); | 3115 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF'); |
| 3107 } else if (name == const SourceString('JS_SET_CURRENT_ISOLATE')) { | 3116 } else if (name == const SourceString('JS_SET_CURRENT_ISOLATE')) { |
| 3108 handleForeignSetCurrentIsolate(node); | 3117 handleForeignSetCurrentIsolate(node); |
| 3109 } else if (name == const SourceString('JS_CREATE_ISOLATE')) { | 3118 } else if (name == const SourceString('JS_CREATE_ISOLATE')) { |
| 3110 handleForeignCreateIsolate(node); | 3119 handleForeignCreateIsolate(node); |
| 3111 } else if (name == const SourceString('JS_OPERATOR_IS_PREFIX')) { | 3120 } else if (name == const SourceString('JS_OPERATOR_IS_PREFIX')) { |
| 3112 stack.add(addConstantString(node, backend.namer.operatorIsPrefix())); | 3121 stack.add(addConstantString(node, backend.namer.operatorIsPrefix())); |
| 3113 } else if (name == const SourceString('JS_OPERATOR_AS_PREFIX')) { | 3122 } else if (name == const SourceString('JS_OPERATOR_AS_PREFIX')) { |
| 3114 stack.add(addConstantString(node, backend.namer.operatorAsPrefix())); | 3123 stack.add(addConstantString(node, backend.namer.operatorAsPrefix())); |
| 3115 } else if (name == const SourceString('JS_DART_OBJECT_CONSTRUCTOR')) { | 3124 } else if (name == const SourceString('JS_DART_OBJECT_CONSTRUCTOR')) { |
| 3116 handleForeignDartObjectJsConstructorFunction(node); | 3125 handleForeignDartObjectJsConstructorFunction(node); |
| 3126 } else if (name == const SourceString('JS_CURRENT_ISOLATE')) { |
| 3127 handleForeignJsCurrentIsolate(node); |
| 3117 } else { | 3128 } else { |
| 3118 throw "Unknown foreign: ${selector}"; | 3129 throw "Unknown foreign: ${selector}"; |
| 3119 } | 3130 } |
| 3120 } | 3131 } |
| 3121 | 3132 |
| 3122 generateSuperNoSuchMethodSend(Send node, | 3133 generateSuperNoSuchMethodSend(Send node, |
| 3123 Selector selector, | 3134 Selector selector, |
| 3124 List<HInstruction> arguments) { | 3135 List<HInstruction> arguments) { |
| 3125 SourceString name = selector.name; | 3136 SourceString name = selector.name; |
| 3126 | 3137 |
| (...skipping 2237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5364 new HSubGraphBlockInformation(elseBranch.graph)); | 5375 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5365 | 5376 |
| 5366 HBasicBlock conditionStartBlock = conditionBranch.block; | 5377 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5367 conditionStartBlock.setBlockFlow(info, joinBlock); | 5378 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5368 SubGraph conditionGraph = conditionBranch.graph; | 5379 SubGraph conditionGraph = conditionBranch.graph; |
| 5369 HIf branch = conditionGraph.end.last; | 5380 HIf branch = conditionGraph.end.last; |
| 5370 assert(branch is HIf); | 5381 assert(branch is HIf); |
| 5371 branch.blockInformation = conditionStartBlock.blockFlow; | 5382 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5372 } | 5383 } |
| 5373 } | 5384 } |
| OLD | NEW |