Revision: 25218
Author: [email protected]
Date: Fri Nov 7 16:01:46 2014 UTC
Log: MIPS: Try avoiding MISS for callic monomorphic case.
Port c01061044028f7a31ba51496e44900481005eb38
Port r25207
BUG=
[email protected]
Review URL: https://codereview.chromium.org/684653007
https://code.google.com/p/v8/source/detail?r=25218
Modified:
/branches/bleeding_edge/src/mips/code-stubs-mips.cc
/branches/bleeding_edge/src/mips64/code-stubs-mips64.cc
=======================================
--- /branches/bleeding_edge/src/mips/code-stubs-mips.cc Thu Nov 6 16:26:42
2014 UTC
+++ /branches/bleeding_edge/src/mips/code-stubs-mips.cc Fri Nov 7 16:01:46
2014 UTC
@@ -2829,8 +2829,12 @@
void CallICStub::Generate(MacroAssembler* masm) {
- // r1 - function
- // r3 - slot id (Smi)
+ // a1 - function
+ // a3 - slot id (Smi)
+ const int with_types_offset =
+ FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
+ const int generic_offset =
+
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
Label extra_checks_or_miss, slow_start;
Label slow, non_function, wrap, cont;
Label have_js_function;
@@ -2869,38 +2873,71 @@
}
__ bind(&extra_checks_or_miss);
- Label miss;
+ Label uninitialized, miss;
__ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex);
__ Branch(&slow_start, eq, t0, Operand(at));
+
+ // 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(&miss, eq, t0, Operand(at));
+ __ 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));
+ __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize);
+ __ Addu(t0, a2, Operand(t0));
+ __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex);
+ __ sw(at, FieldMemOperand(t0, FixedArray::kHeaderSize));
+ // We have to update statistics for runtime profiling.
+ __ lw(t0, FieldMemOperand(a2, with_types_offset));
+ __ Subu(t0, t0, Operand(Smi::FromInt(1)));
+ __ sw(t0, FieldMemOperand(a2, with_types_offset));
+ __ lw(t0, FieldMemOperand(a2, generic_offset));
+ __ Addu(t0, t0, Operand(Smi::FromInt(1)));
+ __ Branch(USE_DELAY_SLOT, &slow_start);
+ __ sw(t0, FieldMemOperand(a2, generic_offset)); // In delay slot.
+
+ __ 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.
+ __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t0);
+ __ Branch(&miss, eq, a1, Operand(t0));
+
+ // Update stats.
+ __ lw(t0, FieldMemOperand(a2, with_types_offset));
+ __ Addu(t0, t0, Operand(Smi::FromInt(1)));
+ __ sw(t0, FieldMemOperand(a2, with_types_offset));
+
+ // Store the function.
+ __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize);
+ __ Addu(t0, a2, Operand(t0));
+ __ Addu(t0, t0, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
+ __ sw(a1, MemOperand(t0, 0));
- if (!FLAG_trace_ic) {
- // 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));
- __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize);
- __ Addu(t0, a2, Operand(t0));
- __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex);
- __ sw(at, FieldMemOperand(t0, FixedArray::kHeaderSize));
- // We have to update statistics for runtime profiling.
- const int with_types_offset =
- FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
- __ lw(t0, FieldMemOperand(a2, with_types_offset));
- __ Subu(t0, t0, Operand(Smi::FromInt(1)));
- __ sw(t0, FieldMemOperand(a2, with_types_offset));
- const int generic_offset =
-
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
- __ lw(t0, FieldMemOperand(a2, generic_offset));
- __ Addu(t0, t0, Operand(Smi::FromInt(1)));
- __ sw(t0, FieldMemOperand(a2, generic_offset));
- __ Branch(&slow_start);
- }
+ // Update the write barrier.
+ __ mov(t1, a1);
+ __ RecordWrite(a2, t0, t1, kRAHasNotBeenSaved, kDontSaveFPRegs,
+ EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
+ __ Branch(&have_js_function);
- // We are here because tracing is on or we are going monomorphic.
+ // We are here because tracing is on or we encountered a MISS case we
can't
+ // handle here.
__ bind(&miss);
GenerateMiss(masm);
=======================================
--- /branches/bleeding_edge/src/mips64/code-stubs-mips64.cc Thu Nov 6
16:26:42 2014 UTC
+++ /branches/bleeding_edge/src/mips64/code-stubs-mips64.cc Fri Nov 7
16:01:46 2014 UTC
@@ -2892,6 +2892,10 @@
void CallICStub::Generate(MacroAssembler* masm) {
// a1 - function
// a3 - slot id (Smi)
+ const int with_types_offset =
+ FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
+ const int generic_offset =
+
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
Label extra_checks_or_miss, slow_start;
Label slow, non_function, wrap, cont;
Label have_js_function;
@@ -2930,38 +2934,71 @@
}
__ bind(&extra_checks_or_miss);
- Label miss;
+ Label uninitialized, miss;
__ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex);
__ Branch(&slow_start, eq, a4, Operand(at));
+
+ // 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(&miss, eq, a4, Operand(at));
+ __ Branch(&uninitialized, eq, a4, 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(a4);
+ __ GetObjectType(a4, a5, a5);
+ __ Branch(&miss, ne, a5, Operand(JS_FUNCTION_TYPE));
+ __ dsrl(a4, a3, 32 - kPointerSizeLog2);
+ __ Daddu(a4, a2, Operand(a4));
+ __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex);
+ __ sd(at, FieldMemOperand(a4, FixedArray::kHeaderSize));
+ // We have to update statistics for runtime profiling.
+ __ ld(a4, FieldMemOperand(a2, with_types_offset));
+ __ Dsubu(a4, a4, Operand(Smi::FromInt(1)));
+ __ sd(a4, FieldMemOperand(a2, with_types_offset));
+ __ ld(a4, FieldMemOperand(a2, generic_offset));
+ __ Daddu(a4, a4, Operand(Smi::FromInt(1)));
+ __ Branch(USE_DELAY_SLOT, &slow_start);
+ __ sd(a4, FieldMemOperand(a2, generic_offset)); // In delay slot.
+
+ __ 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, a4, a4);
+ __ Branch(&miss, ne, a4, Operand(JS_FUNCTION_TYPE));
+
+ // Make sure the function is not the Array() function, which requires
special
+ // behavior on MISS.
+ __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, a4);
+ __ Branch(&miss, eq, a1, Operand(a4));
+
+ // Update stats.
+ __ ld(a4, FieldMemOperand(a2, with_types_offset));
+ __ Daddu(a4, a4, Operand(Smi::FromInt(1)));
+ __ sd(a4, FieldMemOperand(a2, with_types_offset));
+
+ // Store the function.
+ __ dsrl(a4, a3, 32 - kPointerSizeLog2);
+ __ Daddu(a4, a2, Operand(a4));
+ __ Daddu(a4, a4, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
+ __ sd(a1, MemOperand(a4, 0));
- if (!FLAG_trace_ic) {
- // 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(a4);
- __ GetObjectType(a4, a5, a5);
- __ Branch(&miss, ne, a5, Operand(JS_FUNCTION_TYPE));
- __ dsrl(a4, a3, 32 - kPointerSizeLog2);
- __ Daddu(a4, a2, Operand(a4));
- __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex);
- __ sd(at, FieldMemOperand(a4, FixedArray::kHeaderSize));
- // We have to update statistics for runtime profiling.
- const int with_types_offset =
- FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
- __ ld(a4, FieldMemOperand(a2, with_types_offset));
- __ Dsubu(a4, a4, Operand(Smi::FromInt(1)));
- __ sd(a4, FieldMemOperand(a2, with_types_offset));
- const int generic_offset =
- FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
- __ ld(a4, FieldMemOperand(a2, generic_offset));
- __ Daddu(a4, a4, Operand(Smi::FromInt(1)));
- __ Branch(USE_DELAY_SLOT, &slow_start);
- __ sd(a4, FieldMemOperand(a2, generic_offset)); // In delay slot.
- }
+ // Update the write barrier.
+ __ mov(a5, a1);
+ __ RecordWrite(a2, a4, a5, kRAHasNotBeenSaved, kDontSaveFPRegs,
+ EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
+ __ Branch(&have_js_function);
- // We are here because tracing is on or we are going monomorphic.
+ // We are here because tracing is on or we encountered a MISS case we
can't
+ // handle here.
__ bind(&miss);
GenerateMiss(masm);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.