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

Unified Diff: src/arm/code-stubs-arm.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 | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/code-stubs-arm.cc
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
index 826e1055c9885523fa3f3cf366ff7ff2cf100d82..d90979170581d27c21a681f302c304c527853610 100644
--- a/src/arm/code-stubs-arm.cc
+++ b/src/arm/code-stubs-arm.cc
@@ -1785,6 +1785,17 @@ 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) {
+ __ add(feedback_vector, feedback_vector,
+ Operand::PointerOffsetFromSmiKey(slot));
+ __ add(feedback_vector, feedback_vector,
+ Operand(FixedArray::kHeaderSize + kPointerSize));
+ __ ldr(slot, FieldMemOperand(feedback_vector, 0));
+ __ add(slot, slot, Operand(Smi::FromInt(1)));
+ __ str(slot, FieldMemOperand(feedback_vector, 0));
+}
void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
// r1 - function
@@ -1798,11 +1809,7 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
__ mov(r0, Operand(arg_count()));
// Increment the call count for monomorphic function calls.
- __ add(r2, r2, Operand::PointerOffsetFromSmiKey(r3));
- __ add(r2, r2, Operand(FixedArray::kHeaderSize + kPointerSize));
- __ ldr(r3, FieldMemOperand(r2, 0));
- __ add(r3, r3, Operand(Smi::FromInt(1)));
- __ str(r3, FieldMemOperand(r2, 0));
+ IncrementCallCount(masm, r2, r3);
__ mov(r2, r4);
__ mov(r3, r1);
@@ -1815,7 +1822,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
// r1 - function
// r3 - slot id (Smi)
// r2 - 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);
@@ -1845,14 +1852,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
// convincing us that we have a monomorphic JSFunction.
__ JumpIfSmi(r1, &extra_checks_or_miss);
+ __ bind(&call_function);
+
// Increment the call count for monomorphic function calls.
- __ add(r2, r2, Operand::PointerOffsetFromSmiKey(r3));
- __ add(r2, r2, Operand(FixedArray::kHeaderSize + kPointerSize));
- __ ldr(r3, FieldMemOperand(r2, 0));
- __ add(r3, r3, Operand(Smi::FromInt(1)));
- __ str(r3, FieldMemOperand(r2, 0));
+ IncrementCallCount(masm, r2, r3);
- __ bind(&call_function);
__ mov(r0, Operand(argc));
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(),
tail_call_mode()),
@@ -1893,6 +1897,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize));
__ bind(&call);
+
+ // Increment the call count for megamorphic function calls.
+ IncrementCallCount(masm, r2, r3);
+
+ __ bind(&call_count_incremented);
__ mov(r0, Operand(argc));
__ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()),
RelocInfo::CODE_TARGET);
@@ -1919,11 +1928,6 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ cmp(r4, ip);
__ b(ne, &miss);
- // Initialize the call counter.
- __ Move(r5, Operand(Smi::FromInt(1)));
- __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3));
- __ str(r5, FieldMemOperand(r4, FixedArray::kHeaderSize + kPointerSize));
-
// Store the function. Use a stub since we need a frame for allocation.
// r2 - vector
// r3 - slot
@@ -1931,9 +1935,13 @@ void CallICStub::Generate(MacroAssembler* masm) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
CreateWeakCellStub create_stub(masm->isolate());
+ __ Push(r2);
+ __ Push(r3);
__ Push(cp, r1);
__ CallStub(&create_stub);
__ Pop(cp, r1);
+ __ Pop(r3);
+ __ Pop(r2);
}
__ jmp(&call_function);
@@ -1943,7 +1951,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ bind(&miss);
GenerateMiss(masm);
- __ jmp(&call);
+ __ jmp(&call_count_incremented);
}
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698