Changeset 190675 in webkit


Ignore:
Timestamp:
Oct 7, 2015 11:26:19 AM (9 years ago)
Author:
fpizlo@apple.com
Message:

JIT::emitGetGlobalProperty/emitPutGlobalProperty are only called from one place
https://bugs.webkit.org/show_bug.cgi?id=149879

Reviewed by Saam Barati.

To simplify my work to insert barriers on loads of the butterfly, I want to reduce the amount
of abstraction we have around code that loads the butterfly.

  • jit/JIT.h:
  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emitLoadWithStructureCheck):
(JSC::JIT::emitGetVarFromPointer):
(JSC::JIT::emit_op_get_from_scope):
(JSC::JIT::emitSlow_op_get_from_scope):
(JSC::JIT::emitPutGlobalVariable):
(JSC::JIT::emit_op_put_to_scope):
(JSC::JIT::emitGetGlobalProperty): Deleted.
(JSC::JIT::emitPutGlobalProperty): Deleted.

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::emitLoadWithStructureCheck):
(JSC::JIT::emitGetVarFromPointer):
(JSC::JIT::emit_op_get_from_scope):
(JSC::JIT::emitSlow_op_get_from_scope):
(JSC::JIT::emitPutGlobalVariable):
(JSC::JIT::emit_op_put_to_scope):
(JSC::JIT::emitGetGlobalProperty): Deleted.
(JSC::JIT::emitPutGlobalProperty): Deleted.

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r190673 r190675  
     12015-10-07  Filip Pizlo  <fpizlo@apple.com>
     2
     3        JIT::emitGetGlobalProperty/emitPutGlobalProperty are only called from one place
     4        https://bugs.webkit.org/show_bug.cgi?id=149879
     5
     6        Reviewed by Saam Barati.
     7
     8        To simplify my work to insert barriers on loads of the butterfly, I want to reduce the amount
     9        of abstraction we have around code that loads the butterfly.
     10
     11        * jit/JIT.h:
     12        * jit/JITPropertyAccess.cpp:
     13        (JSC::JIT::emitLoadWithStructureCheck):
     14        (JSC::JIT::emitGetVarFromPointer):
     15        (JSC::JIT::emit_op_get_from_scope):
     16        (JSC::JIT::emitSlow_op_get_from_scope):
     17        (JSC::JIT::emitPutGlobalVariable):
     18        (JSC::JIT::emit_op_put_to_scope):
     19        (JSC::JIT::emitGetGlobalProperty): Deleted.
     20        (JSC::JIT::emitPutGlobalProperty): Deleted.
     21        * jit/JITPropertyAccess32_64.cpp:
     22        (JSC::JIT::emitLoadWithStructureCheck):
     23        (JSC::JIT::emitGetVarFromPointer):
     24        (JSC::JIT::emit_op_get_from_scope):
     25        (JSC::JIT::emitSlow_op_get_from_scope):
     26        (JSC::JIT::emitPutGlobalVariable):
     27        (JSC::JIT::emit_op_put_to_scope):
     28        (JSC::JIT::emitGetGlobalProperty): Deleted.
     29        (JSC::JIT::emitPutGlobalProperty): Deleted.
     30
    1312015-10-07  Filip Pizlo  <fpizlo@apple.com>
    232
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r190673 r190675  
    669669        void emitResolveClosure(int dst, int scope, bool needsVarInjectionChecks, unsigned depth);
    670670        void emitLoadWithStructureCheck(int scope, Structure** structureSlot);
    671         void emitGetGlobalProperty(uintptr_t* operandSlot);
    672671#if USE(JSVALUE64)
    673672        void emitGetVarFromPointer(JSValue* operand, GPRReg);
     
    678677#endif
    679678        void emitGetClosureVar(int scope, uintptr_t operand);
    680         void emitPutGlobalProperty(uintptr_t* operandSlot, int value);
    681679        void emitNotifyWrite(WatchpointSet*);
    682680        void emitNotifyWrite(GPRReg pointerToSet);
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp

    r190673 r190675  
    755755}
    756756
    757 void JIT::emitGetGlobalProperty(uintptr_t* operandSlot)
    758 {
    759     GPRReg base = regT0;
    760     GPRReg result = regT0;
    761     GPRReg offset = regT1;
    762     GPRReg scratch = regT2;
    763    
    764     load32(operandSlot, offset);
    765     if (!ASSERT_DISABLED) {
    766         Jump isOutOfLine = branch32(GreaterThanOrEqual, offset, TrustedImm32(firstOutOfLineOffset));
    767         abortWithReason(JITOffsetIsNotOutOfLine);
    768         isOutOfLine.link(this);
    769     }
    770     loadPtr(Address(base, JSObject::butterflyOffset()), scratch);
    771     neg32(offset);
    772     signExtend32ToPtr(offset, offset);
    773     load64(BaseIndex(scratch, offset, TimesEight, (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), result);
    774 }
    775 
    776757void JIT::emitGetVarFromPointer(JSValue* operand, GPRReg reg)
    777758{
     
    802783        switch (resolveType) {
    803784        case GlobalProperty:
    804         case GlobalPropertyWithVarInjectionChecks:
     785        case GlobalPropertyWithVarInjectionChecks: {
    805786            emitLoadWithStructureCheck(scope, structureSlot); // Structure check covers var injection.
    806             emitGetGlobalProperty(operandSlot);
     787            GPRReg base = regT0;
     788            GPRReg result = regT0;
     789            GPRReg offset = regT1;
     790            GPRReg scratch = regT2;
     791           
     792            load32(operandSlot, offset);
     793            if (!ASSERT_DISABLED) {
     794                Jump isOutOfLine = branch32(GreaterThanOrEqual, offset, TrustedImm32(firstOutOfLineOffset));
     795                abortWithReason(JITOffsetIsNotOutOfLine);
     796                isOutOfLine.link(this);
     797            }
     798            loadPtr(Address(base, JSObject::butterflyOffset()), scratch);
     799            neg32(offset);
     800            signExtend32ToPtr(offset, offset);
     801            load64(BaseIndex(scratch, offset, TimesEight, (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), result);
    807802            break;
     803        }
    808804        case GlobalVar:
    809805        case GlobalVarWithVarInjectionChecks:
     
    902898}
    903899
    904 void JIT::emitPutGlobalProperty(uintptr_t* operandSlot, int value)
    905 {
    906     emitGetVirtualRegister(value, regT2);
    907 
    908     loadPtr(Address(regT0, JSObject::butterflyOffset()), regT0);
    909     loadPtr(operandSlot, regT1);
    910     negPtr(regT1);
    911     storePtr(regT2, BaseIndex(regT0, regT1, TimesEight, (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)));
    912 }
    913 
    914900void JIT::emitPutGlobalVariable(JSValue* operand, int value, WatchpointSet* set)
    915901{
     
    947933        switch (resolveType) {
    948934        case GlobalProperty:
    949         case GlobalPropertyWithVarInjectionChecks:
     935        case GlobalPropertyWithVarInjectionChecks: {
    950936            emitWriteBarrier(m_codeBlock->globalObject(), value, ShouldFilterValue);
    951937            emitLoadWithStructureCheck(scope, structureSlot); // Structure check covers var injection.
    952             emitPutGlobalProperty(operandSlot, value);
     938            emitGetVirtualRegister(value, regT2);
     939           
     940            loadPtr(Address(regT0, JSObject::butterflyOffset()), regT0);
     941            loadPtr(operandSlot, regT1);
     942            negPtr(regT1);
     943            storePtr(regT2, BaseIndex(regT0, regT1, TimesEight, (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)));
    953944            break;
     945        }
    954946        case GlobalVar:
    955947        case GlobalVarWithVarInjectionChecks:
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp

    r190673 r190675  
    781781}
    782782
    783 void JIT::emitGetGlobalProperty(uintptr_t* operandSlot)
    784 {
    785     GPRReg base = regT2;
    786     GPRReg resultTag = regT1;
    787     GPRReg resultPayload = regT0;
    788     GPRReg offset = regT3;
    789    
    790     move(regT0, base);
    791     load32(operandSlot, offset);
    792     if (!ASSERT_DISABLED) {
    793         Jump isOutOfLine = branch32(GreaterThanOrEqual, offset, TrustedImm32(firstOutOfLineOffset));
    794         abortWithReason(JITOffsetIsNotOutOfLine);
    795         isOutOfLine.link(this);
    796     }
    797     loadPtr(Address(base, JSObject::butterflyOffset()), base);
    798     neg32(offset);
    799     load32(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload) + (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), resultPayload);
    800     load32(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag) + (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), resultTag);
    801 }
    802 
    803783void JIT::emitGetVarFromPointer(JSValue* operand, GPRReg tag, GPRReg payload)
    804784{
     
    832812        switch (resolveType) {
    833813        case GlobalProperty:
    834         case GlobalPropertyWithVarInjectionChecks:
     814        case GlobalPropertyWithVarInjectionChecks: {
    835815            emitLoadWithStructureCheck(scope, structureSlot); // Structure check covers var injection.
    836             emitGetGlobalProperty(operandSlot);
     816            GPRReg base = regT2;
     817            GPRReg resultTag = regT1;
     818            GPRReg resultPayload = regT0;
     819            GPRReg offset = regT3;
     820           
     821            move(regT0, base);
     822            load32(operandSlot, offset);
     823            if (!ASSERT_DISABLED) {
     824                Jump isOutOfLine = branch32(GreaterThanOrEqual, offset, TrustedImm32(firstOutOfLineOffset));
     825                abortWithReason(JITOffsetIsNotOutOfLine);
     826                isOutOfLine.link(this);
     827            }
     828            loadPtr(Address(base, JSObject::butterflyOffset()), base);
     829            neg32(offset);
     830            load32(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload) + (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), resultPayload);
     831            load32(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag) + (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), resultTag);
    837832            break;
     833        }
    838834        case GlobalVar:
    839835        case GlobalVarWithVarInjectionChecks:
     
    927923}
    928924
    929 void JIT::emitPutGlobalProperty(uintptr_t* operandSlot, int value)
    930 {
    931     emitLoad(value, regT3, regT2);
    932    
    933     loadPtr(Address(regT0, JSObject::butterflyOffset()), regT0);
    934     loadPtr(operandSlot, regT1);
    935     negPtr(regT1);
    936     store32(regT3, BaseIndex(regT0, regT1, TimesEight, (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag)));
    937     store32(regT2, BaseIndex(regT0, regT1, TimesEight, (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload)));
    938 }
    939 
    940925void JIT::emitPutGlobalVariable(JSValue* operand, int value, WatchpointSet* set)
    941926{
     
    978963        switch (resolveType) {
    979964        case GlobalProperty:
    980         case GlobalPropertyWithVarInjectionChecks:
     965        case GlobalPropertyWithVarInjectionChecks: {
    981966            emitWriteBarrier(m_codeBlock->globalObject(), value, ShouldFilterValue);
    982967            emitLoadWithStructureCheck(scope, structureSlot); // Structure check covers var injection.
    983             emitPutGlobalProperty(operandSlot, value);
     968            emitLoad(value, regT3, regT2);
     969           
     970            loadPtr(Address(regT0, JSObject::butterflyOffset()), regT0);
     971            loadPtr(operandSlot, regT1);
     972            negPtr(regT1);
     973            store32(regT3, BaseIndex(regT0, regT1, TimesEight, (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag)));
     974            store32(regT2, BaseIndex(regT0, regT1, TimesEight, (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload)));
    984975            break;
     976        }
    985977        case GlobalVar:
    986978        case GlobalVarWithVarInjectionChecks:
Note: See TracChangeset for help on using the changeset viewer.