Changeset 137379 in webkit for trunk/Source/JavaScriptCore/profiler/ProfilerBytecodes.cpp
- Timestamp:
- Dec 11, 2012, 4:21:43 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/profiler/ProfilerBytecodes.cpp
r137179 r137379 27 27 #include "ProfilerBytecodes.h" 28 28 29 #include "CodeBlock.h" 29 30 #include "JSGlobalObject.h" 30 31 #include <wtf/StringPrintStream.h> … … 32 33 namespace JSC { namespace Profiler { 33 34 34 Bytecodes::Bytecodes( 35 size_t id, const String& inferredName, const String& sourceCode, CodeBlockHash hash) 36 : m_id(id) 37 , m_inferredName(inferredName) 38 , m_sourceCode(sourceCode) 39 , m_hash(hash) 35 Bytecodes::Bytecodes(size_t id, CodeBlock* codeBlock) 36 : BytecodeSequence(codeBlock) 37 , m_id(id) 38 , m_inferredName(codeBlock->inferredName()) 39 , m_sourceCode(codeBlock->sourceCodeForTools()) 40 , m_hash(codeBlock->hash()) 41 , m_instructionCount(codeBlock->instructionCount()) 40 42 { 41 43 } 42 44 43 45 Bytecodes::~Bytecodes() { } 44 45 unsigned Bytecodes::indexForBytecodeIndex(unsigned bytecodeIndex) const46 {47 return binarySearch<Bytecode, unsigned, getBytecodeIndexForBytecode>(const_cast<Bytecode*>(m_bytecode.begin()), m_bytecode.size(), bytecodeIndex) - m_bytecode.begin();48 }49 50 const Bytecode& Bytecodes::forBytecodeIndex(unsigned bytecodeIndex) const51 {52 return at(indexForBytecodeIndex(bytecodeIndex));53 }54 46 55 47 void Bytecodes::dump(PrintStream& out) const … … 66 58 result->putDirect(exec->globalData(), exec->propertyNames().sourceCode, jsString(exec, m_sourceCode)); 67 59 result->putDirect(exec->globalData(), exec->propertyNames().hash, jsString(exec, String::fromUTF8(toCString(m_hash)))); 68 69 JSArray* stream = constructEmptyArray(exec, 0); 70 for (unsigned i = 0; i < m_bytecode.size(); ++i) 71 stream->putDirectIndex(exec, i, m_bytecode[i].toJS(exec)); 72 result->putDirect(exec->globalData(), exec->propertyNames().bytecode, stream); 60 result->putDirect(exec->globalData(), exec->propertyNames().instructionCount, jsNumber(m_instructionCount)); 61 addSequenceProperties(exec, result); 73 62 74 63 return result;
Note:
See TracChangeset
for help on using the changeset viewer.