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

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

Issue 2325083003: Record call counts also for megamorphic calls. (Closed)
Patch Set: Code comments. Created 4 years, 3 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/interpreter/interpreter-assembler.cc ('k') | src/mips64/code-stubs-mips64.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 7a46a30682081cc3239cfacea06049a53c59689b..f8f177ccf6601ed1dd5e1560ec2f40803e64542c 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -1917,6 +1917,14 @@ 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) {
// a1 - function
@@ -1929,10 +1937,7 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
__ li(a0, Operand(arg_count()));
// Increment the call count for monomorphic function calls.
- __ Lsa(at, a2, a3, kPointerSizeLog2 - kSmiTagSize);
- __ lw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize));
- __ Addu(a3, a3, Operand(Smi::FromInt(1)));
- __ sw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize));
+ IncrementCallCount(masm, a2, a3);
__ mov(a2, t0);
__ mov(a3, a1);
@@ -1945,7 +1950,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
// a1 - function
// a3 - slot id (Smi)
// a2 - vector
- Label extra_checks_or_miss, call, call_function;
+ Label extra_checks_or_miss, call, call_function, call_count_incremented;
int argc = arg_count();
ParameterCount actual(argc);
@@ -1974,13 +1979,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
// 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.
- __ Lsa(at, a2, a3, kPointerSizeLog2 - kSmiTagSize);
- __ lw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize));
- __ Addu(a3, a3, Operand(Smi::FromInt(1)));
- __ sw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize));
+ IncrementCallCount(masm, a2, a3);
- __ bind(&call_function);
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(),
tail_call_mode()),
RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg),
@@ -2021,6 +2024,10 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ 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),
USE_DELAY_SLOT);
@@ -2046,11 +2053,6 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ lw(t1, NativeContextMemOperand());
__ Branch(&miss, ne, t0, Operand(t1));
- // Initialize the call counter.
- __ Lsa(at, a2, a3, kPointerSizeLog2 - kSmiTagSize);
- __ li(t0, Operand(Smi::FromInt(1)));
- __ sw(t0, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize));
-
// Store the function. Use a stub since we need a frame for allocation.
// a2 - vector
// a3 - slot
@@ -2058,9 +2060,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
CreateWeakCellStub create_stub(masm->isolate());
+ __ Push(a2, a3);
__ Push(cp, a1);
__ CallStub(&create_stub);
__ Pop(cp, a1);
+ __ Pop(a2, a3);
}
__ Branch(&call_function);
@@ -2070,7 +2074,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ bind(&miss);
GenerateMiss(masm);
- __ Branch(&call);
+ __ Branch(&call_count_incremented);
}
« no previous file with comments | « src/interpreter/interpreter-assembler.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698