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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
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 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 return true; | 994 return true; |
995 } | 995 } |
996 | 996 |
997 | 997 |
998 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 998 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
999 CEntryStub::GenerateAheadOfTime(isolate); | 999 CEntryStub::GenerateAheadOfTime(isolate); |
1000 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); | 1000 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
1001 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); | 1001 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); |
1002 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 1002 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
1003 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); | 1003 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); |
| 1004 CreateWeakCellStub::GenerateAheadOfTime(isolate); |
1004 BinaryOpICStub::GenerateAheadOfTime(isolate); | 1005 BinaryOpICStub::GenerateAheadOfTime(isolate); |
1005 StoreRegistersStateStub::GenerateAheadOfTime(isolate); | 1006 StoreRegistersStateStub::GenerateAheadOfTime(isolate); |
1006 RestoreRegistersStateStub::GenerateAheadOfTime(isolate); | 1007 RestoreRegistersStateStub::GenerateAheadOfTime(isolate); |
1007 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); | 1008 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); |
1008 } | 1009 } |
1009 | 1010 |
1010 | 1011 |
1011 void StoreRegistersStateStub::GenerateAheadOfTime(Isolate* isolate) { | 1012 void StoreRegistersStateStub::GenerateAheadOfTime(Isolate* isolate) { |
1012 StoreRegistersStateStub stub(isolate); | 1013 StoreRegistersStateStub stub(isolate); |
1013 stub.GetCode(); | 1014 stub.GetCode(); |
(...skipping 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2790 Label extra_checks_or_miss, slow_start; | 2791 Label extra_checks_or_miss, slow_start; |
2791 Label slow, non_function, wrap, cont; | 2792 Label slow, non_function, wrap, cont; |
2792 Label have_js_function; | 2793 Label have_js_function; |
2793 int argc = arg_count(); | 2794 int argc = arg_count(); |
2794 ParameterCount actual(argc); | 2795 ParameterCount actual(argc); |
2795 | 2796 |
2796 // The checks. First, does r1 match the recorded monomorphic target? | 2797 // The checks. First, does r1 match the recorded monomorphic target? |
2797 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); | 2798 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); |
2798 __ Addu(t0, a2, Operand(t0)); | 2799 __ Addu(t0, a2, Operand(t0)); |
2799 __ lw(t0, FieldMemOperand(t0, FixedArray::kHeaderSize)); | 2800 __ lw(t0, FieldMemOperand(t0, FixedArray::kHeaderSize)); |
2800 __ Branch(&extra_checks_or_miss, ne, a1, Operand(t0)); | 2801 |
| 2802 // We don't know that we have a weak cell. We might have a private symbol |
| 2803 // or an AllocationSite, but the memory is safe to examine. |
| 2804 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to |
| 2805 // FixedArray. |
| 2806 // WeakCell::kValueOffset - contains a JSFunction or Smi(0) |
| 2807 // Symbol::kHashFieldSlot - if the low bit is 1, then the hash is not |
| 2808 // computed, meaning that it can't appear to be a pointer. If the low bit is |
| 2809 // 0, then hash is computed, but the 0 bit prevents the field from appearing |
| 2810 // to be a pointer. |
| 2811 STATIC_ASSERT(WeakCell::kSize >= kPointerSize); |
| 2812 STATIC_ASSERT(AllocationSite::kTransitionInfoOffset == |
| 2813 WeakCell::kValueOffset && |
| 2814 WeakCell::kValueOffset == Symbol::kHashFieldSlot); |
| 2815 |
| 2816 __ lw(t1, FieldMemOperand(t0, WeakCell::kValueOffset)); |
| 2817 __ Branch(&extra_checks_or_miss, ne, a1, Operand(t1)); |
| 2818 |
| 2819 // The compare above could have been a SMI/SMI comparison. Guard against this |
| 2820 // convincing us that we have a monomorphic JSFunction. |
| 2821 __ JumpIfSmi(a1, &extra_checks_or_miss); |
2801 | 2822 |
2802 __ bind(&have_js_function); | 2823 __ bind(&have_js_function); |
2803 if (CallAsMethod()) { | 2824 if (CallAsMethod()) { |
2804 EmitContinueIfStrictOrNative(masm, &cont); | 2825 EmitContinueIfStrictOrNative(masm, &cont); |
2805 // Compute the receiver in sloppy mode. | 2826 // Compute the receiver in sloppy mode. |
2806 __ lw(a3, MemOperand(sp, argc * kPointerSize)); | 2827 __ lw(a3, MemOperand(sp, argc * kPointerSize)); |
2807 | 2828 |
2808 __ JumpIfSmi(a3, &wrap); | 2829 __ JumpIfSmi(a3, &wrap); |
2809 __ GetObjectType(a3, t0, t0); | 2830 __ GetObjectType(a3, t0, t0); |
2810 __ Branch(&wrap, lt, t0, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2831 __ Branch(&wrap, lt, t0, Operand(FIRST_SPEC_OBJECT_TYPE)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2867 // Make sure the function is not the Array() function, which requires special | 2888 // Make sure the function is not the Array() function, which requires special |
2868 // behavior on MISS. | 2889 // behavior on MISS. |
2869 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t0); | 2890 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t0); |
2870 __ Branch(&miss, eq, a1, Operand(t0)); | 2891 __ Branch(&miss, eq, a1, Operand(t0)); |
2871 | 2892 |
2872 // Update stats. | 2893 // Update stats. |
2873 __ lw(t0, FieldMemOperand(a2, with_types_offset)); | 2894 __ lw(t0, FieldMemOperand(a2, with_types_offset)); |
2874 __ Addu(t0, t0, Operand(Smi::FromInt(1))); | 2895 __ Addu(t0, t0, Operand(Smi::FromInt(1))); |
2875 __ sw(t0, FieldMemOperand(a2, with_types_offset)); | 2896 __ sw(t0, FieldMemOperand(a2, with_types_offset)); |
2876 | 2897 |
2877 // Store the function. | 2898 // Store the function. Use a stub since we need a frame for allocation. |
2878 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); | 2899 // a2 - vector |
2879 __ Addu(t0, a2, Operand(t0)); | 2900 // a3 - slot |
2880 __ Addu(t0, t0, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 2901 // a1 - function |
2881 __ sw(a1, MemOperand(t0, 0)); | 2902 { |
| 2903 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2904 CreateWeakCellStub create_stub(masm->isolate()); |
| 2905 __ Push(a1); |
| 2906 __ CallStub(&create_stub); |
| 2907 __ Pop(a1); |
| 2908 } |
2882 | 2909 |
2883 // Update the write barrier. | |
2884 __ mov(t1, a1); | |
2885 __ RecordWrite(a2, t0, t1, kRAHasNotBeenSaved, kDontSaveFPRegs, | |
2886 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
2887 __ Branch(&have_js_function); | 2910 __ Branch(&have_js_function); |
2888 | 2911 |
2889 // We are here because tracing is on or we encountered a MISS case we can't | 2912 // We are here because tracing is on or we encountered a MISS case we can't |
2890 // handle here. | 2913 // handle here. |
2891 __ bind(&miss); | 2914 __ bind(&miss); |
2892 GenerateMiss(masm); | 2915 GenerateMiss(masm); |
2893 | 2916 |
2894 // the slow case | 2917 // the slow case |
2895 __ bind(&slow_start); | 2918 __ bind(&slow_start); |
2896 // Check that the function is really a JavaScript function. | 2919 // Check that the function is really a JavaScript function. |
(...skipping 2255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5152 kStackUnwindSpace, kInvalidStackOffset, | 5175 kStackUnwindSpace, kInvalidStackOffset, |
5153 MemOperand(fp, 6 * kPointerSize), NULL); | 5176 MemOperand(fp, 6 * kPointerSize), NULL); |
5154 } | 5177 } |
5155 | 5178 |
5156 | 5179 |
5157 #undef __ | 5180 #undef __ |
5158 | 5181 |
5159 } } // namespace v8::internal | 5182 } } // namespace v8::internal |
5160 | 5183 |
5161 #endif // V8_TARGET_ARCH_MIPS | 5184 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |