| Index: src/x64/code-stubs-x64.cc
|
| diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
|
| index 0637bd2fb928ac1d0f4bea03afab158eedf85d4e..55a0789c3603e53f55f0eed79cb4f76568724242 100644
|
| --- a/src/x64/code-stubs-x64.cc
|
| +++ b/src/x64/code-stubs-x64.cc
|
| @@ -103,16 +103,6 @@ void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
|
| }
|
|
|
|
|
| -void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
|
| - Isolate* isolate,
|
| - CodeStubInterfaceDescriptor* descriptor) {
|
| - static Register registers[] = { rbx, rdx };
|
| - descriptor->register_param_count_ = 2;
|
| - descriptor->register_params_ = registers;
|
| - descriptor->deoptimization_handler_ = NULL;
|
| -}
|
| -
|
| -
|
| void KeyedLoadFastElementStub::InitializeInterfaceDescriptor(
|
| Isolate* isolate,
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| @@ -2169,8 +2159,7 @@ 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;
|
|
|
| // Load the cache state into rcx.
|
| __ SmiToInteger32(rdx, rdx);
|
| @@ -2184,21 +2173,6 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
|
| __ Cmp(rcx, TypeFeedbackInfo::MegamorphicSentinel(isolate));
|
| __ j(equal, &done);
|
|
|
| - // If we came here, we need to see if we are the array function.
|
| - // 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 rcx.
|
| - Handle<Map> allocation_site_map =
|
| - masm->isolate()->factory()->allocation_site_map();
|
| - __ Cmp(FieldOperand(rcx, 0), allocation_site_map);
|
| - __ j(not_equal, &miss);
|
| -
|
| - // Make sure the function is the Array() function
|
| - __ LoadArrayFunction(rcx);
|
| - __ cmpq(rdi, rcx);
|
| - __ j(not_equal, &megamorphic);
|
| - __ jmp(&done);
|
| -
|
| __ bind(&miss);
|
|
|
| // A monomorphic miss (i.e, here the cache is not uninitialized) goes
|
| @@ -2215,36 +2189,6 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
|
| // An uninitialized cache is patched with the function or sentinel to
|
| // indicate the ElementsKind if function is the Array constructor.
|
| __ bind(&initialize);
|
| - // Make sure the function is the Array() function
|
| - __ LoadArrayFunction(rcx);
|
| - __ cmpq(rdi, rcx);
|
| - __ j(not_equal, ¬_array_function);
|
| -
|
| - // 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.
|
| - __ Integer32ToSmi(rax, rax);
|
| - __ push(rax);
|
| - __ push(rdi);
|
| - __ Integer32ToSmi(rdx, rdx);
|
| - __ push(rdx);
|
| - __ push(rbx);
|
| -
|
| - CreateAllocationSiteStub create_stub;
|
| - __ CallStub(&create_stub);
|
| -
|
| - __ pop(rbx);
|
| - __ pop(rdx);
|
| - __ pop(rdi);
|
| - __ pop(rax);
|
| - __ SmiToInteger32(rax, rax);
|
| - }
|
| - __ jmp(&done_no_smi_convert);
|
| -
|
| - __ bind(¬_array_function);
|
| __ movp(FieldOperand(rbx, rdx, times_pointer_size, FixedArray::kHeaderSize),
|
| rdi);
|
|
|
| @@ -2260,8 +2204,6 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
|
|
|
| __ bind(&done);
|
| __ Integer32ToSmi(rdx, rdx);
|
| -
|
| - __ bind(&done_no_smi_convert);
|
| }
|
|
|
|
|
| @@ -2283,6 +2225,10 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
|
|
|
| if (RecordCallTarget()) {
|
| GenerateRecordCallTarget(masm);
|
| + // Type information was updated. Because we may call Array, which
|
| + // expects either undefined or an AllocationSite in ebx we need
|
| + // to set ebx to undefined.
|
| + __ Move(rbx, handle(isolate->heap()->undefined_value()));
|
| }
|
| }
|
|
|
| @@ -2391,6 +2337,13 @@ void CallConstructStub::Generate(MacroAssembler* masm) {
|
|
|
| if (RecordCallTarget()) {
|
| GenerateRecordCallTarget(masm);
|
| + // Put the AllocationSite from the feedback vector into ebx.
|
| + // By adding kPointerSize we encode that we know the AllocationSite
|
| + // entry is at the feedback vector slot given by rdx + 1.
|
| + __ SmiToInteger32(rdx, rdx);
|
| + __ movp(rbx, FieldOperand(rbx, rdx, times_pointer_size,
|
| + FixedArray::kHeaderSize + kPointerSize));
|
| + __ AssertUndefinedOrAllocationSite(rbx);
|
| }
|
|
|
| // Jump to the function-specific construct stub.
|
| @@ -2432,7 +2385,6 @@ void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
|
| StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
|
| // It is important that the store buffer overflow stubs are generated first.
|
| ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
|
| - CreateAllocationSiteStub::GenerateAheadOfTime(isolate);
|
| BinaryOpICStub::GenerateAheadOfTime(isolate);
|
| BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate);
|
| }
|
| @@ -5003,8 +4955,7 @@ void ArrayConstructorStub::GenerateDispatchToArrayStub(
|
| void ArrayConstructorStub::Generate(MacroAssembler* masm) {
|
| // ----------- S t a t e -------------
|
| // -- rax : argc
|
| - // -- rbx : feedback vector (fixed array or undefined)
|
| - // -- rdx : slot index (if ebx is fixed array)
|
| + // -- rbx : AllocationSite or undefined
|
| // -- rdi : constructor
|
| // -- rsp[0] : return address
|
| // -- rsp[8] : last argument
|
| @@ -5026,18 +4977,8 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
|
| __ CmpObjectType(rcx, MAP_TYPE, rcx);
|
| __ Check(equal, kUnexpectedInitialMapForArrayFunction);
|
|
|
| - // We should either have undefined in rbx or a valid fixed array.
|
| - Label okay_here;
|
| - Handle<Map> fixed_array_map = masm->isolate()->factory()->fixed_array_map();
|
| - __ Cmp(rbx, undefined_sentinel);
|
| - __ j(equal, &okay_here);
|
| - __ Cmp(FieldOperand(rbx, 0), fixed_array_map);
|
| - __ Assert(equal, kExpectedFixedArrayInRegisterRbx);
|
| -
|
| - // rdx should be a smi if we don't have undefined in rbx.
|
| - __ AssertSmi(rdx);
|
| -
|
| - __ bind(&okay_here);
|
| + // We should either have undefined in rbx or a valid AllocationSite
|
| + __ AssertUndefinedOrAllocationSite(rbx);
|
| }
|
|
|
| Label no_info;
|
| @@ -5045,13 +4986,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
|
| // AllocationSite, call an array constructor that doesn't use AllocationSites.
|
| __ Cmp(rbx, undefined_sentinel);
|
| __ j(equal, &no_info);
|
| - __ SmiToInteger32(rdx, rdx);
|
| - __ movp(rbx, FieldOperand(rbx, rdx, times_pointer_size,
|
| - FixedArray::kHeaderSize));
|
| - __ Integer32ToSmi(rdx, rdx);
|
| - __ Cmp(FieldOperand(rbx, 0),
|
| - masm->isolate()->factory()->allocation_site_map());
|
| - __ j(not_equal, &no_info);
|
|
|
| // Only look at the lower 16 bits of the transition info.
|
| __ movp(rdx, FieldOperand(rbx, AllocationSite::kTransitionInfoOffset));
|
|
|