Changeset 81040 in webkit


Ignore:
Timestamp:
Mar 14, 2011 11:16:36 AM (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:
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r80995 r81040  
     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-13  Geoffrey Garen  <ggaren@apple.com>
    260
  • trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp

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

    r80969 r81040  
    5757        EncodedJSValue encodedJSValue() const;
    5858       
    59         Register& operator=(JSActivation*);
    6059        Register& operator=(CallFrame*);
    6160        Register& operator=(CodeBlock*);
    62         Register& operator=(JSPropertyNameIterator*);
    6361        Register& operator=(ScopeChainNode*);
    6462        Register& operator=(Instruction*);
     
    7573        static Register withInt(int32_t i)
    7674        {
    77             Register r;
    78             r.u.i = i;
     75            Register r = jsNumber(i);
    7976            return r;
    8077        }
    8178
    82         static Register withCallee(JSObject* callee)
    83         {
    84             Register r;
    85             r.u.function = callee;
    86             return r;
    87         }
     79        static inline Register withCallee(JSObject* callee);
    8880
    8981    private:
    9082        union {
    91             int32_t i;
    9283            EncodedJSValue value;
    93 
    94             JSActivation* activation;
    9584            CallFrame* callFrame;
    9685            CodeBlock* codeBlock;
    97             JSObject* function;
    98             JSPropertyNameIterator* propertyNameIterator;
    99             ScopeChainNode* scopeChain;
    10086            Instruction* vPC;
    10187        } u;
     
    138124    // Interpreter functions
    139125
    140     ALWAYS_INLINE Register& Register::operator=(JSActivation* activation)
    141     {
    142         u.activation = activation;
    143         return *this;
    144     }
    145 
    146126    ALWAYS_INLINE Register& Register::operator=(CallFrame* callFrame)
    147127    {
     
    162142    }
    163143
    164     ALWAYS_INLINE Register& Register::operator=(ScopeChainNode* scopeChain)
     144    ALWAYS_INLINE int32_t Register::i() const
    165145    {
    166         u.scopeChain = scopeChain;
    167         return *this;
     146        return jsValue().asInt32();
    168147    }
    169148
    170     ALWAYS_INLINE Register& Register::operator=(JSPropertyNameIterator* propertyNameIterator)
    171     {
    172         u.propertyNameIterator = propertyNameIterator;
    173         return *this;
    174     }
    175 
    176     ALWAYS_INLINE int32_t Register::i() const
    177     {
    178         return u.i;
    179     }
    180    
    181     ALWAYS_INLINE JSActivation* Register::activation() const
    182     {
    183         return u.activation;
    184     }
    185    
    186149    ALWAYS_INLINE CallFrame* Register::callFrame() const
    187150    {
     
    193156        return u.codeBlock;
    194157    }
    195    
    196     ALWAYS_INLINE JSObject* Register::function() const
    197     {
    198         return u.function;
    199     }
    200    
    201     ALWAYS_INLINE JSPropertyNameIterator* Register::propertyNameIterator() const
    202     {
    203         return u.propertyNameIterator;
    204     }
    205    
    206     ALWAYS_INLINE ScopeChainNode* Register::scopeChain() const
    207     {
    208         return u.scopeChain;
    209     }
    210    
     158
    211159    ALWAYS_INLINE Instruction* Register::vPC() const
    212160    {
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r80938 r81040  
    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

    r80938 r81040  
    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

    r80969 r81040  
    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

    r80972 r81040  
    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

    r80969 r81040  
    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

    r80969 r81040  
    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

    r80938 r81040  
    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        // Can't just propogate JSValue::Int32Tag as visual studio doesn't like it
     163        static const unsigned Int32Tag = 0xfffffffd;
     164        COMPILE_ASSERT(Int32Tag == JSValue::Int32Tag, Int32Tag_out_of_sync);
     165#else
     166        static const unsigned Int32Tag = JSImmediate::TagTypeNumber >> 32;
     167#endif
    160168        inline Jump emitLoadJSCell(unsigned virtualRegisterIndex, RegisterID payload);
    161169        inline Jump emitLoadInt32(unsigned virtualRegisterIndex, RegisterID dst);
     
    174182
    175183        inline Address payloadFor(unsigned index, RegisterID base = callFrameRegister);
     184        inline Address intPayloadFor(unsigned index, RegisterID base = callFrameRegister);
     185        inline Address intTagFor(unsigned index, RegisterID base = callFrameRegister);
    176186        inline Address addressFor(unsigned index, RegisterID base = callFrameRegister);
    177187    };
     
    213223        ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
    214224        return Address(base, (virtualRegisterIndex * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.payload));
     225    }
     226
     227    inline JSInterfaceJIT::Address JSInterfaceJIT::intPayloadFor(unsigned virtualRegisterIndex, RegisterID base)
     228    {
     229        return payloadFor(virtualRegisterIndex, base);
     230    }
     231
     232    inline JSInterfaceJIT::Address JSInterfaceJIT::intTagFor(unsigned virtualRegisterIndex, RegisterID base)
     233    {
     234        return tagFor(virtualRegisterIndex, base);
    215235    }
    216236
     
    280300        return addressFor(virtualRegisterIndex, base);
    281301    }
     302
     303    inline JSInterfaceJIT::Address JSInterfaceJIT::intPayloadFor(unsigned virtualRegisterIndex, RegisterID base)
     304    {
     305        ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
     306        return Address(base, (virtualRegisterIndex * sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));
     307    }
     308    inline JSInterfaceJIT::Address JSInterfaceJIT::intTagFor(unsigned virtualRegisterIndex, RegisterID base)
     309    {
     310        ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
     311        return Address(base, (virtualRegisterIndex * sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));
     312    }
    282313#endif
    283314
  • trunk/Source/JavaScriptCore/jit/SpecializedThunkJIT.h

    r80938 r81040  
    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

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

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

    r80938 r81040  
    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

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

    r80938 r81040  
    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

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

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

    r80938 r81040  
    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

    r80938 r81040  
    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

    r80938 r81040  
    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

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

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

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

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

    r80976 r81040  
    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

    r80938 r81040  
    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

    r81039 r81040  
     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-14  Luiz Agostini  <luiz.agostini@openbossa.org>
    216
  • trunk/Source/WebCore/bridge/c/c_class.cpp

    r80938 r81040  
    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

    r80938 r81040  
    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

    r81036 r81040  
    3232#include "JavaString.h"
    3333
     34#if USE(JSC)
     35#include <runtime/JSObject.h>
     36#include <runtime/ScopeChain.h>
     37#endif
    3438#include <wtf/text/StringBuilder.h>
    3539
  • trunk/Source/WebCore/plugins/PluginViewNone.cpp

    r80938 r81040  
    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.