| 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 #library('native'); | 5 #library('native'); |
| 6 #import('dart:uri'); | 6 #import('dart:uri'); |
| 7 #import('leg.dart'); | 7 #import('leg.dart'); |
| 8 #import('elements/elements.dart'); | 8 #import('elements/elements.dart'); |
| 9 #import('scanner/scannerlib.dart'); | 9 #import('scanner/scannerlib.dart'); |
| 10 #import('ssa/ssa.dart'); | 10 #import('ssa/ssa.dart'); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 && nativeEmitter.toNativeName(element.enclosingElement) == 'DOMType') { | 211 && nativeEmitter.toNativeName(element.enclosingElement) == 'DOMType') { |
| 212 Element methodElement = | 212 Element methodElement = |
| 213 compiler.findHelper(const SourceString('getTypeNameOf')); | 213 compiler.findHelper(const SourceString('getTypeNameOf')); |
| 214 HStatic method = new HStatic(methodElement); | 214 HStatic method = new HStatic(methodElement); |
| 215 builder.add(method); | 215 builder.add(method); |
| 216 builder.push(new HInvokeStatic(Selector.INVOCATION_1, | 216 builder.push(new HInvokeStatic(Selector.INVOCATION_1, |
| 217 <HInstruction>[method, builder.localsHandler.readThis()])); | 217 <HInstruction>[method, builder.localsHandler.readThis()])); |
| 218 return; | 218 return; |
| 219 } | 219 } |
| 220 | 220 |
| 221 HInstruction convertDartClosure(Element parameter, Type type) { | 221 HInstruction convertDartClosure(Element parameter, FunctionType type) { |
| 222 HInstruction local = builder.localsHandler.readLocal(parameter); | 222 HInstruction local = builder.localsHandler.readLocal(parameter); |
| 223 // TODO(ngeoffray): For static methods, we could pass a method with a | 223 // TODO(ngeoffray): For static methods, we could pass a method with a |
| 224 // defined arity. | 224 // defined arity. |
| 225 builder.push(new HStatic(builder.interceptors.getClosureConverter())); | 225 builder.push(new HStatic(builder.interceptors.getClosureConverter())); |
| 226 HInstruction arity = builder.graph.addConstantInt(type.computeArity()); | 226 HInstruction arity = builder.graph.addConstantInt(type.computeArity()); |
| 227 List<HInstruction> callInputs = <HInstruction>[builder.pop(), local, arity]; | 227 List<HInstruction> callInputs = <HInstruction>[builder.pop(), local, arity]; |
| 228 HInstruction closure = new HInvokeStatic(Selector.INVOCATION_1, callInputs); | 228 HInstruction closure = new HInvokeStatic(Selector.INVOCATION_1, callInputs); |
| 229 builder.add(closure); | 229 builder.add(closure); |
| 230 return closure; | 230 return closure; |
| 231 } | 231 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 String parameters) { | 353 String parameters) { |
| 354 buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty"); | 354 buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty"); |
| 355 buffer.add("('$methodName')) {\n"); | 355 buffer.add("('$methodName')) {\n"); |
| 356 buffer.add(" $code"); | 356 buffer.add(" $code"); |
| 357 buffer.add(" } else {\n"); | 357 buffer.add(" } else {\n"); |
| 358 buffer.add(" return Object.prototype.$methodName.call(this"); | 358 buffer.add(" return Object.prototype.$methodName.call(this"); |
| 359 buffer.add(parameters == '' ? '' : ', $parameters'); | 359 buffer.add(parameters == '' ? '' : ', $parameters'); |
| 360 buffer.add(");\n"); | 360 buffer.add(");\n"); |
| 361 buffer.add(" }\n"); | 361 buffer.add(" }\n"); |
| 362 } | 362 } |
| OLD | NEW |