| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
| 6 | 6 |
| 7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
| (...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2217 index_, | 2217 index_, |
| 2218 result_, | 2218 result_, |
| 2219 &call_runtime_); | 2219 &call_runtime_); |
| 2220 | 2220 |
| 2221 __ SmiTag(result_); | 2221 __ SmiTag(result_); |
| 2222 __ bind(&exit_); | 2222 __ bind(&exit_); |
| 2223 } | 2223 } |
| 2224 | 2224 |
| 2225 | 2225 |
| 2226 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { | 2226 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
| 2227 // a0 - number of arguments - if argc_in_register() is true. | |
| 2228 // a1 - function | 2227 // a1 - function |
| 2229 // a3 - slot id | 2228 // a3 - slot id |
| 2230 // a2 - vector | 2229 // a2 - vector |
| 2231 // a4 - allocation site (loaded from vector[slot]) | 2230 // a4 - allocation site (loaded from vector[slot]) |
| 2232 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, at); | 2231 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, at); |
| 2233 __ Branch(miss, ne, a1, Operand(at)); | 2232 __ Branch(miss, ne, a1, Operand(at)); |
| 2234 | 2233 |
| 2234 __ li(a0, Operand(arg_count())); |
| 2235 |
| 2235 // Increment the call count for monomorphic function calls. | 2236 // Increment the call count for monomorphic function calls. |
| 2236 __ dsrl(a5, a3, kSmiShiftSize + 1 - kPointerSizeLog2); | 2237 __ dsrl(t0, a3, 32 - kPointerSizeLog2); |
| 2237 __ Daddu(a3, a2, Operand(a5)); | 2238 __ Daddu(a3, a2, Operand(t0)); |
| 2238 __ ld(a5, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); | 2239 __ ld(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); |
| 2239 __ Daddu(a5, a5, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 2240 __ Daddu(t0, t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
| 2240 __ sd(a5, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); | 2241 __ sd(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); |
| 2241 | 2242 |
| 2242 __ mov(a2, a4); | 2243 __ mov(a2, a4); |
| 2243 __ mov(a3, a1); | 2244 __ mov(a3, a1); |
| 2244 if (argc_in_register()) { | 2245 ArrayConstructorStub stub(masm->isolate(), arg_count()); |
| 2245 // Pass a default ArgumentCountKey::Any since the argc is only available | 2246 __ TailCallStub(&stub); |
| 2246 // in a0. We do not have the actual count here. | |
| 2247 ArrayConstructorStub stub(masm->isolate()); | |
| 2248 __ TailCallStub(&stub); | |
| 2249 } else { | |
| 2250 // arg_count() is expected in a0 if the arg_count() >= 2 | |
| 2251 // (ArgumentCountKey::MORE_THAN_ONE). | |
| 2252 ArrayConstructorStub stub(masm->isolate(), arg_count()); | |
| 2253 __ TailCallStub(&stub); | |
| 2254 } | |
| 2255 } | 2247 } |
| 2256 | 2248 |
| 2257 | 2249 |
| 2258 void CallICStub::Generate(MacroAssembler* masm) { | 2250 void CallICStub::Generate(MacroAssembler* masm) { |
| 2259 // a0 - number of arguments - if argc_in_register() is true. | |
| 2260 // a1 - function | 2251 // a1 - function |
| 2261 // a3 - slot id (Smi) | 2252 // a3 - slot id (Smi) |
| 2262 // a2 - vector | 2253 // a2 - vector |
| 2263 Label extra_checks_or_miss, call, call_function; | 2254 Label extra_checks_or_miss, call, call_function; |
| 2264 if (!argc_in_register()) { | 2255 int argc = arg_count(); |
| 2265 int argc = arg_count(); | 2256 ParameterCount actual(argc); |
| 2266 __ li(a0, argc); | |
| 2267 } | |
| 2268 | 2257 |
| 2269 // The checks. First, does a1 match the recorded monomorphic target? | 2258 // The checks. First, does r1 match the recorded monomorphic target? |
| 2270 __ dsrl(a4, a3, kSmiShiftSize + 1 - kPointerSizeLog2); | 2259 __ dsrl(a4, a3, 32 - kPointerSizeLog2); |
| 2271 __ Daddu(a4, a2, Operand(a4)); | 2260 __ Daddu(a4, a2, Operand(a4)); |
| 2272 __ ld(a4, FieldMemOperand(a4, FixedArray::kHeaderSize)); | 2261 __ ld(a4, FieldMemOperand(a4, FixedArray::kHeaderSize)); |
| 2273 | 2262 |
| 2274 // We don't know that we have a weak cell. We might have a private symbol | 2263 // We don't know that we have a weak cell. We might have a private symbol |
| 2275 // or an AllocationSite, but the memory is safe to examine. | 2264 // or an AllocationSite, but the memory is safe to examine. |
| 2276 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to | 2265 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to |
| 2277 // FixedArray. | 2266 // FixedArray. |
| 2278 // WeakCell::kValueOffset - contains a JSFunction or Smi(0) | 2267 // WeakCell::kValueOffset - contains a JSFunction or Smi(0) |
| 2279 // Symbol::kHashFieldSlot - if the low bit is 1, then the hash is not | 2268 // Symbol::kHashFieldSlot - if the low bit is 1, then the hash is not |
| 2280 // computed, meaning that it can't appear to be a pointer. If the low bit is | 2269 // computed, meaning that it can't appear to be a pointer. If the low bit is |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2295 // Increment the call count for monomorphic function calls. | 2284 // Increment the call count for monomorphic function calls. |
| 2296 __ dsrl(t0, a3, 32 - kPointerSizeLog2); | 2285 __ dsrl(t0, a3, 32 - kPointerSizeLog2); |
| 2297 __ Daddu(a3, a2, Operand(t0)); | 2286 __ Daddu(a3, a2, Operand(t0)); |
| 2298 __ ld(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); | 2287 __ ld(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); |
| 2299 __ Daddu(t0, t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 2288 __ Daddu(t0, t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
| 2300 __ sd(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); | 2289 __ sd(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); |
| 2301 | 2290 |
| 2302 __ bind(&call_function); | 2291 __ bind(&call_function); |
| 2303 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), | 2292 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), |
| 2304 tail_call_mode()), | 2293 tail_call_mode()), |
| 2305 RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg)); | 2294 RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg), |
| 2295 USE_DELAY_SLOT); |
| 2296 __ li(a0, Operand(argc)); // In delay slot. |
| 2306 | 2297 |
| 2307 __ bind(&extra_checks_or_miss); | 2298 __ bind(&extra_checks_or_miss); |
| 2308 Label uninitialized, miss, not_allocation_site; | 2299 Label uninitialized, miss, not_allocation_site; |
| 2309 | 2300 |
| 2310 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); | 2301 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
| 2311 __ Branch(&call, eq, a4, Operand(at)); | 2302 __ Branch(&call, eq, a4, Operand(at)); |
| 2312 | 2303 |
| 2313 // Verify that a4 contains an AllocationSite | 2304 // Verify that a4 contains an AllocationSite |
| 2314 __ ld(a5, FieldMemOperand(a4, HeapObject::kMapOffset)); | 2305 __ ld(a5, FieldMemOperand(a4, HeapObject::kMapOffset)); |
| 2315 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | 2306 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2333 __ AssertNotSmi(a4); | 2324 __ AssertNotSmi(a4); |
| 2334 __ GetObjectType(a4, a5, a5); | 2325 __ GetObjectType(a4, a5, a5); |
| 2335 __ Branch(&miss, ne, a5, Operand(JS_FUNCTION_TYPE)); | 2326 __ Branch(&miss, ne, a5, Operand(JS_FUNCTION_TYPE)); |
| 2336 __ dsrl(a4, a3, 32 - kPointerSizeLog2); | 2327 __ dsrl(a4, a3, 32 - kPointerSizeLog2); |
| 2337 __ Daddu(a4, a2, Operand(a4)); | 2328 __ Daddu(a4, a2, Operand(a4)); |
| 2338 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); | 2329 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
| 2339 __ sd(at, FieldMemOperand(a4, FixedArray::kHeaderSize)); | 2330 __ sd(at, FieldMemOperand(a4, FixedArray::kHeaderSize)); |
| 2340 | 2331 |
| 2341 __ bind(&call); | 2332 __ bind(&call); |
| 2342 __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), | 2333 __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), |
| 2343 RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg)); | 2334 RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg), |
| 2335 USE_DELAY_SLOT); |
| 2336 __ li(a0, Operand(argc)); // In delay slot. |
| 2344 | 2337 |
| 2345 __ bind(&uninitialized); | 2338 __ bind(&uninitialized); |
| 2346 | 2339 |
| 2347 // We are going monomorphic, provided we actually have a JSFunction. | 2340 // We are going monomorphic, provided we actually have a JSFunction. |
| 2348 __ JumpIfSmi(a1, &miss); | 2341 __ JumpIfSmi(a1, &miss); |
| 2349 | 2342 |
| 2350 // Goto miss case if we do not have a function. | 2343 // Goto miss case if we do not have a function. |
| 2351 __ GetObjectType(a1, a4, a4); | 2344 __ GetObjectType(a1, a4, a4); |
| 2352 __ Branch(&miss, ne, a4, Operand(JS_FUNCTION_TYPE)); | 2345 __ Branch(&miss, ne, a4, Operand(JS_FUNCTION_TYPE)); |
| 2353 | 2346 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2368 __ li(t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 2361 __ li(t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
| 2369 __ sd(t0, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize)); | 2362 __ sd(t0, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize)); |
| 2370 | 2363 |
| 2371 // Store the function. Use a stub since we need a frame for allocation. | 2364 // Store the function. Use a stub since we need a frame for allocation. |
| 2372 // a2 - vector | 2365 // a2 - vector |
| 2373 // a3 - slot | 2366 // a3 - slot |
| 2374 // a1 - function | 2367 // a1 - function |
| 2375 { | 2368 { |
| 2376 FrameScope scope(masm, StackFrame::INTERNAL); | 2369 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2377 CreateWeakCellStub create_stub(masm->isolate()); | 2370 CreateWeakCellStub create_stub(masm->isolate()); |
| 2378 __ SmiTag(a0); | 2371 __ Push(a1); |
| 2379 __ Push(a0, a1); | |
| 2380 __ CallStub(&create_stub); | 2372 __ CallStub(&create_stub); |
| 2381 __ Pop(a0, a1); | 2373 __ Pop(a1); |
| 2382 __ SmiUntag(a0); | |
| 2383 } | 2374 } |
| 2384 | 2375 |
| 2385 __ Branch(&call_function); | 2376 __ Branch(&call_function); |
| 2386 | 2377 |
| 2387 // We are here because tracing is on or we encountered a MISS case we can't | 2378 // We are here because tracing is on or we encountered a MISS case we can't |
| 2388 // handle here. | 2379 // handle here. |
| 2389 __ bind(&miss); | 2380 __ bind(&miss); |
| 2390 GenerateMiss(masm); | 2381 GenerateMiss(masm); |
| 2391 | 2382 |
| 2392 __ Branch(&call); | 2383 __ Branch(&call); |
| 2393 } | 2384 } |
| 2394 | 2385 |
| 2395 | 2386 |
| 2396 void CallICStub::GenerateMiss(MacroAssembler* masm) { | 2387 void CallICStub::GenerateMiss(MacroAssembler* masm) { |
| 2397 FrameScope scope(masm, StackFrame::INTERNAL); | 2388 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2398 | 2389 |
| 2399 __ SmiTag(a0); | 2390 // Push the receiver and the function and feedback info. |
| 2400 // Push number of arguments, receiver, function and feedback info. | 2391 __ Push(a1, a2, a3); |
| 2401 __ Push(a0, a1, a2, a3); | |
| 2402 | 2392 |
| 2403 // Call the entry. | 2393 // Call the entry. |
| 2404 __ CallRuntime(Runtime::kCallIC_Miss); | 2394 __ CallRuntime(Runtime::kCallIC_Miss); |
| 2405 | 2395 |
| 2406 // Move result to a1 and exit the internal frame. | 2396 // Move result to a1 and exit the internal frame. |
| 2407 __ mov(a1, v0); | 2397 __ mov(a1, v0); |
| 2408 | |
| 2409 // Restore a0. | |
| 2410 __ Pop(a0); | |
| 2411 __ SmiUntag(a0); | |
| 2412 } | 2398 } |
| 2413 | 2399 |
| 2414 | 2400 |
| 2415 void StringCharCodeAtGenerator::GenerateSlow( | 2401 void StringCharCodeAtGenerator::GenerateSlow( |
| 2416 MacroAssembler* masm, EmbedMode embed_mode, | 2402 MacroAssembler* masm, EmbedMode embed_mode, |
| 2417 const RuntimeCallHelper& call_helper) { | 2403 const RuntimeCallHelper& call_helper) { |
| 2418 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); | 2404 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); |
| 2419 | 2405 |
| 2420 // Index is not a smi. | 2406 // Index is not a smi. |
| 2421 __ bind(&index_not_smi_); | 2407 __ bind(&index_not_smi_); |
| (...skipping 3407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5829 return_value_operand, NULL); | 5815 return_value_operand, NULL); |
| 5830 } | 5816 } |
| 5831 | 5817 |
| 5832 | 5818 |
| 5833 #undef __ | 5819 #undef __ |
| 5834 | 5820 |
| 5835 } // namespace internal | 5821 } // namespace internal |
| 5836 } // namespace v8 | 5822 } // namespace v8 |
| 5837 | 5823 |
| 5838 #endif // V8_TARGET_ARCH_MIPS64 | 5824 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |