diff options
Diffstat (limited to 'JavaScriptCore/bytecode')
-rw-r--r-- | JavaScriptCore/bytecode/CodeBlock.cpp | 40 | ||||
-rw-r--r-- | JavaScriptCore/bytecode/CodeBlock.h | 25 | ||||
-rw-r--r-- | JavaScriptCore/bytecode/EvalCodeCache.h | 2 | ||||
-rw-r--r-- | JavaScriptCore/bytecode/Opcode.h | 5 |
4 files changed, 54 insertions, 18 deletions
diff --git a/JavaScriptCore/bytecode/CodeBlock.cpp b/JavaScriptCore/bytecode/CodeBlock.cpp index fd56ece..68debb2 100644 --- a/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/JavaScriptCore/bytecode/CodeBlock.cpp @@ -49,8 +49,8 @@ namespace JSC { static UString escapeQuotes(const UString& str) { UString result = str; - int pos = 0; - while ((pos = result.find('\"', pos)) >= 0) { + unsigned pos = 0; + while ((pos = result.find('\"', pos)) != UString::NotFound) { result = makeString(result.substr(0, pos), "\"\\\"\"", result.substr(pos + 1)); pos += 4; } @@ -765,6 +765,26 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& printGetByIdOp(exec, location, it, "get_by_id_chain"); break; } + case op_get_by_id_getter_self: { + printGetByIdOp(exec, location, it, "get_by_id_getter_self"); + break; + } + case op_get_by_id_getter_self_list: { + printGetByIdOp(exec, location, it, "get_by_id_getter_self_list"); + break; + } + case op_get_by_id_getter_proto: { + printGetByIdOp(exec, location, it, "get_by_id_getter_proto"); + break; + } + case op_get_by_id_getter_proto_list: { + printGetByIdOp(exec, location, it, "get_by_id_getter_proto_list"); + break; + } + case op_get_by_id_getter_chain: { + printGetByIdOp(exec, location, it, "get_by_id_getter_chain"); + break; + } case op_get_by_id_generic: { printGetByIdOp(exec, location, it, "get_by_id_generic"); break; @@ -1355,16 +1375,16 @@ void CodeBlock::derefStructures(Instruction* vPC) const { Interpreter* interpreter = m_globalData->interpreter; - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_self)) { vPC[4].u.structure->deref(); return; } - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_proto)) { vPC[4].u.structure->deref(); vPC[5].u.structure->deref(); return; } - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain)) { vPC[4].u.structure->deref(); vPC[5].u.structureChain->deref(); return; @@ -1385,7 +1405,9 @@ void CodeBlock::derefStructures(Instruction* vPC) const return; } if ((vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto_list)) - || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self_list))) { + || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self_list)) + || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_proto_list)) + || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_self_list))) { PolymorphicAccessStructureList* polymorphicStructures = vPC[4].u.polymorphicStructures; polymorphicStructures->derefStructures(vPC[5].u.operand); delete polymorphicStructures; @@ -1400,16 +1422,16 @@ void CodeBlock::refStructures(Instruction* vPC) const { Interpreter* interpreter = m_globalData->interpreter; - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_self)) { vPC[4].u.structure->ref(); return; } - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_proto)) { vPC[4].u.structure->ref(); vPC[5].u.structure->ref(); return; } - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain)) { vPC[4].u.structure->ref(); vPC[5].u.structureChain->ref(); return; diff --git a/JavaScriptCore/bytecode/CodeBlock.h b/JavaScriptCore/bytecode/CodeBlock.h index eb874cc..d92dc9d 100644 --- a/JavaScriptCore/bytecode/CodeBlock.h +++ b/JavaScriptCore/bytecode/CodeBlock.h @@ -36,7 +36,6 @@ #include "JSGlobalObject.h" #include "JumpTable.h" #include "Nodes.h" -#include "PtrAndFlags.h" #include "RegExp.h" #include "UString.h" #include <wtf/FastAllocBase.h> @@ -110,44 +109,54 @@ namespace JSC { CodeLocationNearCall callReturnLocation; CodeLocationDataLabelPtr hotPathBegin; CodeLocationNearCall hotPathOther; - PtrAndFlags<CodeBlock, HasSeenShouldRepatch> ownerCodeBlock; + CodeBlock* ownerCodeBlock; CodeBlock* callee; - unsigned position; + unsigned position : 31; + unsigned hasSeenShouldRepatch : 1; void setUnlinked() { callee = 0; } bool isLinked() { return callee; } bool seenOnce() { - return ownerCodeBlock.isFlagSet(hasSeenShouldRepatch); + return hasSeenShouldRepatch; } void setSeen() { - ownerCodeBlock.setFlag(hasSeenShouldRepatch); + hasSeenShouldRepatch = true; } }; struct MethodCallLinkInfo { MethodCallLinkInfo() : cachedStructure(0) + , cachedPrototypeStructure(0) { } bool seenOnce() { - return cachedPrototypeStructure.isFlagSet(hasSeenShouldRepatch); + ASSERT(!cachedStructure); + return cachedPrototypeStructure; } void setSeen() { - cachedPrototypeStructure.setFlag(hasSeenShouldRepatch); + ASSERT(!cachedStructure && !cachedPrototypeStructure); + // We use the values of cachedStructure & cachedPrototypeStructure to indicate the + // current state. + // - In the initial state, both are null. + // - Once this transition has been taken once, cachedStructure is + // null and cachedPrototypeStructure is set to a nun-null value. + // - Once the call is linked both structures are set to non-null values. + cachedPrototypeStructure = (Structure*)1; } CodeLocationCall callReturnLocation; CodeLocationDataLabelPtr structureLabel; Structure* cachedStructure; - PtrAndFlags<Structure, HasSeenShouldRepatch> cachedPrototypeStructure; + Structure* cachedPrototypeStructure; }; struct FunctionRegisterInfo { diff --git a/JavaScriptCore/bytecode/EvalCodeCache.h b/JavaScriptCore/bytecode/EvalCodeCache.h index 05834fc..a036dd4 100644 --- a/JavaScriptCore/bytecode/EvalCodeCache.h +++ b/JavaScriptCore/bytecode/EvalCodeCache.h @@ -65,7 +65,7 @@ namespace JSC { bool isEmpty() const { return m_cacheMap.isEmpty(); } private: - static const int maxCacheableSourceLength = 256; + static const unsigned maxCacheableSourceLength = 256; static const int maxCacheEntries = 64; typedef HashMap<RefPtr<UString::Rep>, RefPtr<EvalExecutable> > EvalCacheMap; diff --git a/JavaScriptCore/bytecode/Opcode.h b/JavaScriptCore/bytecode/Opcode.h index d9b2153..56555f3 100644 --- a/JavaScriptCore/bytecode/Opcode.h +++ b/JavaScriptCore/bytecode/Opcode.h @@ -104,6 +104,11 @@ namespace JSC { macro(op_get_by_id_proto, 8) \ macro(op_get_by_id_proto_list, 8) \ macro(op_get_by_id_chain, 8) \ + macro(op_get_by_id_getter_self, 8) \ + macro(op_get_by_id_getter_self_list, 8) \ + macro(op_get_by_id_getter_proto, 8) \ + macro(op_get_by_id_getter_proto_list, 8) \ + macro(op_get_by_id_getter_chain, 8) \ macro(op_get_by_id_generic, 8) \ macro(op_get_array_length, 8) \ macro(op_get_string_length, 8) \ |