Revision: 9752
Author:   [email protected]
Date:     Mon Oct 24 05:07:35 2011
Log:      Remove one static initializer from disasm.

Review URL: http://codereview.chromium.org/8381002
http://code.google.com/p/v8/source/detail?r=9752

Modified:
 /branches/bleeding_edge/src/ia32/disasm-ia32.cc

=======================================
--- /branches/bleeding_edge/src/ia32/disasm-ia32.cc     Mon Sep 19 11:36:47 2011
+++ /branches/bleeding_edge/src/ia32/disasm-ia32.cc     Mon Oct 24 05:07:35 2011
@@ -179,6 +179,10 @@
  public:
   InstructionTable();
   const InstructionDesc& Get(byte x) const { return instructions_[x]; }
+  static InstructionTable* get_instance() {
+    static InstructionTable table;
+    return &table;
+  }

  private:
   InstructionDesc instructions_[256];
@@ -257,9 +261,6 @@
     id->type = JUMP_CONDITIONAL_SHORT_INSTR;
   }
 }
-
-
-static InstructionTable instruction_table;


 // The IA32 disassembler implementation.
@@ -267,7 +268,8 @@
  public:
   DisassemblerIA32(const NameConverter& converter,
                    bool abort_on_unimplemented = true)
-      : converter_(converter),
+      : instruction_table_(InstructionTabel::get_instance()),
+        converter_(converter),
         tmp_buffer_pos_(0),
         abort_on_unimplemented_(abort_on_unimplemented) {
     tmp_buffer_[0] = '\0';
@@ -281,11 +283,11 @@

  private:
   const NameConverter& converter_;
+  InstructionTable* instruction_table_;
   v8::internal::EmbeddedVector<char, 128> tmp_buffer_;
   unsigned int tmp_buffer_pos_;
   bool abort_on_unimplemented_;

-
   enum {
     eax = 0,
     ecx = 1,
@@ -884,7 +886,7 @@
   }
bool processed = true; // Will be set to false if the current instruction
                           // is not in 'instructions' table.
-  const InstructionDesc& idesc = instruction_table.Get(*data);
+  const InstructionDesc& idesc = instruction_table_->Get(*data);
   switch (idesc.type) {
     case ZERO_OPERANDS_INSTR:
       AppendToBuffer(idesc.mnem);

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to