diff --git a/src/arm/ic-arm.cc b/src/arm/ic-arm.cc index 79263090db..10bc438a12 100644 --- a/src/arm/ic-arm.cc +++ b/src/arm/ic-arm.cc @@ -788,23 +788,6 @@ void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, } -void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { - // ---------- S t a t e -------------- - // -- r0 : value - // -- lr : return address - // -- sp[0] : key - // -- sp[1] : receiver - // ----------- S t a t e ------------- - - __ ldm(ia, sp, r2.bit() | r3.bit()); - __ stm(db_w, sp, r0.bit() | r2.bit() | r3.bit()); - - // Perform tail call to the entry. - __ TailCallRuntime( - ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); -} - - void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- r0 : value @@ -825,23 +808,6 @@ void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { } -void StoreIC::GenerateExtendStorage(MacroAssembler* masm) { - // ----------- S t a t e ------------- - // -- r0 : value - // -- r2 : name - // -- lr : return address - // -- [sp] : receiver - // ----------------------------------- - - __ ldr(r3, MemOperand(sp)); // copy receiver - __ stm(db_w, sp, r0.bit() | r2.bit() | r3.bit()); - - // Perform tail call to the entry. - __ TailCallRuntime( - ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); -} - - void StoreIC::GenerateMiss(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- r0 : value diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc index e5b2e8837d..44a754e401 100644 --- a/src/arm/stub-cache-arm.cc +++ b/src/arm/stub-cache-arm.cc @@ -261,7 +261,6 @@ void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, // After executing generated code, the receiver_reg and name_reg // may be clobbered. void StubCompiler::GenerateStoreField(MacroAssembler* masm, - Builtins::Name storage_extend, JSObject* object, int index, Map* transition, @@ -294,11 +293,12 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm, if ((transition != NULL) && (object->map()->unused_property_fields() == 0)) { // The properties must be extended before we can store the value. // We jump to a runtime call that extends the properties array. + __ push(receiver_reg); __ mov(r2, Operand(Handle(transition))); - // Please note, if we implement keyed store for arm we need - // to call the Builtins::KeyedStoreIC_ExtendStorage. - Handle ic(Builtins::builtin(Builtins::StoreIC_ExtendStorage)); - __ Jump(ic, RelocInfo::CODE_TARGET); + __ stm(db_w, sp, r2.bit() | r0.bit()); + __ TailCallRuntime( + ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage)), + 3, 1); return; } @@ -1215,7 +1215,6 @@ Object* StoreStubCompiler::CompileStoreField(JSObject* object, // name register might be clobbered. GenerateStoreField(masm(), - Builtins::StoreIC_ExtendStorage, object, index, transition, @@ -1719,7 +1718,6 @@ Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, __ ldr(r3, MemOperand(sp)); // r1 is used as scratch register, r3 and r2 might be clobbered. GenerateStoreField(masm(), - Builtins::StoreIC_ExtendStorage, object, index, transition, diff --git a/src/builtins.cc b/src/builtins.cc index db0770f3a9..a49fd602ab 100644 --- a/src/builtins.cc +++ b/src/builtins.cc @@ -668,10 +668,6 @@ static void Generate_StoreIC_Miss(MacroAssembler* masm) { } -static void Generate_StoreIC_ExtendStorage(MacroAssembler* masm) { - StoreIC::GenerateExtendStorage(masm); -} - static void Generate_StoreIC_Megamorphic(MacroAssembler* masm) { StoreIC::GenerateMegamorphic(masm); } @@ -720,11 +716,6 @@ static void Generate_KeyedStoreIC_ExternalFloatArray(MacroAssembler* masm) { } -static void Generate_KeyedStoreIC_ExtendStorage(MacroAssembler* masm) { - KeyedStoreIC::GenerateExtendStorage(masm); -} - - static void Generate_KeyedStoreIC_Miss(MacroAssembler* masm) { KeyedStoreIC::GenerateMiss(masm); } diff --git a/src/builtins.h b/src/builtins.h index 418948f750..655478e3b7 100644 --- a/src/builtins.h +++ b/src/builtins.h @@ -69,9 +69,6 @@ enum BuiltinExtraArguments { V(StoreIC_Miss, BUILTIN, UNINITIALIZED) \ V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED) \ \ - V(StoreIC_ExtendStorage, BUILTIN, UNINITIALIZED) \ - V(KeyedStoreIC_ExtendStorage, BUILTIN, UNINITIALIZED) \ - \ V(LoadIC_Initialize, LOAD_IC, UNINITIALIZED) \ V(LoadIC_PreMonomorphic, LOAD_IC, PREMONOMORPHIC) \ V(LoadIC_Normal, LOAD_IC, MONOMORPHIC) \ diff --git a/src/ia32/ic-ia32.cc b/src/ia32/ic-ia32.cc index db83ddea15..024aba50b3 100644 --- a/src/ia32/ic-ia32.cc +++ b/src/ia32/ic-ia32.cc @@ -1385,26 +1385,6 @@ void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { } -void StoreIC::GenerateExtendStorage(MacroAssembler* masm) { - // ----------- S t a t e ------------- - // -- eax : value - // -- ecx : transition map - // -- edx : receiver - // -- esp[0] : return address - // ----------------------------------- - - __ pop(ebx); - __ push(edx); // receiver - __ push(ecx); // transition map - __ push(eax); // value - __ push(ebx); // return address - - // Perform tail call to the entry. - __ TailCallRuntime( - ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); -} - - void StoreIC::GenerateMiss(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- eax : value @@ -1464,27 +1444,6 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedStoreIC_Miss)), 3, 1); } - -void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { - // ----------- S t a t e ------------- - // -- eax : value - // -- ecx : transition map - // -- esp[0] : return address - // -- esp[4] : key - // -- esp[8] : receiver - // ----------------------------------- - - __ pop(ebx); - __ push(Operand(esp, 1 * kPointerSize)); - __ push(ecx); - __ push(eax); - __ push(ebx); - - // Do tail-call to runtime routine. - __ TailCallRuntime( - ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); -} - #undef __ diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc index 1990578bf1..87a4297708 100644 --- a/src/ia32/stub-cache-ia32.cc +++ b/src/ia32/stub-cache-ia32.cc @@ -607,8 +607,9 @@ void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { } +// Both name_reg and receiver_reg are preserved on jumps to miss_label, +// but may be destroyed if store is successful. void StubCompiler::GenerateStoreField(MacroAssembler* masm, - Builtins::Name storage_extend, JSObject* object, int index, Map* transition, @@ -638,9 +639,13 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm, if ((transition != NULL) && (object->map()->unused_property_fields() == 0)) { // The properties must be extended before we can store the value. // We jump to a runtime call that extends the properties array. - __ mov(ecx, Immediate(Handle(transition))); - Handle ic(Builtins::builtin(storage_extend)); - __ jmp(ic, RelocInfo::CODE_TARGET); + __ pop(scratch); // Return address. + __ push(receiver_reg); + __ push(Immediate(Handle(transition))); + __ push(eax); + __ push(scratch); + __ TailCallRuntime( + ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage)), 3, 1); return; } @@ -1251,7 +1256,6 @@ Object* StoreStubCompiler::CompileStoreField(JSObject* object, // Generate store field code. Trashes the name register. GenerateStoreField(masm(), - Builtins::StoreIC_ExtendStorage, object, index, transition, @@ -1425,15 +1429,14 @@ Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, __ j(not_equal, &miss, not_taken); // Get the object from the stack. - __ mov(ebx, Operand(esp, 2 * kPointerSize)); + __ mov(edx, Operand(esp, 2 * kPointerSize)); // Generate store field code. Trashes the name register. GenerateStoreField(masm(), - Builtins::KeyedStoreIC_ExtendStorage, object, index, transition, - ebx, ecx, edx, + edx, ecx, ebx, &miss); // Handle store cache miss. diff --git a/src/ic.h b/src/ic.h index 9096a7fd7e..b34236f45e 100644 --- a/src/ic.h +++ b/src/ic.h @@ -352,7 +352,6 @@ class StoreIC: public IC { static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } static void GenerateMiss(MacroAssembler* masm); static void GenerateMegamorphic(MacroAssembler* masm); - static void GenerateExtendStorage(MacroAssembler* masm); private: // Update the inline cache and the global stub cache based on the @@ -389,7 +388,6 @@ class KeyedStoreIC: public IC { static void GenerateMiss(MacroAssembler* masm); static void GenerateRuntimeSetProperty(MacroAssembler* masm); static void GenerateGeneric(MacroAssembler* masm); - static void GenerateExtendStorage(MacroAssembler* masm); // Generators for external array types. See objects.h. // These are similar to the generic IC; they optimize the case of diff --git a/src/stub-cache.h b/src/stub-cache.h index fae569a90e..8eeef02e70 100644 --- a/src/stub-cache.h +++ b/src/stub-cache.h @@ -369,7 +369,6 @@ class StubCompiler BASE_EMBEDDED { Label* miss_label); static void GenerateStoreField(MacroAssembler* masm, - Builtins::Name storage_extend, JSObject* object, int index, Map* transition, diff --git a/src/x64/ic-x64.cc b/src/x64/ic-x64.cc index 115d70dfa1..d670a1f764 100644 --- a/src/x64/ic-x64.cc +++ b/src/x64/ic-x64.cc @@ -611,27 +611,6 @@ void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm) { } -void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { - // ----------- S t a t e ------------- - // -- rax : value - // -- rcx : transition map - // -- rsp[0] : return address - // -- rsp[8] : key - // -- rsp[16] : receiver - // ----------------------------------- - - __ pop(rbx); - __ push(Operand(rsp, 1 * kPointerSize)); // receiver - __ push(rcx); // transition map - __ push(rax); // value - __ push(rbx); // return address - - // Do tail-call to runtime routine. - __ TailCallRuntime( - ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); -} - - void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- rax : value @@ -1308,7 +1287,6 @@ void LoadIC::GenerateStringLength(MacroAssembler* masm) { } - bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { // The address of the instruction following the call. Address test_instruction_address = @@ -1336,6 +1314,7 @@ bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { return true; } + void StoreIC::GenerateMiss(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- rax : value @@ -1354,24 +1333,6 @@ void StoreIC::GenerateMiss(MacroAssembler* masm) { __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1); } -void StoreIC::GenerateExtendStorage(MacroAssembler* masm) { - // ----------- S t a t e ------------- - // -- rax : value - // -- rcx : Map (target of map transition) - // -- rdx : receiver - // -- rsp[0] : return address - // ----------------------------------- - - __ pop(rbx); - __ push(rdx); // receiver - __ push(rcx); // transition map - __ push(rax); // value - __ push(rbx); // return address - - // Perform tail call to the entry. - __ TailCallRuntime( - ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); -} void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { // ----------- S t a t e ------------- diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc index 6e8743eb8d..1c3fd3694d 100644 --- a/src/x64/stub-cache-x64.cc +++ b/src/x64/stub-cache-x64.cc @@ -201,8 +201,9 @@ void StubCache::GenerateProbe(MacroAssembler* masm, } +// Both name_reg and receiver_reg are preserved on jumps to miss_label, +// but may be destroyed if store is successful. void StubCompiler::GenerateStoreField(MacroAssembler* masm, - Builtins::Name storage_extend, JSObject* object, int index, Map* transition, @@ -231,9 +232,13 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm, if ((transition != NULL) && (object->map()->unused_property_fields() == 0)) { // The properties must be extended before we can store the value. // We jump to a runtime call that extends the properties array. - __ Move(rcx, Handle(transition)); - Handle ic(Builtins::builtin(storage_extend)); - __ Jump(ic, RelocInfo::CODE_TARGET); + __ pop(scratch); // Return address. + __ push(receiver_reg); + __ Push(Handle(transition)); + __ push(rax); + __ push(scratch); + __ TailCallRuntime( + ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage)), 3, 1); return; } @@ -1399,9 +1404,8 @@ Object* StoreStubCompiler::CompileStoreField(JSObject* object, // ----------------------------------- Label miss; - // Generate store field code. Trashes the name register. + // Generate store field code. Preserves receiver and name on jump to miss. GenerateStoreField(masm(), - Builtins::StoreIC_ExtendStorage, object, index, transition, @@ -1410,7 +1414,6 @@ Object* StoreStubCompiler::CompileStoreField(JSObject* object, // Handle store cache miss. __ bind(&miss); - __ Move(rcx, Handle(name)); // restore name Handle ic(Builtins::builtin(Builtins::StoreIC_Miss)); __ Jump(ic, RelocInfo::CODE_TARGET); @@ -1552,16 +1555,15 @@ Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, __ Cmp(rcx, Handle(name)); __ j(not_equal, &miss); - // Get the object from the stack. - __ movq(rbx, Operand(rsp, 2 * kPointerSize)); + // Get the receiver from the stack. + __ movq(rdx, Operand(rsp, 2 * kPointerSize)); - // Generate store field code. Trashes the name register. + // Generate store field code. Preserves receiver and name on jump to miss. GenerateStoreField(masm(), - Builtins::KeyedStoreIC_ExtendStorage, object, index, transition, - rbx, rcx, rdx, + rdx, rcx, rbx, &miss); // Handle store cache miss.