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 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 ASSERT(ToRegister(instr->object()).is(rax)); | 1714 ASSERT(ToRegister(instr->object()).is(rax)); |
1715 ASSERT(ToRegister(instr->result()).is(rax)); | 1715 ASSERT(ToRegister(instr->result()).is(rax)); |
1716 | 1716 |
1717 __ Move(rcx, instr->name()); | 1717 __ Move(rcx, instr->name()); |
1718 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1718 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
1719 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 1719 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
1720 } | 1720 } |
1721 | 1721 |
1722 | 1722 |
1723 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 1723 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
1724 Abort("Unimplemented: %s", "DoLoadFunctionPrototype"); | 1724 Register function = ToRegister(instr->function()); |
| 1725 Register result = ToRegister(instr->result()); |
| 1726 |
| 1727 // Check that the function really is a function. |
| 1728 __ CmpObjectType(function, JS_FUNCTION_TYPE, result); |
| 1729 DeoptimizeIf(not_equal, instr->environment()); |
| 1730 |
| 1731 // Check whether the function has an instance prototype. |
| 1732 NearLabel non_instance; |
| 1733 __ testb(FieldOperand(result, Map::kBitFieldOffset), |
| 1734 Immediate(1 << Map::kHasNonInstancePrototype)); |
| 1735 __ j(not_zero, &non_instance); |
| 1736 |
| 1737 // Get the prototype or initial map from the function. |
| 1738 __ movq(result, |
| 1739 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
| 1740 |
| 1741 // Check that the function has a prototype or an initial map. |
| 1742 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
| 1743 DeoptimizeIf(equal, instr->environment()); |
| 1744 |
| 1745 // If the function does not have an initial map, we're done. |
| 1746 NearLabel done; |
| 1747 __ CmpObjectType(result, MAP_TYPE, kScratchRegister); |
| 1748 __ j(not_equal, &done); |
| 1749 |
| 1750 // Get the prototype from the initial map. |
| 1751 __ movq(result, FieldOperand(result, Map::kPrototypeOffset)); |
| 1752 __ jmp(&done); |
| 1753 |
| 1754 // Non-instance prototype: Fetch prototype from constructor field |
| 1755 // in the function's map. |
| 1756 __ bind(&non_instance); |
| 1757 __ movq(result, FieldOperand(result, Map::kConstructorOffset)); |
| 1758 |
| 1759 // All done. |
| 1760 __ bind(&done); |
| 1761 |
1725 } | 1762 } |
1726 | 1763 |
1727 | 1764 |
1728 void LCodeGen::DoLoadElements(LLoadElements* instr) { | 1765 void LCodeGen::DoLoadElements(LLoadElements* instr) { |
1729 ASSERT(instr->result()->Equals(instr->InputAt(0))); | 1766 ASSERT(instr->result()->Equals(instr->InputAt(0))); |
1730 Register reg = ToRegister(instr->InputAt(0)); | 1767 Register reg = ToRegister(instr->InputAt(0)); |
1731 __ movq(reg, FieldOperand(reg, JSObject::kElementsOffset)); | 1768 __ movq(reg, FieldOperand(reg, JSObject::kElementsOffset)); |
1732 if (FLAG_debug_code) { | 1769 if (FLAG_debug_code) { |
1733 NearLabel done; | 1770 NearLabel done; |
1734 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), | 1771 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1802 } | 1839 } |
1803 } else if (argument->IsRegister()) { | 1840 } else if (argument->IsRegister()) { |
1804 __ push(ToRegister(argument)); | 1841 __ push(ToRegister(argument)); |
1805 } else { | 1842 } else { |
1806 ASSERT(!argument->IsDoubleRegister()); | 1843 ASSERT(!argument->IsDoubleRegister()); |
1807 __ push(ToOperand(argument)); | 1844 __ push(ToOperand(argument)); |
1808 } | 1845 } |
1809 } | 1846 } |
1810 | 1847 |
1811 | 1848 |
| 1849 void LCodeGen::DoContext(LContext* instr) { |
| 1850 Register result = ToRegister(instr->result()); |
| 1851 __ movq(result, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 1852 } |
| 1853 |
| 1854 |
1812 void LCodeGen::DoGlobalObject(LGlobalObject* instr) { | 1855 void LCodeGen::DoGlobalObject(LGlobalObject* instr) { |
1813 Register result = ToRegister(instr->result()); | 1856 Register result = ToRegister(instr->result()); |
1814 __ movq(result, GlobalObjectOperand()); | 1857 __ movq(result, GlobalObjectOperand()); |
1815 } | 1858 } |
1816 | 1859 |
1817 | 1860 |
1818 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) { | 1861 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) { |
1819 Register result = ToRegister(instr->result()); | 1862 Register result = ToRegister(instr->result()); |
1820 __ movq(result, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 1863 __ movq(result, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
1821 __ movq(result, FieldOperand(result, GlobalObject::kGlobalReceiverOffset)); | 1864 __ movq(result, FieldOperand(result, GlobalObject::kGlobalReceiverOffset)); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1919 Abort("Unimplemented: %s", "DoUnaryMathOperation"); | 1962 Abort("Unimplemented: %s", "DoUnaryMathOperation"); |
1920 } | 1963 } |
1921 | 1964 |
1922 | 1965 |
1923 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { | 1966 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { |
1924 Abort("Unimplemented: %s", "DoCallKeyed"); | 1967 Abort("Unimplemented: %s", "DoCallKeyed"); |
1925 } | 1968 } |
1926 | 1969 |
1927 | 1970 |
1928 void LCodeGen::DoCallNamed(LCallNamed* instr) { | 1971 void LCodeGen::DoCallNamed(LCallNamed* instr) { |
1929 Abort("Unimplemented: %s", "DoCallNamed"); | 1972 ASSERT(ToRegister(instr->result()).is(rax)); |
| 1973 |
| 1974 int arity = instr->arity(); |
| 1975 Handle<Code> ic = StubCache::ComputeCallInitialize(arity, NOT_IN_LOOP); |
| 1976 __ Move(rcx, instr->name()); |
| 1977 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 1978 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
1930 } | 1979 } |
1931 | 1980 |
1932 | 1981 |
1933 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 1982 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
1934 Abort("Unimplemented: %s", "DoCallFunction"); | 1983 Abort("Unimplemented: %s", "DoCallFunction"); |
1935 } | 1984 } |
1936 | 1985 |
1937 | 1986 |
1938 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 1987 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
1939 Abort("Unimplemented: %s", "DoCallGlobal"); | 1988 ASSERT(ToRegister(instr->result()).is(rax)); |
| 1989 int arity = instr->arity(); |
| 1990 Handle<Code> ic = StubCache::ComputeCallInitialize(arity, NOT_IN_LOOP); |
| 1991 __ Move(rcx, instr->name()); |
| 1992 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); |
| 1993 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
1940 } | 1994 } |
1941 | 1995 |
1942 | 1996 |
1943 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { | 1997 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { |
1944 ASSERT(ToRegister(instr->result()).is(rax)); | 1998 ASSERT(ToRegister(instr->result()).is(rax)); |
1945 __ Move(rdi, instr->target()); | 1999 __ Move(rdi, instr->target()); |
1946 CallKnownFunction(instr->target(), instr->arity(), instr); | 2000 CallKnownFunction(instr->target(), instr->arity(), instr); |
1947 } | 2001 } |
1948 | 2002 |
1949 | 2003 |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2572 | 2626 |
2573 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 2627 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
2574 Abort("Unimplemented: %s", "DoOsrEntry"); | 2628 Abort("Unimplemented: %s", "DoOsrEntry"); |
2575 } | 2629 } |
2576 | 2630 |
2577 #undef __ | 2631 #undef __ |
2578 | 2632 |
2579 } } // namespace v8::internal | 2633 } } // namespace v8::internal |
2580 | 2634 |
2581 #endif // V8_TARGET_ARCH_X64 | 2635 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |