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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 'Object.prototype.$dartMethodName.call(#$params)'); | 323 'Object.prototype.$dartMethodName.call(#$params)'); |
324 elseInstruction = | 324 elseInstruction = |
325 new HForeign(jsCode, const LiteralDartString('Object'), inputs); | 325 new HForeign(jsCode, const LiteralDartString('Object'), inputs); |
326 builder.add(elseInstruction); | 326 builder.add(elseInstruction); |
327 } | 327 } |
328 | 328 |
329 HConstant constant = builder.graph.addConstantString( | 329 HConstant constant = builder.graph.addConstantString( |
330 new DartString.literal('$dartMethodName')); | 330 new DartString.literal('$dartMethodName')); |
331 DartString jsCode = new DartString.literal( | 331 DartString jsCode = new DartString.literal( |
332 'Object.getPrototypeOf(#).hasOwnProperty(#)'); | 332 'Object.getPrototypeOf(#).hasOwnProperty(#)'); |
333 builder.push(new HForeign( | 333 visitCondition() { |
334 jsCode, const LiteralDartString('Object'), | 334 builder.push(new HForeign( |
335 <HInstruction>[builder.localsHandler.readThis(), constant])); | 335 jsCode, const LiteralDartString('Object'), |
| 336 <HInstruction>[builder.localsHandler.readThis(), constant])); |
| 337 } |
336 | 338 |
337 builder.handleIf(visitThen, visitElse); | 339 builder.handleIf(visitCondition, visitThen, visitElse); |
338 | 340 |
339 HPhi phi = new HPhi.manyInputs( | 341 HPhi phi = new HPhi.manyInputs( |
340 null, <HInstruction>[thenInstruction, elseInstruction]); | 342 null, <HInstruction>[thenInstruction, elseInstruction]); |
341 builder.current.addPhi(phi); | 343 builder.current.addPhi(phi); |
342 builder.stack.add(phi); | 344 builder.stack.add(phi); |
343 } | 345 } |
344 } else { | 346 } else { |
345 // This is JS code written in a Dart file with the construct | 347 // This is JS code written in a Dart file with the construct |
346 // native """ ... """;. It does not work well with mangling, | 348 // native """ ... """;. It does not work well with mangling, |
347 // but there should currently be no clash between leg mangling | 349 // but there should currently be no clash between leg mangling |
(...skipping 11 matching lines...) Expand all Loading... |
359 const LiteralDartString('void'), | 361 const LiteralDartString('void'), |
360 <HInstruction>[jsClosure])); | 362 <HInstruction>[jsClosure])); |
361 } | 363 } |
362 }); | 364 }); |
363 LiteralString jsCode = node.arguments.head; | 365 LiteralString jsCode = node.arguments.head; |
364 builder.push(new HForeign(jsCode.dartString, | 366 builder.push(new HForeign(jsCode.dartString, |
365 const LiteralDartString('Object'), | 367 const LiteralDartString('Object'), |
366 <HInstruction>[])); | 368 <HInstruction>[])); |
367 } | 369 } |
368 } | 370 } |
OLD | NEW |