Upgrade to Pro — share decks privately, control downloads, hide ads and more …

V8のコードベース

 V8のコードベース

V8のC++コードベースについてなど

More Decks by Taketoshi Aono(青野健利 a.k.a brn)

Other Decks in Programming

Transcript

  1. #define IGNITION_HANDLER(Name, BaseAssembler) \! class Name##Assembler : public BaseAssembler {

    \! public: \! explicit Name##Assembler(compiler::CodeAssemblerState* state, \! Bytecode bytecode, OperandScale scale) \! : BaseAssembler(state, bytecode, scale) {} \! static void Generate(compiler::CodeAssemblerState* state, \! OperandScale scale); \! \! private: \! void GenerateImpl(); \! DISALLOW_COPY_AND_ASSIGN(Name##Assembler); \! }; \! void Name##Assembler::Generate(compiler::CodeAssemblerState* state, \! OperandScale scale) { \! Name##Assembler assembler(state, Bytecode::k##Name, scale); \! state->SetInitialDebugInformation(#Name, __FILE__, __LINE__); \! assembler.GenerateImpl(); \! } \! void Name##Assembler::GenerateImpl()!
  2. #define BYTECODE_LIST(V) \! /* Extended width operands */ \! V(Wide,

    AccumulatorUse::kNone) \! V(ExtraWide, AccumulatorUse::kNone) \! \! /* Loading the accumulator */ \! V(LdaZero, AccumulatorUse::kWrite) \! V(LdaSmi, AccumulatorUse::kWrite, OperandType::kImm) \! V(LdaUndefined, AccumulatorUse::kWrite) \! V(LdaNull, AccumulatorUse::kWrite) \! V(LdaTheHole, AccumulatorUse::kWrite) \! V(LdaTrue, AccumulatorUse::kWrite) \! .! .! .!
  3. switch (bytecode) {! #define CASE(Name, ...) \! case Bytecode::k##Name: \!

    return #Name;! BYTECODE_LIST(CASE)! #undef CASE! }!