Ignore:
Timestamp:
May 8, 2009, 3:18:34 AM (16 years ago)
Author:
[email protected]
Message:

2009-05-08 Gavin Barraclough <[email protected]>

Reviewed by Oliver "I see lots of ifdefs" Hunt.

Fix (kinda) for sampling tool breakage. The codeblock sampling tool has become
b0rked due to recent changes in native function calling. The initialization of
a ScopeNode appears to now occur before the sampling tool (or possibly the
interpreter has been brought into existence, wihich leads to crashyness).

This patch doesn't fix the problem. The crash occurs when tracking a Scope, but
we shouldn't need to track scopes when we're just sampling opcodes, not
codeblocks. Not retaining Scopes when just opcode sampling will reduce sampling
overhead reducing any instrumentation skew, which is a good thing. As a side
benefit this patch also gets the opcode sampling going again, albeit in a bit of
a lame way. Will come back later with a proper fix from codeblock sampling.

  • JavaScriptCore.exp:
  • bytecode/SamplingTool.cpp: (JSC::compareLineCountInfoSampling): (JSC::SamplingTool::dump):
  • bytecode/SamplingTool.h: (JSC::SamplingTool::SamplingTool):
  • parser/Nodes.cpp: (JSC::ScopeNode::ScopeNode):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecode/SamplingTool.cpp

    r43392 r43395  
    210210}
    211211
     212#if ENABLE(CODEBLOCK_SAMPLING)
    212213void SamplingTool::notifyOfScope(ScopeNode* scope)
    213214{
     
    215216    m_scopeSampleMap->set(scope, new ScopeSampleRecord(scope));
    216217}
     218#endif
    217219
    218220void SamplingTool::setup()
     
    234236};
    235237
     238static int compareOpcodeIndicesSampling(const void* left, const void* right)
     239{
     240    const OpcodeSampleInfo* leftSampleInfo = reinterpret_cast<const OpcodeSampleInfo*>(left);
     241    const OpcodeSampleInfo* rightSampleInfo = reinterpret_cast<const OpcodeSampleInfo*>(right);
     242
     243    return (leftSampleInfo->count < rightSampleInfo->count) ? 1 : (leftSampleInfo->count > rightSampleInfo->count) ? -1 : 0;
     244}
     245
     246#if ENABLE(CODEBLOCK_SAMPLING)
    236247static int compareLineCountInfoSampling(const void* left, const void* right)
    237248{
     
    242253}
    243254
    244 static int compareOpcodeIndicesSampling(const void* left, const void* right)
    245 {
    246     const OpcodeSampleInfo* leftSampleInfo = reinterpret_cast<const OpcodeSampleInfo*>(left);
    247     const OpcodeSampleInfo* rightSampleInfo = reinterpret_cast<const OpcodeSampleInfo*>(right);
    248 
    249     return (leftSampleInfo->count < rightSampleInfo->count) ? 1 : (leftSampleInfo->count > rightSampleInfo->count) ? -1 : 0;
    250 }
    251 
    252255static int compareScopeSampleRecords(const void* left, const void* right)
    253256{
     
    257260    return (leftValue->m_sampleCount < rightValue->m_sampleCount) ? 1 : (leftValue->m_sampleCount > rightValue->m_sampleCount) ? -1 : 0;
    258261}
     262#endif
    259263
    260264void SamplingTool::dump(ExecState* exec)
     
    308312    printf("\tcti %% of self:\tcti count / sample count\n");
    309313   
     314#if ENABLE(CODEBLOCK_SAMPLING)
     315
    310316    // (3) Build and sort 'codeBlockSamples' array.
    311317
     
    366372        }
    367373    }
    368 }
    369 
    370374#else
     375    UNUSED_PARAM(exec);
     376#endif
     377}
     378
     379#else
    371380
    372381void SamplingTool::dump(ExecState*)
Note: See TracChangeset for help on using the changeset viewer.