Changeset 38428 in webkit for trunk/JavaScriptCore/VM/Opcode.h


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:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/Opcode.h

    r38425 r38428  
    2828 */
    2929
    30 #ifndef Bytecodes_h
    31 #define Bytecodes_h
     30#ifndef Opcode_h
     31#define Opcode_h
    3232
    3333#include <algorithm>
     
    3838namespace JSC {
    3939
    40     #define FOR_EACH_BYTECODE_ID(macro) \
     40    #define FOR_EACH_OPCODE_ID(macro) \
    4141        macro(op_enter) \
    4242        macro(op_enter_with_activation) \
     
    163163        macro(op_profile_did_call) \
    164164        \
    165         macro(op_end) // end must be the last bytecode in the list
    166 
    167     #define BYTECODE_ID_ENUM(bytecode) bytecode,
    168         typedef enum { FOR_EACH_BYTECODE_ID(BYTECODE_ID_ENUM) } BytecodeID;
    169     #undef BYTECODE_ID_ENUM
    170 
    171     const int numBytecodeIDs = op_end + 1;
    172 
    173     #define VERIFY_BYTECODE_ID(id) COMPILE_ASSERT(id <= op_end, ASSERT_THAT_JS_BYTECODE_IDS_ARE_VALID);
    174         FOR_EACH_BYTECODE_ID(VERIFY_BYTECODE_ID);
    175     #undef VERIFY_BYTECODE_ID
     165        macro(op_end) // end must be the last opcode in the list
     166
     167    #define OPCODE_ID_ENUM(opcode) opcode,
     168        typedef enum { FOR_EACH_OPCODE_ID(OPCODE_ID_ENUM) } OpcodeID;
     169    #undef OPCODE_ID_ENUM
     170
     171    const int numOpcodeIDs = op_end + 1;
     172
     173    #define VERIFY_OPCODE_ID(id) COMPILE_ASSERT(id <= op_end, ASSERT_THAT_JS_OPCODE_IDS_ARE_VALID);
     174        FOR_EACH_OPCODE_ID(VERIFY_OPCODE_ID);
     175    #undef VERIFY_OPCODE_ID
    176176
    177177#if HAVE(COMPUTED_GOTO)
    178     typedef void* Bytecode;
     178    typedef void* Opcode;
    179179#else
    180     typedef BytecodeID Bytecode;
     180    typedef OpcodeID Opcode;
    181181#endif
    182182
    183 #if ENABLE(BYTECODE_SAMPLING) || ENABLE(CODEBLOCK_SAMPLING) || ENABLE(BYTECODE_STATS)
     183#if ENABLE(OPCODE_SAMPLING) || ENABLE(CODEBLOCK_SAMPLING) || ENABLE(OPCODE_STATS)
    184184
    185185#define PADDING_STRING "                                "
    186186#define PADDING_STRING_LENGTH static_cast<unsigned>(strlen(PADDING_STRING))
    187187
    188     extern const char* const bytecodeNames[];
    189 
    190     inline const char* padBytecodeName(BytecodeID op, unsigned width)
     188    extern const char* const opcodeNames[];
     189
     190    inline const char* padOpcodeName(OpcodeID op, unsigned width)
    191191    {
    192         unsigned pad = width - strlen(bytecodeNames[op]);
     192        unsigned pad = width - strlen(opcodeNames[op]);
    193193        pad = std::min(pad, PADDING_STRING_LENGTH);
    194194        return PADDING_STRING + PADDING_STRING_LENGTH - pad;
     
    200200#endif
    201201
    202 #if ENABLE(BYTECODE_STATS)
    203 
    204     struct BytecodeStats {
    205         BytecodeStats();
    206         ~BytecodeStats();
    207         static long long bytecodeCounts[numBytecodeIDs];
    208         static long long bytecodePairCounts[numBytecodeIDs][numBytecodeIDs];
    209         static int lastBytecode;
    210 
    211         static void recordInstruction(int bytecode);
     202#if ENABLE(OPCODE_STATS)
     203
     204    struct OpcodeStats {
     205        OpcodeStats();
     206        ~OpcodeStats();
     207        static long long opcodeCounts[numOpcodeIDs];
     208        static long long opcodePairCounts[numOpcodeIDs][numOpcodeIDs];
     209        static int lastOpcode;
     210
     211        static void recordInstruction(int opcode);
    212212        static void resetLastInstruction();
    213213    };
     
    217217} // namespace JSC
    218218
    219 #endif // Bytecodes_h
     219#endif // Opcode_h
Note: See TracChangeset for help on using the changeset viewer.