Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index 28ac74273a15ffff4e8b8d20b81f3c28f8fa2f69..22774c13022be114e5a712bfcb340af622232b5f 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -1331,8 +1331,8 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// rdx : slot in feedback vector (Smi) |
// rdi : the function to call |
Isolate* isolate = masm->isolate(); |
- Label initialize, done, miss, megamorphic, not_array_function, |
- done_no_smi_convert; |
+ Label initialize, done, miss, megamorphic, not_array_function; |
+ Label done_initialize_count, done_increment_count; |
// Load the cache state into r11. |
__ SmiToInteger32(rdx, rdx); |
@@ -1346,7 +1346,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// type-feedback-vector.h). |
Label check_allocation_site; |
__ cmpp(rdi, FieldOperand(r11, WeakCell::kValueOffset)); |
- __ j(equal, &done, Label::kFar); |
+ __ j(equal, &done_increment_count, Label::kFar); |
__ CompareRoot(r11, Heap::kmegamorphic_symbolRootIndex); |
__ j(equal, &done, Label::kFar); |
__ CompareRoot(FieldOperand(r11, HeapObject::kMapOffset), |
@@ -1370,7 +1370,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
__ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r11); |
__ cmpp(rdi, r11); |
__ j(not_equal, &megamorphic); |
- __ jmp(&done); |
+ __ jmp(&done_increment_count); |
__ bind(&miss); |
@@ -1396,17 +1396,29 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
CreateAllocationSiteStub create_stub(isolate); |
CallStubInRecordCallTarget(masm, &create_stub); |
- __ jmp(&done_no_smi_convert); |
+ __ jmp(&done_initialize_count); |
__ bind(¬_array_function); |
CreateWeakCellStub weak_cell_stub(isolate); |
CallStubInRecordCallTarget(masm, &weak_cell_stub); |
- __ jmp(&done_no_smi_convert); |
+ |
+ __ bind(&done_initialize_count); |
+ // Initialize the call counter. |
+ __ SmiToInteger32(rdx, rdx); |
+ __ Move(FieldOperand(rbx, rdx, times_pointer_size, |
+ FixedArray::kHeaderSize + kPointerSize), |
+ Smi::FromInt(1)); |
+ __ jmp(&done); |
+ |
+ __ bind(&done_increment_count); |
+ |
+ // Increment the call count for monomorphic function calls. |
+ __ SmiAddConstant(FieldOperand(rbx, rdx, times_pointer_size, |
+ FixedArray::kHeaderSize + kPointerSize), |
+ Smi::FromInt(1)); |
__ bind(&done); |
__ Integer32ToSmi(rdx, rdx); |
- |
- __ bind(&done_no_smi_convert); |
} |