| Index: src/ia32/code-stubs-ia32.cc
|
| diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
|
| index 2159c6070b6e9748305e910c375afbe1d1398203..343489795146d947bf9e38cc3d02fe41ec350d44 100644
|
| --- a/src/ia32/code-stubs-ia32.cc
|
| +++ b/src/ia32/code-stubs-ia32.cc
|
| @@ -1913,6 +1913,30 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) {
|
| }
|
|
|
|
|
| +static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
|
| + // eax : number of arguments to the construct function
|
| + // ebx : Feedback vector
|
| + // edx : slot in feedback vector (Smi)
|
| + // edi : the function to call
|
| + FrameScope scope(masm, StackFrame::INTERNAL);
|
| +
|
| + // Arguments register must be smi-tagged to call out.
|
| + __ SmiTag(eax);
|
| + __ push(eax);
|
| + __ push(edi);
|
| + __ push(edx);
|
| + __ push(ebx);
|
| +
|
| + __ CallStub(stub);
|
| +
|
| + __ pop(ebx);
|
| + __ pop(edx);
|
| + __ pop(edi);
|
| + __ pop(eax);
|
| + __ SmiUntag(eax);
|
| +}
|
| +
|
| +
|
| static void GenerateRecordCallTarget(MacroAssembler* masm) {
|
| // Cache the called function in a feedback vector slot. Cache states
|
| // are uninitialized, monomorphic (indicated by a JSFunction), and
|
| @@ -1930,9 +1954,20 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
|
|
|
| // A monomorphic cache hit or an already megamorphic state: invoke the
|
| // function without changing the state.
|
| - __ cmp(ecx, edi);
|
| + Label check_megamorphic;
|
| + __ cmp(edi, FieldOperand(ecx, WeakCell::kValueOffset));
|
| __ j(equal, &done, Label::kFar);
|
| - __ cmp(ecx, Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate)));
|
| + __ CompareRoot(FieldOperand(ecx, 0), Heap::kWeakCellMapRootIndex);
|
| + __ j(not_equal, &check_megamorphic);
|
| +
|
| + // If edi is not equal to the weak cell value, and the weak cell value is
|
| + // cleared, we have a new chance to become monomorphic.
|
| + __ cmp(FieldOperand(ecx, WeakCell::kValueOffset), Immediate(Smi::FromInt(0)));
|
| + __ j(equal, &initialize);
|
| + __ jmp(&megamorphic);
|
| +
|
| + __ bind(&check_megamorphic);
|
| + __ CompareRoot(ecx, Heap::kmegamorphic_symbolRootIndex);
|
| __ j(equal, &done, Label::kFar);
|
|
|
| if (!FLAG_pretenuring_call_new) {
|
| @@ -1940,8 +1975,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
|
| // If we didn't have a matching function, and we didn't find the megamorph
|
| // sentinel, then we have in the slot either some other function or an
|
| // AllocationSite. Do a map check on the object in ecx.
|
| - Handle<Map> allocation_site_map = isolate->factory()->allocation_site_map();
|
| - __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map));
|
| + __ CompareRoot(FieldOperand(ecx, 0), Heap::kAllocationSiteMapRootIndex);
|
| __ j(not_equal, &miss);
|
|
|
| // Make sure the function is the Array() function
|
| @@ -1955,7 +1989,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
|
|
|
| // A monomorphic miss (i.e, here the cache is not uninitialized) goes
|
| // megamorphic.
|
| - __ cmp(ecx, Immediate(TypeFeedbackVector::UninitializedSentinel(isolate)));
|
| + __ CompareRoot(ecx, Heap::kuninitialized_symbolRootIndex);
|
| __ j(equal, &initialize);
|
| // MegamorphicSentinel is an immortal immovable object (undefined) so no
|
| // write-barrier is needed.
|
| @@ -1977,43 +2011,15 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
|
| // The target function is the Array constructor,
|
| // Create an AllocationSite if we don't already have it, store it in the
|
| // slot.
|
| - {
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| -
|
| - // Arguments register must be smi-tagged to call out.
|
| - __ SmiTag(eax);
|
| - __ push(eax);
|
| - __ push(edi);
|
| - __ push(edx);
|
| - __ push(ebx);
|
| -
|
| - CreateAllocationSiteStub create_stub(isolate);
|
| - __ CallStub(&create_stub);
|
| -
|
| - __ pop(ebx);
|
| - __ pop(edx);
|
| - __ pop(edi);
|
| - __ pop(eax);
|
| - __ SmiUntag(eax);
|
| - }
|
| + CreateAllocationSiteStub create_stub(isolate);
|
| + CallStubInRecordCallTarget(masm, &create_stub);
|
| __ jmp(&done);
|
|
|
| __ bind(¬_array_function);
|
| }
|
|
|
| - __ mov(FieldOperand(ebx, edx, times_half_pointer_size,
|
| - FixedArray::kHeaderSize),
|
| - edi);
|
| - // We won't need edx or ebx anymore, just save edi
|
| - __ push(edi);
|
| - __ push(ebx);
|
| - __ push(edx);
|
| - __ RecordWriteArray(ebx, edi, edx, kDontSaveFPRegs,
|
| - EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
|
| - __ pop(edx);
|
| - __ pop(ebx);
|
| - __ pop(edi);
|
| -
|
| + CreateWeakCellStub create_stub(isolate);
|
| + CallStubInRecordCallTarget(masm, &create_stub);
|
| __ bind(&done);
|
| }
|
|
|
|
|