| 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2454 | 2454 |
| 2455 | 2455 |
| 2456 void CallICStub::Generate(MacroAssembler* masm) { | 2456 void CallICStub::Generate(MacroAssembler* masm) { |
| 2457 // r1 - function | 2457 // r1 - function |
| 2458 // r3 - slot id (Smi) | 2458 // r3 - slot id (Smi) |
| 2459 // r2 - vector | 2459 // r2 - vector |
| 2460 const int with_types_offset = | 2460 const int with_types_offset = |
| 2461 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); | 2461 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); |
| 2462 const int generic_offset = | 2462 const int generic_offset = |
| 2463 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); | 2463 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); |
| 2464 Label extra_checks_or_miss, call; | 2464 Label extra_checks_or_miss, call, call_function; |
| 2465 int argc = arg_count(); | 2465 int argc = arg_count(); |
| 2466 ParameterCount actual(argc); | 2466 ParameterCount actual(argc); |
| 2467 | 2467 |
| 2468 // The checks. First, does r1 match the recorded monomorphic target? | 2468 // The checks. First, does r1 match the recorded monomorphic target? |
| 2469 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); | 2469 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
| 2470 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); | 2470 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
| 2471 | 2471 |
| 2472 // We don't know that we have a weak cell. We might have a private symbol | 2472 // We don't know that we have a weak cell. We might have a private symbol |
| 2473 // or an AllocationSite, but the memory is safe to examine. | 2473 // or an AllocationSite, but the memory is safe to examine. |
| 2474 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to | 2474 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2491 // convincing us that we have a monomorphic JSFunction. | 2491 // convincing us that we have a monomorphic JSFunction. |
| 2492 __ JumpIfSmi(r1, &extra_checks_or_miss); | 2492 __ JumpIfSmi(r1, &extra_checks_or_miss); |
| 2493 | 2493 |
| 2494 // Increment the call count for monomorphic function calls. | 2494 // Increment the call count for monomorphic function calls. |
| 2495 __ add(r2, r2, Operand::PointerOffsetFromSmiKey(r3)); | 2495 __ add(r2, r2, Operand::PointerOffsetFromSmiKey(r3)); |
| 2496 __ add(r2, r2, Operand(FixedArray::kHeaderSize + kPointerSize)); | 2496 __ add(r2, r2, Operand(FixedArray::kHeaderSize + kPointerSize)); |
| 2497 __ ldr(r3, FieldMemOperand(r2, 0)); | 2497 __ ldr(r3, FieldMemOperand(r2, 0)); |
| 2498 __ add(r3, r3, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 2498 __ add(r3, r3, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
| 2499 __ str(r3, FieldMemOperand(r2, 0)); | 2499 __ str(r3, FieldMemOperand(r2, 0)); |
| 2500 | 2500 |
| 2501 __ bind(&call); | 2501 __ bind(&call_function); |
| 2502 __ mov(r0, Operand(argc)); | 2502 __ mov(r0, Operand(argc)); |
| 2503 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2503 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode()), |
| 2504 RelocInfo::CODE_TARGET); |
| 2504 | 2505 |
| 2505 __ bind(&extra_checks_or_miss); | 2506 __ bind(&extra_checks_or_miss); |
| 2506 Label uninitialized, miss, not_allocation_site; | 2507 Label uninitialized, miss, not_allocation_site; |
| 2507 | 2508 |
| 2508 __ CompareRoot(r4, Heap::kmegamorphic_symbolRootIndex); | 2509 __ CompareRoot(r4, Heap::kmegamorphic_symbolRootIndex); |
| 2509 __ b(eq, &call); | 2510 __ b(eq, &call); |
| 2510 | 2511 |
| 2511 // Verify that r4 contains an AllocationSite | 2512 // Verify that r4 contains an AllocationSite |
| 2512 __ ldr(r5, FieldMemOperand(r4, HeapObject::kMapOffset)); | 2513 __ ldr(r5, FieldMemOperand(r4, HeapObject::kMapOffset)); |
| 2513 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); | 2514 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2535 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); | 2536 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
| 2536 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); | 2537 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); |
| 2537 __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize)); | 2538 __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
| 2538 // We have to update statistics for runtime profiling. | 2539 // We have to update statistics for runtime profiling. |
| 2539 __ ldr(r4, FieldMemOperand(r2, with_types_offset)); | 2540 __ ldr(r4, FieldMemOperand(r2, with_types_offset)); |
| 2540 __ sub(r4, r4, Operand(Smi::FromInt(1))); | 2541 __ sub(r4, r4, Operand(Smi::FromInt(1))); |
| 2541 __ str(r4, FieldMemOperand(r2, with_types_offset)); | 2542 __ str(r4, FieldMemOperand(r2, with_types_offset)); |
| 2542 __ ldr(r4, FieldMemOperand(r2, generic_offset)); | 2543 __ ldr(r4, FieldMemOperand(r2, generic_offset)); |
| 2543 __ add(r4, r4, Operand(Smi::FromInt(1))); | 2544 __ add(r4, r4, Operand(Smi::FromInt(1))); |
| 2544 __ str(r4, FieldMemOperand(r2, generic_offset)); | 2545 __ str(r4, FieldMemOperand(r2, generic_offset)); |
| 2545 __ jmp(&call); | 2546 |
| 2547 __ bind(&call); |
| 2548 __ mov(r0, Operand(argc)); |
| 2549 __ Jump(masm->isolate()->builtins()->Call(convert_mode()), |
| 2550 RelocInfo::CODE_TARGET); |
| 2546 | 2551 |
| 2547 __ bind(&uninitialized); | 2552 __ bind(&uninitialized); |
| 2548 | 2553 |
| 2549 // We are going monomorphic, provided we actually have a JSFunction. | 2554 // We are going monomorphic, provided we actually have a JSFunction. |
| 2550 __ JumpIfSmi(r1, &miss); | 2555 __ JumpIfSmi(r1, &miss); |
| 2551 | 2556 |
| 2552 // Goto miss case if we do not have a function. | 2557 // Goto miss case if we do not have a function. |
| 2553 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE); | 2558 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE); |
| 2554 __ b(ne, &miss); | 2559 __ b(ne, &miss); |
| 2555 | 2560 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2582 // r3 - slot | 2587 // r3 - slot |
| 2583 // r1 - function | 2588 // r1 - function |
| 2584 { | 2589 { |
| 2585 FrameScope scope(masm, StackFrame::INTERNAL); | 2590 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2586 CreateWeakCellStub create_stub(masm->isolate()); | 2591 CreateWeakCellStub create_stub(masm->isolate()); |
| 2587 __ Push(r1); | 2592 __ Push(r1); |
| 2588 __ CallStub(&create_stub); | 2593 __ CallStub(&create_stub); |
| 2589 __ Pop(r1); | 2594 __ Pop(r1); |
| 2590 } | 2595 } |
| 2591 | 2596 |
| 2592 __ jmp(&call); | 2597 __ jmp(&call_function); |
| 2593 | 2598 |
| 2594 // We are here because tracing is on or we encountered a MISS case we can't | 2599 // We are here because tracing is on or we encountered a MISS case we can't |
| 2595 // handle here. | 2600 // handle here. |
| 2596 __ bind(&miss); | 2601 __ bind(&miss); |
| 2597 GenerateMiss(masm); | 2602 GenerateMiss(masm); |
| 2598 | 2603 |
| 2599 __ jmp(&call); | 2604 __ jmp(&call); |
| 2600 } | 2605 } |
| 2601 | 2606 |
| 2602 | 2607 |
| (...skipping 2780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5383 MemOperand(fp, 6 * kPointerSize), NULL); | 5388 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5384 } | 5389 } |
| 5385 | 5390 |
| 5386 | 5391 |
| 5387 #undef __ | 5392 #undef __ |
| 5388 | 5393 |
| 5389 } // namespace internal | 5394 } // namespace internal |
| 5390 } // namespace v8 | 5395 } // namespace v8 |
| 5391 | 5396 |
| 5392 #endif // V8_TARGET_ARCH_ARM | 5397 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |