Changeset 35231 in webkit


Ignore:
Timestamp:
Jul 17, 2008 9:00:28 PM (16 years ago)
Author:
ggaren@apple.com
Message:

2008-07-17 Geoffrey Garen <ggaren@apple.com>

Reviewed by Oliver Hunt.


Next step toward putting doubles in registers: Store constant pool
entries as registers, not JSValue*s.


SunSpider reports no change.

Location:
trunk/JavaScriptCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r35230 r35231  
     12008-07-17  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4       
     5        Next step toward putting doubles in registers: Store constant pool
     6        entries as registers, not JSValue*s.
     7       
     8        SunSpider reports no change.
     9
    1102008-07-17  Geoffrey Garen  <ggaren@apple.com>
    211
     
    141150        (KJS::Register::Register):
    142151
    143 2008-07-16  Geoffrey Garen  <ggaren@apple.com>
     1522008-07-17  Geoffrey Garen  <ggaren@apple.com>
    144153
    145154        Reviewed by Oliver Hunt.
  • trunk/JavaScriptCore/VM/CodeBlock.cpp

    r34883 r35231  
    4949}
    5050
    51 static UString valueToSourceString(ExecState* exec, JSValue* val)
    52 {
    53     if (val->isString()) {
     51static UString valueToSourceString(ExecState* exec, const Register& val)
     52{
     53    if (val.isString()) {
    5454        UString result("\"");
    55         result += escapeQuotes(val->toString(exec)) + "\"";
     55        result += escapeQuotes(val.toString(exec)) + "\"";
    5656        return result;
    5757    }
    5858
    59     return val->toString(exec);
     59    return val.toString(exec);
    6060}
    6161
     
    6868}
    6969
    70 static CString constantName(ExecState* exec, int k, JSValue* value)
     70static CString constantName(ExecState* exec, int k, const Register& value)
    7171{
    7272    return (valueToSourceString(exec, value) + "(@k" + UString::from(k) + ")").UTF8String();
     
    172172    }
    173173
    174     if (jsValues.size()) {
     174    if (registers.size()) {
    175175        printf("\nConstants:\n");
    176176        size_t i = 0;
    177177        do {
    178             printf("  k%u = %s\n", static_cast<unsigned>(i), valueToSourceString(exec, jsValues[i]).ascii());
     178            printf("  k%u = %s\n", static_cast<unsigned>(i), valueToSourceString(exec, registers[i]).ascii());
    179179            ++i;
    180         } while (i < jsValues.size());
     180        } while (i < registers.size());
    181181    }
    182182   
     
    209209            int r0 = (++it)->u.operand;
    210210            int k0 = (++it)->u.operand;
    211             printf("[%4d] load\t\t %s, %s\t\t\n", location, registerName(r0).c_str(), constantName(exec, k0, jsValues[k0]).c_str());
     211            printf("[%4d] load\t\t %s, %s\t\t\n", location, registerName(r0).c_str(), constantName(exec, k0, registers[k0]).c_str());
    212212            break;
    213213        }
     
    588588            int errorType = (++it)->u.operand;
    589589            int k0 = (++it)->u.operand;
    590             printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, jsValues[k0]).c_str());
     590            printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, registers[k0]).c_str());
    591591            break;
    592592        }
     
    623623void CodeBlock::mark()
    624624{
    625     for (size_t i = 0; i < jsValues.size(); ++i)
    626         if (!jsValues[i]->marked())
    627             jsValues[i]->mark();
     625    for (size_t i = 0; i < registers.size(); ++i)
     626        if (!registers[i].marked())
     627            registers[i].mark();
    628628
    629629    for (size_t i = 0; i < functions.size(); ++i)
  • trunk/JavaScriptCore/VM/CodeBlock.h

    r34457 r35231  
    9191        Vector<RefPtr<FuncDeclNode> > functions;
    9292        Vector<RefPtr<FuncExprNode> > functionExpressions;
    93         Vector<JSValue*> jsValues;
     93        Vector<Register> registers;
    9494        Vector<RefPtr<RegExp> > regexps;
    9595        Vector<HandlerInfo> exceptionHandlers;
  • trunk/JavaScriptCore/VM/CodeGenerator.cpp

    r35230 r35231  
    522522unsigned CodeGenerator::addConstant(JSValue* v)
    523523{
    524     pair<JSValueMap::iterator, bool> result = m_jsValueMap.add(v, m_codeBlock->jsValues.size());
     524    pair<JSValueMap::iterator, bool> result = m_jsValueMap.add(v, m_codeBlock->registers.size());
    525525    if (result.second) // new entry
    526         m_codeBlock->jsValues.append(v);
     526        m_codeBlock->registers.append(v);
    527527
    528528    return result.first->second;
  • trunk/JavaScriptCore/VM/Machine.cpp

    r35217 r35231  
    575575}
    576576
    577 NEVER_INLINE bool Machine::unwindCallFrame(ExecState* exec, JSValue* exceptionValue, const Instruction*& vPC, CodeBlock*& codeBlock, JSValue**& k, ScopeChainNode*& scopeChain, Register*& r)
     577NEVER_INLINE bool Machine::unwindCallFrame(ExecState* exec, JSValue* exceptionValue, const Instruction*& vPC, CodeBlock*& codeBlock, Register*& k, ScopeChainNode*& scopeChain, Register*& r)
    578578{
    579579    CodeBlock* oldCodeBlock = codeBlock;
     
    608608        return false;
    609609
    610     k = codeBlock->jsValues.data();
     610    k = codeBlock->registers.data();
    611611    scopeChain = callFrame[RegisterFile::CallerScopeChain].scopeChain();
    612612    r = callFrame[RegisterFile::CallerRegisters].r();
     
    617617}
    618618
    619 NEVER_INLINE Instruction* Machine::throwException(ExecState* exec, JSValue* exceptionValue, const Instruction* vPC, CodeBlock*& codeBlock, JSValue**& k, ScopeChainNode*& scopeChain, Register*& r)
     619NEVER_INLINE Instruction* Machine::throwException(ExecState* exec, JSValue* exceptionValue, const Instruction* vPC, CodeBlock*& codeBlock, Register*& k, ScopeChainNode*& scopeChain, Register*& r)
    620620{
    621621    // Set up the exception object
     
    978978    Register* registerBase = registerFile->base();
    979979    Instruction* vPC = codeBlock->instructions.begin();
    980     JSValue** k = codeBlock->jsValues.data();
     980    Register* k = codeBlock->registers.data();
    981981    Profiler** enabledProfilerReference = Profiler::enabledProfilerReference();
    982982    unsigned tickCount = m_ticksUntilNextTimeoutCheck + 1;
     
    22482248            codeBlock = newCodeBlock;
    22492249            setScopeChain(exec, scopeChain, scopeChainForCall(exec, functionBodyNode, codeBlock, callDataScopeChain, r));
    2250             k = codeBlock->jsValues.data();
     2250            k = codeBlock->registers.data();
    22512251            vPC = codeBlock->instructions.begin();
    22522252
     
    23172317            return returnValue;
    23182318
    2319         k = codeBlock->jsValues.data();
     2319        k = codeBlock->registers.data();
    23202320        vPC = callFrame[RegisterFile::ReturnVPC].vPC();
    23212321        setScopeChain(exec, scopeChain, callFrame[RegisterFile::CallerScopeChain].scopeChain());
     
    23792379            codeBlock = newCodeBlock;
    23802380            setScopeChain(exec, scopeChain, scopeChainForCall(exec, functionBodyNode, codeBlock, callDataScopeChain, r));
    2381             k = codeBlock->jsValues.data();
     2381            k = codeBlock->registers.data();
    23822382            vPC = codeBlock->instructions.begin();
    23832383
     
    25502550        int message = (++vPC)->u.operand;
    25512551
    2552         r[dst] = Error::create(exec, (ErrorType)type, k[message]->toString(exec), codeBlock->lineNumberForVPC(vPC), codeBlock->ownerNode->sourceId(), codeBlock->ownerNode->sourceURL());
     2552        r[dst] = Error::create(exec, (ErrorType)type, k[message].toString(exec), codeBlock->lineNumberForVPC(vPC), codeBlock->ownerNode->sourceId(), codeBlock->ownerNode->sourceURL());
    25532553
    25542554        ++vPC;
  • trunk/JavaScriptCore/VM/Machine.h

    r35203 r35231  
    132132        NEVER_INLINE void debug(ExecState*, const Instruction*, const CodeBlock*, ScopeChainNode*, Register*);
    133133
    134         NEVER_INLINE bool unwindCallFrame(ExecState*, JSValue*, const Instruction*&, CodeBlock*&, JSValue**&, ScopeChainNode*&, Register*&);
    135         NEVER_INLINE Instruction* throwException(ExecState*, JSValue*, const Instruction*, CodeBlock*&, JSValue**&, ScopeChainNode*&, Register*&);
     134        NEVER_INLINE bool unwindCallFrame(ExecState*, JSValue*, const Instruction*&, CodeBlock*&, Register*&, ScopeChainNode*&, Register*&);
     135        NEVER_INLINE Instruction* throwException(ExecState*, JSValue*, const Instruction*, CodeBlock*&, Register*&, ScopeChainNode*&, Register*&);
    136136
    137137        Register* callFrame(ExecState*, JSFunction*) const;
  • trunk/JavaScriptCore/VM/Register.h

    r35217 r35231  
    5353        void mark();
    5454       
     55        bool isString() const;
     56       
    5557        uint32_t toUInt32(ExecState*) const;
    5658        UString toString(ExecState*) const;
     59       
    5760
    5861    private:
     
    216219    }
    217220   
     221    ALWAYS_INLINE bool Register::isString() const
     222    {
     223        return jsValue()->isString();
     224    }
     225
    218226    ALWAYS_INLINE uint32_t Register::toUInt32(ExecState* exec) const
    219227    {
Note: See TracChangeset for help on using the changeset viewer.