OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 } else { | 391 } else { |
392 __ mov(Operand(esp, 2 * kPointerSize), | 392 __ mov(Operand(esp, 2 * kPointerSize), |
393 Immediate(Handle<Object>(call_data))); | 393 Immediate(Handle<Object>(call_data))); |
394 } | 394 } |
395 | 395 |
396 // Set the number of arguments. | 396 // Set the number of arguments. |
397 __ mov(eax, Immediate(argc + 4)); | 397 __ mov(eax, Immediate(argc + 4)); |
398 | 398 |
399 // Jump to the fast api call builtin (tail call). | 399 // Jump to the fast api call builtin (tail call). |
400 Handle<Code> code = Handle<Code>( | 400 Handle<Code> code = Handle<Code>( |
401 Builtins::builtin(Builtins::FastHandleApiCall)); | 401 Isolate::Current()->builtins()->builtin(Builtins::FastHandleApiCall)); |
402 ParameterCount expected(0); | 402 ParameterCount expected(0); |
403 __ InvokeCode(code, expected, expected, | 403 __ InvokeCode(code, expected, expected, |
404 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 404 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
405 } | 405 } |
406 | 406 |
407 | 407 |
408 class CallInterceptorCompiler BASE_EMBEDDED { | 408 class CallInterceptorCompiler BASE_EMBEDDED { |
409 public: | 409 public: |
410 CallInterceptorCompiler(StubCompiler* stub_compiler, | 410 CallInterceptorCompiler(StubCompiler* stub_compiler, |
411 const ParameterCount& arguments, | 411 const ParameterCount& arguments, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 StubCompiler* stub_compiler_; | 606 StubCompiler* stub_compiler_; |
607 const ParameterCount& arguments_; | 607 const ParameterCount& arguments_; |
608 Register name_; | 608 Register name_; |
609 }; | 609 }; |
610 | 610 |
611 | 611 |
612 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { | 612 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { |
613 ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC); | 613 ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC); |
614 Code* code = NULL; | 614 Code* code = NULL; |
615 if (kind == Code::LOAD_IC) { | 615 if (kind == Code::LOAD_IC) { |
616 code = Builtins::builtin(Builtins::LoadIC_Miss); | 616 code = Isolate::Current()->builtins()->builtin(Builtins::LoadIC_Miss); |
617 } else { | 617 } else { |
618 code = Builtins::builtin(Builtins::KeyedLoadIC_Miss); | 618 code = Isolate::Current()->builtins()->builtin(Builtins::KeyedLoadIC_Miss); |
619 } | 619 } |
620 | 620 |
621 Handle<Code> ic(code); | 621 Handle<Code> ic(code); |
622 __ jmp(ic, RelocInfo::CODE_TARGET); | 622 __ jmp(ic, RelocInfo::CODE_TARGET); |
623 } | 623 } |
624 | 624 |
625 | 625 |
626 // Both name_reg and receiver_reg are preserved on jumps to miss_label, | 626 // Both name_reg and receiver_reg are preserved on jumps to miss_label, |
627 // but may be destroyed if store is successful. | 627 // but may be destroyed if store is successful. |
628 void StubCompiler::GenerateStoreField(MacroAssembler* masm, | 628 void StubCompiler::GenerateStoreField(MacroAssembler* masm, |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1788 GenerateStoreField(masm(), | 1788 GenerateStoreField(masm(), |
1789 object, | 1789 object, |
1790 index, | 1790 index, |
1791 transition, | 1791 transition, |
1792 edx, ecx, ebx, | 1792 edx, ecx, ebx, |
1793 &miss); | 1793 &miss); |
1794 | 1794 |
1795 // Handle store cache miss. | 1795 // Handle store cache miss. |
1796 __ bind(&miss); | 1796 __ bind(&miss); |
1797 __ mov(ecx, Immediate(Handle<String>(name))); // restore name | 1797 __ mov(ecx, Immediate(Handle<String>(name))); // restore name |
1798 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 1798 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1799 Builtins::StoreIC_Miss)); |
1799 __ jmp(ic, RelocInfo::CODE_TARGET); | 1800 __ jmp(ic, RelocInfo::CODE_TARGET); |
1800 | 1801 |
1801 // Return the generated code. | 1802 // Return the generated code. |
1802 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); | 1803 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); |
1803 } | 1804 } |
1804 | 1805 |
1805 | 1806 |
1806 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, | 1807 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, |
1807 AccessorInfo* callback, | 1808 AccessorInfo* callback, |
1808 String* name) { | 1809 String* name) { |
(...skipping 30 matching lines...) Expand all Loading... |
1839 __ push(eax); // value | 1840 __ push(eax); // value |
1840 __ push(ebx); // restore return address | 1841 __ push(ebx); // restore return address |
1841 | 1842 |
1842 // Do tail-call to the runtime system. | 1843 // Do tail-call to the runtime system. |
1843 ExternalReference store_callback_property = | 1844 ExternalReference store_callback_property = |
1844 ExternalReference(IC_Utility(IC::kStoreCallbackProperty)); | 1845 ExternalReference(IC_Utility(IC::kStoreCallbackProperty)); |
1845 __ TailCallExternalReference(store_callback_property, 4, 1); | 1846 __ TailCallExternalReference(store_callback_property, 4, 1); |
1846 | 1847 |
1847 // Handle store cache miss. | 1848 // Handle store cache miss. |
1848 __ bind(&miss); | 1849 __ bind(&miss); |
1849 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 1850 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1851 Builtins::StoreIC_Miss)); |
1850 __ jmp(ic, RelocInfo::CODE_TARGET); | 1852 __ jmp(ic, RelocInfo::CODE_TARGET); |
1851 | 1853 |
1852 // Return the generated code. | 1854 // Return the generated code. |
1853 return GetCode(CALLBACKS, name); | 1855 return GetCode(CALLBACKS, name); |
1854 } | 1856 } |
1855 | 1857 |
1856 | 1858 |
1857 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, | 1859 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, |
1858 String* name) { | 1860 String* name) { |
1859 // ----------- S t a t e ------------- | 1861 // ----------- S t a t e ------------- |
(...skipping 28 matching lines...) Expand all Loading... |
1888 __ push(eax); // value | 1890 __ push(eax); // value |
1889 __ push(ebx); // restore return address | 1891 __ push(ebx); // restore return address |
1890 | 1892 |
1891 // Do tail-call to the runtime system. | 1893 // Do tail-call to the runtime system. |
1892 ExternalReference store_ic_property = | 1894 ExternalReference store_ic_property = |
1893 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty)); | 1895 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty)); |
1894 __ TailCallExternalReference(store_ic_property, 3, 1); | 1896 __ TailCallExternalReference(store_ic_property, 3, 1); |
1895 | 1897 |
1896 // Handle store cache miss. | 1898 // Handle store cache miss. |
1897 __ bind(&miss); | 1899 __ bind(&miss); |
1898 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 1900 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1901 Builtins::StoreIC_Miss)); |
1899 __ jmp(ic, RelocInfo::CODE_TARGET); | 1902 __ jmp(ic, RelocInfo::CODE_TARGET); |
1900 | 1903 |
1901 // Return the generated code. | 1904 // Return the generated code. |
1902 return GetCode(INTERCEPTOR, name); | 1905 return GetCode(INTERCEPTOR, name); |
1903 } | 1906 } |
1904 | 1907 |
1905 | 1908 |
1906 Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, | 1909 Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, |
1907 JSGlobalPropertyCell* cell, | 1910 JSGlobalPropertyCell* cell, |
1908 String* name) { | 1911 String* name) { |
(...skipping 14 matching lines...) Expand all Loading... |
1923 __ mov(ecx, Immediate(Handle<JSGlobalPropertyCell>(cell))); | 1926 __ mov(ecx, Immediate(Handle<JSGlobalPropertyCell>(cell))); |
1924 __ mov(FieldOperand(ecx, JSGlobalPropertyCell::kValueOffset), eax); | 1927 __ mov(FieldOperand(ecx, JSGlobalPropertyCell::kValueOffset), eax); |
1925 | 1928 |
1926 // Return the value (register eax). | 1929 // Return the value (register eax). |
1927 __ IncrementCounter(&Counters::named_store_global_inline, 1); | 1930 __ IncrementCounter(&Counters::named_store_global_inline, 1); |
1928 __ ret(0); | 1931 __ ret(0); |
1929 | 1932 |
1930 // Handle store cache miss. | 1933 // Handle store cache miss. |
1931 __ bind(&miss); | 1934 __ bind(&miss); |
1932 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1); | 1935 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1); |
1933 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 1936 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1937 Builtins::StoreIC_Miss)); |
1934 __ jmp(ic, RelocInfo::CODE_TARGET); | 1938 __ jmp(ic, RelocInfo::CODE_TARGET); |
1935 | 1939 |
1936 // Return the generated code. | 1940 // Return the generated code. |
1937 return GetCode(NORMAL, name); | 1941 return GetCode(NORMAL, name); |
1938 } | 1942 } |
1939 | 1943 |
1940 | 1944 |
1941 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, | 1945 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, |
1942 int index, | 1946 int index, |
1943 Map* transition, | 1947 Map* transition, |
(...skipping 16 matching lines...) Expand all Loading... |
1960 GenerateStoreField(masm(), | 1964 GenerateStoreField(masm(), |
1961 object, | 1965 object, |
1962 index, | 1966 index, |
1963 transition, | 1967 transition, |
1964 edx, ecx, ebx, | 1968 edx, ecx, ebx, |
1965 &miss); | 1969 &miss); |
1966 | 1970 |
1967 // Handle store cache miss. | 1971 // Handle store cache miss. |
1968 __ bind(&miss); | 1972 __ bind(&miss); |
1969 __ DecrementCounter(&Counters::keyed_store_field, 1); | 1973 __ DecrementCounter(&Counters::keyed_store_field, 1); |
1970 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); | 1974 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1975 Builtins::KeyedStoreIC_Miss)); |
1971 __ jmp(ic, RelocInfo::CODE_TARGET); | 1976 __ jmp(ic, RelocInfo::CODE_TARGET); |
1972 | 1977 |
1973 // Return the generated code. | 1978 // Return the generated code. |
1974 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); | 1979 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); |
1975 } | 1980 } |
1976 | 1981 |
1977 | 1982 |
1978 Object* LoadStubCompiler::CompileLoadNonexistent(String* name, | 1983 Object* LoadStubCompiler::CompileLoadNonexistent(String* name, |
1979 JSObject* object, | 1984 JSObject* object, |
1980 JSObject* last) { | 1985 JSObject* last) { |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2482 __ pop(ecx); | 2487 __ pop(ecx); |
2483 __ lea(esp, Operand(esp, ebx, times_pointer_size, 1 * kPointerSize)); | 2488 __ lea(esp, Operand(esp, ebx, times_pointer_size, 1 * kPointerSize)); |
2484 __ push(ecx); | 2489 __ push(ecx); |
2485 __ IncrementCounter(&Counters::constructed_objects, 1); | 2490 __ IncrementCounter(&Counters::constructed_objects, 1); |
2486 __ IncrementCounter(&Counters::constructed_objects_stub, 1); | 2491 __ IncrementCounter(&Counters::constructed_objects_stub, 1); |
2487 __ ret(0); | 2492 __ ret(0); |
2488 | 2493 |
2489 // Jump to the generic stub in case the specialized code cannot handle the | 2494 // Jump to the generic stub in case the specialized code cannot handle the |
2490 // construction. | 2495 // construction. |
2491 __ bind(&generic_stub_call); | 2496 __ bind(&generic_stub_call); |
2492 Code* code = Builtins::builtin(Builtins::JSConstructStubGeneric); | 2497 Code* code = Isolate::Current()->builtins()->builtin( |
| 2498 Builtins::JSConstructStubGeneric); |
2493 Handle<Code> generic_construct_stub(code); | 2499 Handle<Code> generic_construct_stub(code); |
2494 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 2500 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
2495 | 2501 |
2496 // Return the generated code. | 2502 // Return the generated code. |
2497 return GetCode(); | 2503 return GetCode(); |
2498 } | 2504 } |
2499 | 2505 |
2500 | 2506 |
2501 #undef __ | 2507 #undef __ |
2502 | 2508 |
2503 } } // namespace v8::internal | 2509 } } // namespace v8::internal |
2504 | 2510 |
2505 #endif // V8_TARGET_ARCH_IA32 | 2511 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |