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