Ignore:
Timestamp:
May 25, 2012, 1:19:55 PM (13 years ago)
Author:
[email protected]
Message:

DFG ConvertThis should just be a CheckStructure if the structure is known
https://bugs.webkit.org/show_bug.cgi?id=87057

Reviewed by Gavin Barraclough.

Merged r118021 from dfgopt.

This gives ValueProfile the ability to track singleton values - i.e. profiling
sites that always see the same value.

That is then used to profile the structure in op_convert_this.

This is then used to optimize op_convert_this into a CheckStructure if the
structure is always the same.

That then results in better CSE in inlined code that uses 'this', since
previously we couldn't CSE accesses on 'this' from different inline call frames.

Also fixed a bug where we were unnecessarily flushing 'this'.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dump):
(JSC::CodeBlock::stronglyVisitStrongReferences):

  • bytecode/LazyOperandValueProfile.cpp:

(JSC::CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions):

  • bytecode/LazyOperandValueProfile.h:

(CompressedLazyOperandValueProfileHolder):

  • bytecode/Opcode.h:

(JSC):
(JSC::padOpcodeName):

  • bytecode/ValueProfile.h:

(JSC::ValueProfileBase::ValueProfileBase):
(JSC::ValueProfileBase::dump):
(JSC::ValueProfileBase::computeUpdatedPrediction):
(ValueProfileBase):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::setArgument):
(JSC::DFG::ByteCodeParser::parseBlock):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_convert_this):
(JSC::JIT::emitSlow_op_convert_this):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_convert_this):
(JSC::JIT::emitSlow_op_convert_this):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
  • runtime/JSValue.h:

(JSValue):

  • runtime/Structure.h:

(JSC::JSValue::structureOrUndefined):
(JSC):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r118323 r118555  
    12581258void JIT::emit_op_convert_this(Instruction* currentInstruction)
    12591259{
    1260     emitGetVirtualRegister(currentInstruction[1].u.operand, regT0);
    1261 
    1262     emitJumpSlowCaseIfNotJSCell(regT0);
    1263     addSlowCase(branchPtr(Equal, Address(regT0, JSCell::classInfoOffset()), TrustedImmPtr(&JSString::s_info)));
     1260    emitGetVirtualRegister(currentInstruction[1].u.operand, regT1);
     1261
     1262    emitJumpSlowCaseIfNotJSCell(regT1);
     1263    if (shouldEmitProfiling()) {
     1264        loadPtr(Address(regT1, JSCell::structureOffset()), regT0);
     1265        emitValueProfilingSite();
     1266    }
     1267    addSlowCase(branchPtr(Equal, Address(regT1, JSCell::classInfoOffset()), TrustedImmPtr(&JSString::s_info)));
    12641268}
    12651269
     
    13161320
    13171321    linkSlowCase(iter);
    1318     Jump isNotUndefined = branchPtr(NotEqual, regT0, TrustedImmPtr(JSValue::encode(jsUndefined())));
     1322    if (shouldEmitProfiling())
     1323        move(TrustedImmPtr(bitwise_cast<void*>(JSValue::encode(jsUndefined()))), regT0);
     1324    Jump isNotUndefined = branchPtr(NotEqual, regT1, TrustedImmPtr(JSValue::encode(jsUndefined())));
     1325    emitValueProfilingSite();
    13191326    move(TrustedImmPtr(globalThis), regT0);
    13201327    emitPutVirtualRegister(currentInstruction[1].u.operand, regT0);
    13211328    emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_convert_this));
    13221329
     1330    linkSlowCase(iter);
     1331    if (shouldEmitProfiling())
     1332        move(TrustedImmPtr(bitwise_cast<void*>(JSValue::encode(m_globalData->stringStructure.get()))), regT0);
    13231333    isNotUndefined.link(this);
    1324     linkSlowCase(iter);
     1334    emitValueProfilingSite();
    13251335    JITStubCall stubCall(this, cti_op_convert_this);
    1326     stubCall.addArgument(regT0);
     1336    stubCall.addArgument(regT1);
    13271337    stubCall.call(currentInstruction[1].u.operand);
    13281338}
Note: See TracChangeset for help on using the changeset viewer.