diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
commit | ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (patch) | |
tree | b34b0daceb7c8e7fdde4b4ec43650ab7caadb0a9 /Source/JavaScriptCore/bytecode/PutByIdStatus.cpp | |
parent | 03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (diff) | |
download | qtwebkit-ad0d549d4cc13433f77c1ac8f0ab379c83d93f28.tar.gz |
Imported WebKit commit bb52bf3c0119e8a128cd93afe5572413a8617de9 (http://svn.webkit.org/repository/webkit/trunk@108790)
Diffstat (limited to 'Source/JavaScriptCore/bytecode/PutByIdStatus.cpp')
-rw-r--r-- | Source/JavaScriptCore/bytecode/PutByIdStatus.cpp | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/Source/JavaScriptCore/bytecode/PutByIdStatus.cpp b/Source/JavaScriptCore/bytecode/PutByIdStatus.cpp index 45a5e614c..209d4cd5e 100644 --- a/Source/JavaScriptCore/bytecode/PutByIdStatus.cpp +++ b/Source/JavaScriptCore/bytecode/PutByIdStatus.cpp @@ -27,27 +27,69 @@ #include "PutByIdStatus.h" #include "CodeBlock.h" +#include "LowLevelInterpreter.h" #include "Structure.h" #include "StructureChain.h" namespace JSC { +PutByIdStatus PutByIdStatus::computeFromLLInt(CodeBlock* profiledBlock, unsigned bytecodeIndex, Identifier& ident) +{ + UNUSED_PARAM(profiledBlock); + UNUSED_PARAM(bytecodeIndex); + UNUSED_PARAM(ident); +#if ENABLE(LLINT) + Instruction* instruction = profiledBlock->instructions().begin() + bytecodeIndex; + + Structure* structure = instruction[4].u.structure.get(); + if (!structure) + return PutByIdStatus(NoInformation, 0, 0, 0, notFound); + + if (instruction[0].u.opcode == llint_op_put_by_id) { + size_t offset = structure->get(*profiledBlock->globalData(), ident); + if (offset == notFound) + return PutByIdStatus(NoInformation, 0, 0, 0, notFound); + + return PutByIdStatus(SimpleReplace, structure, 0, 0, offset); + } + + ASSERT(instruction[0].u.opcode == llint_op_put_by_id_transition_direct + || instruction[0].u.opcode == llint_op_put_by_id_transition_normal); + + Structure* newStructure = instruction[6].u.structure.get(); + StructureChain* chain = instruction[7].u.structureChain.get(); + ASSERT(newStructure); + ASSERT(chain); + + size_t offset = newStructure->get(*profiledBlock->globalData(), ident); + if (offset == notFound) + return PutByIdStatus(NoInformation, 0, 0, 0, notFound); + + return PutByIdStatus(SimpleTransition, structure, newStructure, chain, offset); +#else + return PutByIdStatus(NoInformation, 0, 0, 0, notFound); +#endif +} + PutByIdStatus PutByIdStatus::computeFor(CodeBlock* profiledBlock, unsigned bytecodeIndex, Identifier& ident) { UNUSED_PARAM(profiledBlock); UNUSED_PARAM(bytecodeIndex); UNUSED_PARAM(ident); #if ENABLE(JIT) && ENABLE(VALUE_PROFILER) + if (!profiledBlock->numberOfStructureStubInfos()) + return computeFromLLInt(profiledBlock, bytecodeIndex, ident); + if (profiledBlock->likelyToTakeSlowCase(bytecodeIndex)) return PutByIdStatus(TakesSlowPath, 0, 0, 0, notFound); StructureStubInfo& stubInfo = profiledBlock->getStubInfo(bytecodeIndex); if (!stubInfo.seen) - return PutByIdStatus(NoInformation, 0, 0, 0, notFound); + return computeFromLLInt(profiledBlock, bytecodeIndex, ident); switch (stubInfo.accessType) { case access_unset: - return PutByIdStatus(NoInformation, 0, 0, 0, notFound); + return computeFromLLInt(profiledBlock, bytecodeIndex, ident); case access_put_by_id_replace: { size_t offset = stubInfo.u.putByIdReplace.baseObjectStructure->get( |