| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/opt_code_generator.h" | 8 #include "vm/opt_code_generator.h" |
| 9 | 9 |
| 10 #include "vm/assembler_macros.h" | 10 #include "vm/assembler_macros.h" |
| (...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2630 if (condition_info.labels_used()) { | 2630 if (condition_info.labels_used()) { |
| 2631 __ Bind(&iterate_label); | 2631 __ Bind(&iterate_label); |
| 2632 } else { | 2632 } else { |
| 2633 __ popl(EAX); | 2633 __ popl(EAX); |
| 2634 __ LoadObject(EDX, bool_true); | 2634 __ LoadObject(EDX, bool_true); |
| 2635 __ cmpl(EAX, EDX); | 2635 __ cmpl(EAX, EDX); |
| 2636 __ j(NOT_EQUAL, label->break_label()); | 2636 __ j(NOT_EQUAL, label->break_label()); |
| 2637 } | 2637 } |
| 2638 } | 2638 } |
| 2639 node->body()->Visit(this); | 2639 node->body()->Visit(this); |
| 2640 HandleBackwardBranch(node->id(), node->token_index()); |
| 2640 __ Bind(label->continue_label()); | 2641 __ Bind(label->continue_label()); |
| 2641 node->increment()->Visit(this); | 2642 node->increment()->Visit(this); |
| 2642 __ jmp(&loop); | 2643 __ jmp(&loop); |
| 2643 __ Bind(label->break_label()); | 2644 __ Bind(label->break_label()); |
| 2644 } | 2645 } |
| 2645 | 2646 |
| 2646 | 2647 |
| 2647 void OptimizingCodeGenerator::VisitDoWhileNode(DoWhileNode* node) { | 2648 void OptimizingCodeGenerator::VisitDoWhileNode(DoWhileNode* node) { |
| 2648 if (FLAG_enable_type_checks) { | 2649 if (FLAG_enable_type_checks) { |
| 2649 CodeGenerator::VisitDoWhileNode(node); | 2650 CodeGenerator::VisitDoWhileNode(node); |
| 2650 return; | 2651 return; |
| 2651 } | 2652 } |
| 2652 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); | 2653 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); |
| 2653 SourceLabel* label = node->label(); | 2654 SourceLabel* label = node->label(); |
| 2654 Label loop; | 2655 Label loop; |
| 2655 __ Bind(&loop); | 2656 __ Bind(&loop); |
| 2656 node->body()->Visit(this); | 2657 node->body()->Visit(this); |
| 2658 HandleBackwardBranch(node->id(), node->token_index()); |
| 2657 __ Bind(label->continue_label()); | 2659 __ Bind(label->continue_label()); |
| 2658 CodeGenInfo condition_info(node->condition()); | 2660 CodeGenInfo condition_info(node->condition()); |
| 2659 condition_info.set_false_label(label->break_label()); | 2661 condition_info.set_false_label(label->break_label()); |
| 2660 condition_info.set_true_label(&loop); | 2662 condition_info.set_true_label(&loop); |
| 2661 condition_info.set_fallthrough_label(label->break_label()); | 2663 condition_info.set_fallthrough_label(label->break_label()); |
| 2662 node->condition()->Visit(this); | 2664 node->condition()->Visit(this); |
| 2663 if (!condition_info.labels_used()) { | 2665 if (!condition_info.labels_used()) { |
| 2664 __ popl(EAX); | 2666 __ popl(EAX); |
| 2665 __ LoadObject(EDX, bool_true); | 2667 __ LoadObject(EDX, bool_true); |
| 2666 __ cmpl(EAX, EDX); | 2668 __ cmpl(EAX, EDX); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2686 node->condition()->Visit(this); | 2688 node->condition()->Visit(this); |
| 2687 if (condition_info.labels_used()) { | 2689 if (condition_info.labels_used()) { |
| 2688 __ Bind(&iterate_label); | 2690 __ Bind(&iterate_label); |
| 2689 } else { | 2691 } else { |
| 2690 __ popl(EAX); | 2692 __ popl(EAX); |
| 2691 __ LoadObject(EDX, bool_true); | 2693 __ LoadObject(EDX, bool_true); |
| 2692 __ cmpl(EAX, EDX); | 2694 __ cmpl(EAX, EDX); |
| 2693 __ j(NOT_EQUAL, label->break_label()); | 2695 __ j(NOT_EQUAL, label->break_label()); |
| 2694 } | 2696 } |
| 2695 node->body()->Visit(this); | 2697 node->body()->Visit(this); |
| 2698 HandleBackwardBranch(node->id(), node->token_index()); |
| 2696 __ jmp(label->continue_label()); | 2699 __ jmp(label->continue_label()); |
| 2697 __ Bind(label->break_label()); | 2700 __ Bind(label->break_label()); |
| 2698 } | 2701 } |
| 2699 | 2702 |
| 2700 | 2703 |
| 2701 void OptimizingCodeGenerator::VisitIfNode(IfNode* node) { | 2704 void OptimizingCodeGenerator::VisitIfNode(IfNode* node) { |
| 2702 if (FLAG_enable_type_checks) { | 2705 if (FLAG_enable_type_checks) { |
| 2703 CodeGenerator::VisitIfNode(node); | 2706 CodeGenerator::VisitIfNode(node); |
| 2704 return; | 2707 return; |
| 2705 } | 2708 } |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3150 } | 3153 } |
| 3151 } | 3154 } |
| 3152 // TODO(srdjan): Implement unary kSUB (negate) Mint. | 3155 // TODO(srdjan): Implement unary kSUB (negate) Mint. |
| 3153 CodeGenerator::VisitUnaryOpNode(node); | 3156 CodeGenerator::VisitUnaryOpNode(node); |
| 3154 } | 3157 } |
| 3155 | 3158 |
| 3156 | 3159 |
| 3157 } // namespace dart | 3160 } // namespace dart |
| 3158 | 3161 |
| 3159 #endif // defined TARGET_ARCH_IA32 | 3162 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |