Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 866493003: Retry "Use a WeakCell in the CallIC type vector." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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);
919 BinaryOpICStub::GenerateAheadOfTime(isolate); 920 BinaryOpICStub::GenerateAheadOfTime(isolate);
920 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); 921 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate);
921 } 922 }
922 923
923 924
924 void CodeStub::GenerateFPStubs(Isolate* isolate) { 925 void CodeStub::GenerateFPStubs(Isolate* isolate) {
925 // Generate if not already in cache. 926 // Generate if not already in cache.
926 SaveFPRegsMode mode = kSaveFPRegs; 927 SaveFPRegsMode mode = kSaveFPRegs;
927 CEntryStub(isolate, 1, mode).GetCode(); 928 CEntryStub(isolate, 1, mode).GetCode();
928 StoreBufferOverflowStub(isolate, mode).GetCode(); 929 StoreBufferOverflowStub(isolate, mode).GetCode();
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); 2651 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
2651 Label extra_checks_or_miss, slow_start; 2652 Label extra_checks_or_miss, slow_start;
2652 Label slow, non_function, wrap, cont; 2653 Label slow, non_function, wrap, cont;
2653 Label have_js_function; 2654 Label have_js_function;
2654 int argc = arg_count(); 2655 int argc = arg_count();
2655 ParameterCount actual(argc); 2656 ParameterCount actual(argc);
2656 2657
2657 // The checks. First, does r1 match the recorded monomorphic target? 2658 // The checks. First, does r1 match the recorded monomorphic target?
2658 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); 2659 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3));
2659 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); 2660 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize));
2660 __ cmp(r1, r4); 2661
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);
2661 __ b(ne, &extra_checks_or_miss); 2678 __ b(ne, &extra_checks_or_miss);
2662 2679
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
2663 __ bind(&have_js_function); 2684 __ bind(&have_js_function);
2664 if (CallAsMethod()) { 2685 if (CallAsMethod()) {
2665 EmitContinueIfStrictOrNative(masm, &cont); 2686 EmitContinueIfStrictOrNative(masm, &cont);
2666 // Compute the receiver in sloppy mode. 2687 // Compute the receiver in sloppy mode.
2667 __ ldr(r3, MemOperand(sp, argc * kPointerSize)); 2688 __ ldr(r3, MemOperand(sp, argc * kPointerSize));
2668 2689
2669 __ JumpIfSmi(r3, &wrap); 2690 __ JumpIfSmi(r3, &wrap);
2670 __ CompareObjectType(r3, r4, r4, FIRST_SPEC_OBJECT_TYPE); 2691 __ CompareObjectType(r3, r4, r4, FIRST_SPEC_OBJECT_TYPE);
2671 __ b(lt, &wrap); 2692 __ b(lt, &wrap);
2672 2693
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2728 // behavior on MISS. 2749 // behavior on MISS.
2729 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4); 2750 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4);
2730 __ cmp(r1, r4); 2751 __ cmp(r1, r4);
2731 __ b(eq, &miss); 2752 __ b(eq, &miss);
2732 2753
2733 // Update stats. 2754 // Update stats.
2734 __ ldr(r4, FieldMemOperand(r2, with_types_offset)); 2755 __ ldr(r4, FieldMemOperand(r2, with_types_offset));
2735 __ add(r4, r4, Operand(Smi::FromInt(1))); 2756 __ add(r4, r4, Operand(Smi::FromInt(1)));
2736 __ str(r4, FieldMemOperand(r2, with_types_offset)); 2757 __ str(r4, FieldMemOperand(r2, with_types_offset));
2737 2758
2738 // Store the function. 2759 // Store the function. Use a stub since we need a frame for allocation.
2739 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); 2760 // r2 - vector
2740 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 2761 // r3 - slot
2741 __ str(r1, MemOperand(r4, 0)); 2762 // r1 - function
2763 {
2764 FrameScope scope(masm, StackFrame::INTERNAL);
2765 CreateWeakCellStub create_stub(masm->isolate());
2766 __ Push(r1);
2767 __ CallStub(&create_stub);
2768 __ Pop(r1);
2769 }
2742 2770
2743 // Update the write barrier.
2744 __ mov(r5, r1);
2745 __ RecordWrite(r2, r4, r5, kLRHasNotBeenSaved, kDontSaveFPRegs,
2746 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
2747 __ jmp(&have_js_function); 2771 __ jmp(&have_js_function);
2748 2772
2749 // We are here because tracing is on or we encountered a MISS case we can't 2773 // We are here because tracing is on or we encountered a MISS case we can't
2750 // handle here. 2774 // handle here.
2751 __ bind(&miss); 2775 __ bind(&miss);
2752 GenerateMiss(masm); 2776 GenerateMiss(masm);
2753 2777
2754 // the slow case 2778 // the slow case
2755 __ bind(&slow_start); 2779 __ bind(&slow_start);
2756 // Check that the function is really a JavaScript function. 2780 // Check that the function is really a JavaScript function.
(...skipping 2188 matching lines...) Expand 10 before | Expand all | Expand 10 after
4945 kStackUnwindSpace, NULL, 4969 kStackUnwindSpace, NULL,
4946 MemOperand(fp, 6 * kPointerSize), NULL); 4970 MemOperand(fp, 6 * kPointerSize), NULL);
4947 } 4971 }
4948 4972
4949 4973
4950 #undef __ 4974 #undef __
4951 4975
4952 } } // namespace v8::internal 4976 } } // namespace v8::internal
4953 4977
4954 #endif // V8_TARGET_ARCH_ARM 4978 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698