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