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 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 5 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
6 import '../common/names.dart' show Selectors; | 6 import '../common/names.dart' show Selectors; |
7 import '../common/tasks.dart' show CompilerTask; | 7 import '../common/tasks.dart' show CompilerTask; |
8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 node.specializer.tryConvertToBuiltin(node, compiler); | 371 node.specializer.tryConvertToBuiltin(node, compiler); |
372 if (instruction != null) return instruction; | 372 if (instruction != null) return instruction; |
373 | 373 |
374 Selector selector = node.selector; | 374 Selector selector = node.selector; |
375 TypeMask mask = node.mask; | 375 TypeMask mask = node.mask; |
376 HInstruction input = node.inputs[1]; | 376 HInstruction input = node.inputs[1]; |
377 | 377 |
378 ClosedWorld world = compiler.closedWorld; | 378 ClosedWorld world = compiler.closedWorld; |
379 | 379 |
380 bool applies(Element element) { | 380 bool applies(Element element) { |
381 return selector.applies(element, backend) && | 381 return selector.applies(element) && |
382 (mask == null || mask.canHit(element, selector, world)); | 382 (mask == null || mask.canHit(element, selector, world)); |
383 } | 383 } |
384 | 384 |
385 if (selector.isCall || selector.isOperator) { | 385 if (selector.isCall || selector.isOperator) { |
386 Element target; | 386 Element target; |
387 if (input.isExtendableArray(compiler)) { | 387 if (input.isExtendableArray(compiler)) { |
388 if (applies(helpers.jsArrayRemoveLast)) { | 388 if (applies(helpers.jsArrayRemoveLast)) { |
389 target = helpers.jsArrayRemoveLast; | 389 target = helpers.jsArrayRemoveLast; |
390 } else if (applies(helpers.jsArrayAdd)) { | 390 } else if (applies(helpers.jsArrayAdd)) { |
391 // The codegen special cases array calls, but does not | 391 // The codegen special cases array calls, but does not |
(...skipping 28 matching lines...) Expand all Loading... |
420 // HForeign is too opaque for the SsaCheckInserter (that adds a | 420 // HForeign is too opaque for the SsaCheckInserter (that adds a |
421 // bounds check on removeLast). Once we start inlining, the | 421 // bounds check on removeLast). Once we start inlining, the |
422 // bounds check will become explicit, so we won't need this | 422 // bounds check will become explicit, so we won't need this |
423 // optimization. | 423 // optimization. |
424 HInvokeDynamicMethod result = new HInvokeDynamicMethod(node.selector, | 424 HInvokeDynamicMethod result = new HInvokeDynamicMethod(node.selector, |
425 node.mask, node.inputs.sublist(1), node.instructionType); | 425 node.mask, node.inputs.sublist(1), node.instructionType); |
426 result.element = target; | 426 result.element = target; |
427 return result; | 427 return result; |
428 } | 428 } |
429 } else if (selector.isGetter) { | 429 } else if (selector.isGetter) { |
430 if (selector.applies(helpers.jsIndexableLength, backend)) { | 430 if (selector.applies(helpers.jsIndexableLength)) { |
431 HInstruction optimized = tryOptimizeLengthInterceptedGetter(node); | 431 HInstruction optimized = tryOptimizeLengthInterceptedGetter(node); |
432 if (optimized != null) return optimized; | 432 if (optimized != null) return optimized; |
433 } | 433 } |
434 } | 434 } |
435 | 435 |
436 return node; | 436 return node; |
437 } | 437 } |
438 | 438 |
439 HInstruction visitInvokeDynamicMethod(HInvokeDynamicMethod node) { | 439 HInstruction visitInvokeDynamicMethod(HInvokeDynamicMethod node) { |
440 propagateConstantValueToUses(node); | 440 propagateConstantValueToUses(node); |
(...skipping 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2651 | 2651 |
2652 keyedValues.forEach((receiver, values) { | 2652 keyedValues.forEach((receiver, values) { |
2653 result.keyedValues[receiver] = | 2653 result.keyedValues[receiver] = |
2654 new Map<HInstruction, HInstruction>.from(values); | 2654 new Map<HInstruction, HInstruction>.from(values); |
2655 }); | 2655 }); |
2656 | 2656 |
2657 result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 2657 result.nonEscapingReceivers.addAll(nonEscapingReceivers); |
2658 return result; | 2658 return result; |
2659 } | 2659 } |
2660 } | 2660 } |
OLD | NEW |