Commit 47d3f059 authored by ggaren@apple.com's avatar ggaren@apple.com

2008-11-15 Geoffrey Garen <ggaren@apple.com>

        Suggested by Maciej Stachowiak.
        
        Reverted most "opcode" => "bytecode" renames. We use "bytecode" as a
        mass noun to refer to a stream of instructions. Each instruction may be
        an opcode or an operand.

        * VM/CTI.cpp:
        (JSC::CTI::emitCTICall):
        (JSC::CTI::compileOpCall):
        (JSC::CTI::compileBinaryArithOp):
        (JSC::CTI::compileBinaryArithOpSlowCase):
        (JSC::CTI::privateCompileMainPass):
        (JSC::CTI::privateCompileSlowCases):
        (JSC::CTI::privateCompile):
        * VM/CTI.h:
        * VM/CodeBlock.cpp:
        (JSC::CodeBlock::printStructureIDs):
        (JSC::CodeBlock::dump):
        (JSC::CodeBlock::derefStructureIDs):
        (JSC::CodeBlock::refStructureIDs):
        * VM/CodeBlock.h:
        * VM/ExceptionHelpers.cpp:
        (JSC::createNotAnObjectError):
        * VM/Instruction.h:
        (JSC::Instruction::Instruction):
        (JSC::Instruction::):
        * VM/Machine.cpp:
        (JSC::BytecodeInterpreter::isOpcode):
        (JSC::BytecodeInterpreter::throwException):
        (JSC::BytecodeInterpreter::tryCachePutByID):
        (JSC::BytecodeInterpreter::uncachePutByID):
        (JSC::BytecodeInterpreter::tryCacheGetByID):
        (JSC::BytecodeInterpreter::uncacheGetByID):
        (JSC::BytecodeInterpreter::privateExecute):
        (JSC::BytecodeInterpreter::tryCTICachePutByID):
        (JSC::BytecodeInterpreter::tryCTICacheGetByID):
        * VM/Machine.h:
        (JSC::BytecodeInterpreter::getOpcode):
        (JSC::BytecodeInterpreter::getOpcodeID):
        (JSC::BytecodeInterpreter::isCallBytecode):
        * VM/Opcode.cpp:
        (JSC::):
        (JSC::OpcodeStats::OpcodeStats):
        (JSC::compareOpcodeIndices):
        (JSC::compareOpcodePairIndices):
        (JSC::OpcodeStats::~OpcodeStats):
        (JSC::OpcodeStats::recordInstruction):
        (JSC::OpcodeStats::resetLastInstruction):
        * VM/Opcode.h:
        (JSC::):
        (JSC::padOpcodeName):
        * VM/SamplingTool.cpp:
        (JSC::ScopeSampleRecord::sample):
        (JSC::SamplingTool::run):
        (JSC::compareOpcodeIndicesSampling):
        (JSC::SamplingTool::dump):
        * VM/SamplingTool.h:
        (JSC::ScopeSampleRecord::ScopeSampleRecord):
        (JSC::SamplingTool::SamplingTool):
        * bytecompiler/CodeGenerator.cpp:
        (JSC::BytecodeGenerator::BytecodeGenerator):
        (JSC::BytecodeGenerator::emitLabel):
        (JSC::BytecodeGenerator::emitOpcode):
        (JSC::BytecodeGenerator::emitJump):
        (JSC::BytecodeGenerator::emitJumpIfTrue):
        (JSC::BytecodeGenerator::emitJumpIfFalse):
        (JSC::BytecodeGenerator::emitMove):
        (JSC::BytecodeGenerator::emitUnaryOp):
        (JSC::BytecodeGenerator::emitPreInc):
        (JSC::BytecodeGenerator::emitPreDec):
        (JSC::BytecodeGenerator::emitPostInc):
        (JSC::BytecodeGenerator::emitPostDec):
        (JSC::BytecodeGenerator::emitBinaryOp):
        (JSC::BytecodeGenerator::emitEqualityOp):
        (JSC::BytecodeGenerator::emitUnexpectedLoad):
        (JSC::BytecodeGenerator::emitInstanceOf):
        (JSC::BytecodeGenerator::emitResolve):
        (JSC::BytecodeGenerator::emitGetScopedVar):
        (JSC::BytecodeGenerator::emitPutScopedVar):
        (JSC::BytecodeGenerator::emitResolveBase):
        (JSC::BytecodeGenerator::emitResolveWithBase):
        (JSC::BytecodeGenerator::emitResolveFunction):
        (JSC::BytecodeGenerator::emitGetById):
        (JSC::BytecodeGenerator::emitPutById):
        (JSC::BytecodeGenerator::emitPutGetter):
        (JSC::BytecodeGenerator::emitPutSetter):
        (JSC::BytecodeGenerator::emitDeleteById):
        (JSC::BytecodeGenerator::emitGetByVal):
        (JSC::BytecodeGenerator::emitPutByVal):
        (JSC::BytecodeGenerator::emitDeleteByVal):
        (JSC::BytecodeGenerator::emitPutByIndex):
        (JSC::BytecodeGenerator::emitNewObject):
        (JSC::BytecodeGenerator::emitNewArray):
        (JSC::BytecodeGenerator::emitNewFunction):
        (JSC::BytecodeGenerator::emitNewRegExp):
        (JSC::BytecodeGenerator::emitNewFunctionExpression):
        (JSC::BytecodeGenerator::emitCall):
        (JSC::BytecodeGenerator::emitReturn):
        (JSC::BytecodeGenerator::emitUnaryNoDstOp):
        (JSC::BytecodeGenerator::emitConstruct):
        (JSC::BytecodeGenerator::emitPopScope):
        (JSC::BytecodeGenerator::emitDebugHook):
        (JSC::BytecodeGenerator::emitComplexJumpScopes):
        (JSC::BytecodeGenerator::emitJumpScopes):
        (JSC::BytecodeGenerator::emitNextPropertyName):
        (JSC::BytecodeGenerator::emitCatch):
        (JSC::BytecodeGenerator::emitNewError):
        (JSC::BytecodeGenerator::emitJumpSubroutine):
        (JSC::BytecodeGenerator::emitSubroutineReturn):
        (JSC::BytecodeGenerator::emitPushNewScope):
        (JSC::BytecodeGenerator::beginSwitch):
        * bytecompiler/CodeGenerator.h:
        * jsc.cpp:
        (runWithScripts):
        * masm/X86Assembler.h:
        (JSC::X86Assembler::):
        (JSC::X86Assembler::emitModRm_opr):
        (JSC::X86Assembler::emitModRm_opr_Unchecked):
        (JSC::X86Assembler::emitModRm_opm):
        (JSC::X86Assembler::emitModRm_opm_Unchecked):
        (JSC::X86Assembler::emitModRm_opmsib):
        * parser/Nodes.cpp:
        (JSC::UnaryOpNode::emitBytecode):
        (JSC::BinaryOpNode::emitBytecode):
        (JSC::ReverseBinaryOpNode::emitBytecode):
        (JSC::ThrowableBinaryOpNode::emitBytecode):
        (JSC::emitReadModifyAssignment):
        (JSC::ScopeNode::ScopeNode):
        * parser/Nodes.h:
        (JSC::UnaryPlusNode::):
        (JSC::NegateNode::):
        (JSC::BitwiseNotNode::):
        (JSC::LogicalNotNode::):
        (JSC::MultNode::):
        (JSC::DivNode::):
        (JSC::ModNode::):
        (JSC::AddNode::):
        (JSC::SubNode::):
        (JSC::LeftShiftNode::):
        (JSC::RightShiftNode::):
        (JSC::UnsignedRightShiftNode::):
        (JSC::LessNode::):
        (JSC::GreaterNode::):
        (JSC::LessEqNode::):
        (JSC::GreaterEqNode::):
        (JSC::InstanceOfNode::):
        (JSC::InNode::):
        (JSC::EqualNode::):
        (JSC::NotEqualNode::):
        (JSC::StrictEqualNode::):
        (JSC::NotStrictEqualNode::):
        (JSC::BitAndNode::):
        (JSC::BitOrNode::):
        (JSC::BitXOrNode::):
        * runtime/StructureID.cpp:
        (JSC::StructureID::fromDictionaryTransition):
        * wtf/Platform.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38428 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8e06f208
2008-11-15 Geoffrey Garen <ggaren@apple.com>
Suggested by Maciej Stachowiak.
Reverted most "opcode" => "bytecode" renames. We use "bytecode" as a
mass noun to refer to a stream of instructions. Each instruction may be
an opcode or an operand.
* VM/CTI.cpp:
(JSC::CTI::emitCTICall):
(JSC::CTI::compileOpCall):
(JSC::CTI::compileBinaryArithOp):
(JSC::CTI::compileBinaryArithOpSlowCase):
(JSC::CTI::privateCompileMainPass):
(JSC::CTI::privateCompileSlowCases):
(JSC::CTI::privateCompile):
* VM/CTI.h:
* VM/CodeBlock.cpp:
(JSC::CodeBlock::printStructureIDs):
(JSC::CodeBlock::dump):
(JSC::CodeBlock::derefStructureIDs):
(JSC::CodeBlock::refStructureIDs):
* VM/CodeBlock.h:
* VM/ExceptionHelpers.cpp:
(JSC::createNotAnObjectError):
* VM/Instruction.h:
(JSC::Instruction::Instruction):
(JSC::Instruction::):
* VM/Machine.cpp:
(JSC::BytecodeInterpreter::isOpcode):
(JSC::BytecodeInterpreter::throwException):
(JSC::BytecodeInterpreter::tryCachePutByID):
(JSC::BytecodeInterpreter::uncachePutByID):
(JSC::BytecodeInterpreter::tryCacheGetByID):
(JSC::BytecodeInterpreter::uncacheGetByID):
(JSC::BytecodeInterpreter::privateExecute):
(JSC::BytecodeInterpreter::tryCTICachePutByID):
(JSC::BytecodeInterpreter::tryCTICacheGetByID):
* VM/Machine.h:
(JSC::BytecodeInterpreter::getOpcode):
(JSC::BytecodeInterpreter::getOpcodeID):
(JSC::BytecodeInterpreter::isCallBytecode):
* VM/Opcode.cpp:
(JSC::):
(JSC::OpcodeStats::OpcodeStats):
(JSC::compareOpcodeIndices):
(JSC::compareOpcodePairIndices):
(JSC::OpcodeStats::~OpcodeStats):
(JSC::OpcodeStats::recordInstruction):
(JSC::OpcodeStats::resetLastInstruction):
* VM/Opcode.h:
(JSC::):
(JSC::padOpcodeName):
* VM/SamplingTool.cpp:
(JSC::ScopeSampleRecord::sample):
(JSC::SamplingTool::run):
(JSC::compareOpcodeIndicesSampling):
(JSC::SamplingTool::dump):
* VM/SamplingTool.h:
(JSC::ScopeSampleRecord::ScopeSampleRecord):
(JSC::SamplingTool::SamplingTool):
* bytecompiler/CodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitLabel):
(JSC::BytecodeGenerator::emitOpcode):
(JSC::BytecodeGenerator::emitJump):
(JSC::BytecodeGenerator::emitJumpIfTrue):
(JSC::BytecodeGenerator::emitJumpIfFalse):
(JSC::BytecodeGenerator::emitMove):
(JSC::BytecodeGenerator::emitUnaryOp):
(JSC::BytecodeGenerator::emitPreInc):
(JSC::BytecodeGenerator::emitPreDec):
(JSC::BytecodeGenerator::emitPostInc):
(JSC::BytecodeGenerator::emitPostDec):
(JSC::BytecodeGenerator::emitBinaryOp):
(JSC::BytecodeGenerator::emitEqualityOp):
(JSC::BytecodeGenerator::emitUnexpectedLoad):
(JSC::BytecodeGenerator::emitInstanceOf):
(JSC::BytecodeGenerator::emitResolve):
(JSC::BytecodeGenerator::emitGetScopedVar):
(JSC::BytecodeGenerator::emitPutScopedVar):
(JSC::BytecodeGenerator::emitResolveBase):
(JSC::BytecodeGenerator::emitResolveWithBase):
(JSC::BytecodeGenerator::emitResolveFunction):
(JSC::BytecodeGenerator::emitGetById):
(JSC::BytecodeGenerator::emitPutById):
(JSC::BytecodeGenerator::emitPutGetter):
(JSC::BytecodeGenerator::emitPutSetter):
(JSC::BytecodeGenerator::emitDeleteById):
(JSC::BytecodeGenerator::emitGetByVal):
(JSC::BytecodeGenerator::emitPutByVal):
(JSC::BytecodeGenerator::emitDeleteByVal):
(JSC::BytecodeGenerator::emitPutByIndex):
(JSC::BytecodeGenerator::emitNewObject):
(JSC::BytecodeGenerator::emitNewArray):
(JSC::BytecodeGenerator::emitNewFunction):
(JSC::BytecodeGenerator::emitNewRegExp):
(JSC::BytecodeGenerator::emitNewFunctionExpression):
(JSC::BytecodeGenerator::emitCall):
(JSC::BytecodeGenerator::emitReturn):
(JSC::BytecodeGenerator::emitUnaryNoDstOp):
(JSC::BytecodeGenerator::emitConstruct):
(JSC::BytecodeGenerator::emitPopScope):
(JSC::BytecodeGenerator::emitDebugHook):
(JSC::BytecodeGenerator::emitComplexJumpScopes):
(JSC::BytecodeGenerator::emitJumpScopes):
(JSC::BytecodeGenerator::emitNextPropertyName):
(JSC::BytecodeGenerator::emitCatch):
(JSC::BytecodeGenerator::emitNewError):
(JSC::BytecodeGenerator::emitJumpSubroutine):
(JSC::BytecodeGenerator::emitSubroutineReturn):
(JSC::BytecodeGenerator::emitPushNewScope):
(JSC::BytecodeGenerator::beginSwitch):
* bytecompiler/CodeGenerator.h:
* jsc.cpp:
(runWithScripts):
* masm/X86Assembler.h:
(JSC::X86Assembler::):
(JSC::X86Assembler::emitModRm_opr):
(JSC::X86Assembler::emitModRm_opr_Unchecked):
(JSC::X86Assembler::emitModRm_opm):
(JSC::X86Assembler::emitModRm_opm_Unchecked):
(JSC::X86Assembler::emitModRm_opmsib):
* parser/Nodes.cpp:
(JSC::UnaryOpNode::emitBytecode):
(JSC::BinaryOpNode::emitBytecode):
(JSC::ReverseBinaryOpNode::emitBytecode):
(JSC::ThrowableBinaryOpNode::emitBytecode):
(JSC::emitReadModifyAssignment):
(JSC::ScopeNode::ScopeNode):
* parser/Nodes.h:
(JSC::UnaryPlusNode::):
(JSC::NegateNode::):
(JSC::BitwiseNotNode::):
(JSC::LogicalNotNode::):
(JSC::MultNode::):
(JSC::DivNode::):
(JSC::ModNode::):
(JSC::AddNode::):
(JSC::SubNode::):
(JSC::LeftShiftNode::):
(JSC::RightShiftNode::):
(JSC::UnsignedRightShiftNode::):
(JSC::LessNode::):
(JSC::GreaterNode::):
(JSC::LessEqNode::):
(JSC::GreaterEqNode::):
(JSC::InstanceOfNode::):
(JSC::InNode::):
(JSC::EqualNode::):
(JSC::NotEqualNode::):
(JSC::StrictEqualNode::):
(JSC::NotStrictEqualNode::):
(JSC::BitAndNode::):
(JSC::BitOrNode::):
(JSC::BitXOrNode::):
* runtime/StructureID.cpp:
(JSC::StructureID::fromDictionaryTransition):
* wtf/Platform.h:
2008-11-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
......
This diff is collapsed.
......@@ -275,7 +275,7 @@ namespace JSC {
static const int repatchOffsetGetByIdStructureID = 7;
static const int repatchOffsetGetByIdBranchToSlowCase = 13;
static const int repatchOffsetGetByIdPropertyMapOffset = 22;
#if ENABLE(BYTECODE_SAMPLING)
#if ENABLE(OPCODE_SAMPLING)
static const int repatchOffsetGetByIdSlowCaseCall = 27 + 4 + ctiArgumentInitSize;
#else
static const int repatchOffsetGetByIdSlowCaseCall = 17 + 4 + ctiArgumentInitSize;
......@@ -363,7 +363,7 @@ namespace JSC {
void privateCompileCTIMachineTrampolines();
void privateCompilePatchGetArrayLength(void* returnAddress);
void compileOpCall(BytecodeID, Instruction* instruction, unsigned i, unsigned callLinkInfoIndex);
void compileOpCall(OpcodeID, Instruction* instruction, unsigned i, unsigned callLinkInfoIndex);
void compileOpCallInitializeCallFrame();
void compileOpCallSetupArgs(Instruction*);
void compileOpCallEvalSetupArgs(Instruction*);
......@@ -371,8 +371,8 @@ namespace JSC {
enum CompileOpStrictEqType { OpStrictEq, OpNStrictEq };
void compileOpStrictEq(Instruction* instruction, unsigned i, CompileOpStrictEqType type);
void putDoubleResultToJSNumberCellOrJSImmediate(X86::XMMRegisterID xmmSource, X86::RegisterID jsNumberCell, unsigned dst, X86Assembler::JmpSrc* wroteJSNumberCell, X86::XMMRegisterID tempXmm, X86::RegisterID tempReg1, X86::RegisterID tempReg2);
void compileBinaryArithOp(BytecodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi, unsigned i);
void compileBinaryArithOpSlowCase(Instruction*, BytecodeID, Vector<SlowCaseEntry>::iterator& iter, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi, unsigned i);
void compileBinaryArithOp(OpcodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi, unsigned i);
void compileBinaryArithOpSlowCase(Instruction*, OpcodeID, Vector<SlowCaseEntry>::iterator& iter, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi, unsigned i);
void emitGetVirtualRegister(int src, X86Assembler::RegisterID dst, unsigned i);
void emitGetVirtualRegisters(int src1, X86Assembler::RegisterID dst1, int src2, X86Assembler::RegisterID dst2, unsigned i);
......
......@@ -39,7 +39,7 @@
namespace JSC {
#if !defined(NDEBUG) || ENABLE(BYTECODE_SAMPLING)
#if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING)
static UString escapeQuotes(const UString& str)
{
......@@ -184,41 +184,41 @@ void CodeBlock::printStructureIDs(const Instruction* vPC) const
BytecodeInterpreter* interpreter = globalData->interpreter;
unsigned instructionOffset = vPC - instructions.begin();
if (vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id)) {
printStructureID("get_by_id", vPC, 4);
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id_self)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) {
printStructureID("get_by_id_self", vPC, 4);
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id_proto)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) {
printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_proto", pointerToSourceString(vPC[4].u.structureID).UTF8String().c_str(), pointerToSourceString(vPC[5].u.structureID).UTF8String().c_str());
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_put_by_id_transition)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) {
printf(" [%4d] %s: %s, %s, %s\n", instructionOffset, "put_by_id_new", pointerToSourceString(vPC[4].u.structureID).UTF8String().c_str(), pointerToSourceString(vPC[5].u.structureID).UTF8String().c_str(), pointerToSourceString(vPC[6].u.structureIDChain).UTF8String().c_str());
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id_chain)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) {
printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_chain", pointerToSourceString(vPC[4].u.structureID).UTF8String().c_str(), pointerToSourceString(vPC[5].u.structureIDChain).UTF8String().c_str());
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_put_by_id)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id)) {
printStructureID("put_by_id", vPC, 4);
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_put_by_id_replace)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_replace)) {
printStructureID("put_by_id_replace", vPC, 4);
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_resolve_global)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_resolve_global)) {
printStructureID("resolve_global", vPC, 4);
return;
}
// These instructions doesn't ref StructureIDs.
ASSERT(vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id_generic) || vPC[0].u.bytecode == interpreter->getBytecode(op_put_by_id_generic) || vPC[0].u.bytecode == interpreter->getBytecode(op_call) || vPC[0].u.bytecode == interpreter->getBytecode(op_call_eval) || vPC[0].u.bytecode == interpreter->getBytecode(op_construct));
ASSERT(vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_call) || vPC[0].u.opcode == interpreter->getOpcode(op_call_eval) || vPC[0].u.opcode == interpreter->getOpcode(op_construct));
}
void CodeBlock::dump(ExecState* exec) const
......@@ -228,7 +228,7 @@ void CodeBlock::dump(ExecState* exec) const
size_t instructionCount = 0;
for (Vector<Instruction>::const_iterator it = begin; it != end; ++it)
if (exec->interpreter()->isBytecode(it->u.bytecode))
if (exec->interpreter()->isOpcode(it->u.opcode))
++instructionCount;
printf("%lu instructions; %lu bytes at %p; %d parameter(s); %d callee register(s)\n\n",
......@@ -359,7 +359,7 @@ void CodeBlock::dump(ExecState* exec) const
void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator& it) const
{
int location = it - begin;
switch (exec->interpreter()->getBytecodeID(it->u.bytecode)) {
switch (exec->interpreter()->getOpcodeID(it->u.opcode)) {
case op_enter: {
printf("[%4d] enter\n", location);
break;
......@@ -945,7 +945,7 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
}
}
#endif // !defined(NDEBUG) || ENABLE(BYTECODE_SAMPLING)
#endif // !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING)
CodeBlock::~CodeBlock()
{
......@@ -990,71 +990,71 @@ void CodeBlock::derefStructureIDs(Instruction* vPC) const
{
BytecodeInterpreter* interpreter = globalData->interpreter;
if (vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id_self)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) {
vPC[4].u.structureID->deref();
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id_proto)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) {
vPC[4].u.structureID->deref();
vPC[5].u.structureID->deref();
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id_chain)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) {
vPC[4].u.structureID->deref();
vPC[5].u.structureIDChain->deref();
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_put_by_id_transition)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) {
vPC[4].u.structureID->deref();
vPC[5].u.structureID->deref();
vPC[6].u.structureIDChain->deref();
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_put_by_id_replace)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_replace)) {
vPC[4].u.structureID->deref();
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_resolve_global)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_resolve_global)) {
if(vPC[4].u.structureID)
vPC[4].u.structureID->deref();
return;
}
// These instructions don't ref their StructureIDs.
ASSERT(vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id) || vPC[0].u.bytecode == interpreter->getBytecode(op_put_by_id) || vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id_generic) || vPC[0].u.bytecode == interpreter->getBytecode(op_put_by_id_generic) || vPC[0].u.bytecode == interpreter->getBytecode(op_get_array_length) || vPC[0].u.bytecode == interpreter->getBytecode(op_get_string_length));
ASSERT(vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_get_array_length) || vPC[0].u.opcode == interpreter->getOpcode(op_get_string_length));
}
void CodeBlock::refStructureIDs(Instruction* vPC) const
{
BytecodeInterpreter* interpreter = globalData->interpreter;
if (vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id_self)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) {
vPC[4].u.structureID->ref();
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id_proto)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) {
vPC[4].u.structureID->ref();
vPC[5].u.structureID->ref();
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id_chain)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) {
vPC[4].u.structureID->ref();
vPC[5].u.structureIDChain->ref();
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_put_by_id_transition)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) {
vPC[4].u.structureID->ref();
vPC[5].u.structureID->ref();
vPC[6].u.structureIDChain->ref();
return;
}
if (vPC[0].u.bytecode == interpreter->getBytecode(op_put_by_id_replace)) {
if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_replace)) {
vPC[4].u.structureID->ref();
return;
}
// These instructions don't ref their StructureIDs.
ASSERT(vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id) || vPC[0].u.bytecode == interpreter->getBytecode(op_put_by_id) || vPC[0].u.bytecode == interpreter->getBytecode(op_get_by_id_generic) || vPC[0].u.bytecode == interpreter->getBytecode(op_put_by_id_generic));
ASSERT(vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_generic));
}
void CodeBlock::mark()
......
......@@ -286,7 +286,7 @@ namespace JSC {
return index >= numVars + numConstants;
}
#if !defined(NDEBUG) || ENABLE_BYTECODE_SAMPLING
#if !defined(NDEBUG) || ENABLE_OPCODE_SAMPLING
void dump(ExecState*) const;
void printStructureIDs(const Instruction*) const;
void printStructureID(const char* name, const Instruction*, int operand) const;
......@@ -364,7 +364,7 @@ namespace JSC {
SymbolTable symbolTable;
private:
#if !defined(NDEBUG) || ENABLE(BYTECODE_SAMPLING)
#if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING)
void dump(ExecState*, const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator&) const;
#endif
......
......@@ -208,9 +208,9 @@ JSNotAnObjectErrorStub* createNotAnObjectErrorStub(ExecState* exec, bool isNull)
JSObject* createNotAnObjectError(ExecState* exec, JSNotAnObjectErrorStub* error, const Instruction* vPC, CodeBlock* codeBlock)
{
if (vPC[8].u.bytecode == exec->interpreter()->getBytecode(op_instanceof))
if (vPC[8].u.opcode == exec->interpreter()->getOpcode(op_instanceof))
return createInvalidParamError(exec, "instanceof", error->isNull() ? jsNull() : jsUndefined(), vPC, codeBlock);
if (vPC[8].u.bytecode == exec->interpreter()->getBytecode(op_construct))
if (vPC[8].u.opcode == exec->interpreter()->getOpcode(op_construct))
return createNotAConstructorError(exec, error->isNull() ? jsNull() : jsUndefined(), vPC, codeBlock);
int startOffset = 0;
......
......@@ -40,7 +40,7 @@ namespace JSC {
class StructureIDChain;
struct Instruction {
Instruction(Bytecode bytecode) { u.bytecode = bytecode; }
Instruction(Opcode opcode) { u.opcode = opcode; }
Instruction(int operand)
{
// We have to initialize one of the pointer members to ensure that
......@@ -54,7 +54,7 @@ namespace JSC {
Instruction(JSCell* jsCell) { u.jsCell = jsCell; }
union {
Bytecode bytecode;
Opcode opcode;
int operand;
StructureID* structureID;
StructureIDChain* structureIDChain;
......
This diff is collapsed.
......@@ -111,26 +111,26 @@ namespace JSC {
RegisterFile& registerFile() { return m_registerFile; }
Bytecode getBytecode(BytecodeID id)
Opcode getOpcode(OpcodeID id)
{
#if HAVE(COMPUTED_GOTO)
return m_bytecodeTable[id];
return m_opcodeTable[id];
#else
return id;
#endif
}
BytecodeID getBytecodeID(Bytecode bytecode)
OpcodeID getOpcodeID(Opcode opcode)
{
#if HAVE(COMPUTED_GOTO)
ASSERT(isBytecode(bytecode));
return m_bytecodeIDTable.get(bytecode);
ASSERT(isOpcode(opcode));
return m_opcodeIDTable.get(opcode);
#else
return bytecode;
return opcode;
#endif
}
bool isBytecode(Bytecode bytecode);
bool isOpcode(Opcode);
JSValue* execute(ProgramNode*, CallFrame*, ScopeChainNode*, JSObject* thisObj, JSValue** exception);
JSValue* execute(FunctionBodyNode*, CallFrame*, JSFunction*, JSObject* thisObj, const ArgList& args, ScopeChainNode*, JSValue** exception);
......@@ -318,7 +318,7 @@ namespace JSC {
void tryCachePutByID(CallFrame*, CodeBlock*, Instruction*, JSValue* baseValue, const PutPropertySlot&);
void uncachePutByID(CodeBlock*, Instruction* vPC);
bool isCallBytecode(Bytecode bytecode) { return bytecode == getBytecode(op_call) || bytecode == getBytecode(op_construct) || bytecode == getBytecode(op_call_eval); }
bool isCallBytecode(Opcode opcode) { return opcode == getOpcode(op_call) || opcode == getOpcode(op_construct) || opcode == getOpcode(op_call_eval); }
#if ENABLE(CTI)
static void throwStackOverflowPreviousFrame(CallFrame**, JSGlobalData*, void*& returnAddress);
......@@ -355,8 +355,8 @@ namespace JSC {
void* m_jsFunctionVptr;
#if HAVE(COMPUTED_GOTO)
Bytecode m_bytecodeTable[numBytecodeIDs]; // Maps BytecodeID => Bytecode for compiling
HashMap<Bytecode, BytecodeID> m_bytecodeIDTable; // Maps Bytecode => BytecodeID for decompiling
Opcode m_opcodeTable[numOpcodeIDs]; // Maps OpcodeID => Opcode for compiling
HashMap<Opcode, OpcodeID> m_opcodeIDTable; // Maps Opcode => OpcodeID for decompiling
#endif
};
......
......@@ -34,38 +34,38 @@ using namespace std;
namespace JSC {
#if ENABLE(BYTECODE_SAMPLING) || ENABLE(CODEBLOCK_SAMPLING) || ENABLE(BYTECODE_STATS)
#if ENABLE(OPCODE_SAMPLING) || ENABLE(CODEBLOCK_SAMPLING) || ENABLE(OPCODE_STATS)
const char* const bytecodeNames[] = {
#define BYTECODE_NAME_ENTRY(bytecode) #bytecode,
FOR_EACH_BYTECODE_ID(BYTECODE_NAME_ENTRY)
#undef BYTECODE_NAME_ENTRY
const char* const opcodeNames[] = {
#define OPCODE_NAME_ENTRY(opcode) #opcode,
FOR_EACH_OPCODE_ID(OPCODE_NAME_ENTRY)
#undef OPCODE_NAME_ENTRY
};
#endif
#if ENABLE(BYTECODE_STATS)
#if ENABLE(OPCODE_STATS)
long long BytecodeStats::bytecodeCounts[numBytecodeIDs];
long long BytecodeStats::bytecodePairCounts[numBytecodeIDs][numBytecodeIDs];
int BytecodeStats::lastBytecode = -1;
long long OpcodeStats::opcodeCounts[numOpcodeIDs];
long long OpcodeStats::opcodePairCounts[numOpcodeIDs][numOpcodeIDs];
int OpcodeStats::lastOpcode = -1;
static BytecodeStats logger;
static OpcodeStats logger;
BytecodeStats::BytecodeStats()
OpcodeStats::OpcodeStats()
{
for (int i = 0; i < numBytecodeIDs; ++i)
bytecodeCounts[i] = 0;
for (int i = 0; i < numOpcodeIDs; ++i)
opcodeCounts[i] = 0;
for (int i = 0; i < numBytecodeIDs; ++i)
for (int j = 0; j < numBytecodeIDs; ++j)
bytecodePairCounts[i][j] = 0;
for (int i = 0; i < numOpcodeIDs; ++i)
for (int j = 0; j < numOpcodeIDs; ++j)
opcodePairCounts[i][j] = 0;
}
static int compareBytecodeIndices(const void* left, const void* right)
static int compareOpcodeIndices(const void* left, const void* right)
{
long long leftValue = BytecodeStats::bytecodeCounts[*(int*) left];
long long rightValue = BytecodeStats::bytecodeCounts[*(int*) right];
long long leftValue = OpcodeStats::opcodeCounts[*(int*) left];
long long rightValue = OpcodeStats::opcodeCounts[*(int*) right];
if (leftValue < rightValue)
return 1;
......@@ -75,12 +75,12 @@ static int compareBytecodeIndices(const void* left, const void* right)
return 0;
}
static int compareBytecodePairIndices(const void* left, const void* right)
static int compareOpcodePairIndices(const void* left, const void* right)
{
pair<int, int> leftPair = *(pair<int, int>*) left;
long long leftValue = BytecodeStats::bytecodePairCounts[leftPair.first][leftPair.second];
long long leftValue = OpcodeStats::opcodePairCounts[leftPair.first][leftPair.second];
pair<int, int> rightPair = *(pair<int, int>*) right;
long long rightValue = BytecodeStats::bytecodePairCounts[rightPair.first][rightPair.second];
long long rightValue = OpcodeStats::opcodePairCounts[rightPair.first][rightPair.second];
if (leftValue < rightValue)
return 1;
......@@ -90,95 +90,95 @@ static int compareBytecodePairIndices(const void* left, const void* right)
return 0;
}
BytecodeStats::~BytecodeStats()
OpcodeStats::~OpcodeStats()
{
long long totalInstructions = 0;
for (int i = 0; i < numBytecodeIDs; ++i)
totalInstructions += bytecodeCounts[i];
for (int i = 0; i < numOpcodeIDs; ++i)
totalInstructions += opcodeCounts[i];
long long totalInstructionPairs = 0;
for (int i = 0; i < numBytecodeIDs; ++i)
for (int j = 0; j < numBytecodeIDs; ++j)
totalInstructionPairs += bytecodePairCounts[i][j];
for (int i = 0; i < numOpcodeIDs; ++i)
for (int j = 0; j < numOpcodeIDs; ++j)
totalInstructionPairs += opcodePairCounts[i][j];
int sortedIndices[numBytecodeIDs];
for (int i = 0; i < numBytecodeIDs; ++i)
int sortedIndices[numOpcodeIDs];
for (int i = 0; i < numOpcodeIDs; ++i)
sortedIndices[i] = i;
qsort(sortedIndices, numBytecodeIDs, sizeof(int), compareBytecodeIndices);
qsort(sortedIndices, numOpcodeIDs, sizeof(int), compareOpcodeIndices);
pair<int, int> sortedPairIndices[numBytecodeIDs * numBytecodeIDs];
pair<int, int> sortedPairIndices[numOpcodeIDs * numOpcodeIDs];
pair<int, int>* currentPairIndex = sortedPairIndices;
for (int i = 0; i < numBytecodeIDs; ++i)
for (int j = 0; j < numBytecodeIDs; ++j)
for (int i = 0; i < numOpcodeIDs; ++i)
for (int j = 0; j < numOpcodeIDs; ++j)
*(currentPairIndex++) = make_pair(i, j);
qsort(sortedPairIndices, numBytecodeIDs * numBytecodeIDs, sizeof(pair<int, int>), compareBytecodePairIndices);
qsort(sortedPairIndices, numOpcodeIDs * numOpcodeIDs, sizeof(pair<int, int>), compareOpcodePairIndices);
printf("\nExecuted bytecode statistics\n");
printf("\nExecuted opcode statistics\n");
printf("Total instructions executed: %lld\n\n", totalInstructions);
printf("All bytecodes by frequency:\n\n");
printf("All opcodes by frequency:\n\n");
for (int i = 0; i < numBytecodeIDs; ++i) {
for (int i = 0; i < numOpcodeIDs; ++i) {
int index = sortedIndices[i];
printf("%s:%s %lld - %.2f%%\n", bytecodeNames[index], padBytecodeName((BytecodeID)index, 28), bytecodeCounts[index], ((double) bytecodeCounts[index]) / ((double) totalInstructions) * 100.0);
printf("%s:%s %lld - %.2f%%\n", opcodeNames[index], padOpcodeName((OpcodeID)index, 28), opcodeCounts[index], ((double) opcodeCounts[index]) / ((double) totalInstructions) * 100.0);
}
printf("\n");
printf("2-bytecode sequences by frequency: %lld\n\n", totalInstructions);
printf("2-opcode sequences by frequency: %lld\n\n", totalInstructions);
for (int i = 0; i < numBytecodeIDs * numBytecodeIDs; ++i) {
for (int i = 0; i < numOpcodeIDs * numOpcodeIDs; ++i) {
pair<int, int> indexPair = sortedPairIndices[i];
long long count = bytecodePairCounts[indexPair.first][indexPair.second];
long long count = opcodePairCounts[indexPair.first][indexPair.second];
if (!count)
break;
printf("%s%s %s:%s %lld %.2f%%\n", bytecodeNames[indexPair.first], padBytecodeName((BytecodeID)indexPair.first, 28), bytecodeNames[indexPair.second], padBytecodeName((BytecodeID)indexPair.second, 28), count, ((double) count) / ((double) totalInstructionPairs) * 100.0);
printf("%s%s %s:%s %lld %.2f%%\n", opcodeNames[indexPair.first], padOpcodeName((OpcodeID)indexPair.first, 28), opcodeNames[indexPair.second], padOpcodeName((OpcodeID)indexPair.second, 28), count, ((double) count) / ((double) totalInstructionPairs) * 100.0);
}
printf("\n");
printf("Most common bytecodes and sequences:\n");
printf("Most common opcodes and sequences:\n");
for (int i = 0; i < numBytecodeIDs; ++i) {
for (int i = 0; i < numOpcodeIDs; ++i) {
int index = sortedIndices[i];