| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1866 Register slot, Register temp) { | 1866 Register slot, Register temp) { |
| 1867 const int count_offset = FixedArray::kHeaderSize + kPointerSize; | 1867 const int count_offset = FixedArray::kHeaderSize + kPointerSize; |
| 1868 __ SmiToPtrArrayOffset(temp, slot); | 1868 __ SmiToPtrArrayOffset(temp, slot); |
| 1869 __ add(feedback_vector, feedback_vector, temp); | 1869 __ add(feedback_vector, feedback_vector, temp); |
| 1870 __ LoadP(slot, FieldMemOperand(feedback_vector, count_offset)); | 1870 __ LoadP(slot, FieldMemOperand(feedback_vector, count_offset)); |
| 1871 __ AddSmiLiteral(slot, slot, Smi::FromInt(1), temp); | 1871 __ AddSmiLiteral(slot, slot, Smi::FromInt(1), temp); |
| 1872 __ StoreP(slot, FieldMemOperand(feedback_vector, count_offset), temp); | 1872 __ StoreP(slot, FieldMemOperand(feedback_vector, count_offset), temp); |
| 1873 } | 1873 } |
| 1874 | 1874 |
| 1875 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { | 1875 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
| 1876 // r3 - number of arguments |
| 1876 // r4 - function | 1877 // r4 - function |
| 1877 // r6 - slot id | 1878 // r6 - slot id |
| 1878 // r5 - vector | 1879 // r5 - vector |
| 1879 // r7 - allocation site (loaded from vector[slot]) | 1880 // r7 - allocation site (loaded from vector[slot]) |
| 1880 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r8); | 1881 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r8); |
| 1881 __ cmp(r4, r8); | 1882 __ cmp(r4, r8); |
| 1882 __ bne(miss); | 1883 __ bne(miss); |
| 1883 | 1884 |
| 1884 // Increment the call count for monomorphic function calls. | 1885 // Increment the call count for monomorphic function calls. |
| 1885 IncrementCallCount(masm, r5, r6, r0); | 1886 IncrementCallCount(masm, r5, r6, r0); |
| 1886 | 1887 |
| 1887 __ mr(r5, r7); | 1888 __ mr(r5, r7); |
| 1888 __ mr(r6, r4); | 1889 __ mr(r6, r4); |
| 1889 __ mov(r3, Operand(arg_count())); | |
| 1890 ArrayConstructorStub stub(masm->isolate()); | 1890 ArrayConstructorStub stub(masm->isolate()); |
| 1891 __ TailCallStub(&stub); | 1891 __ TailCallStub(&stub); |
| 1892 } | 1892 } |
| 1893 | 1893 |
| 1894 | 1894 |
| 1895 void CallICStub::Generate(MacroAssembler* masm) { | 1895 void CallICStub::Generate(MacroAssembler* masm) { |
| 1896 // r3 - number of arguments |
| 1896 // r4 - function | 1897 // r4 - function |
| 1897 // r6 - slot id (Smi) | 1898 // r6 - slot id (Smi) |
| 1898 // r5 - vector | 1899 // r5 - vector |
| 1899 Label extra_checks_or_miss, call, call_function, call_count_incremented; | 1900 Label extra_checks_or_miss, call, call_function, call_count_incremented; |
| 1900 int argc = arg_count(); | |
| 1901 ParameterCount actual(argc); | |
| 1902 | 1901 |
| 1903 // The checks. First, does r4 match the recorded monomorphic target? | 1902 // The checks. First, does r4 match the recorded monomorphic target? |
| 1904 __ SmiToPtrArrayOffset(r9, r6); | 1903 __ SmiToPtrArrayOffset(r9, r6); |
| 1905 __ add(r9, r5, r9); | 1904 __ add(r9, r5, r9); |
| 1906 __ LoadP(r7, FieldMemOperand(r9, FixedArray::kHeaderSize)); | 1905 __ LoadP(r7, FieldMemOperand(r9, FixedArray::kHeaderSize)); |
| 1907 | 1906 |
| 1908 // We don't know that we have a weak cell. We might have a private symbol | 1907 // We don't know that we have a weak cell. We might have a private symbol |
| 1909 // or an AllocationSite, but the memory is safe to examine. | 1908 // or an AllocationSite, but the memory is safe to examine. |
| 1910 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to | 1909 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to |
| 1911 // FixedArray. | 1910 // FixedArray. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1925 | 1924 |
| 1926 // The compare above could have been a SMI/SMI comparison. Guard against this | 1925 // The compare above could have been a SMI/SMI comparison. Guard against this |
| 1927 // convincing us that we have a monomorphic JSFunction. | 1926 // convincing us that we have a monomorphic JSFunction. |
| 1928 __ JumpIfSmi(r4, &extra_checks_or_miss); | 1927 __ JumpIfSmi(r4, &extra_checks_or_miss); |
| 1929 | 1928 |
| 1930 __ bind(&call_function); | 1929 __ bind(&call_function); |
| 1931 | 1930 |
| 1932 // Increment the call count for monomorphic function calls. | 1931 // Increment the call count for monomorphic function calls. |
| 1933 IncrementCallCount(masm, r5, r6, r0); | 1932 IncrementCallCount(masm, r5, r6, r0); |
| 1934 | 1933 |
| 1935 __ mov(r3, Operand(argc)); | |
| 1936 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), | 1934 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), |
| 1937 tail_call_mode()), | 1935 tail_call_mode()), |
| 1938 RelocInfo::CODE_TARGET); | 1936 RelocInfo::CODE_TARGET); |
| 1939 | 1937 |
| 1940 __ bind(&extra_checks_or_miss); | 1938 __ bind(&extra_checks_or_miss); |
| 1941 Label uninitialized, miss, not_allocation_site; | 1939 Label uninitialized, miss, not_allocation_site; |
| 1942 | 1940 |
| 1943 __ CompareRoot(r7, Heap::kmegamorphic_symbolRootIndex); | 1941 __ CompareRoot(r7, Heap::kmegamorphic_symbolRootIndex); |
| 1944 __ beq(&call); | 1942 __ beq(&call); |
| 1945 | 1943 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1969 __ bne(&miss); | 1967 __ bne(&miss); |
| 1970 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); | 1968 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); |
| 1971 __ StoreP(ip, FieldMemOperand(r9, FixedArray::kHeaderSize), r0); | 1969 __ StoreP(ip, FieldMemOperand(r9, FixedArray::kHeaderSize), r0); |
| 1972 | 1970 |
| 1973 __ bind(&call); | 1971 __ bind(&call); |
| 1974 | 1972 |
| 1975 // Increment the call count for megamorphic function calls. | 1973 // Increment the call count for megamorphic function calls. |
| 1976 IncrementCallCount(masm, r5, r6, r0); | 1974 IncrementCallCount(masm, r5, r6, r0); |
| 1977 | 1975 |
| 1978 __ bind(&call_count_incremented); | 1976 __ bind(&call_count_incremented); |
| 1979 __ mov(r3, Operand(argc)); | |
| 1980 __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), | 1977 __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), |
| 1981 RelocInfo::CODE_TARGET); | 1978 RelocInfo::CODE_TARGET); |
| 1982 | 1979 |
| 1983 __ bind(&uninitialized); | 1980 __ bind(&uninitialized); |
| 1984 | 1981 |
| 1985 // We are going monomorphic, provided we actually have a JSFunction. | 1982 // We are going monomorphic, provided we actually have a JSFunction. |
| 1986 __ JumpIfSmi(r4, &miss); | 1983 __ JumpIfSmi(r4, &miss); |
| 1987 | 1984 |
| 1988 // Goto miss case if we do not have a function. | 1985 // Goto miss case if we do not have a function. |
| 1989 __ CompareObjectType(r4, r7, r7, JS_FUNCTION_TYPE); | 1986 __ CompareObjectType(r4, r7, r7, JS_FUNCTION_TYPE); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2002 __ cmp(r7, ip); | 1999 __ cmp(r7, ip); |
| 2003 __ bne(&miss); | 2000 __ bne(&miss); |
| 2004 | 2001 |
| 2005 // Store the function. Use a stub since we need a frame for allocation. | 2002 // Store the function. Use a stub since we need a frame for allocation. |
| 2006 // r5 - vector | 2003 // r5 - vector |
| 2007 // r6 - slot | 2004 // r6 - slot |
| 2008 // r4 - function | 2005 // r4 - function |
| 2009 { | 2006 { |
| 2010 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 2007 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 2011 CreateWeakCellStub create_stub(masm->isolate()); | 2008 CreateWeakCellStub create_stub(masm->isolate()); |
| 2012 __ Push(r5); | 2009 __ SmiTag(r3); |
| 2013 __ Push(r6); | 2010 __ Push(r3, r5, r6, cp, r4); |
| 2014 __ Push(cp, r4); | |
| 2015 __ CallStub(&create_stub); | 2011 __ CallStub(&create_stub); |
| 2016 __ Pop(cp, r4); | 2012 __ Pop(r5, r6, cp, r4); |
| 2017 __ Pop(r6); | 2013 __ Pop(r3); |
| 2018 __ Pop(r5); | 2014 __ SmiUntag(r3); |
| 2019 } | 2015 } |
| 2020 | 2016 |
| 2021 __ b(&call_function); | 2017 __ b(&call_function); |
| 2022 | 2018 |
| 2023 // We are here because tracing is on or we encountered a MISS case we can't | 2019 // We are here because tracing is on or we encountered a MISS case we can't |
| 2024 // handle here. | 2020 // handle here. |
| 2025 __ bind(&miss); | 2021 __ bind(&miss); |
| 2026 GenerateMiss(masm); | 2022 GenerateMiss(masm); |
| 2027 | 2023 |
| 2028 __ b(&call_count_incremented); | 2024 __ b(&call_count_incremented); |
| 2029 } | 2025 } |
| 2030 | 2026 |
| 2031 | 2027 |
| 2032 void CallICStub::GenerateMiss(MacroAssembler* masm) { | 2028 void CallICStub::GenerateMiss(MacroAssembler* masm) { |
| 2033 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 2029 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 2034 | 2030 |
| 2035 // Push the function and feedback info. | 2031 // Preserve the number of arguments as Smi. |
| 2036 __ Push(r4, r5, r6); | 2032 __ SmiTag(r3); |
| 2033 |
| 2034 // Push the receiver and the function and feedback info. |
| 2035 __ Push(r3, r4, r5, r6); |
| 2037 | 2036 |
| 2038 // Call the entry. | 2037 // Call the entry. |
| 2039 __ CallRuntime(Runtime::kCallIC_Miss); | 2038 __ CallRuntime(Runtime::kCallIC_Miss); |
| 2040 | 2039 |
| 2041 // Move result to r4 and exit the internal frame. | 2040 // Move result to r4 and exit the internal frame. |
| 2042 __ mr(r4, r3); | 2041 __ mr(r4, r3); |
| 2042 |
| 2043 // Restore number of arguments. |
| 2044 __ Pop(r3); |
| 2045 __ SmiUntag(r3); |
| 2043 } | 2046 } |
| 2044 | 2047 |
| 2045 | 2048 |
| 2046 // StringCharCodeAtGenerator | 2049 // StringCharCodeAtGenerator |
| 2047 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { | 2050 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
| 2048 // If the receiver is a smi trigger the non-string case. | 2051 // If the receiver is a smi trigger the non-string case. |
| 2049 if (check_mode_ == RECEIVER_IS_UNKNOWN) { | 2052 if (check_mode_ == RECEIVER_IS_UNKNOWN) { |
| 2050 __ JumpIfSmi(object_, receiver_not_string_); | 2053 __ JumpIfSmi(object_, receiver_not_string_); |
| 2051 | 2054 |
| 2052 // Fetch the instance type of the receiver into result register. | 2055 // Fetch the instance type of the receiver into result register. |
| (...skipping 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5146 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 5149 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
| 5147 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5150 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 5148 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5151 kStackUnwindSpace, NULL, return_value_operand, NULL); |
| 5149 } | 5152 } |
| 5150 | 5153 |
| 5151 #undef __ | 5154 #undef __ |
| 5152 } // namespace internal | 5155 } // namespace internal |
| 5153 } // namespace v8 | 5156 } // namespace v8 |
| 5154 | 5157 |
| 5155 #endif // V8_TARGET_ARCH_PPC | 5158 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |