Changeset 221018 in webkit for trunk/Source/JavaScriptCore/tools


Ignore:
Timestamp:
Aug 22, 2017, 9:28:13 AM (8 years ago)
Author:
[email protected]
Message:

We are using valueProfileForBytecodeOffset when there may not be a value profile
https://bugs.webkit.org/show_bug.cgi?id=175812

Reviewed by Michael Saboff.

This patch uses the type system to aid the code around CodeBlock's ValueProfile
accessor methods. valueProfileForBytecodeOffset used to return ValueProfile*,
so there were callers of this that thought it could return nullptr when there
was no such ValueProfile. This was not the case, it always returned a non-null
pointer. This patch changes valueProfileForBytecodeOffset to return ValueProfile&
and adds a new tryGetValueProfileForBytecodeOffset method that returns ValueProfile*
and does the right thing if there is no such ValueProfile.

This patch also changes the other ValueProfile accessors on CodeBlock to
return ValueProfile& instead of ValueProfile*. Some callers handled the null
case unnecessarily, and using the type system to specify the result can't be
null removes these useless branches.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::updateAllPredictionsAndCountLiveness):
(JSC::CodeBlock::dumpValueProfiles):
(JSC::CodeBlock::tryGetValueProfileForBytecodeOffset):
(JSC::CodeBlock::valueProfileForBytecodeOffset):
(JSC::CodeBlock::validate):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::valueProfileForArgument):
(JSC::CodeBlock::valueProfile):
(JSC::CodeBlock::valueProfilePredictionForBytecodeOffset):
(JSC::CodeBlock::getFromAllValueProfiles):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleInlining):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::methodOfGettingAValueProfileFor):

  • dfg/DFGPredictionInjectionPhase.cpp:

(JSC::DFG::PredictionInjectionPhase::run):

  • jit/JIT.h:
  • jit/JITInlines.h:

(JSC::JIT::emitValueProfilingSite):

  • profiler/ProfilerBytecodeSequence.cpp:

(JSC::Profiler::BytecodeSequence::BytecodeSequence):

  • tools/HeapVerifier.cpp:

(JSC::HeapVerifier::validateJSCell):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/tools/HeapVerifier.cpp

    r213883 r221018  
    332332            bool success = true;
    333333            for (unsigned i = 0; i < codeBlock->totalNumberOfValueProfiles(); ++i) {
    334                 ValueProfile* valueProfile = codeBlock->getFromAllValueProfiles(i);
     334                ValueProfile& valueProfile = codeBlock->getFromAllValueProfiles(i);
    335335                for (unsigned i = 0; i < ValueProfile::totalNumberOfBuckets; ++i) {
    336                     JSValue value = JSValue::decode(valueProfile->m_buckets[i]);
     336                    JSValue value = JSValue::decode(valueProfile.m_buckets[i]);
    337337                    if (!value)
    338338                        continue;
Note: See TracChangeset for help on using the changeset viewer.