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 '../constants/values.dart'; | 5 import '../constants/values.dart'; |
6 import '../elements/elements.dart'; | 6 import '../elements/entities.dart'; |
7 import '../js_backend/js_backend.dart'; | 7 import '../js_backend/js_backend.dart'; |
8 import '../js_backend/interceptor_data.dart'; | 8 import '../js_backend/interceptor_data.dart'; |
9 import '../options.dart'; | 9 import '../options.dart'; |
10 import '../types/types.dart'; | 10 import '../types/types.dart'; |
11 import '../universe/selector.dart' show Selector; | 11 import '../universe/selector.dart' show Selector; |
12 import '../world.dart' show ClosedWorld; | 12 import '../world.dart' show ClosedWorld; |
13 import 'nodes.dart'; | 13 import 'nodes.dart'; |
14 | 14 |
15 /** | 15 /** |
16 * Replaces some instructions with specialized versions to make codegen easier. | 16 * Replaces some instructions with specialized versions to make codegen easier. |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 .isNotEmpty; | 418 .isNotEmpty; |
419 } | 419 } |
420 | 420 |
421 void visitInstruction(HInstruction instruction) { | 421 void visitInstruction(HInstruction instruction) { |
422 // A code motion invariant instruction is dealt before visiting it. | 422 // A code motion invariant instruction is dealt before visiting it. |
423 assert(!instruction.isCodeMotionInvariant()); | 423 assert(!instruction.isCodeMotionInvariant()); |
424 analyzeInputs(instruction, 0); | 424 analyzeInputs(instruction, 0); |
425 } | 425 } |
426 | 426 |
427 void visitInvokeSuper(HInvokeSuper instruction) { | 427 void visitInvokeSuper(HInvokeSuper instruction) { |
428 MemberElement superMethod = instruction.element; | 428 MemberEntity superMethod = instruction.element; |
429 Selector selector = instruction.selector; | 429 Selector selector = instruction.selector; |
430 // If aliased super members cannot be used, we will generate code like | 430 // If aliased super members cannot be used, we will generate code like |
431 // | 431 // |
432 // C.prototype.method.call(instance) | 432 // C.prototype.method.call(instance) |
433 // | 433 // |
434 // where instance is the [this] object for the method. In such a case, the | 434 // where instance is the [this] object for the method. In such a case, the |
435 // get of prototype might be evaluated before instance is created if we | 435 // get of prototype might be evaluated before instance is created if we |
436 // generate instance at use site, which in turn might update the prototype | 436 // generate instance at use site, which in turn might update the prototype |
437 // after first access if we use lazy initialization. | 437 // after first access if we use lazy initialization. |
438 // In this case, we therefore don't allow the receiver (the first argument) | 438 // In this case, we therefore don't allow the receiver (the first argument) |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 } | 801 } |
802 | 802 |
803 // If [thenInput] is defined in the first predecessor, then it is only used | 803 // If [thenInput] is defined in the first predecessor, then it is only used |
804 // by [phi] and can be generated at use site. | 804 // by [phi] and can be generated at use site. |
805 if (identical(thenInput.block, end.predecessors[0])) { | 805 if (identical(thenInput.block, end.predecessors[0])) { |
806 assert(thenInput.usedBy.length == 1); | 806 assert(thenInput.usedBy.length == 1); |
807 markAsGenerateAtUseSite(thenInput); | 807 markAsGenerateAtUseSite(thenInput); |
808 } | 808 } |
809 } | 809 } |
810 } | 810 } |
OLD | NEW |