Changeset 95887 in webkit
- Timestamp:
- Sep 23, 2011 4:28:07 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r95884 r95887 1 2011-09-23 Filip Pizlo <fpizlo@apple.com> 2 3 Resolve opcodes should have value profiling. 4 https://bugs.webkit.org/show_bug.cgi?id=68723 5 6 Reviewed by Oliver Hunt. 7 8 This adds value profiling to all forms of op_resolve in the 9 old JIT, and patches that information into the DFG along with 10 performing the appropriate type propagation. 11 12 * dfg/DFGByteCodeParser.cpp: 13 (JSC::DFG::ByteCodeParser::parseBlock): 14 * dfg/DFGGraph.h: 15 (JSC::DFG::Graph::predict): 16 * dfg/DFGNode.h: 17 (JSC::DFG::Node::hasIdentifier): 18 (JSC::DFG::Node::resolveGlobalDataIndex): 19 (JSC::DFG::Node::hasPrediction): 20 * dfg/DFGPropagator.cpp: 21 (JSC::DFG::Propagator::propagateNodePredictions): 22 * dfg/DFGSpeculativeJIT.cpp: 23 (JSC::DFG::SpeculativeJIT::compile): 24 * jit/JITOpcodes.cpp: 25 (JSC::JIT::emit_op_resolve): 26 (JSC::JIT::emit_op_resolve_base): 27 (JSC::JIT::emit_op_resolve_skip): 28 (JSC::JIT::emit_op_resolve_global): 29 (JSC::JIT::emitSlow_op_resolve_global): 30 (JSC::JIT::emit_op_resolve_with_base): 31 (JSC::JIT::emit_op_resolve_with_this): 32 (JSC::JIT::emitSlow_op_resolve_global_dynamic): 33 * jit/JITStubCall.h: 34 (JSC::JITStubCall::callWithValueProfiling): 35 1 36 2011-09-23 Oliver Hunt <oliver@apple.com> 2 37 -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r95840 r95887 1416 1416 unsigned identifier = currentInstruction[2].u.operand; 1417 1417 1418 NodeIndex resolve = addToGraph(Resolve, OpInfo(identifier) );1418 NodeIndex resolve = addToGraph(Resolve, OpInfo(identifier), OpInfo(PredictNone)); 1419 1419 set(currentInstruction[1].u.operand, resolve); 1420 stronglyPredict(resolve); 1420 1421 1421 1422 NEXT_OPCODE(op_resolve); … … 1425 1426 unsigned identifier = currentInstruction[2].u.operand; 1426 1427 1427 NodeIndex resolve = addToGraph(currentInstruction[3].u.operand ? ResolveBaseStrictPut : ResolveBase, OpInfo(identifier) );1428 NodeIndex resolve = addToGraph(currentInstruction[3].u.operand ? ResolveBaseStrictPut : ResolveBase, OpInfo(identifier), OpInfo(PredictNone)); 1428 1429 set(currentInstruction[1].u.operand, resolve); 1430 stronglyPredict(resolve); 1429 1431 1430 1432 NEXT_OPCODE(op_resolve_base); … … 1432 1434 1433 1435 case op_resolve_global: { 1434 unsigned identifier = currentInstruction[2].u.operand; 1435 1436 NodeIndex resolve = addToGraph(ResolveGlobal, OpInfo(identifier), OpInfo(m_globalResolveNumber++)); 1436 NodeIndex resolve = addToGraph(ResolveGlobal, OpInfo(m_graph.m_resolveGlobalData.size()), OpInfo(PredictNone)); 1437 m_graph.m_resolveGlobalData.append(ResolveGlobalData()); 1438 ResolveGlobalData& data = m_graph.m_resolveGlobalData.last(); 1439 data.identifierNumber = currentInstruction[2].u.operand; 1440 data.resolveInfoIndex = m_globalResolveNumber++; 1437 1441 set(currentInstruction[1].u.operand, resolve); 1442 stronglyPredict(resolve); 1438 1443 1439 1444 NEXT_OPCODE(op_resolve_global); -
trunk/Source/JavaScriptCore/dfg/DFGGraph.h
r95786 r95887 98 98 }; 99 99 100 struct ResolveGlobalData { 101 unsigned identifierNumber; 102 unsigned resolveInfoIndex; 103 }; 104 100 105 typedef Vector <BlockIndex, 2> PredecessorList; 101 106 … … 198 203 case GetByOffset: 199 204 case GetScopedVar: 205 case Resolve: 206 case ResolveBase: 207 case ResolveBaseStrictPut: 208 case ResolveGlobal: 200 209 return node.predict(prediction, source); 201 210 default: … … 317 326 Vector<MethodCheckData> m_methodCheckData; 318 327 Vector<StorageAccessData> m_storageAccessData; 328 Vector<ResolveGlobalData> m_resolveGlobalData; 319 329 unsigned m_preservedVars; 320 330 unsigned m_parameterSlots; -
trunk/Source/JavaScriptCore/dfg/DFGNode.h
r95854 r95887 468 468 case ResolveBase: 469 469 case ResolveBaseStrictPut: 470 case ResolveGlobal:471 470 return true; 472 471 default: … … 482 481 } 483 482 484 unsigned resolve InfoIndex()483 unsigned resolveGlobalDataIndex() 485 484 { 486 485 ASSERT(op == ResolveGlobal); 487 return m_opInfo 2;486 return m_opInfo; 488 487 } 489 488 … … 634 633 case GetByOffset: 635 634 case GetScopedVar: 635 case Resolve: 636 case ResolveBase: 637 case ResolveBaseStrictPut: 638 case ResolveGlobal: 636 639 return true; 637 640 default: -
trunk/Source/JavaScriptCore/dfg/DFGPropagator.cpp
r95876 r95887 535 535 } 536 536 537 case GetScopedVar: { 537 case GetScopedVar: 538 case Resolve: 539 case ResolveBase: 540 case ResolveBaseStrictPut: 541 case ResolveGlobal: { 538 542 changed |= node.predict(m_uses[m_compileIndex] & ~PredictionTagMask, StrongPrediction); 539 543 PredictedType prediction = node.getPrediction(); … … 594 598 #ifndef NDEBUG 595 599 // These get ignored because they don't return anything. 600 case PutScopedVar: 596 601 case DFG::Jump: 597 602 case Branch: … … 604 609 break; 605 610 606 // These get ignored because we don't have profiling for them, yet.607 case Resolve:608 case ResolveBase:609 case ResolveBaseStrictPut:610 case ResolveGlobal:611 case PutScopedVar:612 break;613 614 611 // This gets ignored because it doesn't do anything. 615 612 case Phantom: 616 613 break; 617 618 619 614 #else 620 615 default: -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r95868 r95887 2056 2056 GPRReg resultGPR = result.gpr(); 2057 2057 2058 GlobalResolveInfo* resolveInfoAddress = &(m_jit.codeBlock()->globalResolveInfo(node.resolveInfoIndex())); 2058 ResolveGlobalData& data = m_jit.graph().m_resolveGlobalData[node.resolveGlobalDataIndex()]; 2059 GlobalResolveInfo* resolveInfoAddress = &(m_jit.codeBlock()->globalResolveInfo(data.resolveInfoIndex)); 2059 2060 2060 2061 // Check Structure of global object … … 2066 2067 silentSpillAllRegisters(resultGPR); 2067 2068 m_jit.move(resolveInfoGPR, GPRInfo::argumentGPR1); 2068 m_jit.move(JITCompiler::TrustedImmPtr(&m_jit.codeBlock()->identifier( node.identifierNumber())), GPRInfo::argumentGPR2);2069 m_jit.move(JITCompiler::TrustedImmPtr(&m_jit.codeBlock()->identifier(data.identifierNumber)), GPRInfo::argumentGPR2); 2069 2070 m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); 2070 2071 JITCompiler::Call functionCall = appendCallWithExceptionCheck(operationResolveGlobal); -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r94920 r95887 519 519 JITStubCall stubCall(this, cti_op_resolve); 520 520 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand))); 521 stubCall.call (currentInstruction[1].u.operand);521 stubCall.callWithValueProfiling(currentInstruction[1].u.operand, FirstProfilingSite); 522 522 } 523 523 … … 550 550 JITStubCall stubCall(this, currentInstruction[3].u.operand ? cti_op_resolve_base_strict_put : cti_op_resolve_base); 551 551 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand))); 552 stubCall.call (currentInstruction[1].u.operand);552 stubCall.callWithValueProfiling(currentInstruction[1].u.operand, FirstProfilingSite); 553 553 } 554 554 … … 566 566 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand))); 567 567 stubCall.addArgument(Imm32(currentInstruction[3].u.operand)); 568 stubCall.call (currentInstruction[1].u.operand);568 stubCall.callWithValueProfiling(currentInstruction[1].u.operand, FirstProfilingSite); 569 569 } 570 570 … … 587 587 load32(Address(regT2, OBJECT_OFFSETOF(GlobalResolveInfo, offset)), regT1); 588 588 loadPtr(BaseIndex(regT0, regT1, ScalePtr), regT0); 589 emitValueProfilingSite(FirstProfilingSite); 589 590 emitPutVirtualRegister(currentInstruction[1].u.operand); 590 591 } … … 602 603 stubCall.addArgument(Imm32(currentIndex)); 603 604 stubCall.addArgument(regT0); 604 stubCall.call (dst);605 stubCall.callWithValueProfiling(dst, SubsequentProfilingSite); 605 606 } 606 607 … … 723 724 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand))); 724 725 stubCall.addArgument(Imm32(currentInstruction[1].u.operand)); 725 stubCall.call (currentInstruction[2].u.operand);726 stubCall.callWithValueProfiling(currentInstruction[2].u.operand, FirstProfilingSite); 726 727 } 727 728 … … 731 732 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand))); 732 733 stubCall.addArgument(Imm32(currentInstruction[1].u.operand)); 733 stubCall.call (currentInstruction[2].u.operand);734 stubCall.callWithValueProfiling(currentInstruction[2].u.operand, FirstProfilingSite); 734 735 } 735 736 … … 1532 1533 stubCall.addArgument(Imm32(currentIndex)); 1533 1534 stubCall.addArgument(regT0); 1534 stubCall.call (dst);1535 stubCall.callWithValueProfiling(dst, SubsequentProfilingSite); // The first profiling site is in emit_op_resolve_global 1535 1536 } 1536 1537 -
trunk/Source/JavaScriptCore/jit/JITStubCall.h
r93755 r95887 201 201 return call; 202 202 } 203 204 JIT::Call callWithValueProfiling(unsigned dst, JIT::ValueProfilingSiteKind) 205 { 206 return call(dst); 207 } 203 208 #else 204 209 JIT::Call call(unsigned dst) // dst is a virtual register. … … 206 211 ASSERT(m_returnType == VoidPtr || m_returnType == Cell); 207 212 JIT::Call call = this->call(); 213 m_jit->emitPutVirtualRegister(dst); 214 return call; 215 } 216 217 JIT::Call callWithValueProfiling(unsigned dst, JIT::ValueProfilingSiteKind kind) 218 { 219 ASSERT(m_returnType == VoidPtr || m_returnType == Cell); 220 JIT::Call call = this->call(); 221 ASSERT(JIT::returnValueRegister == JIT::regT0); 222 m_jit->emitValueProfilingSite(kind); 208 223 m_jit->emitPutVirtualRegister(dst); 209 224 return call;
Note: See TracChangeset
for help on using the changeset viewer.