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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 mov(sp, Operand(fp)); // respect ABI stack constraint | 675 mov(sp, Operand(fp)); // respect ABI stack constraint |
676 ldm(ia, sp, fp.bit() | sp.bit() | pc.bit()); | 676 ldm(ia, sp, fp.bit() | sp.bit() | pc.bit()); |
677 } | 677 } |
678 | 678 |
679 | 679 |
680 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 680 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
681 const ParameterCount& actual, | 681 const ParameterCount& actual, |
682 Handle<Code> code_constant, | 682 Handle<Code> code_constant, |
683 Register code_reg, | 683 Register code_reg, |
684 Label* done, | 684 Label* done, |
685 InvokeFlag flag) { | 685 InvokeFlag flag, |
| 686 PostCallGenerator* post_call_generator) { |
686 bool definitely_matches = false; | 687 bool definitely_matches = false; |
687 Label regular_invoke; | 688 Label regular_invoke; |
688 | 689 |
689 // Check whether the expected and actual arguments count match. If not, | 690 // Check whether the expected and actual arguments count match. If not, |
690 // setup registers according to contract with ArgumentsAdaptorTrampoline: | 691 // setup registers according to contract with ArgumentsAdaptorTrampoline: |
691 // r0: actual arguments count | 692 // r0: actual arguments count |
692 // r1: function (passed through to callee) | 693 // r1: function (passed through to callee) |
693 // r2: expected arguments count | 694 // r2: expected arguments count |
694 // r3: callee code entry | 695 // r3: callee code entry |
695 | 696 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 if (!definitely_matches) { | 732 if (!definitely_matches) { |
732 if (!code_constant.is_null()) { | 733 if (!code_constant.is_null()) { |
733 mov(r3, Operand(code_constant)); | 734 mov(r3, Operand(code_constant)); |
734 add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); | 735 add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); |
735 } | 736 } |
736 | 737 |
737 Handle<Code> adaptor = | 738 Handle<Code> adaptor = |
738 Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); | 739 Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); |
739 if (flag == CALL_FUNCTION) { | 740 if (flag == CALL_FUNCTION) { |
740 Call(adaptor, RelocInfo::CODE_TARGET); | 741 Call(adaptor, RelocInfo::CODE_TARGET); |
| 742 if (post_call_generator != NULL) post_call_generator->Generate(); |
741 b(done); | 743 b(done); |
742 } else { | 744 } else { |
743 Jump(adaptor, RelocInfo::CODE_TARGET); | 745 Jump(adaptor, RelocInfo::CODE_TARGET); |
744 } | 746 } |
745 bind(®ular_invoke); | 747 bind(®ular_invoke); |
746 } | 748 } |
747 } | 749 } |
748 | 750 |
749 | 751 |
750 void MacroAssembler::InvokeCode(Register code, | 752 void MacroAssembler::InvokeCode(Register code, |
751 const ParameterCount& expected, | 753 const ParameterCount& expected, |
752 const ParameterCount& actual, | 754 const ParameterCount& actual, |
753 InvokeFlag flag) { | 755 InvokeFlag flag, |
| 756 PostCallGenerator* post_call_generator) { |
754 Label done; | 757 Label done; |
755 | 758 |
756 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag); | 759 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag, |
| 760 post_call_generator); |
757 if (flag == CALL_FUNCTION) { | 761 if (flag == CALL_FUNCTION) { |
758 Call(code); | 762 Call(code); |
| 763 if (post_call_generator != NULL) post_call_generator->Generate(); |
759 } else { | 764 } else { |
760 ASSERT(flag == JUMP_FUNCTION); | 765 ASSERT(flag == JUMP_FUNCTION); |
761 Jump(code); | 766 Jump(code); |
762 } | 767 } |
763 | 768 |
764 // Continue here if InvokePrologue does handle the invocation due to | 769 // Continue here if InvokePrologue does handle the invocation due to |
765 // mismatched parameter counts. | 770 // mismatched parameter counts. |
766 bind(&done); | 771 bind(&done); |
767 } | 772 } |
768 | 773 |
(...skipping 13 matching lines...) Expand all Loading... |
782 } | 787 } |
783 | 788 |
784 // Continue here if InvokePrologue does handle the invocation due to | 789 // Continue here if InvokePrologue does handle the invocation due to |
785 // mismatched parameter counts. | 790 // mismatched parameter counts. |
786 bind(&done); | 791 bind(&done); |
787 } | 792 } |
788 | 793 |
789 | 794 |
790 void MacroAssembler::InvokeFunction(Register fun, | 795 void MacroAssembler::InvokeFunction(Register fun, |
791 const ParameterCount& actual, | 796 const ParameterCount& actual, |
792 InvokeFlag flag) { | 797 InvokeFlag flag, |
| 798 PostCallGenerator* post_call_generator) { |
793 // Contract with called JS functions requires that function is passed in r1. | 799 // Contract with called JS functions requires that function is passed in r1. |
794 ASSERT(fun.is(r1)); | 800 ASSERT(fun.is(r1)); |
795 | 801 |
796 Register expected_reg = r2; | 802 Register expected_reg = r2; |
797 Register code_reg = r3; | 803 Register code_reg = r3; |
798 | 804 |
799 ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 805 ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
800 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 806 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
801 ldr(expected_reg, | 807 ldr(expected_reg, |
802 FieldMemOperand(code_reg, | 808 FieldMemOperand(code_reg, |
803 SharedFunctionInfo::kFormalParameterCountOffset)); | 809 SharedFunctionInfo::kFormalParameterCountOffset)); |
804 mov(expected_reg, Operand(expected_reg, ASR, kSmiTagSize)); | 810 mov(expected_reg, Operand(expected_reg, ASR, kSmiTagSize)); |
805 ldr(code_reg, | 811 ldr(code_reg, |
806 FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 812 FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
807 | 813 |
808 ParameterCount expected(expected_reg); | 814 ParameterCount expected(expected_reg); |
809 InvokeCode(code_reg, expected, actual, flag); | 815 InvokeCode(code_reg, expected, actual, flag, post_call_generator); |
810 } | 816 } |
811 | 817 |
812 | 818 |
813 void MacroAssembler::InvokeFunction(JSFunction* function, | 819 void MacroAssembler::InvokeFunction(JSFunction* function, |
814 const ParameterCount& actual, | 820 const ParameterCount& actual, |
815 InvokeFlag flag) { | 821 InvokeFlag flag) { |
816 ASSERT(function->is_compiled()); | 822 ASSERT(function->is_compiled()); |
817 | 823 |
818 // Get the function and setup the context. | 824 // Get the function and setup the context. |
819 mov(r1, Operand(Handle<JSFunction>(function))); | 825 mov(r1, Operand(Handle<JSFunction>(function))); |
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2154 | 2160 |
2155 void CodePatcher::Emit(Address addr) { | 2161 void CodePatcher::Emit(Address addr) { |
2156 masm()->emit(reinterpret_cast<Instr>(addr)); | 2162 masm()->emit(reinterpret_cast<Instr>(addr)); |
2157 } | 2163 } |
2158 #endif // ENABLE_DEBUGGER_SUPPORT | 2164 #endif // ENABLE_DEBUGGER_SUPPORT |
2159 | 2165 |
2160 | 2166 |
2161 } } // namespace v8::internal | 2167 } } // namespace v8::internal |
2162 | 2168 |
2163 #endif // V8_TARGET_ARCH_ARM | 2169 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |