⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 assembler.h.svn-base

📁 Google浏览器V8内核代码
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
  // Read/modify the address of a call instruction. This is used to relocate  // the break points where straight-line code is patched with a call  // instruction.  INLINE(Address call_address());  INLINE(void set_call_address(Address target));  INLINE(Object* call_object());  INLINE(Object** call_object_address());  INLINE(void set_call_object(Object* target));  // Patch the code with some other code.  void patch_code(byte* instructions, int instruction_count);  // Patch the code with a call.  void patch_code_with_call(Address target, int guard_bytes);  INLINE(bool is_call_instruction());#ifdef ENABLE_DISASSEMBLER  // Printing  static const char* RelocModeName(Mode rmode);  void Print();#endif  // ENABLE_DISASSEMBLER#ifdef DEBUG  // Debugging  void Verify();#endif  static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1;  static const int kPositionMask = 1 << POSITION | 1 << STATEMENT_POSITION;  static const int kDebugMask = kPositionMask | 1 << COMMENT;  static const int kApplyMask;  // Modes affected by apply. Depends on arch. private:  // On ARM, note that pc_ is the address of the constant pool entry  // to be relocated and not the address of the instruction  // referencing the constant pool entry (except when rmode_ ==  // comment).  byte* pc_;  Mode rmode_;  intptr_t data_;  friend class RelocIterator;};// RelocInfoWriter serializes a stream of relocation info. It writes towards// lower addresses.class RelocInfoWriter BASE_EMBEDDED { public:  RelocInfoWriter() : pos_(NULL), last_pc_(NULL), last_data_(0) {}  RelocInfoWriter(byte* pos, byte* pc) : pos_(pos), last_pc_(pc),                                         last_data_(0) {}  byte* pos() const { return pos_; }  byte* last_pc() const { return last_pc_; }  void Write(const RelocInfo* rinfo);  // Update the state of the stream after reloc info buffer  // and/or code is moved while the stream is active.  void Reposition(byte* pos, byte* pc) {    pos_ = pos;    last_pc_ = pc;  }  // Max size (bytes) of a written RelocInfo.  static const int kMaxSize = 12; private:  inline uint32_t WriteVariableLengthPCJump(uint32_t pc_delta);  inline void WriteTaggedPC(uint32_t pc_delta, int tag);  inline void WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag);  inline void WriteExtraTaggedData(int32_t data_delta, int top_tag);  inline void WriteTaggedData(int32_t data_delta, int tag);  inline void WriteExtraTag(int extra_tag, int top_tag);  byte* pos_;  byte* last_pc_;  intptr_t last_data_;  DISALLOW_COPY_AND_ASSIGN(RelocInfoWriter);};// A RelocIterator iterates over relocation information.// Typical use:////   for (RelocIterator it(code); !it.done(); it.next()) {//     // do something with it.rinfo() here//   }//// A mask can be specified to skip unwanted modes.class RelocIterator: public Malloced { public:  // Create a new iterator positioned at  // the beginning of the reloc info.  // Relocation information with mode k is included in the  // iteration iff bit k of mode_mask is set.  explicit RelocIterator(Code* code, int mode_mask = -1);  explicit RelocIterator(const CodeDesc& desc, int mode_mask = -1);  // Iteration  bool done() const  { return done_; }  void next();  // Return pointer valid until next next().  RelocInfo* rinfo() {    ASSERT(!done());    return &rinfo_;  } private:  // Advance* moves the position before/after reading.  // *Read* reads from current byte(s) into rinfo_.  // *Get* just reads and returns info on current byte.  void Advance(int bytes = 1) { pos_ -= bytes; }  int AdvanceGetTag();  int GetExtraTag();  int GetTopTag();  void ReadTaggedPC();  void AdvanceReadPC();  void AdvanceReadData();  void AdvanceReadVariableLengthPCJump();  int GetPositionTypeTag();  void ReadTaggedData();  static RelocInfo::Mode DebugInfoModeFromTag(int tag);  // If the given mode is wanted, set it in rinfo_ and return true.  // Else return false. Used for efficiently skipping unwanted modes.  bool SetMode(RelocInfo::Mode mode) {    return (mode_mask_ & 1 << mode) ? (rinfo_.rmode_ = mode, true) : false;  }  byte* pos_;  byte* end_;  RelocInfo rinfo_;  bool done_;  int mode_mask_;  DISALLOW_COPY_AND_ASSIGN(RelocIterator);};//------------------------------------------------------------------------------// External function//----------------------------------------------------------------------------class IC_Utility;class Debug_Address;class SCTableReference;// An ExternalReference represents a C++ address called from the generated// code. All references to C++ functions and must be encapsulated in an// ExternalReference instance. This is done in order to track the origin of// all external references in the code.class ExternalReference BASE_EMBEDDED { public:  explicit ExternalReference(Builtins::CFunctionId id);  explicit ExternalReference(Builtins::Name name);  explicit ExternalReference(Runtime::FunctionId id);  explicit ExternalReference(Runtime::Function* f);  explicit ExternalReference(const IC_Utility& ic_utility);  explicit ExternalReference(const Debug_Address& debug_address);  explicit ExternalReference(StatsCounter* counter);  explicit ExternalReference(Top::AddressId id);  explicit ExternalReference(const SCTableReference& table_ref);  // One-of-a-kind references. These references are not part of a general  // pattern. This means that they have to be added to the  // ExternalReferenceTable in serialize.cc manually.  static ExternalReference builtin_passed_function();  // Static variable Factory::the_hole_value.location()  static ExternalReference the_hole_value_location();  // Static variable StackGuard::address_of_limit()  static ExternalReference address_of_stack_guard_limit();  // Function Debug::Break()  static ExternalReference debug_break();  // Static variable Heap::NewSpaceStart()  static ExternalReference new_space_start();  // Used for fast allocation in generated code.  static ExternalReference new_space_allocation_top_address();  static ExternalReference new_space_allocation_limit_address();  // Used to check if single stepping is enabled in generated code.  static ExternalReference debug_step_in_fp_address();  Address address() const {return address_;} private:  explicit ExternalReference(void* address)    : address_(reinterpret_cast<Address>(address)) {}  Address address_;};// -----------------------------------------------------------------------------// Utility functions// Move these into inline file?static inline bool is_intn(int x, int n)  {  return -(1 << (n-1)) <= x && x < (1 << (n-1));}static inline bool is_int24(int x)  { return is_intn(x, 24); }static inline bool is_int8(int x)  { return is_intn(x, 8); }static inline bool is_uintn(int x, int n) {  return (x & -(1 << n)) == 0;}static inline bool is_uint3(int x)  { return is_uintn(x, 3); }static inline bool is_uint4(int x)  { return is_uintn(x, 4); }static inline bool is_uint5(int x)  { return is_uintn(x, 5); }static inline bool is_uint8(int x)  { return is_uintn(x, 8); }static inline bool is_uint12(int x)  { return is_uintn(x, 12); }static inline bool is_uint16(int x)  { return is_uintn(x, 16); }static inline bool is_uint24(int x)  { return is_uintn(x, 24); }} }  // namespace v8::internal#endif  // V8_ASSEMBLER_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -