| 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 strd(src1, src2, dst, cond); | 512 strd(src1, src2, dst, cond); |
| 513 } else { | 513 } else { |
| 514 MemOperand dst2(dst); | 514 MemOperand dst2(dst); |
| 515 dst2.set_offset(dst2.offset() + 4); | 515 dst2.set_offset(dst2.offset() + 4); |
| 516 str(src1, dst, cond); | 516 str(src1, dst, cond); |
| 517 str(src2, dst2, cond); | 517 str(src2, dst2, cond); |
| 518 } | 518 } |
| 519 } | 519 } |
| 520 | 520 |
| 521 | 521 |
| 522 void MacroAssembler::ClearFPSCRBits(const uint32_t bits_to_clear, |
| 523 const Register scratch, |
| 524 const Condition cond) { |
| 525 vmrs(scratch, cond); |
| 526 bic(scratch, scratch, Operand(bits_to_clear), LeaveCC, cond); |
| 527 vmsr(scratch, cond); |
| 528 } |
| 529 |
| 530 |
| 531 void MacroAssembler::VFPCompareAndSetFlags(const DwVfpRegister src1, |
| 532 const DwVfpRegister src2, |
| 533 const Condition cond) { |
| 534 // Compare and move FPSCR flags to the normal condition flags. |
| 535 VFPCompareAndLoadFlags(src1, src2, pc, cond); |
| 536 } |
| 537 |
| 538 void MacroAssembler::VFPCompareAndSetFlags(const DwVfpRegister src1, |
| 539 const double src2, |
| 540 const Condition cond) { |
| 541 // Compare and move FPSCR flags to the normal condition flags. |
| 542 VFPCompareAndLoadFlags(src1, src2, pc, cond); |
| 543 } |
| 544 |
| 545 |
| 546 void MacroAssembler::VFPCompareAndLoadFlags(const DwVfpRegister src1, |
| 547 const DwVfpRegister src2, |
| 548 const Register fpscr_flags, |
| 549 const Condition cond) { |
| 550 // Compare and load FPSCR. |
| 551 vcmp(src1, src2, cond); |
| 552 vmrs(fpscr_flags, cond); |
| 553 } |
| 554 |
| 555 void MacroAssembler::VFPCompareAndLoadFlags(const DwVfpRegister src1, |
| 556 const double src2, |
| 557 const Register fpscr_flags, |
| 558 const Condition cond) { |
| 559 // Compare and load FPSCR. |
| 560 vcmp(src1, src2, cond); |
| 561 vmrs(fpscr_flags, cond); |
| 562 } |
| 563 |
| 564 |
| 522 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 565 void MacroAssembler::EnterFrame(StackFrame::Type type) { |
| 523 // r0-r3: preserved | 566 // r0-r3: preserved |
| 524 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 567 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); |
| 525 mov(ip, Operand(Smi::FromInt(type))); | 568 mov(ip, Operand(Smi::FromInt(type))); |
| 526 push(ip); | 569 push(ip); |
| 527 mov(ip, Operand(CodeObject())); | 570 mov(ip, Operand(CodeObject())); |
| 528 push(ip); | 571 push(ip); |
| 529 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP. | 572 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP. |
| 530 } | 573 } |
| 531 | 574 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 mov(sp, Operand(fp)); // respect ABI stack constraint | 711 mov(sp, Operand(fp)); // respect ABI stack constraint |
| 669 ldm(ia, sp, fp.bit() | sp.bit() | pc.bit()); | 712 ldm(ia, sp, fp.bit() | sp.bit() | pc.bit()); |
| 670 } | 713 } |
| 671 | 714 |
| 672 | 715 |
| 673 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 716 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
| 674 const ParameterCount& actual, | 717 const ParameterCount& actual, |
| 675 Handle<Code> code_constant, | 718 Handle<Code> code_constant, |
| 676 Register code_reg, | 719 Register code_reg, |
| 677 Label* done, | 720 Label* done, |
| 678 InvokeFlag flag) { | 721 InvokeFlag flag, |
| 722 PostCallGenerator* post_call_generator) { |
| 679 bool definitely_matches = false; | 723 bool definitely_matches = false; |
| 680 Label regular_invoke; | 724 Label regular_invoke; |
| 681 | 725 |
| 682 // Check whether the expected and actual arguments count match. If not, | 726 // Check whether the expected and actual arguments count match. If not, |
| 683 // setup registers according to contract with ArgumentsAdaptorTrampoline: | 727 // setup registers according to contract with ArgumentsAdaptorTrampoline: |
| 684 // r0: actual arguments count | 728 // r0: actual arguments count |
| 685 // r1: function (passed through to callee) | 729 // r1: function (passed through to callee) |
| 686 // r2: expected arguments count | 730 // r2: expected arguments count |
| 687 // r3: callee code entry | 731 // r3: callee code entry |
| 688 | 732 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 if (!code_constant.is_null()) { | 769 if (!code_constant.is_null()) { |
| 726 mov(r3, Operand(code_constant)); | 770 mov(r3, Operand(code_constant)); |
| 727 add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); | 771 add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 728 } | 772 } |
| 729 | 773 |
| 730 Handle<Code> adaptor = | 774 Handle<Code> adaptor = |
| 731 Handle<Code>(Isolate::Current()->builtins()->builtin( | 775 Handle<Code>(Isolate::Current()->builtins()->builtin( |
| 732 Builtins::ArgumentsAdaptorTrampoline)); | 776 Builtins::ArgumentsAdaptorTrampoline)); |
| 733 if (flag == CALL_FUNCTION) { | 777 if (flag == CALL_FUNCTION) { |
| 734 Call(adaptor, RelocInfo::CODE_TARGET); | 778 Call(adaptor, RelocInfo::CODE_TARGET); |
| 779 if (post_call_generator != NULL) post_call_generator->Generate(); |
| 735 b(done); | 780 b(done); |
| 736 } else { | 781 } else { |
| 737 Jump(adaptor, RelocInfo::CODE_TARGET); | 782 Jump(adaptor, RelocInfo::CODE_TARGET); |
| 738 } | 783 } |
| 739 bind(®ular_invoke); | 784 bind(®ular_invoke); |
| 740 } | 785 } |
| 741 } | 786 } |
| 742 | 787 |
| 743 | 788 |
| 744 void MacroAssembler::InvokeCode(Register code, | 789 void MacroAssembler::InvokeCode(Register code, |
| 745 const ParameterCount& expected, | 790 const ParameterCount& expected, |
| 746 const ParameterCount& actual, | 791 const ParameterCount& actual, |
| 747 InvokeFlag flag) { | 792 InvokeFlag flag, |
| 793 PostCallGenerator* post_call_generator) { |
| 748 Label done; | 794 Label done; |
| 749 | 795 |
| 750 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag); | 796 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag, |
| 797 post_call_generator); |
| 751 if (flag == CALL_FUNCTION) { | 798 if (flag == CALL_FUNCTION) { |
| 752 Call(code); | 799 Call(code); |
| 800 if (post_call_generator != NULL) post_call_generator->Generate(); |
| 753 } else { | 801 } else { |
| 754 ASSERT(flag == JUMP_FUNCTION); | 802 ASSERT(flag == JUMP_FUNCTION); |
| 755 Jump(code); | 803 Jump(code); |
| 756 } | 804 } |
| 757 | 805 |
| 758 // Continue here if InvokePrologue does handle the invocation due to | 806 // Continue here if InvokePrologue does handle the invocation due to |
| 759 // mismatched parameter counts. | 807 // mismatched parameter counts. |
| 760 bind(&done); | 808 bind(&done); |
| 761 } | 809 } |
| 762 | 810 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 776 } | 824 } |
| 777 | 825 |
| 778 // Continue here if InvokePrologue does handle the invocation due to | 826 // Continue here if InvokePrologue does handle the invocation due to |
| 779 // mismatched parameter counts. | 827 // mismatched parameter counts. |
| 780 bind(&done); | 828 bind(&done); |
| 781 } | 829 } |
| 782 | 830 |
| 783 | 831 |
| 784 void MacroAssembler::InvokeFunction(Register fun, | 832 void MacroAssembler::InvokeFunction(Register fun, |
| 785 const ParameterCount& actual, | 833 const ParameterCount& actual, |
| 786 InvokeFlag flag) { | 834 InvokeFlag flag, |
| 835 PostCallGenerator* post_call_generator) { |
| 787 // Contract with called JS functions requires that function is passed in r1. | 836 // Contract with called JS functions requires that function is passed in r1. |
| 788 ASSERT(fun.is(r1)); | 837 ASSERT(fun.is(r1)); |
| 789 | 838 |
| 790 Register expected_reg = r2; | 839 Register expected_reg = r2; |
| 791 Register code_reg = r3; | 840 Register code_reg = r3; |
| 792 | 841 |
| 793 ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 842 ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 794 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 843 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 795 ldr(expected_reg, | 844 ldr(expected_reg, |
| 796 FieldMemOperand(code_reg, | 845 FieldMemOperand(code_reg, |
| 797 SharedFunctionInfo::kFormalParameterCountOffset)); | 846 SharedFunctionInfo::kFormalParameterCountOffset)); |
| 798 mov(expected_reg, Operand(expected_reg, ASR, kSmiTagSize)); | 847 mov(expected_reg, Operand(expected_reg, ASR, kSmiTagSize)); |
| 799 ldr(code_reg, | 848 ldr(code_reg, |
| 800 FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 849 FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
| 801 | 850 |
| 802 ParameterCount expected(expected_reg); | 851 ParameterCount expected(expected_reg); |
| 803 InvokeCode(code_reg, expected, actual, flag); | 852 InvokeCode(code_reg, expected, actual, flag, post_call_generator); |
| 804 } | 853 } |
| 805 | 854 |
| 806 | 855 |
| 807 void MacroAssembler::InvokeFunction(JSFunction* function, | 856 void MacroAssembler::InvokeFunction(JSFunction* function, |
| 808 const ParameterCount& actual, | 857 const ParameterCount& actual, |
| 809 InvokeFlag flag) { | 858 InvokeFlag flag) { |
| 810 ASSERT(function->is_compiled()); | 859 ASSERT(function->is_compiled()); |
| 811 | 860 |
| 812 // Get the function and setup the context. | 861 // Get the function and setup the context. |
| 813 mov(r1, Operand(Handle<JSFunction>(function))); | 862 mov(r1, Operand(Handle<JSFunction>(function))); |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 // Thumb mode builtin. | 1713 // Thumb mode builtin. |
| 1665 ASSERT((reinterpret_cast<intptr_t>(builtin.address()) & 1) == 1); | 1714 ASSERT((reinterpret_cast<intptr_t>(builtin.address()) & 1) == 1); |
| 1666 #endif | 1715 #endif |
| 1667 mov(r1, Operand(builtin)); | 1716 mov(r1, Operand(builtin)); |
| 1668 CEntryStub stub(1); | 1717 CEntryStub stub(1); |
| 1669 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 1718 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
| 1670 } | 1719 } |
| 1671 | 1720 |
| 1672 | 1721 |
| 1673 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, | 1722 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, |
| 1674 InvokeJSFlags flags) { | 1723 InvokeJSFlags flags, |
| 1724 PostCallGenerator* post_call_generator) { |
| 1675 GetBuiltinEntry(r2, id); | 1725 GetBuiltinEntry(r2, id); |
| 1676 if (flags == CALL_JS) { | 1726 if (flags == CALL_JS) { |
| 1677 Call(r2); | 1727 Call(r2); |
| 1728 if (post_call_generator != NULL) post_call_generator->Generate(); |
| 1678 } else { | 1729 } else { |
| 1679 ASSERT(flags == JUMP_JS); | 1730 ASSERT(flags == JUMP_JS); |
| 1680 Jump(r2); | 1731 Jump(r2); |
| 1681 } | 1732 } |
| 1682 } | 1733 } |
| 1683 | 1734 |
| 1684 | 1735 |
| 1685 void MacroAssembler::GetBuiltinFunction(Register target, | 1736 void MacroAssembler::GetBuiltinFunction(Register target, |
| 1686 Builtins::JavaScript id) { | 1737 Builtins::JavaScript id) { |
| 1687 // Load the builtins object into target register. | 1738 // Load the builtins object into target register. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1790 intptr_t p1 = reinterpret_cast<intptr_t>(msg); | 1841 intptr_t p1 = reinterpret_cast<intptr_t>(msg); |
| 1791 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; | 1842 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; |
| 1792 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); | 1843 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); |
| 1793 #ifdef DEBUG | 1844 #ifdef DEBUG |
| 1794 if (msg != NULL) { | 1845 if (msg != NULL) { |
| 1795 RecordComment("Abort message: "); | 1846 RecordComment("Abort message: "); |
| 1796 RecordComment(msg); | 1847 RecordComment(msg); |
| 1797 } | 1848 } |
| 1798 #endif | 1849 #endif |
| 1799 // Disable stub call restrictions to always allow calls to abort. | 1850 // Disable stub call restrictions to always allow calls to abort. |
| 1800 set_allow_stub_calls(true); | 1851 AllowStubCallsScope allow_scope(this, true); |
| 1801 | 1852 |
| 1802 mov(r0, Operand(p0)); | 1853 mov(r0, Operand(p0)); |
| 1803 push(r0); | 1854 push(r0); |
| 1804 mov(r0, Operand(Smi::FromInt(p1 - p0))); | 1855 mov(r0, Operand(Smi::FromInt(p1 - p0))); |
| 1805 push(r0); | 1856 push(r0); |
| 1806 CallRuntime(Runtime::kAbort, 2); | 1857 CallRuntime(Runtime::kAbort, 2); |
| 1807 // will not return here | 1858 // will not return here |
| 1808 if (is_const_pool_blocked()) { | 1859 if (is_const_pool_blocked()) { |
| 1809 // If the calling code cares about the exact number of | 1860 // If the calling code cares about the exact number of |
| 1810 // instructions generated, we insert padding here to keep the size | 1861 // instructions generated, we insert padding here to keep the size |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2182 | 2233 |
| 2183 void CodePatcher::Emit(Address addr) { | 2234 void CodePatcher::Emit(Address addr) { |
| 2184 masm()->emit(reinterpret_cast<Instr>(addr)); | 2235 masm()->emit(reinterpret_cast<Instr>(addr)); |
| 2185 } | 2236 } |
| 2186 #endif // ENABLE_DEBUGGER_SUPPORT | 2237 #endif // ENABLE_DEBUGGER_SUPPORT |
| 2187 | 2238 |
| 2188 | 2239 |
| 2189 } } // namespace v8::internal | 2240 } } // namespace v8::internal |
| 2190 | 2241 |
| 2191 #endif // V8_TARGET_ARCH_ARM | 2242 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |