Changeset 197303 in webkit
- Timestamp:
- Feb 28, 2016 2:21:54 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r197299 r197303 1 2016-02-28 Andreas Kling <akling@apple.com> 2 3 Shrink UnlinkedCodeBlock a bit. 4 <https://webkit.org/b/154797> 5 6 Reviewed by Anders Carlsson. 7 8 Move profiler-related members of UnlinkedCodeBlock into its RareData 9 structure, saving 40 bytes, and then reorder the other members of 10 UnlinkedCodeBlock to save another 24 bytes, netting a nice total 64. 11 12 The VM member was removed entirely since UnlinkedCodeBlock is a cell 13 and can retrieve its VM through MarkedBlock header lookup. 14 15 * bytecode/UnlinkedCodeBlock.cpp: 16 (JSC::UnlinkedCodeBlock::vm): 17 (JSC::UnlinkedCodeBlock::typeProfilerExpressionInfoForBytecodeOffset): 18 (JSC::UnlinkedCodeBlock::addTypeProfilerExpressionInfo): 19 (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): Deleted. 20 * bytecode/UnlinkedCodeBlock.h: 21 (JSC::UnlinkedCodeBlock::addRegExp): 22 (JSC::UnlinkedCodeBlock::addConstant): 23 (JSC::UnlinkedCodeBlock::addFunctionDecl): 24 (JSC::UnlinkedCodeBlock::addFunctionExpr): 25 (JSC::UnlinkedCodeBlock::addOpProfileControlFlowBytecodeOffset): 26 (JSC::UnlinkedCodeBlock::opProfileControlFlowBytecodeOffsets): 27 (JSC::UnlinkedCodeBlock::vm): Deleted. 28 1 29 2016-02-27 Filip Pizlo <fpizlo@apple.com> 2 30 -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp
r197043 r197303 57 57 , m_numCalleeLocals(0) 58 58 , m_numParameters(0) 59 , m_vm(vm)60 59 , m_globalObjectRegister(VirtualRegister()) 61 60 , m_usesEval(info.usesEval()) … … 86 85 } 87 86 87 VM* UnlinkedCodeBlock::vm() const 88 { 89 return MarkedBlock::blockFor(this)->vm(); 90 } 91 88 92 void UnlinkedCodeBlock::visitChildren(JSCell* cell, SlotVisitor& visitor) 89 93 { … … 262 266 bool UnlinkedCodeBlock::typeProfilerExpressionInfoForBytecodeOffset(unsigned bytecodeOffset, unsigned& startDivot, unsigned& endDivot) 263 267 { 268 ASSERT(m_rareData); 264 269 static const bool verbose = false; 265 auto iter = m_ typeProfilerInfoMap.find(bytecodeOffset);266 if (iter == m_ typeProfilerInfoMap.end()) {270 auto iter = m_rareData->m_typeProfilerInfoMap.find(bytecodeOffset); 271 if (iter == m_rareData->m_typeProfilerInfoMap.end()) { 267 272 if (verbose) 268 273 dataLogF("Don't have assignment info for offset:%u\n", bytecodeOffset); … … 272 277 } 273 278 274 TypeProfilerExpressionRange& range = iter->value;279 RareData::TypeProfilerExpressionRange& range = iter->value; 275 280 startDivot = range.m_startDivot; 276 281 endDivot = range.m_endDivot; … … 280 285 void UnlinkedCodeBlock::addTypeProfilerExpressionInfo(unsigned instructionOffset, unsigned startDivot, unsigned endDivot) 281 286 { 282 TypeProfilerExpressionRange range; 287 createRareDataIfNecessary(); 288 RareData::TypeProfilerExpressionRange range; 283 289 range.m_startDivot = startDivot; 284 290 range.m_endDivot = endDivot; 285 m_ typeProfilerInfoMap.set(instructionOffset, range);291 m_rareData->m_typeProfilerInfoMap.set(instructionOffset, range); 286 292 } 287 293 -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h
r197043 r197303 149 149 createRareDataIfNecessary(); 150 150 unsigned size = m_rareData->m_regexps.size(); 151 m_rareData->m_regexps.append(WriteBarrier<RegExp>(* m_vm, this, r));151 m_rareData->m_regexps.append(WriteBarrier<RegExp>(*vm(), this, r)); 152 152 return size; 153 153 } … … 171 171 unsigned result = m_constantRegisters.size(); 172 172 m_constantRegisters.append(WriteBarrier<Unknown>()); 173 m_constantRegisters.last().set(* m_vm, this, v);173 m_constantRegisters.last().set(*vm(), this, v); 174 174 m_constantsSourceCodeRepresentation.append(sourceCodeRepresentation); 175 175 return result; … … 250 250 unsigned size = m_functionDecls.size(); 251 251 m_functionDecls.append(WriteBarrier<UnlinkedFunctionExecutable>()); 252 m_functionDecls.last().set(* m_vm, this, n);252 m_functionDecls.last().set(*vm(), this, n); 253 253 return size; 254 254 } … … 259 259 unsigned size = m_functionExprs.size(); 260 260 m_functionExprs.append(WriteBarrier<UnlinkedFunctionExecutable>()); 261 m_functionExprs.last().set(* m_vm, this, n);261 m_functionExprs.last().set(*vm(), this, n); 262 262 return size; 263 263 } … … 270 270 UnlinkedHandlerInfo& exceptionHandler(int index) { ASSERT(m_rareData); return m_rareData->m_exceptionHandlers[index]; } 271 271 272 VM* vm() const { return m_vm; }272 VM* vm() const; 273 273 274 274 UnlinkedArrayProfile addArrayProfile() { return m_arrayProfileCount++; } … … 346 346 unsigned endColumn() const { return m_endColumn; } 347 347 348 void addOpProfileControlFlowBytecodeOffset(size_t offset) { m_opProfileControlFlowBytecodeOffsets.append(offset); } 349 const Vector<size_t>& opProfileControlFlowBytecodeOffsets() const { return m_opProfileControlFlowBytecodeOffsets; } 348 void addOpProfileControlFlowBytecodeOffset(size_t offset) 349 { 350 createRareDataIfNecessary(); 351 m_rareData->m_opProfileControlFlowBytecodeOffsets.append(offset); 352 } 353 const Vector<size_t>& opProfileControlFlowBytecodeOffsets() const 354 { 355 ASSERT(m_rareData); 356 return m_rareData->m_opProfileControlFlowBytecodeOffsets; 357 } 350 358 351 359 void dumpExpressionRangeInfo(); // For debugging purpose only. … … 370 378 void getLineAndColumn(ExpressionRangeInfo&, unsigned& line, unsigned& column); 371 379 380 int m_numParameters; 381 372 382 std::unique_ptr<UnlinkedInstructionStream> m_unlinkedInstructions; 373 374 int m_numParameters;375 VM* m_vm;376 383 377 384 VirtualRegister m_thisRegister; … … 399 406 Vector<unsigned> m_jumpTargets; 400 407 408 Vector<unsigned> m_propertyAccessInstructions; 409 401 410 // Constant Pools 402 411 Vector<Identifier> m_identifiers; 403 412 Vector<WriteBarrier<Unknown>> m_constantRegisters; 404 413 Vector<SourceCodeRepresentation> m_constantsSourceCodeRepresentation; 405 std::array<unsigned, LinkTimeConstantCount> m_linkTimeConstants;406 414 typedef Vector<WriteBarrier<UnlinkedFunctionExecutable>> FunctionExpressionVector; 407 415 FunctionExpressionVector m_functionDecls; 408 416 FunctionExpressionVector m_functionExprs; 409 410 Vector<unsigned> m_propertyAccessInstructions; 417 std::array<unsigned, LinkTimeConstantCount> m_linkTimeConstants; 411 418 412 419 unsigned m_arrayProfileCount; … … 433 440 434 441 Vector<ExpressionRangeInfo::FatPosition> m_expressionInfoFatPositions; 442 443 struct TypeProfilerExpressionRange { 444 unsigned m_startDivot; 445 unsigned m_endDivot; 446 }; 447 HashMap<unsigned, TypeProfilerExpressionRange> m_typeProfilerInfoMap; 448 Vector<size_t> m_opProfileControlFlowBytecodeOffsets; 435 449 }; 436 450 … … 438 452 std::unique_ptr<RareData> m_rareData; 439 453 Vector<ExpressionRangeInfo> m_expressionInfo; 440 struct TypeProfilerExpressionRange {441 unsigned m_startDivot;442 unsigned m_endDivot;443 };444 HashMap<unsigned, TypeProfilerExpressionRange> m_typeProfilerInfoMap;445 Vector<size_t> m_opProfileControlFlowBytecodeOffsets;446 454 447 455 protected:
Note: See TracChangeset
for help on using the changeset viewer.