Changeset 35231 in webkit
- Timestamp:
- Jul 17, 2008 9:00:28 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r35230 r35231 1 2008-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 1 10 2008-07-17 Geoffrey Garen <ggaren@apple.com> 2 11 … … 141 150 (KJS::Register::Register): 142 151 143 2008-07-1 6Geoffrey Garen <ggaren@apple.com>152 2008-07-17 Geoffrey Garen <ggaren@apple.com> 144 153 145 154 Reviewed by Oliver Hunt. -
trunk/JavaScriptCore/VM/CodeBlock.cpp
r34883 r35231 49 49 } 50 50 51 static UString valueToSourceString(ExecState* exec, JSValue* val)52 { 53 if (val ->isString()) {51 static UString valueToSourceString(ExecState* exec, const Register& val) 52 { 53 if (val.isString()) { 54 54 UString result("\""); 55 result += escapeQuotes(val ->toString(exec)) + "\"";55 result += escapeQuotes(val.toString(exec)) + "\""; 56 56 return result; 57 57 } 58 58 59 return val ->toString(exec);59 return val.toString(exec); 60 60 } 61 61 … … 68 68 } 69 69 70 static CString constantName(ExecState* exec, int k, JSValue*value)70 static CString constantName(ExecState* exec, int k, const Register& value) 71 71 { 72 72 return (valueToSourceString(exec, value) + "(@k" + UString::from(k) + ")").UTF8String(); … … 172 172 } 173 173 174 if ( jsValues.size()) {174 if (registers.size()) { 175 175 printf("\nConstants:\n"); 176 176 size_t i = 0; 177 177 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()); 179 179 ++i; 180 } while (i < jsValues.size());180 } while (i < registers.size()); 181 181 } 182 182 … … 209 209 int r0 = (++it)->u.operand; 210 210 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()); 212 212 break; 213 213 } … … 588 588 int errorType = (++it)->u.operand; 589 589 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()); 591 591 break; 592 592 } … … 623 623 void CodeBlock::mark() 624 624 { 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(); 628 628 629 629 for (size_t i = 0; i < functions.size(); ++i) -
trunk/JavaScriptCore/VM/CodeBlock.h
r34457 r35231 91 91 Vector<RefPtr<FuncDeclNode> > functions; 92 92 Vector<RefPtr<FuncExprNode> > functionExpressions; 93 Vector< JSValue*> jsValues;93 Vector<Register> registers; 94 94 Vector<RefPtr<RegExp> > regexps; 95 95 Vector<HandlerInfo> exceptionHandlers; -
trunk/JavaScriptCore/VM/CodeGenerator.cpp
r35230 r35231 522 522 unsigned CodeGenerator::addConstant(JSValue* v) 523 523 { 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()); 525 525 if (result.second) // new entry 526 m_codeBlock-> jsValues.append(v);526 m_codeBlock->registers.append(v); 527 527 528 528 return result.first->second; -
trunk/JavaScriptCore/VM/Machine.cpp
r35217 r35231 575 575 } 576 576 577 NEVER_INLINE bool Machine::unwindCallFrame(ExecState* exec, JSValue* exceptionValue, const Instruction*& vPC, CodeBlock*& codeBlock, JSValue**& k, ScopeChainNode*& scopeChain, Register*& r)577 NEVER_INLINE bool Machine::unwindCallFrame(ExecState* exec, JSValue* exceptionValue, const Instruction*& vPC, CodeBlock*& codeBlock, Register*& k, ScopeChainNode*& scopeChain, Register*& r) 578 578 { 579 579 CodeBlock* oldCodeBlock = codeBlock; … … 608 608 return false; 609 609 610 k = codeBlock-> jsValues.data();610 k = codeBlock->registers.data(); 611 611 scopeChain = callFrame[RegisterFile::CallerScopeChain].scopeChain(); 612 612 r = callFrame[RegisterFile::CallerRegisters].r(); … … 617 617 } 618 618 619 NEVER_INLINE Instruction* Machine::throwException(ExecState* exec, JSValue* exceptionValue, const Instruction* vPC, CodeBlock*& codeBlock, JSValue**& k, ScopeChainNode*& scopeChain, Register*& r)619 NEVER_INLINE Instruction* Machine::throwException(ExecState* exec, JSValue* exceptionValue, const Instruction* vPC, CodeBlock*& codeBlock, Register*& k, ScopeChainNode*& scopeChain, Register*& r) 620 620 { 621 621 // Set up the exception object … … 978 978 Register* registerBase = registerFile->base(); 979 979 Instruction* vPC = codeBlock->instructions.begin(); 980 JSValue** k = codeBlock->jsValues.data();980 Register* k = codeBlock->registers.data(); 981 981 Profiler** enabledProfilerReference = Profiler::enabledProfilerReference(); 982 982 unsigned tickCount = m_ticksUntilNextTimeoutCheck + 1; … … 2248 2248 codeBlock = newCodeBlock; 2249 2249 setScopeChain(exec, scopeChain, scopeChainForCall(exec, functionBodyNode, codeBlock, callDataScopeChain, r)); 2250 k = codeBlock-> jsValues.data();2250 k = codeBlock->registers.data(); 2251 2251 vPC = codeBlock->instructions.begin(); 2252 2252 … … 2317 2317 return returnValue; 2318 2318 2319 k = codeBlock-> jsValues.data();2319 k = codeBlock->registers.data(); 2320 2320 vPC = callFrame[RegisterFile::ReturnVPC].vPC(); 2321 2321 setScopeChain(exec, scopeChain, callFrame[RegisterFile::CallerScopeChain].scopeChain()); … … 2379 2379 codeBlock = newCodeBlock; 2380 2380 setScopeChain(exec, scopeChain, scopeChainForCall(exec, functionBodyNode, codeBlock, callDataScopeChain, r)); 2381 k = codeBlock-> jsValues.data();2381 k = codeBlock->registers.data(); 2382 2382 vPC = codeBlock->instructions.begin(); 2383 2383 … … 2550 2550 int message = (++vPC)->u.operand; 2551 2551 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()); 2553 2553 2554 2554 ++vPC; -
trunk/JavaScriptCore/VM/Machine.h
r35203 r35231 132 132 NEVER_INLINE void debug(ExecState*, const Instruction*, const CodeBlock*, ScopeChainNode*, Register*); 133 133 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*&); 136 136 137 137 Register* callFrame(ExecState*, JSFunction*) const; -
trunk/JavaScriptCore/VM/Register.h
r35217 r35231 53 53 void mark(); 54 54 55 bool isString() const; 56 55 57 uint32_t toUInt32(ExecState*) const; 56 58 UString toString(ExecState*) const; 59 57 60 58 61 private: … … 216 219 } 217 220 221 ALWAYS_INLINE bool Register::isString() const 222 { 223 return jsValue()->isString(); 224 } 225 218 226 ALWAYS_INLINE uint32_t Register::toUInt32(ExecState* exec) const 219 227 {
Note: See TracChangeset
for help on using the changeset viewer.