Changeset 38428 in webkit for trunk/JavaScriptCore/bytecompiler


Ignore:
Timestamp:
Nov 15, 2008, 1:37:49 PM (17 years ago)
Author:
[email protected]
Message:

2008-11-15 Geoffrey Garen <[email protected]>

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:
Location:
trunk/JavaScriptCore/bytecompiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecompiler/CodeGenerator.cpp

    r38427 r38428  
    228228    , m_nextGlobalIndex(-1)
    229229    , m_globalData(&scopeChain.globalObject()->globalExec()->globalData())
    230     , m_lastBytecodeID(op_end)
     230    , m_lastOpcodeID(op_end)
    231231    , m_emitNodeDepth(0)
    232232{
     
    234234        m_codeBlock->needsFullScopeChain = true;
    235235
    236     emitBytecode(op_enter);
     236    emitOpcode(op_enter);
    237237    codeBlock->globalData = m_globalData;
    238238
     
    305305    , m_codeType(FunctionCode)
    306306    , m_globalData(&scopeChain.globalObject()->globalExec()->globalData())
    307     , m_lastBytecodeID(op_end)
     307    , m_lastOpcodeID(op_end)
    308308    , m_emitNodeDepth(0)
    309309{
     
    323323        ++m_codeBlock->numVars;
    324324        m_activationRegisterIndex = newRegister()->index();
    325         emitBytecode(op_enter_with_activation);
     325        emitOpcode(op_enter_with_activation);
    326326        instructions().append(m_activationRegisterIndex);
    327327    } else
    328         emitBytecode(op_enter);
     328        emitOpcode(op_enter);
    329329
    330330    if (usesArguments)
    331         emitBytecode(op_create_arguments);
     331        emitOpcode(op_create_arguments);
    332332
    333333    const DeclarationStacks::FunctionStack& functionStack = functionBody->functionStack();
     
    354354
    355355    if (functionBody->usesThis()) {
    356         emitBytecode(op_convert_this);
     356        emitOpcode(op_convert_this);
    357357        instructions().append(m_thisRegister.index());
    358358    }
     
    376376    , m_codeType(EvalCode)
    377377    , m_globalData(&scopeChain.globalObject()->globalExec()->globalData())
    378     , m_lastBytecodeID(op_end)
     378    , m_lastOpcodeID(op_end)
    379379    , m_emitNodeDepth(0)
    380380{
     
    382382        m_codeBlock->needsFullScopeChain = true;
    383383
    384     emitBytecode(op_enter);
     384    emitOpcode(op_enter);
    385385    codeBlock->globalData = m_globalData;
    386386    m_codeBlock->numParameters = 1; // Allocate space for "this"
     
    513513
    514514    // This disables peephole optimizations when an instruction is a jump target
    515     m_lastBytecodeID = op_end;
     515    m_lastOpcodeID = op_end;
    516516    return l0;
    517517}
    518518
    519 void BytecodeGenerator::emitBytecode(BytecodeID bytecodeID)
    520 {
    521     instructions().append(globalData()->interpreter->getBytecode(bytecodeID));
    522     m_lastBytecodeID = bytecodeID;
     519void BytecodeGenerator::emitOpcode(OpcodeID opcodeID)
     520{
     521    instructions().append(globalData()->interpreter->getOpcode(opcodeID));
     522    m_lastOpcodeID = opcodeID;
    523523}
    524524
     
    554554PassRefPtr<LabelID> BytecodeGenerator::emitJump(LabelID* target)
    555555{
    556     emitBytecode(target->isForwardLabel() ? op_jmp : op_loop);
     556    emitOpcode(target->isForwardLabel() ? op_jmp : op_loop);
    557557    instructions().append(target->offsetFrom(instructions().size()));
    558558    return target;
     
    561561PassRefPtr<LabelID> BytecodeGenerator::emitJumpIfTrue(RegisterID* cond, LabelID* target)
    562562{
    563     if (m_lastBytecodeID == op_less && !target->isForwardLabel()) {
     563    if (m_lastOpcodeID == op_less && !target->isForwardLabel()) {
    564564        int dstIndex;
    565565        int src1Index;
     
    570570        if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
    571571            rewindBinaryOp();
    572             emitBytecode(op_loop_if_less);
     572            emitOpcode(op_loop_if_less);
    573573            instructions().append(src1Index);
    574574            instructions().append(src2Index);
     
    576576            return target;
    577577        }
    578     } else if (m_lastBytecodeID == op_lesseq && !target->isForwardLabel()) {
     578    } else if (m_lastOpcodeID == op_lesseq && !target->isForwardLabel()) {
    579579        int dstIndex;
    580580        int src1Index;
     
    585585        if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
    586586            rewindBinaryOp();
    587             emitBytecode(op_loop_if_lesseq);
     587            emitOpcode(op_loop_if_lesseq);
    588588            instructions().append(src1Index);
    589589            instructions().append(src2Index);
     
    591591            return target;
    592592        }
    593     } else if (m_lastBytecodeID == op_eq_null && target->isForwardLabel()) {
     593    } else if (m_lastOpcodeID == op_eq_null && target->isForwardLabel()) {
    594594        int dstIndex;
    595595        int srcIndex;
     
    599599        if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
    600600            rewindUnaryOp();
    601             emitBytecode(op_jeq_null);
     601            emitOpcode(op_jeq_null);
    602602            instructions().append(srcIndex);
    603603            instructions().append(target->offsetFrom(instructions().size()));
    604604            return target;
    605605        }
    606     } else if (m_lastBytecodeID == op_neq_null && target->isForwardLabel()) {
     606    } else if (m_lastOpcodeID == op_neq_null && target->isForwardLabel()) {
    607607        int dstIndex;
    608608        int srcIndex;
     
    612612        if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
    613613            rewindUnaryOp();
    614             emitBytecode(op_jneq_null);
     614            emitOpcode(op_jneq_null);
    615615            instructions().append(srcIndex);
    616616            instructions().append(target->offsetFrom(instructions().size()));
     
    619619    }
    620620
    621     emitBytecode(target->isForwardLabel() ? op_jtrue : op_loop_if_true);
     621    emitOpcode(target->isForwardLabel() ? op_jtrue : op_loop_if_true);
    622622    instructions().append(cond->index());
    623623    instructions().append(target->offsetFrom(instructions().size()));
     
    629629    ASSERT(target->isForwardLabel());
    630630
    631     if (m_lastBytecodeID == op_less) {
     631    if (m_lastOpcodeID == op_less) {
    632632        int dstIndex;
    633633        int src1Index;
     
    638638        if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
    639639            rewindBinaryOp();
    640             emitBytecode(op_jnless);
     640            emitOpcode(op_jnless);
    641641            instructions().append(src1Index);
    642642            instructions().append(src2Index);
     
    644644            return target;
    645645        }
    646     } else if (m_lastBytecodeID == op_not) {
     646    } else if (m_lastOpcodeID == op_not) {
    647647        int dstIndex;
    648648        int srcIndex;
     
    652652        if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
    653653            rewindUnaryOp();
    654             emitBytecode(op_jtrue);
     654            emitOpcode(op_jtrue);
    655655            instructions().append(srcIndex);
    656656            instructions().append(target->offsetFrom(instructions().size()));
    657657            return target;
    658658        }
    659     } else if (m_lastBytecodeID == op_eq_null) {
     659    } else if (m_lastOpcodeID == op_eq_null) {
    660660        int dstIndex;
    661661        int srcIndex;
     
    665665        if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
    666666            rewindUnaryOp();
    667             emitBytecode(op_jneq_null);
     667            emitOpcode(op_jneq_null);
    668668            instructions().append(srcIndex);
    669669            instructions().append(target->offsetFrom(instructions().size()));
    670670            return target;
    671671        }
    672     } else if (m_lastBytecodeID == op_neq_null) {
     672    } else if (m_lastOpcodeID == op_neq_null) {
    673673        int dstIndex;
    674674        int srcIndex;
     
    678678        if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
    679679            rewindUnaryOp();
    680             emitBytecode(op_jeq_null);
     680            emitOpcode(op_jeq_null);
    681681            instructions().append(srcIndex);
    682682            instructions().append(target->offsetFrom(instructions().size()));
     
    685685    }
    686686
    687     emitBytecode(op_jfalse);
     687    emitOpcode(op_jfalse);
    688688    instructions().append(cond->index());
    689689    instructions().append(target->offsetFrom(instructions().size()));
     
    748748RegisterID* BytecodeGenerator::emitMove(RegisterID* dst, RegisterID* src)
    749749{
    750     emitBytecode(op_mov);
     750    emitOpcode(op_mov);
    751751    instructions().append(dst->index());
    752752    instructions().append(src->index());
     
    754754}
    755755
    756 RegisterID* BytecodeGenerator::emitUnaryOp(BytecodeID bytecode, RegisterID* dst, RegisterID* src, ResultType type)
    757 {
    758     emitBytecode(bytecode);
     756RegisterID* BytecodeGenerator::emitUnaryOp(OpcodeID opcodeID, RegisterID* dst, RegisterID* src, ResultType type)
     757{
     758    emitOpcode(opcodeID);
    759759    instructions().append(dst->index());
    760760    instructions().append(src->index());
    761     if (bytecode == op_negate)
     761    if (opcodeID == op_negate)
    762762        instructions().append(type.toInt());
    763763    return dst;
     
    766766RegisterID* BytecodeGenerator::emitPreInc(RegisterID* srcDst)
    767767{
    768     emitBytecode(op_pre_inc);
     768    emitOpcode(op_pre_inc);
    769769    instructions().append(srcDst->index());
    770770    return srcDst;
     
    773773RegisterID* BytecodeGenerator::emitPreDec(RegisterID* srcDst)
    774774{
    775     emitBytecode(op_pre_dec);
     775    emitOpcode(op_pre_dec);
    776776    instructions().append(srcDst->index());
    777777    return srcDst;
     
    780780RegisterID* BytecodeGenerator::emitPostInc(RegisterID* dst, RegisterID* srcDst)
    781781{
    782     emitBytecode(op_post_inc);
     782    emitOpcode(op_post_inc);
    783783    instructions().append(dst->index());
    784784    instructions().append(srcDst->index());
     
    788788RegisterID* BytecodeGenerator::emitPostDec(RegisterID* dst, RegisterID* srcDst)
    789789{
    790     emitBytecode(op_post_dec);
     790    emitOpcode(op_post_dec);
    791791    instructions().append(dst->index());
    792792    instructions().append(srcDst->index());
     
    794794}
    795795
    796 RegisterID* BytecodeGenerator::emitBinaryOp(BytecodeID bytecode, RegisterID* dst, RegisterID* src1, RegisterID* src2, OperandTypes types)
    797 {
    798     emitBytecode(bytecode);
     796RegisterID* BytecodeGenerator::emitBinaryOp(OpcodeID opcodeID, RegisterID* dst, RegisterID* src1, RegisterID* src2, OperandTypes types)
     797{
     798    emitOpcode(opcodeID);
    799799    instructions().append(dst->index());
    800800    instructions().append(src1->index());
    801801    instructions().append(src2->index());
    802802
    803     if (bytecode == op_bitor || bytecode == op_bitand || bytecode == op_bitxor ||
    804         bytecode == op_add || bytecode == op_mul || bytecode == op_sub) {
     803    if (opcodeID == op_bitor || opcodeID == op_bitand || opcodeID == op_bitxor ||
     804        opcodeID == op_add || opcodeID == op_mul || opcodeID == op_sub) {
    805805        instructions().append(types.toInt());
    806806    }
     
    809809}
    810810
    811 RegisterID* BytecodeGenerator::emitEqualityOp(BytecodeID bytecode, RegisterID* dst, RegisterID* src1, RegisterID* src2)
    812 {
    813     if (m_lastBytecodeID == op_typeof) {
     811RegisterID* BytecodeGenerator::emitEqualityOp(OpcodeID opcodeID, RegisterID* dst, RegisterID* src1, RegisterID* src2)
     812{
     813    if (m_lastOpcodeID == op_typeof) {
    814814        int dstIndex;
    815815        int srcIndex;
     
    824824            if (value == "undefined") {
    825825                rewindUnaryOp();
    826                 emitBytecode(op_is_undefined);
     826                emitOpcode(op_is_undefined);
    827827                instructions().append(dst->index());
    828828                instructions().append(srcIndex);
     
    831831            if (value == "boolean") {
    832832                rewindUnaryOp();
    833                 emitBytecode(op_is_boolean);
     833                emitOpcode(op_is_boolean);
    834834                instructions().append(dst->index());
    835835                instructions().append(srcIndex);
     
    838838            if (value == "number") {
    839839                rewindUnaryOp();
    840                 emitBytecode(op_is_number);
     840                emitOpcode(op_is_number);
    841841                instructions().append(dst->index());
    842842                instructions().append(srcIndex);
     
    845845            if (value == "string") {
    846846                rewindUnaryOp();
    847                 emitBytecode(op_is_string);
     847                emitOpcode(op_is_string);
    848848                instructions().append(dst->index());
    849849                instructions().append(srcIndex);
     
    852852            if (value == "object") {
    853853                rewindUnaryOp();
    854                 emitBytecode(op_is_object);
     854                emitOpcode(op_is_object);
    855855                instructions().append(dst->index());
    856856                instructions().append(srcIndex);
     
    859859            if (value == "function") {
    860860                rewindUnaryOp();
    861                 emitBytecode(op_is_function);
     861                emitOpcode(op_is_function);
    862862                instructions().append(dst->index());
    863863                instructions().append(srcIndex);
     
    867867    }
    868868
    869     emitBytecode(bytecode);
     869    emitOpcode(opcodeID);
    870870    instructions().append(dst->index());
    871871    instructions().append(src1->index());
     
    915915RegisterID* BytecodeGenerator::emitUnexpectedLoad(RegisterID* dst, bool b)
    916916{
    917     emitBytecode(op_unexpected_load);
     917    emitOpcode(op_unexpected_load);
    918918    instructions().append(dst->index());
    919919    instructions().append(addUnexpectedConstant(jsBoolean(b)));
     
    923923RegisterID* BytecodeGenerator::emitUnexpectedLoad(RegisterID* dst, double d)
    924924{
    925     emitBytecode(op_unexpected_load);
     925    emitOpcode(op_unexpected_load);
    926926    instructions().append(dst->index());
    927927    instructions().append(addUnexpectedConstant(jsNumber(globalData(), d)));
     
    985985RegisterID* BytecodeGenerator::emitInstanceOf(RegisterID* dst, RegisterID* value, RegisterID* base, RegisterID* basePrototype)
    986986{
    987     emitBytecode(op_instanceof);
     987    emitOpcode(op_instanceof);
    988988    instructions().append(dst->index());
    989989    instructions().append(value->index());
     
    10001000    if (!findScopedProperty(property, index, depth, false, globalObject) && !globalObject) {
    10011001        // We can't optimise at all :-(
    1002         emitBytecode(op_resolve);
     1002        emitOpcode(op_resolve);
    10031003        instructions().append(dst->index());
    10041004        instructions().append(addConstant(property));
     
    10131013    if (globalObject) {
    10141014        m_codeBlock->globalResolveInstructions.append(instructions().size());
    1015         emitBytecode(op_resolve_global);
     1015        emitOpcode(op_resolve_global);
    10161016        instructions().append(dst->index());
    10171017        instructions().append(globalObject);
     
    10241024    // In this case we are at least able to drop a few scope chains from the
    10251025    // lookup chain, although we still need to hash from then on.
    1026     emitBytecode(op_resolve_skip);
     1026    emitOpcode(op_resolve_skip);
    10271027    instructions().append(dst->index());
    10281028    instructions().append(addConstant(property));
     
    10341034{
    10351035    if (globalObject) {
    1036         emitBytecode(op_get_global_var);
     1036        emitOpcode(op_get_global_var);
    10371037        instructions().append(dst->index());
    10381038        instructions().append(asCell(globalObject));
     
    10411041    }
    10421042
    1043     emitBytecode(op_get_scoped_var);
     1043    emitOpcode(op_get_scoped_var);
    10441044    instructions().append(dst->index());
    10451045    instructions().append(index);
     
    10511051{
    10521052    if (globalObject) {
    1053         emitBytecode(op_put_global_var);
     1053        emitOpcode(op_put_global_var);
    10541054        instructions().append(asCell(globalObject));
    10551055        instructions().append(index);
     
    10571057        return value;
    10581058    }
    1059     emitBytecode(op_put_scoped_var);
     1059    emitOpcode(op_put_scoped_var);
    10601060    instructions().append(index);
    10611061    instructions().append(depth);
     
    10661066RegisterID* BytecodeGenerator::emitResolveBase(RegisterID* dst, const Identifier& property)
    10671067{
    1068     emitBytecode(op_resolve_base);
     1068    emitOpcode(op_resolve_base);
    10691069    instructions().append(dst->index());
    10701070    instructions().append(addConstant(property));
     
    10741074RegisterID* BytecodeGenerator::emitResolveWithBase(RegisterID* baseDst, RegisterID* propDst, const Identifier& property)
    10751075{
    1076     emitBytecode(op_resolve_with_base);
     1076    emitOpcode(op_resolve_with_base);
    10771077    instructions().append(baseDst->index());
    10781078    instructions().append(propDst->index());
     
    10831083RegisterID* BytecodeGenerator::emitResolveFunction(RegisterID* baseDst, RegisterID* funcDst, const Identifier& property)
    10841084{
    1085     emitBytecode(op_resolve_func);
     1085    emitOpcode(op_resolve_func);
    10861086    instructions().append(baseDst->index());
    10871087    instructions().append(funcDst->index());
     
    10941094    m_codeBlock->propertyAccessInstructions.append(instructions().size());
    10951095
    1096     emitBytecode(op_get_by_id);
     1096    emitOpcode(op_get_by_id);
    10971097    instructions().append(dst->index());
    10981098    instructions().append(base->index());
     
    11091109    m_codeBlock->propertyAccessInstructions.append(instructions().size());
    11101110
    1111     emitBytecode(op_put_by_id);
     1111    emitOpcode(op_put_by_id);
    11121112    instructions().append(base->index());
    11131113    instructions().append(addConstant(property));
     
    11221122RegisterID* BytecodeGenerator::emitPutGetter(RegisterID* base, const Identifier& property, RegisterID* value)
    11231123{
    1124     emitBytecode(op_put_getter);
     1124    emitOpcode(op_put_getter);
    11251125    instructions().append(base->index());
    11261126    instructions().append(addConstant(property));
     
    11311131RegisterID* BytecodeGenerator::emitPutSetter(RegisterID* base, const Identifier& property, RegisterID* value)
    11321132{
    1133     emitBytecode(op_put_setter);
     1133    emitOpcode(op_put_setter);
    11341134    instructions().append(base->index());
    11351135    instructions().append(addConstant(property));
     
    11401140RegisterID* BytecodeGenerator::emitDeleteById(RegisterID* dst, RegisterID* base, const Identifier& property)
    11411141{
    1142     emitBytecode(op_del_by_id);
     1142    emitOpcode(op_del_by_id);
    11431143    instructions().append(dst->index());
    11441144    instructions().append(base->index());
     
    11491149RegisterID* BytecodeGenerator::emitGetByVal(RegisterID* dst, RegisterID* base, RegisterID* property)
    11501150{
    1151     emitBytecode(op_get_by_val);
     1151    emitOpcode(op_get_by_val);
    11521152    instructions().append(dst->index());
    11531153    instructions().append(base->index());
     
    11581158RegisterID* BytecodeGenerator::emitPutByVal(RegisterID* base, RegisterID* property, RegisterID* value)
    11591159{
    1160     emitBytecode(op_put_by_val);
     1160    emitOpcode(op_put_by_val);
    11611161    instructions().append(base->index());
    11621162    instructions().append(property->index());
     
    11671167RegisterID* BytecodeGenerator::emitDeleteByVal(RegisterID* dst, RegisterID* base, RegisterID* property)
    11681168{
    1169     emitBytecode(op_del_by_val);
     1169    emitOpcode(op_del_by_val);
    11701170    instructions().append(dst->index());
    11711171    instructions().append(base->index());
     
    11761176RegisterID* BytecodeGenerator::emitPutByIndex(RegisterID* base, unsigned index, RegisterID* value)
    11771177{
    1178     emitBytecode(op_put_by_index);
     1178    emitOpcode(op_put_by_index);
    11791179    instructions().append(base->index());
    11801180    instructions().append(index);
     
    11851185RegisterID* BytecodeGenerator::emitNewObject(RegisterID* dst)
    11861186{
    1187     emitBytecode(op_new_object);
     1187    emitOpcode(op_new_object);
    11881188    instructions().append(dst->index());
    11891189    return dst;
     
    11991199        emitNode(argv.last().get(), n->value());
    12001200    }
    1201     emitBytecode(op_new_array);
     1201    emitOpcode(op_new_array);
    12021202    instructions().append(dst->index());
    12031203    instructions().append(argv.size() ? argv[0]->index() : 0); // argv
     
    12081208RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FuncDeclNode* n)
    12091209{
    1210     emitBytecode(op_new_func);
     1210    emitOpcode(op_new_func);
    12111211    instructions().append(dst->index());
    12121212    instructions().append(addConstant(n));
     
    12161216RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp)
    12171217{
    1218     emitBytecode(op_new_regexp);
     1218    emitOpcode(op_new_regexp);
    12191219    instructions().append(dst->index());
    12201220    instructions().append(addRegExp(regExp));
     
    12251225RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n)
    12261226{
    1227     emitBytecode(op_new_func_exp);
     1227    emitOpcode(op_new_func_exp);
    12281228    instructions().append(r0->index());
    12291229    instructions().append(addConstant(n));
     
    12411241}
    12421242
    1243 RegisterID* BytecodeGenerator::emitCall(BytecodeID bytecodeID, RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset)
    1244 {
    1245     ASSERT(bytecodeID == op_call || bytecodeID == op_call_eval);
     1243RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset)
     1244{
     1245    ASSERT(opcodeID == op_call || opcodeID == op_call_eval);
    12461246    ASSERT(func->refCount());
    12471247
     
    12741274
    12751275    if (m_shouldEmitProfileHooks) {
    1276         emitBytecode(op_profile_will_call);
     1276        emitOpcode(op_profile_will_call);
    12771277        instructions().append(func->index());
    12781278    }
     
    12821282
    12831283    // Emit call.
    1284     emitBytecode(bytecodeID);
     1284    emitOpcode(opcodeID);
    12851285    instructions().append(dst->index()); // dst
    12861286    instructions().append(func->index()); // func
     
    12891289
    12901290    if (m_shouldEmitProfileHooks) {
    1291         emitBytecode(op_profile_did_call);
     1291        emitOpcode(op_profile_did_call);
    12921292        instructions().append(func->index());
    12931293
     
    13041304{
    13051305    if (m_codeBlock->needsFullScopeChain) {
    1306         emitBytecode(op_tear_off_activation);
     1306        emitOpcode(op_tear_off_activation);
    13071307        instructions().append(m_activationRegisterIndex);
    13081308    } else if (m_codeBlock->usesArguments && m_codeBlock->numParameters > 1)
    1309         emitBytecode(op_tear_off_arguments);
     1309        emitOpcode(op_tear_off_arguments);
    13101310
    13111311    return emitUnaryNoDstOp(op_ret, src);
    13121312}
    13131313
    1314 RegisterID* BytecodeGenerator::emitUnaryNoDstOp(BytecodeID bytecode, RegisterID* src)
    1315 {
    1316     emitBytecode(bytecode);
     1314RegisterID* BytecodeGenerator::emitUnaryNoDstOp(OpcodeID opcodeID, RegisterID* src)
     1315{
     1316    emitOpcode(opcodeID);
    13171317    instructions().append(src->index());
    13181318    return src;
     
    13441344
    13451345    if (m_shouldEmitProfileHooks) {
    1346         emitBytecode(op_profile_will_call);
     1346        emitOpcode(op_profile_will_call);
    13471347        instructions().append(func->index());
    13481348    }
     
    13601360    m_codeBlock->callLinkInfos.append(CallLinkInfo());
    13611361
    1362     emitBytecode(op_construct);
     1362    emitOpcode(op_construct);
    13631363    instructions().append(dst->index()); // dst
    13641364    instructions().append(func->index()); // func
     
    13681368    instructions().append(argv[0]->index()); // thisRegister
    13691369
    1370     emitBytecode(op_construct_verify);
     1370    emitOpcode(op_construct_verify);
    13711371    instructions().append(dst->index());
    13721372    instructions().append(argv[0]->index());
    13731373
    13741374    if (m_shouldEmitProfileHooks) {
    1375         emitBytecode(op_profile_did_call);
     1375        emitOpcode(op_profile_did_call);
    13761376        instructions().append(func->index());
    13771377       
     
    13981398    ASSERT(!m_scopeContextStack.last().isFinallyBlock);
    13991399
    1400     emitBytecode(op_pop_scope);
     1400    emitOpcode(op_pop_scope);
    14011401
    14021402    m_scopeContextStack.removeLast();
     
    14081408    if (!m_shouldEmitDebugHooks)
    14091409        return;
    1410     emitBytecode(op_debug);
     1410    emitOpcode(op_debug);
    14111411    instructions().append(debugHookID);
    14121412    instructions().append(firstLine);
     
    15171517            // We need to remove a number of dynamic scopes to get to the next
    15181518            // finally block
    1519             emitBytecode(op_jmp_scopes);
     1519            emitOpcode(op_jmp_scopes);
    15201520            instructions().append(nNormalScopes);
    15211521
     
    15591559        return emitComplexJumpScopes(target, &m_scopeContextStack.last(), &m_scopeContextStack.last() - scopeDelta);
    15601560
    1561     emitBytecode(op_jmp_scopes);
     1561    emitOpcode(op_jmp_scopes);
    15621562    instructions().append(scopeDelta);
    15631563    instructions().append(target->offsetFrom(instructions().size()));
     
    15671567RegisterID* BytecodeGenerator::emitNextPropertyName(RegisterID* dst, RegisterID* iter, LabelID* target)
    15681568{
    1569     emitBytecode(op_next_pname);
     1569    emitOpcode(op_next_pname);
    15701570    instructions().append(dst->index());
    15711571    instructions().append(iter->index());
     
    15781578    HandlerInfo info = { start->offsetFrom(0), end->offsetFrom(0), instructions().size(), m_dynamicScopeDepth, 0 };
    15791579    exceptionHandlers().append(info);
    1580     emitBytecode(op_catch);
     1580    emitOpcode(op_catch);
    15811581    instructions().append(targetRegister->index());
    15821582    return targetRegister;
     
    15851585RegisterID* BytecodeGenerator::emitNewError(RegisterID* dst, ErrorType type, JSValue* message)
    15861586{
    1587     emitBytecode(op_new_error);
     1587    emitOpcode(op_new_error);
    15881588    instructions().append(dst->index());
    15891589    instructions().append(static_cast<int>(type));
     
    15941594PassRefPtr<LabelID> BytecodeGenerator::emitJumpSubroutine(RegisterID* retAddrDst, LabelID* finally)
    15951595{
    1596     emitBytecode(op_jsr);
     1596    emitOpcode(op_jsr);
    15971597    instructions().append(retAddrDst->index());
    15981598    instructions().append(finally->offsetFrom(instructions().size()));
     
    16021602void BytecodeGenerator::emitSubroutineReturn(RegisterID* retAddrSrc)
    16031603{
    1604     emitBytecode(op_sret);
     1604    emitOpcode(op_sret);
    16051605    instructions().append(retAddrSrc->index());
    16061606}
     
    16131613    m_dynamicScopeDepth++;
    16141614   
    1615     emitBytecode(op_push_new_scope);
     1615    emitOpcode(op_push_new_scope);
    16161616    instructions().append(dst->index());
    16171617    instructions().append(addConstant(property));
     
    16241624    switch (type) {
    16251625        case SwitchInfo::SwitchImmediate:
    1626             emitBytecode(op_switch_imm);
     1626            emitOpcode(op_switch_imm);
    16271627            break;
    16281628        case SwitchInfo::SwitchCharacter:
    1629             emitBytecode(op_switch_char);
     1629            emitOpcode(op_switch_char);
    16301630            break;
    16311631        case SwitchInfo::SwitchString:
    1632             emitBytecode(op_switch_string);
     1632            emitOpcode(op_switch_string);
    16331633            break;
    16341634        default:
  • trunk/JavaScriptCore/bytecompiler/CodeGenerator.h

    r38427 r38428  
    232232        RegisterID* emitUnexpectedLoad(RegisterID* dst, double);
    233233
    234         RegisterID* emitUnaryOp(BytecodeID, RegisterID* dst, RegisterID* src, ResultType);
    235         RegisterID* emitBinaryOp(BytecodeID, RegisterID* dst, RegisterID* src1, RegisterID* src2, OperandTypes);
    236         RegisterID* emitEqualityOp(BytecodeID, RegisterID* dst, RegisterID* src1, RegisterID* src2);
    237         RegisterID* emitUnaryNoDstOp(BytecodeID, RegisterID* src);
     234        RegisterID* emitUnaryOp(OpcodeID, RegisterID* dst, RegisterID* src, ResultType);
     235        RegisterID* emitBinaryOp(OpcodeID, RegisterID* dst, RegisterID* src1, RegisterID* src2, OperandTypes);
     236        RegisterID* emitEqualityOp(OpcodeID, RegisterID* dst, RegisterID* src1, RegisterID* src2);
     237        RegisterID* emitUnaryNoDstOp(OpcodeID, RegisterID* src);
    238238
    239239        RegisterID* emitNewObject(RegisterID* dst);
     
    318318
    319319    private:
    320         void emitBytecode(BytecodeID);
     320        void emitOpcode(OpcodeID);
    321321        void retrieveLastBinaryOp(int& dstIndex, int& src1Index, int& src2Index);
    322322        void retrieveLastUnaryOp(int& dstIndex, int& srcIndex);
     
    346346        typedef HashMap<UString::Rep*, JSString*, IdentifierRepHash> IdentifierStringMap;
    347347
    348         RegisterID* emitCall(BytecodeID, RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
     348        RegisterID* emitCall(OpcodeID, RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
    349349       
    350350        RegisterID* newRegister();
     
    447447        JSGlobalData* m_globalData;
    448448
    449         BytecodeID m_lastBytecodeID;
     449        OpcodeID m_lastOpcodeID;
    450450
    451451#ifndef NDEBUG
Note: See TracChangeset for help on using the changeset viewer.