| 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 2590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2601 | 2601 |
| 2602 Label done; | 2602 Label done; |
| 2603 __ movl(EAX, Address(ESP, (num_args - 1) * kWordSize)); // Load receiver. | 2603 __ movl(EAX, Address(ESP, (num_args - 1) * kWordSize)); // Load receiver. |
| 2604 if (classes[0]->raw() == smi_class_.raw()) { | 2604 if (classes[0]->raw() == smi_class_.raw()) { |
| 2605 start_ix++; | 2605 start_ix++; |
| 2606 // Smi test is needed. | 2606 // Smi test is needed. |
| 2607 __ testl(EAX, Immediate(kSmiTagMask)); | 2607 __ testl(EAX, Immediate(kSmiTagMask)); |
| 2608 if (classes.length() == 1) { | 2608 if (classes.length() == 1) { |
| 2609 // Only Smi test. | 2609 // Only Smi test. |
| 2610 DeoptimizationBlob* deopt_blob = | 2610 DeoptimizationBlob* deopt_blob = |
| 2611 AddDeoptimizationBlob(node, kDeoptCheckedInstanceCallSmiOnly); | 2611 AddDeoptimizationBlob(node, kDeoptPolymorphicInstanceCallSmiOnly); |
| 2612 __ j(NOT_ZERO, deopt_blob->label()); | 2612 __ j(NOT_ZERO, deopt_blob->label()); |
| 2613 GenerateDirectCall(node->id(), | 2613 GenerateDirectCall(node->id(), |
| 2614 token_index, | 2614 token_index, |
| 2615 *targets[0], | 2615 *targets[0], |
| 2616 num_args, | 2616 num_args, |
| 2617 optional_arguments_names); | 2617 optional_arguments_names); |
| 2618 return; | 2618 return; |
| 2619 } | 2619 } |
| 2620 Label not_smi; | 2620 Label not_smi; |
| 2621 __ j(NOT_ZERO, ¬_smi); | 2621 __ j(NOT_ZERO, ¬_smi); |
| 2622 GenerateDirectCall(node->id(), | 2622 GenerateDirectCall(node->id(), |
| 2623 token_index, | 2623 token_index, |
| 2624 *targets[0], | 2624 *targets[0], |
| 2625 num_args, | 2625 num_args, |
| 2626 optional_arguments_names); | 2626 optional_arguments_names); |
| 2627 __ jmp(&done); | 2627 __ jmp(&done); |
| 2628 __ Bind(¬_smi); // Continue with other test below. | 2628 __ Bind(¬_smi); // Continue with other test below. |
| 2629 } else if (NodeMayBeSmi(receiver)) { | 2629 } else if (NodeMayBeSmi(receiver)) { |
| 2630 DeoptimizationBlob* deopt_blob = | 2630 DeoptimizationBlob* deopt_blob = |
| 2631 AddDeoptimizationBlob(node, kDeoptCheckedInstanceCallSmiFail); | 2631 AddDeoptimizationBlob(node, kDeoptPolymorphicInstanceCallSmiFail); |
| 2632 __ testl(EAX, Immediate(kSmiTagMask)); | 2632 __ testl(EAX, Immediate(kSmiTagMask)); |
| 2633 __ j(ZERO, deopt_blob->label()); | 2633 __ j(ZERO, deopt_blob->label()); |
| 2634 } else { | 2634 } else { |
| 2635 // Receiver cannot be Smi, no need to test it. | 2635 // Receiver cannot be Smi, no need to test it. |
| 2636 } | 2636 } |
| 2637 __ LoadClassId(EAX, EAX); // Receiver's class id. | 2637 __ LoadClassId(EAX, EAX); // Receiver's class id. |
| 2638 for (intptr_t i = start_ix; i < classes.length(); i++) { | 2638 for (intptr_t i = start_ix; i < classes.length(); i++) { |
| 2639 const Class& cls = *classes[i]; | 2639 const Class& cls = *classes[i]; |
| 2640 const Function& target = *targets[i]; | 2640 const Function& target = *targets[i]; |
| 2641 __ cmpl(EAX, Immediate(cls.id())); | 2641 __ cmpl(EAX, Immediate(cls.id())); |
| 2642 if (i == (classes.length() - 1)) { | 2642 if (i == (classes.length() - 1)) { |
| 2643 // Last check. | 2643 // Last check. |
| 2644 DeoptimizationBlob* deopt_blob = | 2644 DeoptimizationBlob* deopt_blob = |
| 2645 AddDeoptimizationBlob(node, kDeoptCheckedInstanceCallCheckFail); | 2645 AddDeoptimizationBlob(node, kDeoptPolymorphicInstanceCallTestFail); |
| 2646 __ j(NOT_EQUAL, deopt_blob->label()); | 2646 __ j(NOT_EQUAL, deopt_blob->label()); |
| 2647 GenerateDirectCall(node->id(), | 2647 GenerateDirectCall(node->id(), |
| 2648 token_index, | 2648 token_index, |
| 2649 target, | 2649 target, |
| 2650 num_args, | 2650 num_args, |
| 2651 optional_arguments_names); | 2651 optional_arguments_names); |
| 2652 } else { | 2652 } else { |
| 2653 Label next; | 2653 Label next; |
| 2654 __ j(NOT_EQUAL, &next); | 2654 __ j(NOT_EQUAL, &next); |
| 2655 GenerateDirectCall(node->id(), | 2655 GenerateDirectCall(node->id(), |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2887 } | 2887 } |
| 2888 } | 2888 } |
| 2889 // TODO(srdjan): Implement unary kSUB (negate) Mint. | 2889 // TODO(srdjan): Implement unary kSUB (negate) Mint. |
| 2890 CodeGenerator::VisitUnaryOpNode(node); | 2890 CodeGenerator::VisitUnaryOpNode(node); |
| 2891 } | 2891 } |
| 2892 | 2892 |
| 2893 | 2893 |
| 2894 } // namespace dart | 2894 } // namespace dart |
| 2895 | 2895 |
| 2896 #endif // defined TARGET_ARCH_IA32 | 2896 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |