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

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

Issue 1208093002: PPC: [ic] Record call counts for monomorphic calls made with an IC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ppc/code-stubs-ppc.cc
diff --git a/src/ppc/code-stubs-ppc.cc b/src/ppc/code-stubs-ppc.cc
index d84492fb292de050b305a99af14e0e74ae67962c..2447cf9318bcc19f093f14d12375188a353c5232 100644
--- a/src/ppc/code-stubs-ppc.cc
+++ b/src/ppc/code-stubs-ppc.cc
@@ -2884,15 +2884,21 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
__ bne(&miss);
__ mov(r3, Operand(arg_count()));
- __ SmiToPtrArrayOffset(r7, r6);
- __ add(r7, r5, r7);
- __ LoadP(r7, FieldMemOperand(r7, FixedArray::kHeaderSize));
+ __ SmiToPtrArrayOffset(r9, r6);
+ __ add(r9, r5, r9);
+ __ LoadP(r7, FieldMemOperand(r9, FixedArray::kHeaderSize));
// Verify that r7 contains an AllocationSite
__ LoadP(r8, FieldMemOperand(r7, HeapObject::kMapOffset));
__ CompareRoot(r8, Heap::kAllocationSiteMapRootIndex);
__ bne(&miss);
+ // Increment the call count for monomorphic function calls.
+ const int count_offset = FixedArray::kHeaderSize + kPointerSize;
+ __ LoadP(r6, FieldMemOperand(r9, count_offset));
+ __ AddSmiLiteral(r6, r6, Smi::FromInt(CallICNexus::kCallCountIncrement), r0);
+ __ StoreP(r6, FieldMemOperand(r9, count_offset));
+
__ mr(r5, r7);
__ mr(r6, r4);
ArrayConstructorStub stub(masm->isolate(), arg_count());
@@ -2924,9 +2930,9 @@ void CallICStub::Generate(MacroAssembler* masm) {
ParameterCount actual(argc);
// The checks. First, does r4 match the recorded monomorphic target?
- __ SmiToPtrArrayOffset(r7, r6);
- __ add(r7, r5, r7);
- __ LoadP(r7, FieldMemOperand(r7, FixedArray::kHeaderSize));
+ __ SmiToPtrArrayOffset(r9, r6);
+ __ add(r9, r5, r9);
+ __ LoadP(r7, FieldMemOperand(r9, 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.
@@ -2950,6 +2956,12 @@ void CallICStub::Generate(MacroAssembler* masm) {
// convincing us that we have a monomorphic JSFunction.
__ JumpIfSmi(r4, &extra_checks_or_miss);
+ // Increment the call count for monomorphic function calls.
+ const int count_offset = FixedArray::kHeaderSize + kPointerSize;
+ __ LoadP(r6, FieldMemOperand(r9, count_offset));
+ __ AddSmiLiteral(r6, r6, Smi::FromInt(CallICNexus::kCallCountIncrement), r0);
+ __ StoreP(r6, FieldMemOperand(r9, count_offset));
+
__ bind(&have_js_function);
if (CallAsMethod()) {
EmitContinueIfStrictOrNative(masm, &cont);
@@ -2993,10 +3005,8 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ AssertNotSmi(r7);
__ CompareObjectType(r7, r8, r8, JS_FUNCTION_TYPE);
__ bne(&miss);
- __ SmiToPtrArrayOffset(r7, r6);
- __ add(r7, r5, r7);
__ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex);
- __ StoreP(ip, FieldMemOperand(r7, FixedArray::kHeaderSize), r0);
+ __ StoreP(ip, FieldMemOperand(r9, FixedArray::kHeaderSize), r0);
// We have to update statistics for runtime profiling.
__ LoadP(r7, FieldMemOperand(r5, with_types_offset));
__ SubSmiLiteral(r7, r7, Smi::FromInt(1), r0);
@@ -3026,6 +3036,10 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ AddSmiLiteral(r7, r7, Smi::FromInt(1), r0);
__ StoreP(r7, FieldMemOperand(r5, with_types_offset), r0);
+ // Initialize the call counter.
+ __ LoadSmiLiteral(r0, Smi::FromInt(CallICNexus::kCallCountIncrement));
+ __ StoreP(r0, FieldMemOperand(r9, count_offset));
+
// Store the function. Use a stub since we need a frame for allocation.
// r5 - vector
// r6 - slot
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698