From 1306839894030a23866108609b97d41b49de7b1e Mon Sep 17 00:00:00 2001 From: "weiliang.lin@intel.com" Date: Tue, 21 Oct 2014 08:28:00 +0000 Subject: [PATCH] X87: vector-based ICs did not update type feedback counts correctly. port r24732. original commit message: vector-based ICs did not update type feedback counts correctly. BUG= R=weiliang.lin@intel.com Review URL: https://codereview.chromium.org/669823002 Patch from Chunyang Dai . git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24756 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/x87/code-stubs-x87.cc | 7 +++++++ src/x87/full-codegen-x87.cc | 3 ++- src/x87/lithium-codegen-x87.cc | 10 ++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc index 946eda2..202dec6 100644 --- a/src/x87/code-stubs-x87.cc +++ b/src/x87/code-stubs-x87.cc @@ -1957,6 +1957,13 @@ void CallICStub::Generate(MacroAssembler* masm) { __ mov(FieldOperand(ebx, edx, times_half_pointer_size, FixedArray::kHeaderSize), Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); + // We have to update statistics for runtime profiling. + const int with_types_offset = + FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); + __ sub(FieldOperand(ebx, with_types_offset), Immediate(Smi::FromInt(1))); + const int generic_offset = + FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); + __ add(FieldOperand(ebx, generic_offset), Immediate(Smi::FromInt(1))); __ jmp(&slow_start); } diff --git a/src/x87/full-codegen-x87.cc b/src/x87/full-codegen-x87.cc index 8ae718f..746110a 100644 --- a/src/x87/full-codegen-x87.cc +++ b/src/x87/full-codegen-x87.cc @@ -1106,7 +1106,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { // No need for a write barrier, we are storing a Smi in the feedback vector. __ LoadHeapObject(ebx, FeedbackVector()); - __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(slot.ToInt())), + int vector_index = FeedbackVector()->GetIndex(slot); + __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)), Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc index 25496cc..2766b65 100644 --- a/src/x87/lithium-codegen-x87.cc +++ b/src/x87/lithium-codegen-x87.cc @@ -3126,13 +3126,15 @@ void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { template void LCodeGen::EmitVectorLoadICRegisters(T* instr) { DCHECK(FLAG_vector_ics); - Register vector = ToRegister(instr->temp_vector()); - DCHECK(vector.is(VectorLoadICDescriptor::VectorRegister())); - __ mov(vector, instr->hydrogen()->feedback_vector()); + Register vector_register = ToRegister(instr->temp_vector()); + DCHECK(vector_register.is(VectorLoadICDescriptor::VectorRegister())); + Handle vector = instr->hydrogen()->feedback_vector(); + __ mov(vector_register, vector); // No need to allocate this register. DCHECK(VectorLoadICDescriptor::SlotRegister().is(eax)); + int index = vector->GetIndex(instr->hydrogen()->slot()); __ mov(VectorLoadICDescriptor::SlotRegister(), - Immediate(Smi::FromInt(instr->hydrogen()->slot().ToInt()))); + Immediate(Smi::FromInt(index))); } -- 2.7.4