diff options
Diffstat (limited to 'JavaScriptCore/bytecompiler')
-rw-r--r-- | JavaScriptCore/bytecompiler/BytecodeGenerator.cpp | 14 | ||||
-rw-r--r-- | JavaScriptCore/bytecompiler/BytecodeGenerator.h | 3 |
2 files changed, 13 insertions, 4 deletions
diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index a3fa937..34011c1 100644 --- a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -216,6 +216,9 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d , m_globalConstantIndex(0) , m_globalData(&scopeChain.globalObject()->globalExec()->globalData()) , m_lastOpcodeID(op_end) +#ifndef NDEBUG + , m_lastOpcodePosition(0) +#endif , m_emitNodeDepth(0) , m_usesExceptions(false) , m_regeneratingForExceptionInfo(false) @@ -588,6 +591,11 @@ PassRefPtr<Label> BytecodeGenerator::emitLabel(Label* l0) void BytecodeGenerator::emitOpcode(OpcodeID opcodeID) { +#ifndef NDEBUG + size_t opcodePosition = instructions().size(); + ASSERT(opcodePosition - m_lastOpcodePosition == opcodeLength(m_lastOpcodeID) || m_lastOpcodeID == op_end); + m_lastOpcodePosition = opcodePosition; +#endif instructions().append(globalData()->interpreter->getOpcode(opcodeID)); m_lastOpcodeID = opcodeID; } @@ -613,12 +621,14 @@ void ALWAYS_INLINE BytecodeGenerator::rewindBinaryOp() { ASSERT(instructions().size() >= 4); instructions().shrink(instructions().size() - 4); + m_lastOpcodeID = op_end; } void ALWAYS_INLINE BytecodeGenerator::rewindUnaryOp() { ASSERT(instructions().size() >= 3); instructions().shrink(instructions().size() - 3); + m_lastOpcodeID = op_end; } PassRefPtr<Label> BytecodeGenerator::emitJump(Label* target) @@ -1106,7 +1116,6 @@ RegisterID* BytecodeGenerator::emitResolve(RegisterID* dst, const Identifier& pr #endif emitOpcode(requiresDynamicChecks ? op_resolve_global_dynamic : op_resolve_global); instructions().append(dst->index()); - instructions().append(globalObject); instructions().append(addConstant(property)); instructions().append(0); instructions().append(0); @@ -1142,7 +1151,6 @@ RegisterID* BytecodeGenerator::emitGetScopedVar(RegisterID* dst, size_t depth, i if (globalObject) { emitOpcode(op_get_global_var); instructions().append(dst->index()); - instructions().append(asCell(globalObject)); instructions().append(index); return dst; } @@ -1158,7 +1166,6 @@ RegisterID* BytecodeGenerator::emitPutScopedVar(size_t depth, int index, Registe { if (globalObject) { emitOpcode(op_put_global_var); - instructions().append(asCell(globalObject)); instructions().append(index); instructions().append(value->index()); return value; @@ -1229,7 +1236,6 @@ RegisterID* BytecodeGenerator::emitResolveWithBase(RegisterID* baseDst, Register #endif emitOpcode(requiresDynamicChecks ? op_resolve_global_dynamic : op_resolve_global); instructions().append(propDst->index()); - instructions().append(globalObject); instructions().append(addConstant(property)); instructions().append(0); instructions().append(0); diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/JavaScriptCore/bytecompiler/BytecodeGenerator.h index ad0ae4e..f855d12 100644 --- a/JavaScriptCore/bytecompiler/BytecodeGenerator.h +++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.h @@ -560,6 +560,9 @@ namespace JSC { JSGlobalData* m_globalData; OpcodeID m_lastOpcodeID; +#ifndef NDEBUG + size_t m_lastOpcodePosition; +#endif unsigned m_emitNodeDepth; |