Ignore:
Timestamp:
Jan 20, 2012, 12:22:18 PM (13 years ago)
Author:
[email protected]
Message:

Bytecode instructions that may have value profiling should have a direct inline
link to the ValueProfile instance
https://bugs.webkit.org/show_bug.cgi?id=76682
<rdar://problem/10727689>

Reviewed by Sam Weinig.

Each opcode that gets value profiled now has a link to its ValueProfile. This
required rationalizing the emission of value profiles for opcode combos, like
op_method_check/op_get_by_id and op_call/op_call_put_result. It only makes
sense for one of them to have a value profile link, and it makes most sense
for it to be the one that actually sets the result. The previous behavior was
to have op_method_check profile for op_get_by_id when they were used together,
but otherwise for op_get_by_id to have its own profiles. op_call already did
the right thing; all profiling was done by op_call_put_result.

But rationalizing this code required breaking some of the natural boundaries
that the code had; for instance the code in DFG that emits a GetById in place
of both op_method_check and op_get_by_id must now know that it's the latter of
those that has the value profile, while the first of those constitutes the OSR
target. Hence each CodeOrigin must now have two bytecode indices - one for
OSR exit and one for profiling.

Finally this change required some refiddling of our optimization heuristics,
because now all code blocks have "more instructions" due to the value profile
slots.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::printGetByIdOp):
(JSC::CodeBlock::dump):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::valueProfileForBytecodeOffset):

  • bytecode/CodeOrigin.h:

(JSC::CodeOrigin::CodeOrigin):
(JSC::CodeOrigin::bytecodeIndexForValueProfile):

  • bytecode/Instruction.h:

(JSC::Instruction::Instruction):

  • bytecode/Opcode.h:
  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitProfiledOpcode):
(JSC::BytecodeGenerator::emitResolve):
(JSC::BytecodeGenerator::emitGetScopedVar):
(JSC::BytecodeGenerator::emitResolveBase):
(JSC::BytecodeGenerator::emitResolveBaseForPut):
(JSC::BytecodeGenerator::emitResolveWithBase):
(JSC::BytecodeGenerator::emitResolveWithThis):
(JSC::BytecodeGenerator::emitGetById):
(JSC::BytecodeGenerator::emitGetByVal):
(JSC::BytecodeGenerator::emitCall):
(JSC::BytecodeGenerator::emitCallVarargs):
(JSC::BytecodeGenerator::emitConstruct):

  • bytecompiler/BytecodeGenerator.h:
  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::ByteCodeParser):
(JSC::DFG::ByteCodeParser::currentCodeOrigin):
(JSC::DFG::ByteCodeParser::addCall):
(JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
(JSC::DFG::ByteCodeParser::getPrediction):
(JSC::DFG::ByteCodeParser::handleCall):
(JSC::DFG::ByteCodeParser::handleInlining):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::parse):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::valueProfileFor):

  • jit/JIT.h:

(JSC::JIT::emitValueProfilingSite):

  • jit/JITCall.cpp:

(JSC::JIT::emit_op_call_put_result):

  • jit/JITCall32_64.cpp:

(JSC::JIT::emit_op_call_put_result):

  • jit/JITInlineMethods.h:

(JSC::JIT::emitValueProfilingSite):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_resolve):
(JSC::JIT::emit_op_resolve_base):
(JSC::JIT::emit_op_resolve_skip):
(JSC::JIT::emit_op_resolve_global):
(JSC::JIT::emitSlow_op_resolve_global):
(JSC::JIT::emit_op_resolve_with_base):
(JSC::JIT::emit_op_resolve_with_this):
(JSC::JIT::emitSlow_op_resolve_global_dynamic):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_resolve):
(JSC::JIT::emit_op_resolve_base):
(JSC::JIT::emit_op_resolve_skip):
(JSC::JIT::emit_op_resolve_global):
(JSC::JIT::emitSlow_op_resolve_global):
(JSC::JIT::emit_op_resolve_with_base):
(JSC::JIT::emit_op_resolve_with_this):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emit_op_method_check):
(JSC::JIT::emitSlow_op_method_check):
(JSC::JIT::emit_op_get_by_id):
(JSC::JIT::emitSlow_op_get_by_id):
(JSC::JIT::emit_op_get_scoped_var):
(JSC::JIT::emit_op_get_global_var):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::emit_op_method_check):
(JSC::JIT::emitSlow_op_method_check):
(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emit_op_get_by_id):
(JSC::JIT::emitSlow_op_get_by_id):
(JSC::JIT::emit_op_get_scoped_var):
(JSC::JIT::emit_op_get_global_var):

  • jit/JITStubCall.h:

(JSC::JITStubCall::callWithValueProfiling):

  • runtime/Options.cpp:

(JSC::Options::initializeOptions):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r104770 r105533  
    181181    int id0 = (++it)->u.operand;
    182182    printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(exec, r0).data(), registerName(exec, r1).data(), idName(id0, m_identifiers[id0]).data());
    183     it += 4;
     183    it += 5;
    184184}
    185185
     
    744744            int id0 = (++it)->u.operand;
    745745            printf("[%4d] resolve\t\t %s, %s\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data());
     746            it++;
    746747            break;
    747748        }
     
    751752            int skipLevels = (++it)->u.operand;
    752753            printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data(), skipLevels);
     754            it++;
    753755            break;
    754756        }
     
    757759            int id0 = (++it)->u.operand;
    758760            printf("[%4d] resolve_global\t %s, %s\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data());
    759             it += 2;
     761            it += 3;
    760762            break;
    761763        }
     
    767769            int depth = (++it)->u.operand;
    768770            printf("[%4d] resolve_global_dynamic\t %s, %s, %s, %d\n", location, registerName(exec, r0).data(), valueToSourceString(exec, scope).utf8().data(), idName(id0, m_identifiers[id0]).data(), depth);
     771            ++it;
    769772            break;
    770773        }
     
    774777            int skipLevels = (++it)->u.operand;
    775778            printf("[%4d] get_scoped_var\t %s, %d, %d\n", location, registerName(exec, r0).data(), index, skipLevels);
     779            it++;
    776780            break;
    777781        }
     
    787791            int index = (++it)->u.operand;
    788792            printf("[%4d] get_global_var\t %s, %d\n", location, registerName(exec, r0).data(), index);
     793            it++;
    789794            break;
    790795        }
     
    800805            int isStrict = (++it)->u.operand;
    801806            printf("[%4d] resolve_base%s\t %s, %s\n", location, isStrict ? "_strict" : "", registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data());
     807            it++;
    802808            break;
    803809        }
     
    813819            int id0 = (++it)->u.operand;
    814820            printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), idName(id0, m_identifiers[id0]).data());
     821            it++;
    815822            break;
    816823        }
     
    820827            int id0 = (++it)->u.operand;
    821828            printf("[%4d] resolve_with_this %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), idName(id0, m_identifiers[id0]).data());
     829            it++;
    822830            break;
    823831        }
     
    925933            int r2 = (++it)->u.operand;
    926934            printf("[%4d] get_by_val\t %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data());
     935            it++;
    927936            break;
    928937        }
     
    11631172            int r0 = (++it)->u.operand;
    11641173            printf("[%4d] op_call_put_result\t\t %s\n", location, registerName(exec, r0).data());
     1174            it++;
    11651175            break;
    11661176        }
Note: See TracChangeset for help on using the changeset viewer.