| Index: src/x64/code-stubs-x64.cc
|
| diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
|
| index f9cdc161f6d26dbb8c51ce2b9647fde12339405d..3e5ef4a108e8bab3e92d9e8af66805616bc5bdcc 100644
|
| --- a/src/x64/code-stubs-x64.cc
|
| +++ b/src/x64/code-stubs-x64.cc
|
| @@ -1296,201 +1296,6 @@ void CallConstructStub::Generate(MacroAssembler* masm) {
|
| __ Jump(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
|
| }
|
|
|
| -static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector,
|
| - Register slot) {
|
| - __ SmiAddConstant(FieldOperand(feedback_vector, slot, times_pointer_size,
|
| - FixedArray::kHeaderSize + kPointerSize),
|
| - Smi::FromInt(1));
|
| -}
|
| -
|
| -void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
|
| - // rdi - function
|
| - // rdx - slot id
|
| - // rbx - vector
|
| - // rcx - allocation site (loaded from vector[slot]).
|
| - __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r8);
|
| - __ cmpp(rdi, r8);
|
| - __ j(not_equal, miss);
|
| -
|
| - // Increment the call count for monomorphic function calls.
|
| - IncrementCallCount(masm, rbx, rdx);
|
| -
|
| - __ movp(rbx, rcx);
|
| - __ movp(rdx, rdi);
|
| - ArrayConstructorStub stub(masm->isolate());
|
| - __ TailCallStub(&stub);
|
| -}
|
| -
|
| -
|
| -void CallICStub::Generate(MacroAssembler* masm) {
|
| - // ----------- S t a t e -------------
|
| - // -- rax - number of arguments
|
| - // -- rdi - function
|
| - // -- rdx - slot id
|
| - // -- rbx - vector
|
| - // -----------------------------------
|
| - Isolate* isolate = masm->isolate();
|
| - Label extra_checks_or_miss, call, call_function, call_count_incremented;
|
| -
|
| - // The checks. First, does rdi match the recorded monomorphic target?
|
| - __ SmiToInteger32(rdx, rdx);
|
| - __ movp(rcx,
|
| - FieldOperand(rbx, rdx, times_pointer_size, FixedArray::kHeaderSize));
|
| -
|
| - // We don't know that we have a weak cell. We might have a private symbol
|
| - // or an AllocationSite, but the memory is safe to examine.
|
| - // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to
|
| - // FixedArray.
|
| - // WeakCell::kValueOffset - contains a JSFunction or Smi(0)
|
| - // Symbol::kHashFieldSlot - if the low bit is 1, then the hash is not
|
| - // computed, meaning that it can't appear to be a pointer. If the low bit is
|
| - // 0, then hash is computed, but the 0 bit prevents the field from appearing
|
| - // to be a pointer.
|
| - STATIC_ASSERT(WeakCell::kSize >= kPointerSize);
|
| - STATIC_ASSERT(AllocationSite::kTransitionInfoOffset ==
|
| - WeakCell::kValueOffset &&
|
| - WeakCell::kValueOffset == Symbol::kHashFieldSlot);
|
| -
|
| - __ cmpp(rdi, FieldOperand(rcx, WeakCell::kValueOffset));
|
| - __ j(not_equal, &extra_checks_or_miss);
|
| -
|
| - // The compare above could have been a SMI/SMI comparison. Guard against this
|
| - // convincing us that we have a monomorphic JSFunction.
|
| - __ JumpIfSmi(rdi, &extra_checks_or_miss);
|
| -
|
| - __ bind(&call_function);
|
| - // Increment the call count for monomorphic function calls.
|
| - IncrementCallCount(masm, rbx, rdx);
|
| -
|
| - __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(),
|
| - tail_call_mode()),
|
| - RelocInfo::CODE_TARGET);
|
| -
|
| - __ bind(&extra_checks_or_miss);
|
| - Label uninitialized, miss, not_allocation_site;
|
| -
|
| - __ Cmp(rcx, TypeFeedbackVector::MegamorphicSentinel(isolate));
|
| - __ j(equal, &call);
|
| -
|
| - // Check if we have an allocation site.
|
| - __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset),
|
| - Heap::kAllocationSiteMapRootIndex);
|
| - __ j(not_equal, ¬_allocation_site);
|
| -
|
| - // We have an allocation site.
|
| - HandleArrayCase(masm, &miss);
|
| -
|
| - __ bind(¬_allocation_site);
|
| -
|
| - // The following cases attempt to handle MISS cases without going to the
|
| - // runtime.
|
| - if (FLAG_trace_ic) {
|
| - __ jmp(&miss);
|
| - }
|
| -
|
| - __ Cmp(rcx, TypeFeedbackVector::UninitializedSentinel(isolate));
|
| - __ j(equal, &uninitialized);
|
| -
|
| - // We are going megamorphic. If the feedback is a JSFunction, it is fine
|
| - // to handle it here. More complex cases are dealt with in the runtime.
|
| - __ AssertNotSmi(rcx);
|
| - __ CmpObjectType(rcx, JS_FUNCTION_TYPE, rcx);
|
| - __ j(not_equal, &miss);
|
| - __ Move(FieldOperand(rbx, rdx, times_pointer_size, FixedArray::kHeaderSize),
|
| - TypeFeedbackVector::MegamorphicSentinel(isolate));
|
| -
|
| - __ bind(&call);
|
| -
|
| - // Increment the call count for megamorphic function calls.
|
| - IncrementCallCount(masm, rbx, rdx);
|
| -
|
| - __ bind(&call_count_incremented);
|
| - __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()),
|
| - RelocInfo::CODE_TARGET);
|
| -
|
| - __ bind(&uninitialized);
|
| -
|
| - // We are going monomorphic, provided we actually have a JSFunction.
|
| - __ JumpIfSmi(rdi, &miss);
|
| -
|
| - // Goto miss case if we do not have a function.
|
| - __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
|
| - __ j(not_equal, &miss);
|
| -
|
| - // Make sure the function is not the Array() function, which requires special
|
| - // behavior on MISS.
|
| - __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, rcx);
|
| - __ cmpp(rdi, rcx);
|
| - __ j(equal, &miss);
|
| -
|
| - // Make sure the function belongs to the same native context.
|
| - __ movp(rcx, FieldOperand(rdi, JSFunction::kContextOffset));
|
| - __ movp(rcx, ContextOperand(rcx, Context::NATIVE_CONTEXT_INDEX));
|
| - __ cmpp(rcx, NativeContextOperand());
|
| - __ j(not_equal, &miss);
|
| -
|
| - // Store the function. Use a stub since we need a frame for allocation.
|
| - // rbx - vector
|
| - // rdx - slot (needs to be in smi form)
|
| - // rdi - function
|
| - {
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| - CreateWeakCellStub create_stub(isolate);
|
| -
|
| - __ Integer32ToSmi(rax, rax);
|
| - __ Integer32ToSmi(rdx, rdx);
|
| - __ Push(rax);
|
| - __ Push(rbx);
|
| - __ Push(rdx);
|
| - __ Push(rdi);
|
| - __ Push(rsi);
|
| - __ CallStub(&create_stub);
|
| - __ Pop(rsi);
|
| - __ Pop(rdi);
|
| - __ Pop(rdx);
|
| - __ Pop(rbx);
|
| - __ Pop(rax);
|
| - __ SmiToInteger32(rdx, rdx);
|
| - __ SmiToInteger32(rax, rax);
|
| - }
|
| -
|
| - __ jmp(&call_function);
|
| -
|
| - // We are here because tracing is on or we encountered a MISS case we can't
|
| - // handle here.
|
| - __ bind(&miss);
|
| - GenerateMiss(masm);
|
| -
|
| - __ jmp(&call_count_incremented);
|
| -
|
| - // Unreachable
|
| - __ int3();
|
| -}
|
| -
|
| -void CallICStub::GenerateMiss(MacroAssembler* masm) {
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| -
|
| - // Preserve the number of arguments.
|
| - __ Integer32ToSmi(rax, rax);
|
| - __ Push(rax);
|
| -
|
| - // Push the receiver and the function and feedback info.
|
| - __ Integer32ToSmi(rdx, rdx);
|
| - __ Push(rdi);
|
| - __ Push(rbx);
|
| - __ Push(rdx);
|
| -
|
| - // Call the entry.
|
| - __ CallRuntime(Runtime::kCallIC_Miss);
|
| -
|
| - // Move result to edi and exit the internal frame.
|
| - __ movp(rdi, rax);
|
| -
|
| - // Restore number of arguments.
|
| - __ Pop(rax);
|
| - __ SmiToInteger32(rax, rax);
|
| -}
|
| -
|
| bool CEntryStub::NeedsImmovableCode() {
|
| return false;
|
| }
|
|
|