OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 // ----------- S t a t e ------------- | 682 // ----------- S t a t e ------------- |
683 // rcx : function name | 683 // rcx : function name |
684 // rsp[0] : return address | 684 // rsp[0] : return address |
685 // rsp[8] : argument argc | 685 // rsp[8] : argument argc |
686 // rsp[16] : argument argc - 1 | 686 // rsp[16] : argument argc - 1 |
687 // ... | 687 // ... |
688 // rsp[argc * 8] : argument 1 | 688 // rsp[argc * 8] : argument 1 |
689 // rsp[(argc + 1) * 8] : argument 0 = receiver | 689 // rsp[(argc + 1) * 8] : argument 0 = receiver |
690 // ----------------------------------- | 690 // ----------------------------------- |
691 | 691 |
| 692 // If object is not an array, bail out to regular call. |
| 693 if (!object->IsJSArray()) { |
| 694 return Heap::undefined_value(); |
| 695 } |
| 696 |
692 // TODO(639): faster implementation. | 697 // TODO(639): faster implementation. |
693 ASSERT(check == RECEIVER_MAP_CHECK); | 698 ASSERT(check == RECEIVER_MAP_CHECK); |
694 | 699 |
695 Label miss; | 700 Label miss; |
696 | 701 |
697 // Get the receiver from the stack. | 702 // Get the receiver from the stack. |
698 const int argc = arguments().immediate(); | 703 const int argc = arguments().immediate(); |
699 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 704 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
700 | 705 |
701 // Check that the receiver isn't a smi. | 706 // Check that the receiver isn't a smi. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 // ----------- S t a t e ------------- | 743 // ----------- S t a t e ------------- |
739 // rcx : function name | 744 // rcx : function name |
740 // rsp[0] : return address | 745 // rsp[0] : return address |
741 // rsp[8] : argument argc | 746 // rsp[8] : argument argc |
742 // rsp[16] : argument argc - 1 | 747 // rsp[16] : argument argc - 1 |
743 // ... | 748 // ... |
744 // rsp[argc * 8] : argument 1 | 749 // rsp[argc * 8] : argument 1 |
745 // rsp[(argc + 1) * 8] : argument 0 = receiver | 750 // rsp[(argc + 1) * 8] : argument 0 = receiver |
746 // ----------------------------------- | 751 // ----------------------------------- |
747 | 752 |
| 753 // If object is not an array, bail out to regular call. |
| 754 if (!object->IsJSArray()) { |
| 755 return Heap::undefined_value(); |
| 756 } |
| 757 |
748 // TODO(642): faster implementation. | 758 // TODO(642): faster implementation. |
749 ASSERT(check == RECEIVER_MAP_CHECK); | 759 ASSERT(check == RECEIVER_MAP_CHECK); |
750 | 760 |
751 Label miss; | 761 Label miss; |
752 | 762 |
753 // Get the receiver from the stack. | 763 // Get the receiver from the stack. |
754 const int argc = arguments().immediate(); | 764 const int argc = arguments().immediate(); |
755 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 765 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
756 | 766 |
757 // Check that the receiver isn't a smi. | 767 // Check that the receiver isn't a smi. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 // rsp[16] : argument argc - 1 | 808 // rsp[16] : argument argc - 1 |
799 // ... | 809 // ... |
800 // rsp[argc * 8] : argument 1 | 810 // rsp[argc * 8] : argument 1 |
801 // rsp[(argc + 1) * 8] : argument 0 = receiver | 811 // rsp[(argc + 1) * 8] : argument 0 = receiver |
802 // ----------------------------------- | 812 // ----------------------------------- |
803 | 813 |
804 SharedFunctionInfo* function_info = function->shared(); | 814 SharedFunctionInfo* function_info = function->shared(); |
805 if (function_info->HasCustomCallGenerator()) { | 815 if (function_info->HasCustomCallGenerator()) { |
806 CustomCallGenerator generator = | 816 CustomCallGenerator generator = |
807 ToCData<CustomCallGenerator>(function_info->function_data()); | 817 ToCData<CustomCallGenerator>(function_info->function_data()); |
808 return generator(this, object, holder, function, name, check); | 818 Object* result = generator(this, object, holder, function, name, check); |
| 819 // undefined means bail out to regular compiler. |
| 820 if (!result->IsUndefined()) { |
| 821 return result; |
| 822 } |
809 } | 823 } |
810 | 824 |
811 Label miss; | 825 Label miss; |
812 | 826 |
813 // Get the receiver from the stack. | 827 // Get the receiver from the stack. |
814 const int argc = arguments().immediate(); | 828 const int argc = arguments().immediate(); |
815 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 829 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
816 | 830 |
817 // Check that the receiver isn't a smi. | 831 // Check that the receiver isn't a smi. |
818 if (check != NUMBER_CHECK) { | 832 if (check != NUMBER_CHECK) { |
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2022 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 2036 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
2023 | 2037 |
2024 // Return the generated code. | 2038 // Return the generated code. |
2025 return GetCode(); | 2039 return GetCode(); |
2026 } | 2040 } |
2027 | 2041 |
2028 | 2042 |
2029 #undef __ | 2043 #undef __ |
2030 | 2044 |
2031 } } // namespace v8::internal | 2045 } } // namespace v8::internal |
OLD | NEW |