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

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

Issue 2351523002: X87: Record call counts also for megamorphic calls. (Closed)
Patch Set: 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/code-stubs-x87.cc
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc
index 29213054c043af235aa06515271904b9d1a91a1c..ba5760287741986b4fe2dcbef65b83a3cbf538ed 100644
--- a/src/x87/code-stubs-x87.cc
+++ b/src/x87/code-stubs-x87.cc
@@ -1260,6 +1260,12 @@ void CallConstructStub::Generate(MacroAssembler* masm) {
__ Jump(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
}
+static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector,
+ Register slot) {
+ __ add(FieldOperand(feedback_vector, slot, times_half_pointer_size,
+ FixedArray::kHeaderSize + kPointerSize),
+ Immediate(Smi::FromInt(1)));
+}
void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
// edi - function
@@ -1275,9 +1281,7 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
FixedArray::kHeaderSize));
// Increment the call count for monomorphic function calls.
- __ add(FieldOperand(ebx, edx, times_half_pointer_size,
- FixedArray::kHeaderSize + kPointerSize),
- Immediate(Smi::FromInt(1)));
+ IncrementCallCount(masm, ebx, edx);
__ mov(ebx, ecx);
__ mov(edx, edi);
@@ -1293,7 +1297,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
// edx - slot id
// ebx - vector
Isolate* isolate = masm->isolate();
- 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);
@@ -1322,12 +1326,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
// convincing us that we have a monomorphic JSFunction.
__ JumpIfSmi(edi, &extra_checks_or_miss);
+ __ bind(&call_function);
+
// Increment the call count for monomorphic function calls.
- __ add(FieldOperand(ebx, edx, times_half_pointer_size,
- FixedArray::kHeaderSize + kPointerSize),
- Immediate(Smi::FromInt(1)));
+ IncrementCallCount(masm, ebx, edx);
- __ bind(&call_function);
__ Set(eax, argc);
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(),
tail_call_mode()),
@@ -1368,6 +1371,12 @@ void CallICStub::Generate(MacroAssembler* masm) {
Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate)));
__ bind(&call);
+
+ // Increment the call count for megamorphic function calls.
+ IncrementCallCount(masm, ebx, edx);
+
+ __ bind(&call_count_incremented);
+
__ Set(eax, argc);
__ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()),
RelocInfo::CODE_TARGET);
@@ -1393,11 +1402,6 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ cmp(ecx, NativeContextOperand());
__ j(not_equal, &miss);
- // Initialize the call counter.
- __ mov(FieldOperand(ebx, edx, times_half_pointer_size,
- FixedArray::kHeaderSize + kPointerSize),
- Immediate(Smi::FromInt(1)));
-
// Store the function. Use a stub since we need a frame for allocation.
// ebx - vector
// edx - slot
@@ -1405,11 +1409,15 @@ void CallICStub::Generate(MacroAssembler* masm) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
CreateWeakCellStub create_stub(isolate);
+ __ push(ebx);
+ __ push(edx);
__ push(edi);
__ push(esi);
__ CallStub(&create_stub);
__ pop(esi);
__ pop(edi);
+ __ pop(edx);
+ __ pop(ebx);
}
__ jmp(&call_function);
@@ -1419,7 +1427,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ bind(&miss);
GenerateMiss(masm);
- __ jmp(&call);
+ __ jmp(&call_count_incremented);
// Unreachable
__ int3();
« 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