Changeset 39422 in webkit for trunk/JavaScriptCore/jit/JIT.cpp
- Timestamp:
- Dec 20, 2008, 2:11:31 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JIT.cpp
r39391 r39422 41 41 #endif 42 42 43 #define __ m_assembler.44 45 43 using namespace std; 46 44 … … 199 197 void ctiRepatchCallByReturnAddress(void* where, void* what) 200 198 { 201 (static_cast<void**>(where))[-1] = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(what) - reinterpret_cast<uintptr_t>(where));199 MacroAssembler::Jump::repatch(where, what); 202 200 } 203 201 … … 348 346 emitCTICall(Interpreter::cti_op_end); 349 347 emitGetVirtualRegister(currentInstruction[1].u.operand, X86::eax); 350 __ push_m(RegisterFile::ReturnPC * static_cast<int>(sizeof(Register)), callFrameRegister);351 __ret();348 push(Address(callFrameRegister, RegisterFile::ReturnPC * static_cast<int>(sizeof(Register)))); 349 ret(); 352 350 NEXT_OPCODE(op_end); 353 351 } … … 588 586 589 587 // Return. 590 __ push_r(X86::edx);591 __ret();588 push(X86::edx); 589 ret(); 592 590 593 591 NEXT_OPCODE(op_ret); … … 1807 1805 1808 1806 // Could use a pop_m, but would need to offset the following instruction if so. 1809 __ pop_r(X86::ecx);1807 pop(X86::ecx); 1810 1808 emitPutToCallFrameHeader(X86::ecx, RegisterFile::ReturnPC); 1811 1809 … … 1922 1920 #if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) 1923 1921 // (1) The first function provides fast property access for array length 1924 X86Assembler::JmpDst arrayLengthBegin = __ align(16); 1922 Label arrayLengthBegin = align(); 1923 1924 // Check eax is an array 1925 Jump array_failureCases1 = emitJumpIfNotJSCell(X86::eax); 1926 Jump array_failureCases2 = jnePtr(Address(X86::eax), ImmPtr(m_interpreter->m_jsArrayVptr)); 1927 1928 // Checks out okay! - get the length from the storage 1929 loadPtr(Address(X86::eax, FIELD_OFFSET(JSArray, m_storage)), X86::eax); 1930 load32(Address(X86::eax, FIELD_OFFSET(ArrayStorage, m_length)), X86::eax); 1931 1932 Jump array_failureCases3 = ja32(X86::eax, Imm32(JSImmediate::maxImmediateInt)); 1933 1934 add32(X86::eax, X86::eax); 1935 add32(Imm32(1), X86::eax); 1925 1936 1926 // Check eax is an array 1927 X86Assembler::JmpSrc array_failureCases1 = emitJumpIfNotJSCell(X86::eax); 1928 __ cmpl_im(reinterpret_cast<unsigned>(m_interpreter->m_jsArrayVptr), 0, X86::eax); 1929 X86Assembler::JmpSrc array_failureCases2 = __ jne(); 1930 1931 // Checks out okay! - get the length from the storage 1932 __ movl_mr(FIELD_OFFSET(JSArray, m_storage), X86::eax, X86::eax); 1933 __ movl_mr(FIELD_OFFSET(ArrayStorage, m_length), X86::eax, X86::eax); 1934 1935 __ cmpl_ir(JSImmediate::maxImmediateInt, X86::eax); 1936 X86Assembler::JmpSrc array_failureCases3 = __ ja(); 1937 1938 __ addl_rr(X86::eax, X86::eax); 1939 __ addl_ir(1, X86::eax); 1937 ret(); 1938 1939 // (2) The second function provides fast property access for string length 1940 Label stringLengthBegin = align(); 1941 1942 // Check eax is a string 1943 Jump string_failureCases1 = emitJumpIfNotJSCell(X86::eax); 1944 Jump string_failureCases2 = jnePtr(Address(X86::eax), ImmPtr(m_interpreter->m_jsStringVptr)); 1945 1946 // Checks out okay! - get the length from the Ustring. 1947 loadPtr(Address(X86::eax, FIELD_OFFSET(JSString, m_value) + FIELD_OFFSET(UString, m_rep)), X86::eax); 1948 load32(Address(X86::eax, FIELD_OFFSET(UString::Rep, len)), X86::eax); 1949 1950 Jump string_failureCases3 = ja32(X86::eax, Imm32(JSImmediate::maxImmediateInt)); 1951 1952 add32(X86::eax, X86::eax); 1953 add32(Imm32(1), X86::eax); 1940 1954 1941 __ ret(); 1942 1943 // (2) The second function provides fast property access for string length 1944 X86Assembler::JmpDst stringLengthBegin = __ align(16); 1945 1946 // Check eax is a string 1947 X86Assembler::JmpSrc string_failureCases1 = emitJumpIfNotJSCell(X86::eax); 1948 __ cmpl_im(reinterpret_cast<unsigned>(m_interpreter->m_jsStringVptr), 0, X86::eax); 1949 X86Assembler::JmpSrc string_failureCases2 = __ jne(); 1950 1951 // Checks out okay! - get the length from the Ustring. 1952 __ movl_mr(FIELD_OFFSET(JSString, m_value) + FIELD_OFFSET(UString, m_rep), X86::eax, X86::eax); 1953 __ movl_mr(FIELD_OFFSET(UString::Rep, len), X86::eax, X86::eax); 1954 1955 __ cmpl_ir(JSImmediate::maxImmediateInt, X86::eax); 1956 X86Assembler::JmpSrc string_failureCases3 = __ ja(); 1957 1958 __ addl_rr(X86::eax, X86::eax); 1959 __ addl_ir(1, X86::eax); 1960 1961 __ ret(); 1955 ret(); 1962 1956 #endif 1963 1957 1964 1958 // (3) Trampolines for the slow cases of op_call / op_call_eval / op_construct. 1965 1959 1966 X86Assembler::JmpDst virtualCallPreLinkBegin = __ align(16); 1967 1960 Label virtualCallPreLinkBegin = align(); 1961 1962 #define __ m_assembler. 1968 1963 // Load the callee CodeBlock* into eax 1969 1964 __ movl_mr(FIELD_OFFSET(JSFunction, m_body), X86::ecx, X86::eax); … … 2003 1998 __ jmp_r(X86::eax); 2004 1999 2005 X86Assembler::JmpDst virtualCallLinkBegin = __ align(16);2000 Label virtualCallLinkBegin = align(); 2006 2001 2007 2002 // Load the callee CodeBlock* into eax … … 2042 2037 __ jmp_r(X86::eax); 2043 2038 2044 X86Assembler::JmpDst virtualCallBegin = __ align(16);2039 Label virtualCallBegin = align(); 2045 2040 2046 2041 // Load the callee CodeBlock* into eax … … 2077 2072 2078 2073 // All trampolines constructed! copy the code, link up calls, and set the pointers on the Machine object. 2079 m_interpreter->m_executablePool = m_globalData->poolForSize(__ size()); 2080 void* code = __ executableCopy(m_interpreter->m_executablePool.get()); 2074 m_interpreter->m_executablePool = m_globalData->poolForSize(m_assembler.size()); 2075 void* code = m_assembler.executableCopy(m_interpreter->m_executablePool.get()); 2076 RepatchBuffer repatchBuffer(code); 2081 2077 2082 2078 #if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) 2083 X86Assembler::link(code, array_failureCases1, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_array_fail)); 2084 X86Assembler::link(code, array_failureCases2, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_array_fail)); 2085 X86Assembler::link(code, array_failureCases3, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_array_fail)); 2086 X86Assembler::link(code, string_failureCases1, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_string_fail)); 2087 X86Assembler::link(code, string_failureCases2, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_string_fail)); 2088 X86Assembler::link(code, string_failureCases3, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_string_fail)); 2089 2090 m_interpreter->m_ctiArrayLengthTrampoline = X86Assembler::getRelocatedAddress(code, arrayLengthBegin); 2091 m_interpreter->m_ctiStringLengthTrampoline = X86Assembler::getRelocatedAddress(code, stringLengthBegin); 2092 #endif 2093 2079 repatchBuffer.link(array_failureCases1, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_array_fail)); 2080 repatchBuffer.link(array_failureCases2, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_array_fail)); 2081 repatchBuffer.link(array_failureCases3, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_array_fail)); 2082 repatchBuffer.link(string_failureCases1, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_string_fail)); 2083 repatchBuffer.link(string_failureCases2, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_string_fail)); 2084 repatchBuffer.link(string_failureCases3, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_string_fail)); 2085 2086 m_interpreter->m_ctiArrayLengthTrampoline = repatchBuffer.addressOf(arrayLengthBegin); 2087 m_interpreter->m_ctiStringLengthTrampoline = repatchBuffer.addressOf(stringLengthBegin); 2088 #endif 2094 2089 X86Assembler::link(code, callArityCheck1, reinterpret_cast<void*>(Interpreter::cti_op_call_arityCheck)); 2095 2090 X86Assembler::link(code, callArityCheck2, reinterpret_cast<void*>(Interpreter::cti_op_call_arityCheck)); … … 2101 2096 X86Assembler::link(code, callLazyLinkCall, reinterpret_cast<void*>(Interpreter::cti_vm_lazyLinkCall)); 2102 2097 2103 m_interpreter->m_ctiVirtualCallPreLink = X86Assembler::getRelocatedAddress(code,virtualCallPreLinkBegin);2104 m_interpreter->m_ctiVirtualCallLink = X86Assembler::getRelocatedAddress(code,virtualCallLinkBegin);2105 m_interpreter->m_ctiVirtualCall = X86Assembler::getRelocatedAddress(code,virtualCallBegin);2098 m_interpreter->m_ctiVirtualCallPreLink = repatchBuffer.addressOf(virtualCallPreLinkBegin); 2099 m_interpreter->m_ctiVirtualCallLink = repatchBuffer.addressOf(virtualCallLinkBegin); 2100 m_interpreter->m_ctiVirtualCall = repatchBuffer.addressOf(virtualCallBegin); 2106 2101 } 2107 2102
Note:
See TracChangeset
for help on using the changeset viewer.