| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 __ jmp(kScratchRegister); | 78 __ jmp(kScratchRegister); |
| 79 | 79 |
| 80 __ bind(&miss); | 80 __ bind(&miss); |
| 81 } | 81 } |
| 82 | 82 |
| 83 | 83 |
| 84 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { | 84 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { |
| 85 ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC); | 85 ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC); |
| 86 Code* code = NULL; | 86 Code* code = NULL; |
| 87 if (kind == Code::LOAD_IC) { | 87 if (kind == Code::LOAD_IC) { |
| 88 code = Builtins::builtin(Builtins::LoadIC_Miss); | 88 code = Isolate::Current()->builtins()->builtin(Builtins::LoadIC_Miss); |
| 89 } else { | 89 } else { |
| 90 code = Builtins::builtin(Builtins::KeyedLoadIC_Miss); | 90 code = Isolate::Current()->builtins()->builtin(Builtins::KeyedLoadIC_Miss); |
| 91 } | 91 } |
| 92 | 92 |
| 93 Handle<Code> ic(code); | 93 Handle<Code> ic(code); |
| 94 __ Jump(ic, RelocInfo::CODE_TARGET); | 94 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 95 } | 95 } |
| 96 | 96 |
| 97 | 97 |
| 98 void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, | 98 void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, |
| 99 int index, | 99 int index, |
| 100 Register prototype) { | 100 Register prototype) { |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 __ movq(Operand(rsp, 2 * kPointerSize), rbx); | 467 __ movq(Operand(rsp, 2 * kPointerSize), rbx); |
| 468 } else { | 468 } else { |
| 469 __ Move(Operand(rsp, 2 * kPointerSize), Handle<Object>(call_data)); | 469 __ Move(Operand(rsp, 2 * kPointerSize), Handle<Object>(call_data)); |
| 470 } | 470 } |
| 471 | 471 |
| 472 // Set the number of arguments. | 472 // Set the number of arguments. |
| 473 __ movq(rax, Immediate(argc + 4)); | 473 __ movq(rax, Immediate(argc + 4)); |
| 474 | 474 |
| 475 // Jump to the fast api call builtin (tail call). | 475 // Jump to the fast api call builtin (tail call). |
| 476 Handle<Code> code = Handle<Code>( | 476 Handle<Code> code = Handle<Code>( |
| 477 Builtins::builtin(Builtins::FastHandleApiCall)); | 477 Isolate::Current()->builtins()->builtin(Builtins::FastHandleApiCall)); |
| 478 ParameterCount expected(0); | 478 ParameterCount expected(0); |
| 479 __ InvokeCode(code, expected, expected, | 479 __ InvokeCode(code, expected, expected, |
| 480 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 480 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
| 481 } | 481 } |
| 482 | 482 |
| 483 | 483 |
| 484 class CallInterceptorCompiler BASE_EMBEDDED { | 484 class CallInterceptorCompiler BASE_EMBEDDED { |
| 485 public: | 485 public: |
| 486 CallInterceptorCompiler(StubCompiler* stub_compiler, | 486 CallInterceptorCompiler(StubCompiler* stub_compiler, |
| 487 const ParameterCount& arguments, | 487 const ParameterCount& arguments, |
| (...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 __ push(rax); // value | 1732 __ push(rax); // value |
| 1733 __ push(rbx); // restore return address | 1733 __ push(rbx); // restore return address |
| 1734 | 1734 |
| 1735 // Do tail-call to the runtime system. | 1735 // Do tail-call to the runtime system. |
| 1736 ExternalReference store_callback_property = | 1736 ExternalReference store_callback_property = |
| 1737 ExternalReference(IC_Utility(IC::kStoreCallbackProperty)); | 1737 ExternalReference(IC_Utility(IC::kStoreCallbackProperty)); |
| 1738 __ TailCallExternalReference(store_callback_property, 4, 1); | 1738 __ TailCallExternalReference(store_callback_property, 4, 1); |
| 1739 | 1739 |
| 1740 // Handle store cache miss. | 1740 // Handle store cache miss. |
| 1741 __ bind(&miss); | 1741 __ bind(&miss); |
| 1742 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 1742 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1743 Builtins::StoreIC_Miss)); |
| 1743 __ Jump(ic, RelocInfo::CODE_TARGET); | 1744 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 1744 | 1745 |
| 1745 // Return the generated code. | 1746 // Return the generated code. |
| 1746 return GetCode(CALLBACKS, name); | 1747 return GetCode(CALLBACKS, name); |
| 1747 } | 1748 } |
| 1748 | 1749 |
| 1749 | 1750 |
| 1750 Object* StoreStubCompiler::CompileStoreField(JSObject* object, | 1751 Object* StoreStubCompiler::CompileStoreField(JSObject* object, |
| 1751 int index, | 1752 int index, |
| 1752 Map* transition, | 1753 Map* transition, |
| 1753 String* name) { | 1754 String* name) { |
| 1754 // ----------- S t a t e ------------- | 1755 // ----------- S t a t e ------------- |
| 1755 // -- rax : value | 1756 // -- rax : value |
| 1756 // -- rcx : name | 1757 // -- rcx : name |
| 1757 // -- rdx : receiver | 1758 // -- rdx : receiver |
| 1758 // -- rsp[0] : return address | 1759 // -- rsp[0] : return address |
| 1759 // ----------------------------------- | 1760 // ----------------------------------- |
| 1760 Label miss; | 1761 Label miss; |
| 1761 | 1762 |
| 1762 // Generate store field code. Preserves receiver and name on jump to miss. | 1763 // Generate store field code. Preserves receiver and name on jump to miss. |
| 1763 GenerateStoreField(masm(), | 1764 GenerateStoreField(masm(), |
| 1764 object, | 1765 object, |
| 1765 index, | 1766 index, |
| 1766 transition, | 1767 transition, |
| 1767 rdx, rcx, rbx, | 1768 rdx, rcx, rbx, |
| 1768 &miss); | 1769 &miss); |
| 1769 | 1770 |
| 1770 // Handle store cache miss. | 1771 // Handle store cache miss. |
| 1771 __ bind(&miss); | 1772 __ bind(&miss); |
| 1772 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 1773 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1774 Builtins::StoreIC_Miss)); |
| 1773 __ Jump(ic, RelocInfo::CODE_TARGET); | 1775 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 1774 | 1776 |
| 1775 // Return the generated code. | 1777 // Return the generated code. |
| 1776 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); | 1778 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); |
| 1777 } | 1779 } |
| 1778 | 1780 |
| 1779 | 1781 |
| 1780 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, | 1782 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, |
| 1781 String* name) { | 1783 String* name) { |
| 1782 // ----------- S t a t e ------------- | 1784 // ----------- S t a t e ------------- |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1810 __ push(rax); // value | 1812 __ push(rax); // value |
| 1811 __ push(rbx); // restore return address | 1813 __ push(rbx); // restore return address |
| 1812 | 1814 |
| 1813 // Do tail-call to the runtime system. | 1815 // Do tail-call to the runtime system. |
| 1814 ExternalReference store_ic_property = | 1816 ExternalReference store_ic_property = |
| 1815 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty)); | 1817 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty)); |
| 1816 __ TailCallExternalReference(store_ic_property, 3, 1); | 1818 __ TailCallExternalReference(store_ic_property, 3, 1); |
| 1817 | 1819 |
| 1818 // Handle store cache miss. | 1820 // Handle store cache miss. |
| 1819 __ bind(&miss); | 1821 __ bind(&miss); |
| 1820 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 1822 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1823 Builtins::StoreIC_Miss)); |
| 1821 __ Jump(ic, RelocInfo::CODE_TARGET); | 1824 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 1822 | 1825 |
| 1823 // Return the generated code. | 1826 // Return the generated code. |
| 1824 return GetCode(INTERCEPTOR, name); | 1827 return GetCode(INTERCEPTOR, name); |
| 1825 } | 1828 } |
| 1826 | 1829 |
| 1827 | 1830 |
| 1828 Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, | 1831 Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, |
| 1829 JSGlobalPropertyCell* cell, | 1832 JSGlobalPropertyCell* cell, |
| 1830 String* name) { | 1833 String* name) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1845 __ Move(rcx, Handle<JSGlobalPropertyCell>(cell)); | 1848 __ Move(rcx, Handle<JSGlobalPropertyCell>(cell)); |
| 1846 __ movq(FieldOperand(rcx, JSGlobalPropertyCell::kValueOffset), rax); | 1849 __ movq(FieldOperand(rcx, JSGlobalPropertyCell::kValueOffset), rax); |
| 1847 | 1850 |
| 1848 // Return the value (register rax). | 1851 // Return the value (register rax). |
| 1849 __ IncrementCounter(&Counters::named_store_global_inline, 1); | 1852 __ IncrementCounter(&Counters::named_store_global_inline, 1); |
| 1850 __ ret(0); | 1853 __ ret(0); |
| 1851 | 1854 |
| 1852 // Handle store cache miss. | 1855 // Handle store cache miss. |
| 1853 __ bind(&miss); | 1856 __ bind(&miss); |
| 1854 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1); | 1857 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1); |
| 1855 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 1858 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1859 Builtins::StoreIC_Miss)); |
| 1856 __ Jump(ic, RelocInfo::CODE_TARGET); | 1860 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 1857 | 1861 |
| 1858 // Return the generated code. | 1862 // Return the generated code. |
| 1859 return GetCode(NORMAL, name); | 1863 return GetCode(NORMAL, name); |
| 1860 } | 1864 } |
| 1861 | 1865 |
| 1862 | 1866 |
| 1863 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, | 1867 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, |
| 1864 JSObject* receiver, | 1868 JSObject* receiver, |
| 1865 JSObject* holder, | 1869 JSObject* holder, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1910 GenerateStoreField(masm(), | 1914 GenerateStoreField(masm(), |
| 1911 object, | 1915 object, |
| 1912 index, | 1916 index, |
| 1913 transition, | 1917 transition, |
| 1914 rdx, rcx, rbx, | 1918 rdx, rcx, rbx, |
| 1915 &miss); | 1919 &miss); |
| 1916 | 1920 |
| 1917 // Handle store cache miss. | 1921 // Handle store cache miss. |
| 1918 __ bind(&miss); | 1922 __ bind(&miss); |
| 1919 __ DecrementCounter(&Counters::keyed_store_field, 1); | 1923 __ DecrementCounter(&Counters::keyed_store_field, 1); |
| 1920 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); | 1924 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1925 Builtins::KeyedStoreIC_Miss)); |
| 1921 __ Jump(ic, RelocInfo::CODE_TARGET); | 1926 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 1922 | 1927 |
| 1923 // Return the generated code. | 1928 // Return the generated code. |
| 1924 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); | 1929 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); |
| 1925 } | 1930 } |
| 1926 | 1931 |
| 1927 | 1932 |
| 1928 // TODO(1241006): Avoid having lazy compile stubs specialized by the | 1933 // TODO(1241006): Avoid having lazy compile stubs specialized by the |
| 1929 // number of arguments. It is not needed anymore. | 1934 // number of arguments. It is not needed anymore. |
| 1930 Object* StubCompiler::CompileLazyCompile(Code::Flags flags) { | 1935 Object* StubCompiler::CompileLazyCompile(Code::Flags flags) { |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2319 __ pop(rcx); | 2324 __ pop(rcx); |
| 2320 __ lea(rsp, Operand(rsp, rbx, times_pointer_size, 1 * kPointerSize)); | 2325 __ lea(rsp, Operand(rsp, rbx, times_pointer_size, 1 * kPointerSize)); |
| 2321 __ push(rcx); | 2326 __ push(rcx); |
| 2322 __ IncrementCounter(&Counters::constructed_objects, 1); | 2327 __ IncrementCounter(&Counters::constructed_objects, 1); |
| 2323 __ IncrementCounter(&Counters::constructed_objects_stub, 1); | 2328 __ IncrementCounter(&Counters::constructed_objects_stub, 1); |
| 2324 __ ret(0); | 2329 __ ret(0); |
| 2325 | 2330 |
| 2326 // Jump to the generic stub in case the specialized code cannot handle the | 2331 // Jump to the generic stub in case the specialized code cannot handle the |
| 2327 // construction. | 2332 // construction. |
| 2328 __ bind(&generic_stub_call); | 2333 __ bind(&generic_stub_call); |
| 2329 Code* code = Builtins::builtin(Builtins::JSConstructStubGeneric); | 2334 Code* code = Isolate::Current()->builtins()->builtin( |
| 2335 Builtins::JSConstructStubGeneric); |
| 2330 Handle<Code> generic_construct_stub(code); | 2336 Handle<Code> generic_construct_stub(code); |
| 2331 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 2337 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 2332 | 2338 |
| 2333 // Return the generated code. | 2339 // Return the generated code. |
| 2334 return GetCode(); | 2340 return GetCode(); |
| 2335 } | 2341 } |
| 2336 | 2342 |
| 2337 | 2343 |
| 2338 #undef __ | 2344 #undef __ |
| 2339 | 2345 |
| 2340 } } // namespace v8::internal | 2346 } } // namespace v8::internal |
| 2341 | 2347 |
| 2342 #endif // V8_TARGET_ARCH_X64 | 2348 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |