Changeset 80919 in webkit


Ignore:
Timestamp:
Mar 11, 2011 7:12:05 PM (13 years ago)
Author:
oliver@apple.com
Message:

2011-03-11 Oliver Hunt <oliver@apple.com>

Reviewed by Gavin Barraclough.

Ensure all values are correctly tagged in the registerfile
https://bugs.webkit.org/show_bug.cgi?id=56214

This patch makes sure that all JSCell pointers written to
the registerfile are correctly tagged as JSCells, and replaces
raw int usage with the immediate representation.

For performance, register pressure, and general saneness reasons
I've added abstractions for reading and writing the tag
and payload of integer registers directly for the JSVALUE64
encoding.

  • interpreter/Register.h: (JSC::Register::withInt): (JSC::Register::withCallee): (JSC::Register::operator=): (JSC::Register::i): (JSC::Register::activation): (JSC::Register::function): (JSC::Register::propertyNameIterator): (JSC::Register::scopeChain):
  • jit/JIT.h:
  • jit/JITCall.cpp: (JSC::JIT::compileOpCallInitializeCallFrame): (JSC::JIT::compileOpCallVarargs): (JSC::JIT::compileOpCall):
  • jit/JITCall32_64.cpp: (JSC::JIT::compileOpCallInitializeCallFrame): (JSC::JIT::compileOpCallVarargs): (JSC::JIT::compileOpCall): (JSC::JIT::compileOpCallSlowCase):
  • jit/JITInlineMethods.h: (JSC::JIT::emitPutToCallFrameHeader): (JSC::JIT::emitPutCellToCallFrameHeader): (JSC::JIT::emitPutIntToCallFrameHeader):
  • jit/JITOpcodes.cpp: (JSC::JIT::privateCompileCTINativeCall): (JSC::JIT::emit_op_get_pnames): (JSC::JIT::emit_op_next_pname): (JSC::JIT::emit_op_load_varargs): (JSC::JIT::emitSlow_op_load_varargs):
  • jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTINativeCall): (JSC::JIT::emit_op_get_pnames): (JSC::JIT::emit_op_next_pname):
  • jit/JSInterfaceJIT.h: (JSC::JSInterfaceJIT::intPayloadFor): (JSC::JSInterfaceJIT::intTagFor):
  • jit/SpecializedThunkJIT.h: (JSC::SpecializedThunkJIT::returnJSValue): (JSC::SpecializedThunkJIT::returnDouble): (JSC::SpecializedThunkJIT::returnInt32): (JSC::SpecializedThunkJIT::returnJSCell):

2011-03-11 Oliver Hunt <oliver@apple.com>

Reviewed by Gavin Barraclough.

Ensure all values are correctly tagged in the registerfile
https://bugs.webkit.org/show_bug.cgi?id=56214

Make sure everything builds still.

  • bridge/c/c_class.cpp:
  • bridge/c/c_runtime.cpp:
  • bridge/jni/JavaMethod.cpp:
  • plugins/PluginViewNone.cpp:
Location:
trunk/Source
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r80906 r80919  
     12011-03-11  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        Ensure all values are correctly tagged in the registerfile
     6        https://bugs.webkit.org/show_bug.cgi?id=56214
     7
     8        This patch makes sure that all JSCell pointers written to
     9        the registerfile are correctly tagged as JSCells, and replaces
     10        raw int usage with the immediate representation.
     11
     12        For performance, register pressure, and general saneness reasons
     13        I've added abstractions for reading and writing the tag
     14        and payload of integer registers directly for the JSVALUE64
     15        encoding.
     16
     17        * interpreter/Register.h:
     18        (JSC::Register::withInt):
     19        (JSC::Register::withCallee):
     20        (JSC::Register::operator=):
     21        (JSC::Register::i):
     22        (JSC::Register::activation):
     23        (JSC::Register::function):
     24        (JSC::Register::propertyNameIterator):
     25        (JSC::Register::scopeChain):
     26        * jit/JIT.h:
     27        * jit/JITCall.cpp:
     28        (JSC::JIT::compileOpCallInitializeCallFrame):
     29        (JSC::JIT::compileOpCallVarargs):
     30        (JSC::JIT::compileOpCall):
     31        * jit/JITCall32_64.cpp:
     32        (JSC::JIT::compileOpCallInitializeCallFrame):
     33        (JSC::JIT::compileOpCallVarargs):
     34        (JSC::JIT::compileOpCall):
     35        (JSC::JIT::compileOpCallSlowCase):
     36        * jit/JITInlineMethods.h:
     37        (JSC::JIT::emitPutToCallFrameHeader):
     38        (JSC::JIT::emitPutCellToCallFrameHeader):
     39        (JSC::JIT::emitPutIntToCallFrameHeader):
     40        * jit/JITOpcodes.cpp:
     41        (JSC::JIT::privateCompileCTINativeCall):
     42        (JSC::JIT::emit_op_get_pnames):
     43        (JSC::JIT::emit_op_next_pname):
     44        (JSC::JIT::emit_op_load_varargs):
     45        (JSC::JIT::emitSlow_op_load_varargs):
     46        * jit/JITOpcodes32_64.cpp:
     47        (JSC::JIT::privateCompileCTINativeCall):
     48        (JSC::JIT::emit_op_get_pnames):
     49        (JSC::JIT::emit_op_next_pname):
     50        * jit/JSInterfaceJIT.h:
     51        (JSC::JSInterfaceJIT::intPayloadFor):
     52        (JSC::JSInterfaceJIT::intTagFor):
     53        * jit/SpecializedThunkJIT.h:
     54        (JSC::SpecializedThunkJIT::returnJSValue):
     55        (JSC::SpecializedThunkJIT::returnDouble):
     56        (JSC::SpecializedThunkJIT::returnInt32):
     57        (JSC::SpecializedThunkJIT::returnJSCell):
     58
    1592011-03-11  Dimitri Glazkov  <dglazkov@chromium.org>
    260
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r80742 r80919  
    25452545                        buildConfigurationList = 149C277108902AFE008A9EFC /* Build configuration list for PBXProject "JavaScriptCore" */;
    25462546                        compatibilityVersion = "Xcode 3.1";
     2547                        developmentRegion = English;
    25472548                        hasScannedForEncodings = 1;
    25482549                        knownRegions = (
  • trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp

    r79904 r80919  
    2727#include "StructureStubInfo.h"
    2828
     29#include "JSObject.h"
    2930#include "ScopeChain.h"
    3031
  • trunk/Source/JavaScriptCore/interpreter/Register.h

    r76248 r80919  
    5555        Register& operator=(const JSValue&);
    5656        JSValue jsValue() const;
    57        
    58         Register& operator=(JSActivation*);
     57
    5958        Register& operator=(CallFrame*);
    6059        Register& operator=(CodeBlock*);
    61         Register& operator=(JSPropertyNameIterator*);
    6260        Register& operator=(ScopeChainNode*);
    6361        Register& operator=(Instruction*);
     
    7472        static Register withInt(int32_t i)
    7573        {
    76             Register r;
    77             r.u.i = i;
     74            Register r = jsNumber(i);
    7875            return r;
    7976        }
    8077
    81         static Register withCallee(JSObject* callee)
    82         {
    83             Register r;
    84             r.u.function = callee;
    85             return r;
    86         }
     78        static inline Register withCallee(JSObject* callee);
    8779
    8880    private:
    8981        union {
    90             int32_t i;
    9182            EncodedJSValue value;
    92 
    93             JSActivation* activation;
    9483            CallFrame* callFrame;
    9584            CodeBlock* codeBlock;
    96             JSObject* function;
    97             JSPropertyNameIterator* propertyNameIterator;
    98             ScopeChainNode* scopeChain;
    9985            Instruction* vPC;
    10086        } u;
     
    132118    // Interpreter functions
    133119
    134     ALWAYS_INLINE Register& Register::operator=(JSActivation* activation)
    135     {
    136         u.activation = activation;
    137         return *this;
    138     }
    139 
    140120    ALWAYS_INLINE Register& Register::operator=(CallFrame* callFrame)
    141121    {
     
    156136    }
    157137
    158     ALWAYS_INLINE Register& Register::operator=(ScopeChainNode* scopeChain)
     138    ALWAYS_INLINE int32_t Register::i() const
    159139    {
    160         u.scopeChain = scopeChain;
    161         return *this;
     140        return jsValue().asInt32();
    162141    }
    163142
    164     ALWAYS_INLINE Register& Register::operator=(JSPropertyNameIterator* propertyNameIterator)
    165     {
    166         u.propertyNameIterator = propertyNameIterator;
    167         return *this;
    168     }
    169 
    170     ALWAYS_INLINE int32_t Register::i() const
    171     {
    172         return u.i;
    173     }
    174    
    175     ALWAYS_INLINE JSActivation* Register::activation() const
    176     {
    177         return u.activation;
    178     }
    179    
    180143    ALWAYS_INLINE CallFrame* Register::callFrame() const
    181144    {
     
    187150        return u.codeBlock;
    188151    }
    189    
    190     ALWAYS_INLINE JSObject* Register::function() const
    191     {
    192         return u.function;
    193     }
    194    
    195     ALWAYS_INLINE JSPropertyNameIterator* Register::propertyNameIterator() const
    196     {
    197         return u.propertyNameIterator;
    198     }
    199    
    200     ALWAYS_INLINE ScopeChainNode* Register::scopeChain() const
    201     {
    202         return u.scopeChain;
    203     }
    204    
     152
    205153    ALWAYS_INLINE Instruction* Register::vPC() const
    206154    {
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r80738 r80919  
    854854
    855855        void emitPutToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry entry);
     856        void emitPutCellToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry);
     857        void emitPutIntToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry);
    856858        void emitPutImmediateToCallFrameHeader(void* value, RegisterFile::CallFrameHeaderEntry entry);
    857859        void emitGetFromCallFrameHeaderPtr(RegisterFile::CallFrameHeaderEntry entry, RegisterID to, RegisterID from = callFrameRegister);
  • trunk/Source/JavaScriptCore/jit/JITCall.cpp

    r79904 r80919  
    4949void JIT::compileOpCallInitializeCallFrame()
    5050{
    51     store32(regT1, Address(callFrameRegister, RegisterFile::ArgumentCount * static_cast<int>(sizeof(Register))));
    52     loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain)), regT3); // newScopeChain
    53     storePtr(regT0, Address(callFrameRegister, RegisterFile::Callee * static_cast<int>(sizeof(Register))));
    54     storePtr(regT3, Address(callFrameRegister, RegisterFile::ScopeChain * static_cast<int>(sizeof(Register))));
     51    // regT0 holds callee, regT1 holds argCount
     52    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain)), regT3); // scopeChain
     53    emitPutIntToCallFrameHeader(regT1, RegisterFile::ArgumentCount);
     54    emitPutCellToCallFrameHeader(regT0, RegisterFile::Callee);
     55    emitPutCellToCallFrameHeader(regT3, RegisterFile::ScopeChain);
    5556}
    5657
     
    6869
    6970    emitGetVirtualRegister(argCountRegister, regT1);
     71    emitFastArithImmToInt(regT1);
    7072    emitGetVirtualRegister(callee, regT0);
    7173    addPtr(Imm32(registerOffset), regT1, regT2);
     
    200202
    201203    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain)), regT1); // newScopeChain
    202 
    203     store32(Imm32(argCount), Address(callFrameRegister, (registerOffset + RegisterFile::ArgumentCount) * static_cast<int>(sizeof(Register))));
     204   
     205    store32(Imm32(Int32Tag), intTagFor(registerOffset + RegisterFile::ArgumentCount));
     206    store32(Imm32(argCount), intPayloadFor(registerOffset + RegisterFile::ArgumentCount));
    204207    storePtr(callFrameRegister, Address(callFrameRegister, (registerOffset + RegisterFile::CallerFrame) * static_cast<int>(sizeof(Register))));
    205208    storePtr(regT0, Address(callFrameRegister, (registerOffset + RegisterFile::Callee) * static_cast<int>(sizeof(Register))));
  • trunk/Source/JavaScriptCore/jit/JITCall32_64.cpp

    r79904 r80919  
    5050{
    5151    // regT0 holds callee, regT1 holds argCount
    52     store32(regT1, Address(callFrameRegister, RegisterFile::ArgumentCount * static_cast<int>(sizeof(Register))));
    5352    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain)), regT3); // scopeChain
    54     storePtr(regT0, Address(callFrameRegister, RegisterFile::Callee * static_cast<int>(sizeof(Register)))); // callee
    55     storePtr(regT3, Address(callFrameRegister, RegisterFile::ScopeChain * static_cast<int>(sizeof(Register)))); // scopeChain
     53    emitPutIntToCallFrameHeader(regT1, RegisterFile::ArgumentCount);
     54    emitPutCellToCallFrameHeader(regT0, RegisterFile::Callee);
     55    emitPutCellToCallFrameHeader(regT3, RegisterFile::ScopeChain);
    5656}
    5757
     
    7878    mul32(Imm32(sizeof(Register)), regT3, regT3);
    7979    addPtr(callFrameRegister, regT3);
    80     storePtr(callFrameRegister, Address(regT3, RegisterFile::CallerFrame * static_cast<int>(sizeof(Register))));
     80    store32(Imm32(JSValue::CellTag), tagFor(RegisterFile::CallerFrame, regT3));
     81    storePtr(callFrameRegister, payloadFor(RegisterFile::CallerFrame, regT3));
    8182    move(regT3, callFrameRegister);
    8283
     
    209210
    210211    // Speculatively roll the callframe, assuming argCount will match the arity.
    211     storePtr(callFrameRegister, Address(callFrameRegister, (RegisterFile::CallerFrame + registerOffset) * static_cast<int>(sizeof(Register))));
     212    store32(Imm32(JSValue::CellTag), tagFor(RegisterFile::CallerFrame + registerOffset, callFrameRegister));
     213    storePtr(callFrameRegister, payloadFor(RegisterFile::CallerFrame + registerOffset, callFrameRegister));
    212214    addPtr(Imm32(registerOffset * static_cast<int>(sizeof(Register))), callFrameRegister);
    213215    move(Imm32(argCount), regT1);
     
    281283    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain)), regT2);
    282284
    283     store32(Imm32(argCount), Address(callFrameRegister, (registerOffset + RegisterFile::ArgumentCount) * static_cast<int>(sizeof(Register))));
    284     storePtr(callFrameRegister, Address(callFrameRegister, (registerOffset + RegisterFile::CallerFrame) * static_cast<int>(sizeof(Register))));
     285    store32(Imm32(JSValue::Int32Tag), tagFor(registerOffset + RegisterFile::ArgumentCount));
     286    store32(Imm32(argCount), payloadFor(registerOffset + RegisterFile::ArgumentCount));
     287    storePtr(callFrameRegister, payloadFor(RegisterFile::CallerFrame + registerOffset, callFrameRegister));
    285288    emitStore(registerOffset + RegisterFile::Callee, regT1, regT0);
    286     storePtr(regT2, Address(callFrameRegister, (registerOffset + RegisterFile::ScopeChain) * static_cast<int>(sizeof(Register))));
     289    store32(Imm32(JSValue::CellTag), tagFor(registerOffset + RegisterFile::ScopeChain));
     290    store32(regT2, payloadFor(registerOffset + RegisterFile::ScopeChain));
    287291    addPtr(Imm32(registerOffset * sizeof(Register)), callFrameRegister);
    288292
     
    310314
    311315    // Speculatively roll the callframe, assuming argCount will match the arity.
    312     storePtr(callFrameRegister, Address(callFrameRegister, (RegisterFile::CallerFrame + registerOffset) * static_cast<int>(sizeof(Register))));
     316    store32(Imm32(JSValue::CellTag), tagFor(RegisterFile::CallerFrame + registerOffset, callFrameRegister));
     317    storePtr(callFrameRegister, payloadFor(RegisterFile::CallerFrame + registerOffset, callFrameRegister));
    313318    addPtr(Imm32(registerOffset * static_cast<int>(sizeof(Register))), callFrameRegister);
    314319    move(Imm32(argCount), regT1);
  • trunk/Source/JavaScriptCore/jit/JITInlineMethods.h

    r80598 r80919  
    5353ALWAYS_INLINE void JIT::emitPutToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry entry)
    5454{
    55     storePtr(from, Address(callFrameRegister, entry * sizeof(Register)));
     55    storePtr(from, payloadFor(entry, callFrameRegister));
     56}
     57
     58ALWAYS_INLINE void JIT::emitPutCellToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry entry)
     59{
     60#if USE(JSVALUE32_64)
     61    store32(Imm32(JSValue::CellTag), tagFor(entry, callFrameRegister));
     62#endif
     63    storePtr(from, payloadFor(entry, callFrameRegister));
     64}
     65
     66ALWAYS_INLINE void JIT::emitPutIntToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry entry)
     67{
     68    store32(Imm32(Int32Tag), intTagFor(entry, callFrameRegister));
     69    store32(from, intPayloadFor(entry, callFrameRegister));
    5670}
    5771
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r80742 r80919  
    200200    emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT0);
    201201    emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT0);
    202     emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
     202    emitPutCellToCallFrameHeader(regT1, RegisterFile::ScopeChain);
    203203
    204204    peek(regT1);
     
    223223    emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT2);
    224224    emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT2);
    225     emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
     225    emitPutCellToCallFrameHeader(regT1, RegisterFile::ScopeChain);
    226226
    227227    preserveReturnAddressAfterCall(regT3); // Callee preserved
     
    244244    emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT0);
    245245    emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT0);
    246     emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
     246    emitPutCellToCallFrameHeader(regT1, RegisterFile::ScopeChain);
    247247
    248248    preserveReturnAddressAfterCall(regT3); // Callee preserved
     
    903903    getPnamesStubCall.call(dst);
    904904    load32(Address(regT0, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStringsSize)), regT3);
    905     store32(Imm32(0), addressFor(i));
    906     store32(regT3, addressFor(size));
     905    storePtr(tagTypeNumberRegister, payloadFor(i));
     906    store32(Imm32(Int32Tag), intTagFor(size));
     907    store32(regT3, intPayloadFor(size));
    907908    Jump end = jump();
    908909
     
    932933
    933934    Label begin(this);
    934     load32(addressFor(i), regT0);
    935     Jump end = branch32(Equal, regT0, addressFor(size));
     935    load32(intPayloadFor(i), regT0);
     936    Jump end = branch32(Equal, regT0, intPayloadFor(size));
    936937
    937938    // Grab key @ i
     
    945946    // Increment i
    946947    add32(Imm32(1), regT0);
    947     store32(regT0, addressFor(i));
     948    store32(regT0, intPayloadFor(i));
    948949
    949950    // Verify that i is valid:
     
    16901691    // Load arg count into regT0
    16911692    emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
    1692     storePtr(regT0, addressFor(argCountDst));
     1693    store32(Imm32(Int32Tag), intTagFor(argCountDst));
     1694    store32(regT0, intPayloadFor(argCountDst));
    16931695    Jump endBranch = branch32(Equal, regT0, Imm32(1));
    16941696
     
    17281730    stubCall.addArgument(Imm32(argsOffset));
    17291731    stubCall.call();
    1730     // Stores a naked int32 in the register file.
    1731     store32(returnValueRegister, Address(callFrameRegister, argCountDst * sizeof(Register)));
     1732   
     1733    store32(Imm32(Int32Tag), intTagFor(argCountDst));
     1734    store32(returnValueRegister, intPayloadFor(argCountDst));
    17321735}
    17331736
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r80742 r80919  
    206206    emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT0);
    207207    emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT0);
    208     emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
     208    emitPutCellToCallFrameHeader(regT1, RegisterFile::ScopeChain);
    209209
    210210    peek(regT1);
     
    230230    emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT2);
    231231    emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT2);
    232     emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
     232    emitPutCellToCallFrameHeader(regT1, RegisterFile::ScopeChain);
    233233
    234234    preserveReturnAddressAfterCall(regT3); // Callee preserved
     
    252252    emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT0);
    253253    emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT0);
    254     emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
     254    emitPutCellToCallFrameHeader(regT1, RegisterFile::ScopeChain);
    255255
    256256    preserveReturnAddressAfterCall(regT3); // Callee preserved
     
    322322    emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT0);
    323323    emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT0);
    324     emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
     324    emitPutCellToCallFrameHeader(regT1, RegisterFile::ScopeChain);
    325325
    326326    peek(regT1);
     
    345345    emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT2);
    346346    emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT2);
    347     emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
     347    emitPutCellToCallFrameHeader(regT1, RegisterFile::ScopeChain);
    348348
    349349    preserveReturnAddressAfterCall(regT3); // Callee preserved
     
    368368    emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT0);
    369369    emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT0);
    370     emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
     370    emitPutCellToCallFrameHeader(regT1, RegisterFile::ScopeChain);
    371371
    372372    preserveReturnAddressAfterCall(regT3); // Callee preserved
     
    12771277    getPnamesStubCall.call(dst);
    12781278    load32(Address(regT0, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStringsSize)), regT3);
    1279     store32(Imm32(0), addressFor(i));
    1280     store32(regT3, addressFor(size));
     1279    store32(Imm32(Int32Tag), intTagFor(i));
     1280    store32(Imm32(0), intPayloadFor(i));
     1281    store32(Imm32(Int32Tag), intTagFor(size));
     1282    store32(regT3, payloadFor(size));
    12811283    Jump end = jump();
    12821284
     
    13041306
    13051307    Label begin(this);
    1306     load32(addressFor(i), regT0);
    1307     Jump end = branch32(Equal, regT0, addressFor(size));
     1308    load32(intPayloadFor(i), regT0);
     1309    Jump end = branch32(Equal, regT0, intPayloadFor(size));
    13081310
    13091311    // Grab key @ i
    1310     loadPtr(addressFor(it), regT1);
     1312    loadPtr(payloadFor(it), regT1);
    13111313    loadPtr(Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStrings)), regT2);
    13121314    load32(BaseIndex(regT2, regT0, TimesEight), regT2);
     
    13161318    // Increment i
    13171319    add32(Imm32(1), regT0);
    1318     store32(regT0, addressFor(i));
     1320    store32(regT0, intPayloadFor(i));
    13191321
    13201322    // Verify that i is valid:
    1321     loadPtr(addressFor(base), regT0);
     1323    loadPtr(payloadFor(base), regT0);
    13221324
    13231325    // Test base's structure
  • trunk/Source/JavaScriptCore/jit/JSInterfaceJIT.h

    r70111 r80919  
    3030#include "JITStubs.h"
    3131#include "JSImmediate.h"
     32#include "JSValue.h"
    3233#include "MacroAssembler.h"
    3334#include "RegisterFile.h"
     
    158159#endif
    159160
     161#if USE(JSVALUE32_64)
     162        static const unsigned Int32Tag = JSValue::Int32Tag;
     163#else
     164        static const unsigned Int32Tag = JSImmediate::TagTypeNumber >> 32;
     165#endif
    160166        inline Jump emitLoadJSCell(unsigned virtualRegisterIndex, RegisterID payload);
    161167        inline Jump emitLoadInt32(unsigned virtualRegisterIndex, RegisterID dst);
     
    174180
    175181        inline Address payloadFor(unsigned index, RegisterID base = callFrameRegister);
     182        inline Address intPayloadFor(unsigned index, RegisterID base = callFrameRegister);
     183        inline Address intTagFor(unsigned index, RegisterID base = callFrameRegister);
    176184        inline Address addressFor(unsigned index, RegisterID base = callFrameRegister);
    177185    };
     
    213221        ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
    214222        return Address(base, (virtualRegisterIndex * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.payload));
     223    }
     224
     225    inline JSInterfaceJIT::Address JSInterfaceJIT::intPayloadFor(unsigned virtualRegisterIndex, RegisterID base)
     226    {
     227        return payloadFor(virtualRegisterIndex, base);
     228    }
     229
     230    inline JSInterfaceJIT::Address JSInterfaceJIT::intTagFor(unsigned virtualRegisterIndex, RegisterID base)
     231    {
     232        return tagFor(virtualRegisterIndex, base);
    215233    }
    216234
     
    280298        return addressFor(virtualRegisterIndex, base);
    281299    }
     300
     301    inline JSInterfaceJIT::Address JSInterfaceJIT::intPayloadFor(unsigned virtualRegisterIndex, RegisterID base)
     302    {
     303        ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
     304        return Address(base, (virtualRegisterIndex * sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));
     305    }
     306    inline JSInterfaceJIT::Address JSInterfaceJIT::intTagFor(unsigned virtualRegisterIndex, RegisterID base)
     307    {
     308        ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
     309        return Address(base, (virtualRegisterIndex * sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));
     310    }
    282311#endif
    283312
  • trunk/Source/JavaScriptCore/jit/SpecializedThunkJIT.h

    r70111 r80919  
    8888            if (src != regT0)
    8989                move(src, regT0);
    90             loadPtr(Address(callFrameRegister, RegisterFile::CallerFrame * (int)sizeof(Register)), callFrameRegister);
     90            loadPtr(payloadFor(RegisterFile::CallerFrame, callFrameRegister), callFrameRegister);
    9191            ret();
    9292        }
     
    102102            loadPtr(Address(stackPointerRegister, OBJECT_OFFSETOF(JSValue, u.asBits.payload) - sizeof(double)), regT0);
    103103#endif
    104             loadPtr(Address(callFrameRegister, RegisterFile::CallerFrame * (int)sizeof(Register)), callFrameRegister);
     104            loadPtr(payloadFor(RegisterFile::CallerFrame, callFrameRegister), callFrameRegister);
    105105            ret();
    106106        }
     
    111111                move(src, regT0);
    112112            tagReturnAsInt32();
    113             loadPtr(Address(callFrameRegister, RegisterFile::CallerFrame * (int)sizeof(Register)), callFrameRegister);
     113            loadPtr(payloadFor(RegisterFile::CallerFrame, callFrameRegister), callFrameRegister);
    114114            ret();
    115115        }
     
    120120                move(src, regT0);
    121121            tagReturnAsJSCell();
    122             loadPtr(Address(callFrameRegister, RegisterFile::CallerFrame * (int)sizeof(Register)), callFrameRegister);
     122            loadPtr(payloadFor(RegisterFile::CallerFrame, callFrameRegister), callFrameRegister);
    123123            ret();
    124124        }
  • trunk/Source/JavaScriptCore/runtime/ArgList.cpp

    r79904 r80919  
    2424#include "JSValue.h"
    2525#include "JSCell.h"
     26#include "JSObject.h"
    2627#include "ScopeChain.h"
    2728
  • trunk/Source/JavaScriptCore/runtime/DateConversion.cpp

    r79904 r80919  
    4545
    4646#include "CallFrame.h"
     47#include "JSObject.h"
    4748#include "ScopeChain.h"
    4849#include "UString.h"
  • trunk/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp

    r79904 r80919  
    3434#include "JSGlobalData.h"
    3535#include "JSLock.h"
     36#include "JSObject.h"
    3637#include "ScopeChain.h"
    3738#include <wtf/RetainPtr.h>
  • trunk/Source/JavaScriptCore/runtime/Identifier.cpp

    r79904 r80919  
    2323
    2424#include "CallFrame.h"
     25#include "JSObject.h"
    2526#include "NumericStrings.h"
    2627#include "ScopeChain.h"
  • trunk/Source/JavaScriptCore/runtime/JSActivation.h

    r80742 r80919  
    9292        return static_cast<JSActivation*>(asObject(value));
    9393    }
     94   
     95    ALWAYS_INLINE JSActivation* Register::activation() const
     96    {
     97        return asActivation(jsValue());
     98    }
    9499
    95100} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/JSLock.cpp

    r79904 r80919  
    2424#include "Heap.h"
    2525#include "CallFrame.h"
     26#include "JSObject.h"
    2627#include "ScopeChain.h"
    2728
  • trunk/Source/JavaScriptCore/runtime/JSNumberCell.cpp

    r79904 r80919  
    2323#include "config.h"
    2424#include "JSNumberCell.h"
     25#include "JSObject.h"
    2526#include "ScopeChain.h"
    2627
  • trunk/Source/JavaScriptCore/runtime/JSObject.h

    r80378 r80919  
    841841}
    842842
     843ALWAYS_INLINE JSObject* Register::function() const
     844{
     845    if (!jsValue())
     846        return 0;
     847    return asObject(jsValue());
     848}
     849
     850ALWAYS_INLINE Register Register::withCallee(JSObject* callee)
     851{
     852    Register r;
     853    r = JSValue(callee);
     854    return r;
     855}
     856
    843857} // namespace JSC
    844858
  • trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h

    r79132 r80919  
    107107    }
    108108
     109    ALWAYS_INLINE JSPropertyNameIterator* Register::propertyNameIterator() const
     110    {
     111        return static_cast<JSPropertyNameIterator*>(jsValue().asCell());
     112    }
     113
    109114} // namespace JSC
    110115
  • trunk/Source/JavaScriptCore/runtime/JSValue.h

    r80751 r80919  
    5353    enum PreferredPrimitiveType { NoPreference, PreferNumber, PreferString };
    5454
     55
    5556#if USE(JSVALUE32_64)
    5657    typedef int64_t EncodedJSValue;
     
    5859    typedef void* EncodedJSValue;
    5960#endif
     61   
     62    union EncodedValueDescriptor {
     63        EncodedJSValue asEncodedJSValue;
     64#if USE(JSVALUE32_64)
     65        double asDouble;
     66#elif USE(JSVALUE64)
     67        JSCell* ptr;
     68#endif
     69       
     70#if CPU(BIG_ENDIAN)
     71        struct {
     72            int32_t tag;
     73            int32_t payload;
     74        } asBits;
     75#else
     76        struct {
     77            int32_t payload;
     78            int32_t tag;
     79        } asBits;
     80#endif
     81    };
    6082
    6183    double nonInlineNaN();
     
    240262       
    241263        enum { LowestTag =  DeletedValueTag };
    242        
     264
    243265        uint32_t tag() const;
    244266        int32_t payload() const;
    245267
    246         union {
    247             EncodedJSValue asEncodedJSValue;
    248             double asDouble;
    249 #if CPU(BIG_ENDIAN)
    250             struct {
    251                 int32_t tag;
    252                 int32_t payload;
    253             } asBits;
    254 #else
    255             struct {
    256                 int32_t payload;
    257                 int32_t tag;
    258             } asBits;
    259 #endif
    260         } u;
    261 #else // USE(JSVALUE32_64)
     268        EncodedValueDescriptor u;
     269#elif USE(JSVALUE64)
    262270        JSCell* m_ptr;
    263 #endif // USE(JSVALUE32_64)
     271#endif
    264272    };
    265273
  • trunk/Source/JavaScriptCore/runtime/JSZombie.cpp

    r80751 r80919  
    2727#include "JSZombie.h"
    2828#include "ClassInfo.h"
     29#include "JSObject.h"
    2930#include "ScopeChain.h"
    3031
  • trunk/Source/JavaScriptCore/runtime/MarkedBlock.cpp

    r80751 r80919  
    2828
    2929#include "JSCell.h"
     30#include "JSObject.h"
    3031#include "JSZombie.h"
    3132#include "ScopeChain.h"
  • trunk/Source/JavaScriptCore/runtime/MarkedSpace.cpp

    r80742 r80919  
    2525#include "JSGlobalData.h"
    2626#include "JSLock.h"
     27#include "JSObject.h"
    2728#include "ScopeChain.h"
    2829
  • trunk/Source/JavaScriptCore/runtime/PropertyNameArray.cpp

    r79904 r80919  
    2222#include "PropertyNameArray.h"
    2323
     24#include "JSObject.h"
    2425#include "ScopeChain.h"
    2526#include "Structure.h"
  • trunk/Source/JavaScriptCore/runtime/ScopeChain.h

    r79904 r80919  
    129129        return scopeChain()->globalThis.get();
    130130    }
     131   
     132    ALWAYS_INLINE ScopeChainNode* Register::scopeChain() const
     133    {
     134        return static_cast<ScopeChainNode*>(jsValue().asCell());
     135    }
     136   
     137    ALWAYS_INLINE Register& Register::operator=(ScopeChainNode* scopeChain)
     138    {
     139        *this = JSValue(scopeChain);
     140        return *this;
     141    }
    131142
    132143} // namespace JSC
  • trunk/Source/JavaScriptCore/wtf/DateMath.cpp

    r80542 r80919  
    7676#include "ASCIICType.h"
    7777#include "CurrentTime.h"
     78#if USE(JSC)
     79#include "JSObject.h"
     80#endif
    7881#include "MathExtras.h"
    7982#if USE(JSC)
  • trunk/Source/WebCore/ChangeLog

    r80918 r80919  
     12011-03-11  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        Ensure all values are correctly tagged in the registerfile
     6        https://bugs.webkit.org/show_bug.cgi?id=56214
     7
     8        Make sure everything builds still.
     9
     10        * bridge/c/c_class.cpp:
     11        * bridge/c/c_runtime.cpp:
     12        * bridge/jni/JavaMethod.cpp:
     13        * plugins/PluginViewNone.cpp:
     14
    1152011-03-11  Mark Rowe  <mrowe@apple.com>
    216
  • trunk/Source/WebCore/bridge/c/c_class.cpp

    r79904 r80919  
    3636#include <runtime/Identifier.h>
    3737#include <runtime/JSLock.h>
     38#include <runtime/JSObject.h>
    3839#include <wtf/text/StringHash.h>
    3940
  • trunk/Source/WebCore/bridge/c/c_runtime.cpp

    r79904 r80919  
    3535#include <runtime/ScopeChain.h>
    3636#include <runtime/JSLock.h>
     37#include <runtime/JSObject.h>
    3738
    3839namespace JSC {
  • trunk/Source/WebCore/bridge/jni/JavaMethod.cpp

    r80888 r80919  
    3232#include "JavaString.h"
    3333
     34#include <runtime/JSObject.h>
    3435#include <runtime/ScopeChain.h>
    3536#include <wtf/text/StringBuilder.h>
  • trunk/Source/WebCore/plugins/PluginViewNone.cpp

    r79988 r80919  
    2929#if USE(JSC)
    3030#include "BridgeJSC.h"
     31#include <runtime/JSObject.h>
    3132#include <runtime/ScopeChain.h>
    3233#endif
Note: See TracChangeset for help on using the changeset viewer.