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

Unified Diff: src/mips/code-stubs-mips.cc

Issue 2670843002: [stubs] Also port the CallICStub to CSA. (Closed)
Patch Set: Introduce FullCodeGenerator::IntFromSlot. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interface-descriptors.cc ('k') | src/mips/interface-descriptors-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index 4062e8932069c008b1712d05d5949ca6d56caaf0..2c56cdbef427584c04beca3346f2d1fe83c4d742 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -1893,187 +1893,6 @@ void CallConstructStub::Generate(MacroAssembler* masm) {
__ Jump(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
}
-// Note: feedback_vector and slot are clobbered after the call.
-static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector,
- Register slot) {
- __ Lsa(at, feedback_vector, slot, kPointerSizeLog2 - kSmiTagSize);
- __ lw(slot, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize));
- __ Addu(slot, slot, Operand(Smi::FromInt(1)));
- __ sw(slot, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize));
-}
-
-void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
- // a0 - number of arguments
- // a1 - function
- // a3 - slot id
- // a2 - vector
- // t0 - loaded from vector[slot]
- __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, at);
- __ Branch(miss, ne, a1, Operand(at));
-
- // Increment the call count for monomorphic function calls.
- IncrementCallCount(masm, a2, a3);
-
- __ mov(a2, t0);
- __ mov(a3, a1);
- ArrayConstructorStub stub(masm->isolate());
- __ TailCallStub(&stub);
-}
-
-
-void CallICStub::Generate(MacroAssembler* masm) {
- // a0 - number of arguments
- // a1 - function
- // a3 - slot id (Smi)
- // a2 - vector
- Label extra_checks_or_miss, call, call_function, call_count_incremented;
-
- // The checks. First, does r1 match the recorded monomorphic target?
- __ Lsa(t0, a2, a3, kPointerSizeLog2 - kSmiTagSize);
- __ lw(t0, FieldMemOperand(t0, FixedArray::kHeaderSize));
-
- // We don't know that we have a weak cell. We might have a private symbol
- // or an AllocationSite, but the memory is safe to examine.
- // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to
- // FixedArray.
- // WeakCell::kValueOffset - contains a JSFunction or Smi(0)
- // Symbol::kHashFieldSlot - if the low bit is 1, then the hash is not
- // computed, meaning that it can't appear to be a pointer. If the low bit is
- // 0, then hash is computed, but the 0 bit prevents the field from appearing
- // to be a pointer.
- STATIC_ASSERT(WeakCell::kSize >= kPointerSize);
- STATIC_ASSERT(AllocationSite::kTransitionInfoOffset ==
- WeakCell::kValueOffset &&
- WeakCell::kValueOffset == Symbol::kHashFieldSlot);
-
- __ lw(t1, FieldMemOperand(t0, WeakCell::kValueOffset));
- __ Branch(&extra_checks_or_miss, ne, a1, Operand(t1));
-
- // The compare above could have been a SMI/SMI comparison. Guard against this
- // convincing us that we have a monomorphic JSFunction.
- __ JumpIfSmi(a1, &extra_checks_or_miss);
-
- __ bind(&call_function);
-
- // Increment the call count for monomorphic function calls.
- IncrementCallCount(masm, a2, a3);
-
- __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(),
- tail_call_mode()),
- RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg));
-
- __ bind(&extra_checks_or_miss);
- Label uninitialized, miss, not_allocation_site;
-
- __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex);
- __ Branch(&call, eq, t0, Operand(at));
-
- // Verify that t0 contains an AllocationSite
- __ lw(t1, FieldMemOperand(t0, HeapObject::kMapOffset));
- __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
- __ Branch(&not_allocation_site, ne, t1, Operand(at));
-
- HandleArrayCase(masm, &miss);
-
- __ bind(&not_allocation_site);
-
- // The following cases attempt to handle MISS cases without going to the
- // runtime.
- if (FLAG_trace_ic) {
- __ Branch(&miss);
- }
-
- __ LoadRoot(at, Heap::kuninitialized_symbolRootIndex);
- __ Branch(&uninitialized, eq, t0, Operand(at));
-
- // We are going megamorphic. If the feedback is a JSFunction, it is fine
- // to handle it here. More complex cases are dealt with in the runtime.
- __ AssertNotSmi(t0);
- __ GetObjectType(t0, t1, t1);
- __ Branch(&miss, ne, t1, Operand(JS_FUNCTION_TYPE));
- __ Lsa(t0, a2, a3, kPointerSizeLog2 - kSmiTagSize);
- __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex);
- __ sw(at, FieldMemOperand(t0, FixedArray::kHeaderSize));
-
- __ bind(&call);
- IncrementCallCount(masm, a2, a3);
-
- __ bind(&call_count_incremented);
-
- __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()),
- RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg));
-
- __ bind(&uninitialized);
-
- // We are going monomorphic, provided we actually have a JSFunction.
- __ JumpIfSmi(a1, &miss);
-
- // Goto miss case if we do not have a function.
- __ GetObjectType(a1, t0, t0);
- __ Branch(&miss, ne, t0, Operand(JS_FUNCTION_TYPE));
-
- // Make sure the function is not the Array() function, which requires special
- // behavior on MISS.
- __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, t0);
- __ Branch(&miss, eq, a1, Operand(t0));
-
- // Make sure the function belongs to the same native context.
- __ lw(t0, FieldMemOperand(a1, JSFunction::kContextOffset));
- __ lw(t0, ContextMemOperand(t0, Context::NATIVE_CONTEXT_INDEX));
- __ lw(t1, NativeContextMemOperand());
- __ Branch(&miss, ne, t0, Operand(t1));
-
- // Store the function. Use a stub since we need a frame for allocation.
- // a2 - vector
- // a3 - slot
- // a1 - function
- {
- FrameScope scope(masm, StackFrame::INTERNAL);
- CreateWeakCellStub create_stub(masm->isolate());
- __ SmiTag(a0);
- __ Push(a0);
- __ Push(a2, a3);
- __ Push(cp, a1);
- __ CallStub(&create_stub);
- __ Pop(cp, a1);
- __ Pop(a2, a3);
- __ Pop(a0);
- __ SmiUntag(a0);
- }
-
- __ Branch(&call_function);
-
- // We are here because tracing is on or we encountered a MISS case we can't
- // handle here.
- __ bind(&miss);
- GenerateMiss(masm);
-
- __ Branch(&call_count_incremented);
-}
-
-
-void CallICStub::GenerateMiss(MacroAssembler* masm) {
- FrameScope scope(masm, StackFrame::INTERNAL);
-
- // Preserve the number of arguments as Smi.
- __ SmiTag(a0);
- __ Push(a0);
-
- // Push the receiver and the function and feedback info.
- __ Push(a1, a2, a3);
-
- // Call the entry.
- __ CallRuntime(Runtime::kCallIC_Miss);
-
- // Move result to a1 and exit the internal frame.
- __ mov(a1, v0);
-
- // Restore number of arguments.
- __ Pop(a0);
- __ SmiUntag(a0);
-}
-
-
// StringCharCodeAtGenerator.
void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {
DCHECK(!t0.is(index_));
« no previous file with comments | « src/interface-descriptors.cc ('k') | src/mips/interface-descriptors-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698