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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 return true; | 909 return true; |
910 } | 910 } |
911 | 911 |
912 | 912 |
913 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 913 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
914 CEntryStub::GenerateAheadOfTime(isolate); | 914 CEntryStub::GenerateAheadOfTime(isolate); |
915 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); | 915 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
916 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); | 916 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); |
917 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 917 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
918 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); | 918 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); |
919 CreateWeakCellStub::GenerateAheadOfTime(isolate); | |
920 BinaryOpICStub::GenerateAheadOfTime(isolate); | 919 BinaryOpICStub::GenerateAheadOfTime(isolate); |
921 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); | 920 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); |
922 } | 921 } |
923 | 922 |
924 | 923 |
925 void CodeStub::GenerateFPStubs(Isolate* isolate) { | 924 void CodeStub::GenerateFPStubs(Isolate* isolate) { |
926 // Generate if not already in cache. | 925 // Generate if not already in cache. |
927 SaveFPRegsMode mode = kSaveFPRegs; | 926 SaveFPRegsMode mode = kSaveFPRegs; |
928 CEntryStub(isolate, 1, mode).GetCode(); | 927 CEntryStub(isolate, 1, mode).GetCode(); |
929 StoreBufferOverflowStub(isolate, mode).GetCode(); | 928 StoreBufferOverflowStub(isolate, mode).GetCode(); |
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2651 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); | 2650 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); |
2652 Label extra_checks_or_miss, slow_start; | 2651 Label extra_checks_or_miss, slow_start; |
2653 Label slow, non_function, wrap, cont; | 2652 Label slow, non_function, wrap, cont; |
2654 Label have_js_function; | 2653 Label have_js_function; |
2655 int argc = arg_count(); | 2654 int argc = arg_count(); |
2656 ParameterCount actual(argc); | 2655 ParameterCount actual(argc); |
2657 | 2656 |
2658 // The checks. First, does r1 match the recorded monomorphic target? | 2657 // The checks. First, does r1 match the recorded monomorphic target? |
2659 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); | 2658 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
2660 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); | 2659 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
2661 | 2660 __ cmp(r1, r4); |
2662 // We don't know that we have a weak cell. We might have a private symbol | |
2663 // or an AllocationSite, but the memory is safe to examine. | |
2664 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to | |
2665 // FixedArray. | |
2666 // WeakCell::kValueOffset - contains a JSFunction or Smi(0) | |
2667 // Symbol::kHashFieldSlot - if the low bit is 1, then the hash is not | |
2668 // computed, meaning that it can't appear to be a pointer. If the low bit is | |
2669 // 0, then hash is computed, but the 0 bit prevents the field from appearing | |
2670 // to be a pointer. | |
2671 STATIC_ASSERT(WeakCell::kSize >= kPointerSize); | |
2672 STATIC_ASSERT(AllocationSite::kTransitionInfoOffset == | |
2673 WeakCell::kValueOffset && | |
2674 WeakCell::kValueOffset == Symbol::kHashFieldSlot); | |
2675 | |
2676 __ ldr(r5, FieldMemOperand(r4, WeakCell::kValueOffset)); | |
2677 __ cmp(r1, r5); | |
2678 __ b(ne, &extra_checks_or_miss); | 2661 __ b(ne, &extra_checks_or_miss); |
2679 | 2662 |
2680 // The compare above could have been a SMI/SMI comparison. Guard against this | |
2681 // convincing us that we have a monomorphic JSFunction. | |
2682 __ JumpIfSmi(r1, &extra_checks_or_miss); | |
2683 | |
2684 __ bind(&have_js_function); | 2663 __ bind(&have_js_function); |
2685 if (CallAsMethod()) { | 2664 if (CallAsMethod()) { |
2686 EmitContinueIfStrictOrNative(masm, &cont); | 2665 EmitContinueIfStrictOrNative(masm, &cont); |
2687 // Compute the receiver in sloppy mode. | 2666 // Compute the receiver in sloppy mode. |
2688 __ ldr(r3, MemOperand(sp, argc * kPointerSize)); | 2667 __ ldr(r3, MemOperand(sp, argc * kPointerSize)); |
2689 | 2668 |
2690 __ JumpIfSmi(r3, &wrap); | 2669 __ JumpIfSmi(r3, &wrap); |
2691 __ CompareObjectType(r3, r4, r4, FIRST_SPEC_OBJECT_TYPE); | 2670 __ CompareObjectType(r3, r4, r4, FIRST_SPEC_OBJECT_TYPE); |
2692 __ b(lt, &wrap); | 2671 __ b(lt, &wrap); |
2693 | 2672 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2749 // behavior on MISS. | 2728 // behavior on MISS. |
2750 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4); | 2729 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4); |
2751 __ cmp(r1, r4); | 2730 __ cmp(r1, r4); |
2752 __ b(eq, &miss); | 2731 __ b(eq, &miss); |
2753 | 2732 |
2754 // Update stats. | 2733 // Update stats. |
2755 __ ldr(r4, FieldMemOperand(r2, with_types_offset)); | 2734 __ ldr(r4, FieldMemOperand(r2, with_types_offset)); |
2756 __ add(r4, r4, Operand(Smi::FromInt(1))); | 2735 __ add(r4, r4, Operand(Smi::FromInt(1))); |
2757 __ str(r4, FieldMemOperand(r2, with_types_offset)); | 2736 __ str(r4, FieldMemOperand(r2, with_types_offset)); |
2758 | 2737 |
2759 // Store the function. Use a stub since we need a frame for allocation. | 2738 // Store the function. |
2760 // r2 - vector | 2739 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
2761 // r3 - slot | 2740 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
2762 // r1 - function | 2741 __ str(r1, MemOperand(r4, 0)); |
2763 { | |
2764 FrameScope scope(masm, StackFrame::INTERNAL); | |
2765 CreateWeakCellStub create_stub(masm->isolate()); | |
2766 __ Push(r1); | |
2767 __ CallStub(&create_stub); | |
2768 __ Pop(r1); | |
2769 } | |
2770 | 2742 |
| 2743 // Update the write barrier. |
| 2744 __ mov(r5, r1); |
| 2745 __ RecordWrite(r2, r4, r5, kLRHasNotBeenSaved, kDontSaveFPRegs, |
| 2746 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
2771 __ jmp(&have_js_function); | 2747 __ jmp(&have_js_function); |
2772 | 2748 |
2773 // We are here because tracing is on or we encountered a MISS case we can't | 2749 // We are here because tracing is on or we encountered a MISS case we can't |
2774 // handle here. | 2750 // handle here. |
2775 __ bind(&miss); | 2751 __ bind(&miss); |
2776 GenerateMiss(masm); | 2752 GenerateMiss(masm); |
2777 | 2753 |
2778 // the slow case | 2754 // the slow case |
2779 __ bind(&slow_start); | 2755 __ bind(&slow_start); |
2780 // Check that the function is really a JavaScript function. | 2756 // Check that the function is really a JavaScript function. |
(...skipping 2186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4967 kStackUnwindSpace, NULL, | 4943 kStackUnwindSpace, NULL, |
4968 MemOperand(fp, 6 * kPointerSize), NULL); | 4944 MemOperand(fp, 6 * kPointerSize), NULL); |
4969 } | 4945 } |
4970 | 4946 |
4971 | 4947 |
4972 #undef __ | 4948 #undef __ |
4973 | 4949 |
4974 } } // namespace v8::internal | 4950 } } // namespace v8::internal |
4975 | 4951 |
4976 #endif // V8_TARGET_ARCH_ARM | 4952 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |