| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1549 index.translate(holder), Representation::Tagged()); | 1549 index.translate(holder), Representation::Tagged()); |
| 1550 GenerateJumpFunction(object, a1, &miss); | 1550 GenerateJumpFunction(object, a1, &miss); |
| 1551 | 1551 |
| 1552 HandlerFrontendFooter(&miss); | 1552 HandlerFrontendFooter(&miss); |
| 1553 | 1553 |
| 1554 // Return the generated code. | 1554 // Return the generated code. |
| 1555 return GetCode(Code::FAST, name); | 1555 return GetCode(Code::FAST, name); |
| 1556 } | 1556 } |
| 1557 | 1557 |
| 1558 | 1558 |
| 1559 Handle<Code> CallStubCompiler::CompileArrayCodeCall( | |
| 1560 Handle<Object> object, | |
| 1561 Handle<JSObject> holder, | |
| 1562 Handle<Cell> cell, | |
| 1563 Handle<JSFunction> function, | |
| 1564 Handle<String> name, | |
| 1565 Code::StubType type) { | |
| 1566 Label miss; | |
| 1567 | |
| 1568 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | |
| 1569 if (!cell.is_null()) { | |
| 1570 ASSERT(cell->value() == *function); | |
| 1571 GenerateLoadFunctionFromCell(cell, function, &miss); | |
| 1572 } | |
| 1573 | |
| 1574 Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite(); | |
| 1575 site->SetElementsKind(GetInitialFastElementsKind()); | |
| 1576 Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site); | |
| 1577 const int argc = arguments().immediate(); | |
| 1578 __ li(a0, Operand(argc)); | |
| 1579 __ li(a2, Operand(site_feedback_cell)); | |
| 1580 __ li(a1, Operand(function)); | |
| 1581 | |
| 1582 ArrayConstructorStub stub(isolate()); | |
| 1583 __ TailCallStub(&stub); | |
| 1584 | |
| 1585 HandlerFrontendFooter(&miss); | |
| 1586 | |
| 1587 // Return the generated code. | |
| 1588 return GetCode(type, name); | |
| 1589 } | |
| 1590 | |
| 1591 | |
| 1592 Handle<Code> CallStubCompiler::CompileArrayPushCall( | 1559 Handle<Code> CallStubCompiler::CompileArrayPushCall( |
| 1593 Handle<Object> object, | 1560 Handle<Object> object, |
| 1594 Handle<JSObject> holder, | 1561 Handle<JSObject> holder, |
| 1595 Handle<Cell> cell, | 1562 Handle<Cell> cell, |
| 1596 Handle<JSFunction> function, | 1563 Handle<JSFunction> function, |
| 1597 Handle<String> name, | 1564 Handle<String> name, |
| 1598 Code::StubType type) { | 1565 Code::StubType type) { |
| 1599 // If object is not an array or is observed or sealed, bail out to regular | 1566 // If object is not an array or is observed or sealed, bail out to regular |
| 1600 // call. | 1567 // call. |
| 1601 if (!object->IsJSArray() || | 1568 if (!object->IsJSArray() || |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1898 __ TailCallExternalReference( | 1865 __ TailCallExternalReference( |
| 1899 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); | 1866 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); |
| 1900 | 1867 |
| 1901 HandlerFrontendFooter(&miss); | 1868 HandlerFrontendFooter(&miss); |
| 1902 | 1869 |
| 1903 // Return the generated code. | 1870 // Return the generated code. |
| 1904 return GetCode(type, name); | 1871 return GetCode(type, name); |
| 1905 } | 1872 } |
| 1906 | 1873 |
| 1907 | 1874 |
| 1908 Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall( | |
| 1909 Handle<Object> object, | |
| 1910 Handle<JSObject> holder, | |
| 1911 Handle<Cell> cell, | |
| 1912 Handle<JSFunction> function, | |
| 1913 Handle<String> name, | |
| 1914 Code::StubType type) { | |
| 1915 // If object is not a string, bail out to regular call. | |
| 1916 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null(); | |
| 1917 | |
| 1918 Label miss; | |
| 1919 Label name_miss; | |
| 1920 Label index_out_of_range; | |
| 1921 | |
| 1922 Label* index_out_of_range_label = &index_out_of_range; | |
| 1923 | |
| 1924 if (kind_ == Code::CALL_IC && | |
| 1925 (CallICBase::StringStubState::decode(extra_state()) == | |
| 1926 DEFAULT_STRING_STUB)) { | |
| 1927 index_out_of_range_label = &miss; | |
| 1928 } | |
| 1929 | |
| 1930 HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss); | |
| 1931 | |
| 1932 Register receiver = a0; | |
| 1933 Register index = t1; | |
| 1934 Register result = a1; | |
| 1935 const int argc = arguments().immediate(); | |
| 1936 __ lw(receiver, MemOperand(sp, argc * kPointerSize)); | |
| 1937 if (argc > 0) { | |
| 1938 __ lw(index, MemOperand(sp, (argc - 1) * kPointerSize)); | |
| 1939 } else { | |
| 1940 __ LoadRoot(index, Heap::kUndefinedValueRootIndex); | |
| 1941 } | |
| 1942 | |
| 1943 StringCharCodeAtGenerator generator(receiver, | |
| 1944 index, | |
| 1945 result, | |
| 1946 &miss, // When not a string. | |
| 1947 &miss, // When not a number. | |
| 1948 index_out_of_range_label, | |
| 1949 STRING_INDEX_IS_NUMBER); | |
| 1950 generator.GenerateFast(masm()); | |
| 1951 __ mov(v0, result); | |
| 1952 __ DropAndRet(argc + 1); | |
| 1953 | |
| 1954 StubRuntimeCallHelper call_helper; | |
| 1955 generator.GenerateSlow(masm(), call_helper); | |
| 1956 | |
| 1957 if (index_out_of_range.is_linked()) { | |
| 1958 __ bind(&index_out_of_range); | |
| 1959 __ LoadRoot(v0, Heap::kNanValueRootIndex); | |
| 1960 __ DropAndRet(argc + 1); | |
| 1961 } | |
| 1962 | |
| 1963 __ bind(&miss); | |
| 1964 // Restore function name in a2. | |
| 1965 __ li(a2, name); | |
| 1966 HandlerFrontendFooter(&name_miss); | |
| 1967 | |
| 1968 // Return the generated code. | |
| 1969 return GetCode(type, name); | |
| 1970 } | |
| 1971 | |
| 1972 | |
| 1973 Handle<Code> CallStubCompiler::CompileStringCharAtCall( | |
| 1974 Handle<Object> object, | |
| 1975 Handle<JSObject> holder, | |
| 1976 Handle<Cell> cell, | |
| 1977 Handle<JSFunction> function, | |
| 1978 Handle<String> name, | |
| 1979 Code::StubType type) { | |
| 1980 // If object is not a string, bail out to regular call. | |
| 1981 if (!object->IsString() || !cell.is_null()) return Handle<Code>::null(); | |
| 1982 | |
| 1983 const int argc = arguments().immediate(); | |
| 1984 Label miss; | |
| 1985 Label name_miss; | |
| 1986 Label index_out_of_range; | |
| 1987 Label* index_out_of_range_label = &index_out_of_range; | |
| 1988 if (kind_ == Code::CALL_IC && | |
| 1989 (CallICBase::StringStubState::decode(extra_state()) == | |
| 1990 DEFAULT_STRING_STUB)) { | |
| 1991 index_out_of_range_label = &miss; | |
| 1992 } | |
| 1993 | |
| 1994 HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss); | |
| 1995 | |
| 1996 Register receiver = a0; | |
| 1997 Register index = t1; | |
| 1998 Register scratch = a3; | |
| 1999 Register result = a1; | |
| 2000 if (argc > 0) { | |
| 2001 __ lw(index, MemOperand(sp, (argc - 1) * kPointerSize)); | |
| 2002 } else { | |
| 2003 __ LoadRoot(index, Heap::kUndefinedValueRootIndex); | |
| 2004 } | |
| 2005 | |
| 2006 StringCharAtGenerator generator(receiver, | |
| 2007 index, | |
| 2008 scratch, | |
| 2009 result, | |
| 2010 &miss, // When not a string. | |
| 2011 &miss, // When not a number. | |
| 2012 index_out_of_range_label, | |
| 2013 STRING_INDEX_IS_NUMBER); | |
| 2014 generator.GenerateFast(masm()); | |
| 2015 __ mov(v0, result); | |
| 2016 __ DropAndRet(argc + 1); | |
| 2017 | |
| 2018 StubRuntimeCallHelper call_helper; | |
| 2019 generator.GenerateSlow(masm(), call_helper); | |
| 2020 | |
| 2021 if (index_out_of_range.is_linked()) { | |
| 2022 __ bind(&index_out_of_range); | |
| 2023 __ LoadRoot(v0, Heap::kempty_stringRootIndex); | |
| 2024 __ DropAndRet(argc + 1); | |
| 2025 } | |
| 2026 | |
| 2027 __ bind(&miss); | |
| 2028 // Restore function name in a2. | |
| 2029 __ li(a2, name); | |
| 2030 HandlerFrontendFooter(&name_miss); | |
| 2031 | |
| 2032 // Return the generated code. | |
| 2033 return GetCode(type, name); | |
| 2034 } | |
| 2035 | |
| 2036 | |
| 2037 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( | |
| 2038 Handle<Object> object, | |
| 2039 Handle<JSObject> holder, | |
| 2040 Handle<Cell> cell, | |
| 2041 Handle<JSFunction> function, | |
| 2042 Handle<String> name, | |
| 2043 Code::StubType type) { | |
| 2044 const int argc = arguments().immediate(); | |
| 2045 | |
| 2046 // If the object is not a JSObject or we got an unexpected number of | |
| 2047 // arguments, bail out to the regular call. | |
| 2048 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); | |
| 2049 | |
| 2050 Label miss; | |
| 2051 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | |
| 2052 if (!cell.is_null()) { | |
| 2053 ASSERT(cell->value() == *function); | |
| 2054 GenerateLoadFunctionFromCell(cell, function, &miss); | |
| 2055 } | |
| 2056 | |
| 2057 // Load the char code argument. | |
| 2058 Register code = a1; | |
| 2059 __ lw(code, MemOperand(sp, 0 * kPointerSize)); | |
| 2060 | |
| 2061 // Check the code is a smi. | |
| 2062 Label slow; | |
| 2063 STATIC_ASSERT(kSmiTag == 0); | |
| 2064 __ JumpIfNotSmi(code, &slow); | |
| 2065 | |
| 2066 // Convert the smi code to uint16. | |
| 2067 __ And(code, code, Operand(Smi::FromInt(0xffff))); | |
| 2068 | |
| 2069 StringCharFromCodeGenerator generator(code, v0); | |
| 2070 generator.GenerateFast(masm()); | |
| 2071 __ DropAndRet(argc + 1); | |
| 2072 | |
| 2073 StubRuntimeCallHelper call_helper; | |
| 2074 generator.GenerateSlow(masm(), call_helper); | |
| 2075 | |
| 2076 __ bind(&slow); | |
| 2077 // We do not have to patch the receiver because the function makes no use of | |
| 2078 // it. | |
| 2079 GenerateJumpFunctionIgnoreReceiver(function); | |
| 2080 | |
| 2081 HandlerFrontendFooter(&miss); | |
| 2082 | |
| 2083 // Return the generated code. | |
| 2084 return GetCode(type, name); | |
| 2085 } | |
| 2086 | |
| 2087 | |
| 2088 Handle<Code> CallStubCompiler::CompileMathFloorCall( | |
| 2089 Handle<Object> object, | |
| 2090 Handle<JSObject> holder, | |
| 2091 Handle<Cell> cell, | |
| 2092 Handle<JSFunction> function, | |
| 2093 Handle<String> name, | |
| 2094 Code::StubType type) { | |
| 2095 const int argc = arguments().immediate(); | |
| 2096 // If the object is not a JSObject or we got an unexpected number of | |
| 2097 // arguments, bail out to the regular call. | |
| 2098 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); | |
| 2099 | |
| 2100 Label miss, slow; | |
| 2101 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | |
| 2102 if (!cell.is_null()) { | |
| 2103 ASSERT(cell->value() == *function); | |
| 2104 GenerateLoadFunctionFromCell(cell, function, &miss); | |
| 2105 } | |
| 2106 | |
| 2107 // Load the (only) argument into v0. | |
| 2108 __ lw(v0, MemOperand(sp, 0 * kPointerSize)); | |
| 2109 | |
| 2110 // If the argument is a smi, just return. | |
| 2111 STATIC_ASSERT(kSmiTag == 0); | |
| 2112 __ SmiTst(v0, t0); | |
| 2113 __ DropAndRet(argc + 1, eq, t0, Operand(zero_reg)); | |
| 2114 | |
| 2115 __ CheckMap(v0, a1, Heap::kHeapNumberMapRootIndex, &slow, DONT_DO_SMI_CHECK); | |
| 2116 | |
| 2117 Label wont_fit_smi, no_fpu_error, restore_fcsr_and_return; | |
| 2118 | |
| 2119 // If fpu is enabled, we use the floor instruction. | |
| 2120 | |
| 2121 // Load the HeapNumber value. | |
| 2122 __ ldc1(f0, FieldMemOperand(v0, HeapNumber::kValueOffset)); | |
| 2123 | |
| 2124 // Backup FCSR. | |
| 2125 __ cfc1(a3, FCSR); | |
| 2126 // Clearing FCSR clears the exception mask with no side-effects. | |
| 2127 __ ctc1(zero_reg, FCSR); | |
| 2128 // Convert the argument to an integer. | |
| 2129 __ floor_w_d(f0, f0); | |
| 2130 | |
| 2131 // Start checking for special cases. | |
| 2132 // Get the argument exponent and clear the sign bit. | |
| 2133 __ lw(t1, FieldMemOperand(v0, HeapNumber::kValueOffset + kPointerSize)); | |
| 2134 __ And(t2, t1, Operand(~HeapNumber::kSignMask)); | |
| 2135 __ srl(t2, t2, HeapNumber::kMantissaBitsInTopWord); | |
| 2136 | |
| 2137 // Retrieve FCSR and check for fpu errors. | |
| 2138 __ cfc1(t5, FCSR); | |
| 2139 __ And(t5, t5, Operand(kFCSRExceptionFlagMask)); | |
| 2140 __ Branch(&no_fpu_error, eq, t5, Operand(zero_reg)); | |
| 2141 | |
| 2142 // Check for NaN, Infinity, and -Infinity. | |
| 2143 // They are invariant through a Math.Floor call, so just | |
| 2144 // return the original argument. | |
| 2145 __ Subu(t3, t2, Operand(HeapNumber::kExponentMask | |
| 2146 >> HeapNumber::kMantissaBitsInTopWord)); | |
| 2147 __ Branch(&restore_fcsr_and_return, eq, t3, Operand(zero_reg)); | |
| 2148 // We had an overflow or underflow in the conversion. Check if we | |
| 2149 // have a big exponent. | |
| 2150 // If greater or equal, the argument is already round and in v0. | |
| 2151 __ Branch(&restore_fcsr_and_return, ge, t3, | |
| 2152 Operand(HeapNumber::kMantissaBits)); | |
| 2153 __ Branch(&wont_fit_smi); | |
| 2154 | |
| 2155 __ bind(&no_fpu_error); | |
| 2156 // Move the result back to v0. | |
| 2157 __ mfc1(v0, f0); | |
| 2158 // Check if the result fits into a smi. | |
| 2159 __ Addu(a1, v0, Operand(0x40000000)); | |
| 2160 __ Branch(&wont_fit_smi, lt, a1, Operand(zero_reg)); | |
| 2161 // Tag the result. | |
| 2162 STATIC_ASSERT(kSmiTag == 0); | |
| 2163 __ sll(v0, v0, kSmiTagSize); | |
| 2164 | |
| 2165 // Check for -0. | |
| 2166 __ Branch(&restore_fcsr_and_return, ne, v0, Operand(zero_reg)); | |
| 2167 // t1 already holds the HeapNumber exponent. | |
| 2168 __ And(t0, t1, Operand(HeapNumber::kSignMask)); | |
| 2169 // If our HeapNumber is negative it was -0, so load its address and return. | |
| 2170 // Else v0 is loaded with 0, so we can also just return. | |
| 2171 __ Branch(&restore_fcsr_and_return, eq, t0, Operand(zero_reg)); | |
| 2172 __ lw(v0, MemOperand(sp, 0 * kPointerSize)); | |
| 2173 | |
| 2174 __ bind(&restore_fcsr_and_return); | |
| 2175 // Restore FCSR and return. | |
| 2176 __ ctc1(a3, FCSR); | |
| 2177 | |
| 2178 __ DropAndRet(argc + 1); | |
| 2179 | |
| 2180 __ bind(&wont_fit_smi); | |
| 2181 // Restore FCSR and fall to slow case. | |
| 2182 __ ctc1(a3, FCSR); | |
| 2183 | |
| 2184 __ bind(&slow); | |
| 2185 // We do not have to patch the receiver because the function makes no use of | |
| 2186 // it. | |
| 2187 GenerateJumpFunctionIgnoreReceiver(function); | |
| 2188 | |
| 2189 HandlerFrontendFooter(&miss); | |
| 2190 | |
| 2191 // Return the generated code. | |
| 2192 return GetCode(type, name); | |
| 2193 } | |
| 2194 | |
| 2195 | |
| 2196 Handle<Code> CallStubCompiler::CompileMathAbsCall( | |
| 2197 Handle<Object> object, | |
| 2198 Handle<JSObject> holder, | |
| 2199 Handle<Cell> cell, | |
| 2200 Handle<JSFunction> function, | |
| 2201 Handle<String> name, | |
| 2202 Code::StubType type) { | |
| 2203 const int argc = arguments().immediate(); | |
| 2204 // If the object is not a JSObject or we got an unexpected number of | |
| 2205 // arguments, bail out to the regular call. | |
| 2206 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); | |
| 2207 | |
| 2208 Label miss; | |
| 2209 | |
| 2210 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | |
| 2211 if (!cell.is_null()) { | |
| 2212 ASSERT(cell->value() == *function); | |
| 2213 GenerateLoadFunctionFromCell(cell, function, &miss); | |
| 2214 } | |
| 2215 | |
| 2216 // Load the (only) argument into v0. | |
| 2217 __ lw(v0, MemOperand(sp, 0 * kPointerSize)); | |
| 2218 | |
| 2219 // Check if the argument is a smi. | |
| 2220 Label not_smi; | |
| 2221 STATIC_ASSERT(kSmiTag == 0); | |
| 2222 __ JumpIfNotSmi(v0, ¬_smi); | |
| 2223 | |
| 2224 // Do bitwise not or do nothing depending on the sign of the | |
| 2225 // argument. | |
| 2226 __ sra(t0, v0, kBitsPerInt - 1); | |
| 2227 __ Xor(a1, v0, t0); | |
| 2228 | |
| 2229 // Add 1 or do nothing depending on the sign of the argument. | |
| 2230 __ Subu(v0, a1, t0); | |
| 2231 | |
| 2232 // If the result is still negative, go to the slow case. | |
| 2233 // This only happens for the most negative smi. | |
| 2234 Label slow; | |
| 2235 __ Branch(&slow, lt, v0, Operand(zero_reg)); | |
| 2236 | |
| 2237 // Smi case done. | |
| 2238 __ DropAndRet(argc + 1); | |
| 2239 | |
| 2240 // Check if the argument is a heap number and load its exponent and | |
| 2241 // sign. | |
| 2242 __ bind(¬_smi); | |
| 2243 __ CheckMap(v0, a1, Heap::kHeapNumberMapRootIndex, &slow, DONT_DO_SMI_CHECK); | |
| 2244 __ lw(a1, FieldMemOperand(v0, HeapNumber::kExponentOffset)); | |
| 2245 | |
| 2246 // Check the sign of the argument. If the argument is positive, | |
| 2247 // just return it. | |
| 2248 Label negative_sign; | |
| 2249 __ And(t0, a1, Operand(HeapNumber::kSignMask)); | |
| 2250 __ Branch(&negative_sign, ne, t0, Operand(zero_reg)); | |
| 2251 __ DropAndRet(argc + 1); | |
| 2252 | |
| 2253 // If the argument is negative, clear the sign, and return a new | |
| 2254 // number. | |
| 2255 __ bind(&negative_sign); | |
| 2256 __ Xor(a1, a1, Operand(HeapNumber::kSignMask)); | |
| 2257 __ lw(a3, FieldMemOperand(v0, HeapNumber::kMantissaOffset)); | |
| 2258 __ LoadRoot(t2, Heap::kHeapNumberMapRootIndex); | |
| 2259 __ AllocateHeapNumber(v0, t0, t1, t2, &slow); | |
| 2260 __ sw(a1, FieldMemOperand(v0, HeapNumber::kExponentOffset)); | |
| 2261 __ sw(a3, FieldMemOperand(v0, HeapNumber::kMantissaOffset)); | |
| 2262 __ DropAndRet(argc + 1); | |
| 2263 | |
| 2264 __ bind(&slow); | |
| 2265 // We do not have to patch the receiver because the function makes no use of | |
| 2266 // it. | |
| 2267 GenerateJumpFunctionIgnoreReceiver(function); | |
| 2268 | |
| 2269 HandlerFrontendFooter(&miss); | |
| 2270 | |
| 2271 // Return the generated code. | |
| 2272 return GetCode(type, name); | |
| 2273 } | |
| 2274 | |
| 2275 | |
| 2276 Handle<Code> CallStubCompiler::CompileFastApiCall( | 1875 Handle<Code> CallStubCompiler::CompileFastApiCall( |
| 2277 const CallOptimization& optimization, | 1876 const CallOptimization& optimization, |
| 2278 Handle<Object> object, | 1877 Handle<Object> object, |
| 2279 Handle<JSObject> holder, | 1878 Handle<JSObject> holder, |
| 2280 Handle<Cell> cell, | 1879 Handle<Cell> cell, |
| 2281 Handle<JSFunction> function, | 1880 Handle<JSFunction> function, |
| 2282 Handle<String> name) { | 1881 Handle<String> name) { |
| 2283 | 1882 |
| 2284 Counters* counters = isolate()->counters(); | 1883 Counters* counters = isolate()->counters(); |
| 2285 | 1884 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2670 } | 2269 } |
| 2671 | 2270 |
| 2672 | 2271 |
| 2673 Register* KeyedStoreStubCompiler::registers() { | 2272 Register* KeyedStoreStubCompiler::registers() { |
| 2674 // receiver, name, value, scratch1, scratch2, scratch3. | 2273 // receiver, name, value, scratch1, scratch2, scratch3. |
| 2675 static Register registers[] = { a2, a1, a0, a3, t0, t1 }; | 2274 static Register registers[] = { a2, a1, a0, a3, t0, t1 }; |
| 2676 return registers; | 2275 return registers; |
| 2677 } | 2276 } |
| 2678 | 2277 |
| 2679 | 2278 |
| 2680 void KeyedLoadStubCompiler::GenerateNameCheck(Handle<Name> name, | |
| 2681 Register name_reg, | |
| 2682 Label* miss) { | |
| 2683 __ Branch(miss, ne, name_reg, Operand(name)); | |
| 2684 } | |
| 2685 | |
| 2686 | |
| 2687 void KeyedStoreStubCompiler::GenerateNameCheck(Handle<Name> name, | |
| 2688 Register name_reg, | |
| 2689 Label* miss) { | |
| 2690 __ Branch(miss, ne, name_reg, Operand(name)); | |
| 2691 } | |
| 2692 | |
| 2693 | |
| 2694 #undef __ | 2279 #undef __ |
| 2695 #define __ ACCESS_MASM(masm) | 2280 #define __ ACCESS_MASM(masm) |
| 2696 | 2281 |
| 2697 | 2282 |
| 2698 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, | 2283 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, |
| 2699 Register receiver, | 2284 Register receiver, |
| 2700 Handle<JSFunction> getter) { | 2285 Handle<JSFunction> getter) { |
| 2701 // ----------- S t a t e ------------- | 2286 // ----------- S t a t e ------------- |
| 2702 // -- a0 : receiver | 2287 // -- a0 : receiver |
| 2703 // -- a2 : name | 2288 // -- a2 : name |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2763 | 2348 |
| 2764 | 2349 |
| 2765 Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC( | 2350 Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC( |
| 2766 TypeHandleList* types, | 2351 TypeHandleList* types, |
| 2767 CodeHandleList* handlers, | 2352 CodeHandleList* handlers, |
| 2768 Handle<Name> name, | 2353 Handle<Name> name, |
| 2769 Code::StubType type, | 2354 Code::StubType type, |
| 2770 IcCheckType check) { | 2355 IcCheckType check) { |
| 2771 Label miss; | 2356 Label miss; |
| 2772 | 2357 |
| 2773 if (check == PROPERTY) { | 2358 if (check == PROPERTY && |
| 2774 GenerateNameCheck(name, this->name(), &miss); | 2359 (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC)) { |
| 2360 __ Branch(&miss, ne, this->name(), Operand(name)); |
| 2775 } | 2361 } |
| 2776 | 2362 |
| 2777 Label number_case; | 2363 Label number_case; |
| 2778 Label* smi_target = IncludesNumberType(types) ? &number_case : &miss; | 2364 Label* smi_target = IncludesNumberType(types) ? &number_case : &miss; |
| 2779 __ JumpIfSmi(receiver(), smi_target); | 2365 __ JumpIfSmi(receiver(), smi_target); |
| 2780 | 2366 |
| 2781 Register map_reg = scratch1(); | 2367 Register map_reg = scratch1(); |
| 2782 | 2368 |
| 2783 int receiver_count = types->length(); | 2369 int receiver_count = types->length(); |
| 2784 int number_of_handled_maps = 0; | 2370 int number_of_handled_maps = 0; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2884 // ----------------------------------- | 2470 // ----------------------------------- |
| 2885 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2471 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 2886 } | 2472 } |
| 2887 | 2473 |
| 2888 | 2474 |
| 2889 #undef __ | 2475 #undef __ |
| 2890 | 2476 |
| 2891 } } // namespace v8::internal | 2477 } } // namespace v8::internal |
| 2892 | 2478 |
| 2893 #endif // V8_TARGET_ARCH_MIPS | 2479 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |