OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 | 881 |
882 // Tail call a code stub (jump) and return the code object called. Try to | 882 // Tail call a code stub (jump) and return the code object called. Try to |
883 // generate the code if necessary. Do not perform a GC but instead return | 883 // generate the code if necessary. Do not perform a GC but instead return |
884 // a retry after GC failure. | 884 // a retry after GC failure. |
885 MUST_USE_RESULT MaybeObject* TryTailCallStub(CodeStub* stub); | 885 MUST_USE_RESULT MaybeObject* TryTailCallStub(CodeStub* stub); |
886 | 886 |
887 // Return from a code stub after popping its arguments. | 887 // Return from a code stub after popping its arguments. |
888 void StubReturn(int argc); | 888 void StubReturn(int argc); |
889 | 889 |
890 // Call a runtime routine. | 890 // Call a runtime routine. |
891 void CallRuntime(Runtime::Function* f, int num_arguments); | 891 void CallRuntime(const Runtime::Function* f, int num_arguments); |
892 | 892 |
893 // Call a runtime function and save the value of XMM registers. | 893 // Call a runtime function and save the value of XMM registers. |
894 void CallRuntimeSaveDoubles(Runtime::FunctionId id); | 894 void CallRuntimeSaveDoubles(Runtime::FunctionId id); |
895 | 895 |
896 // Call a runtime function, returning the CodeStub object called. | 896 // Call a runtime function, returning the CodeStub object called. |
897 // Try to generate the stub code if necessary. Do not perform a GC | 897 // Try to generate the stub code if necessary. Do not perform a GC |
898 // but instead return a retry after GC failure. | 898 // but instead return a retry after GC failure. |
899 MUST_USE_RESULT MaybeObject* TryCallRuntime(Runtime::Function* f, | 899 MUST_USE_RESULT MaybeObject* TryCallRuntime(const Runtime::Function* f, |
900 int num_arguments); | 900 int num_arguments); |
901 | 901 |
902 // Convenience function: Same as above, but takes the fid instead. | 902 // Convenience function: Same as above, but takes the fid instead. |
903 void CallRuntime(Runtime::FunctionId id, int num_arguments); | 903 void CallRuntime(Runtime::FunctionId id, int num_arguments); |
904 | 904 |
905 // Convenience function: Same as above, but takes the fid instead. | 905 // Convenience function: Same as above, but takes the fid instead. |
906 MUST_USE_RESULT MaybeObject* TryCallRuntime(Runtime::FunctionId id, | 906 MUST_USE_RESULT MaybeObject* TryCallRuntime(Runtime::FunctionId id, |
907 int num_arguments); | 907 int num_arguments); |
908 | 908 |
909 // Convenience function: call an external reference. | 909 // Convenience function: call an external reference. |
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1800 movq(kScratchRegister, ExternalReference::new_space_mask()); | 1800 movq(kScratchRegister, ExternalReference::new_space_mask()); |
1801 and_(scratch, kScratchRegister); | 1801 and_(scratch, kScratchRegister); |
1802 } else { | 1802 } else { |
1803 movq(scratch, ExternalReference::new_space_mask()); | 1803 movq(scratch, ExternalReference::new_space_mask()); |
1804 and_(scratch, object); | 1804 and_(scratch, object); |
1805 } | 1805 } |
1806 movq(kScratchRegister, ExternalReference::new_space_start()); | 1806 movq(kScratchRegister, ExternalReference::new_space_start()); |
1807 cmpq(scratch, kScratchRegister); | 1807 cmpq(scratch, kScratchRegister); |
1808 j(cc, branch); | 1808 j(cc, branch); |
1809 } else { | 1809 } else { |
1810 ASSERT(is_int32(static_cast<int64_t>(Heap::NewSpaceMask()))); | 1810 ASSERT(is_int32(static_cast<int64_t>(HEAP->NewSpaceMask()))); |
1811 intptr_t new_space_start = | 1811 intptr_t new_space_start = |
1812 reinterpret_cast<intptr_t>(Heap::NewSpaceStart()); | 1812 reinterpret_cast<intptr_t>(HEAP->NewSpaceStart()); |
1813 movq(kScratchRegister, -new_space_start, RelocInfo::NONE); | 1813 movq(kScratchRegister, -new_space_start, RelocInfo::NONE); |
1814 if (scratch.is(object)) { | 1814 if (scratch.is(object)) { |
1815 addq(scratch, kScratchRegister); | 1815 addq(scratch, kScratchRegister); |
1816 } else { | 1816 } else { |
1817 lea(scratch, Operand(object, kScratchRegister, times_1, 0)); | 1817 lea(scratch, Operand(object, kScratchRegister, times_1, 0)); |
1818 } | 1818 } |
1819 and_(scratch, Immediate(static_cast<int32_t>(Heap::NewSpaceMask()))); | 1819 and_(scratch, Immediate(static_cast<int32_t>(HEAP->NewSpaceMask()))); |
1820 j(cc, branch); | 1820 j(cc, branch); |
1821 } | 1821 } |
1822 } | 1822 } |
1823 | 1823 |
1824 | 1824 |
1825 template <typename LabelType> | 1825 template <typename LabelType> |
1826 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 1826 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
1827 const ParameterCount& actual, | 1827 const ParameterCount& actual, |
1828 Handle<Code> code_constant, | 1828 Handle<Code> code_constant, |
1829 Register code_register, | 1829 Register code_register, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1863 // is the case when we invoke functions using call and apply. | 1863 // is the case when we invoke functions using call and apply. |
1864 cmpq(expected.reg(), actual.reg()); | 1864 cmpq(expected.reg(), actual.reg()); |
1865 j(equal, &invoke); | 1865 j(equal, &invoke); |
1866 ASSERT(actual.reg().is(rax)); | 1866 ASSERT(actual.reg().is(rax)); |
1867 ASSERT(expected.reg().is(rbx)); | 1867 ASSERT(expected.reg().is(rbx)); |
1868 } | 1868 } |
1869 } | 1869 } |
1870 | 1870 |
1871 if (!definitely_matches) { | 1871 if (!definitely_matches) { |
1872 Handle<Code> adaptor = | 1872 Handle<Code> adaptor = |
1873 Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); | 1873 Handle<Code>(Isolate::Current()->builtins()->builtin( |
| 1874 Builtins::ArgumentsAdaptorTrampoline)); |
1874 if (!code_constant.is_null()) { | 1875 if (!code_constant.is_null()) { |
1875 movq(rdx, code_constant, RelocInfo::EMBEDDED_OBJECT); | 1876 movq(rdx, code_constant, RelocInfo::EMBEDDED_OBJECT); |
1876 addq(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 1877 addq(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
1877 } else if (!code_register.is(rdx)) { | 1878 } else if (!code_register.is(rdx)) { |
1878 movq(rdx, code_register); | 1879 movq(rdx, code_register); |
1879 } | 1880 } |
1880 | 1881 |
1881 if (flag == CALL_FUNCTION) { | 1882 if (flag == CALL_FUNCTION) { |
1882 if (call_wrapper != NULL) call_wrapper->BeforeCall(CallSize(adaptor)); | 1883 if (call_wrapper != NULL) call_wrapper->BeforeCall(CallSize(adaptor)); |
1883 Call(adaptor, RelocInfo::CODE_TARGET); | 1884 Call(adaptor, RelocInfo::CODE_TARGET); |
1884 if (call_wrapper != NULL) call_wrapper->AfterCall(); | 1885 if (call_wrapper != NULL) call_wrapper->AfterCall(); |
1885 jmp(done); | 1886 jmp(done); |
1886 } else { | 1887 } else { |
1887 Jump(adaptor, RelocInfo::CODE_TARGET); | 1888 Jump(adaptor, RelocInfo::CODE_TARGET); |
1888 } | 1889 } |
1889 bind(&invoke); | 1890 bind(&invoke); |
1890 } | 1891 } |
1891 } | 1892 } |
1892 | 1893 |
1893 | 1894 |
1894 } } // namespace v8::internal | 1895 } } // namespace v8::internal |
1895 | 1896 |
1896 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1897 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |