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

📄 assembler.cc.svn-base

📁 Google浏览器V8内核代码
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
  return *pos_ & ((1 << kPositionTypeTagBits) - 1);}inline void RelocIterator::ReadTaggedData() {  int8_t signed_b = *pos_;  rinfo_.data_ += ArithmeticShiftRight(signed_b, kPositionTypeTagBits);}inline RelocInfo::Mode RelocIterator::DebugInfoModeFromTag(int tag) {  if (tag == kStatementPositionTag) {    return RelocInfo::STATEMENT_POSITION;  } else if (tag == kNonstatementPositionTag) {    return RelocInfo::POSITION;  } else {    ASSERT(tag == kCommentTag);    return RelocInfo::COMMENT;  }}void RelocIterator::next() {  ASSERT(!done());  // Basically, do the opposite of RelocInfoWriter::Write.  // Reading of data is as far as possible avoided for unwanted modes,  // but we must always update the pc.  //  // We exit this loop by returning when we find a mode we want.  while (pos_ > end_) {    int tag = AdvanceGetTag();    if (tag == kEmbeddedObjectTag) {      ReadTaggedPC();      if (SetMode(RelocInfo::EMBEDDED_OBJECT)) return;    } else if (tag == kCodeTargetTag) {      ReadTaggedPC();      if (*(reinterpret_cast<int**>(rinfo_.pc())) ==          reinterpret_cast<int*>(0x61)) {        tag = 0;      }      if (SetMode(RelocInfo::CODE_TARGET)) return;    } else if (tag == kPositionTag) {      ReadTaggedPC();      Advance();      // Check if we want source positions.      if (mode_mask_ & RelocInfo::kPositionMask) {        // Check if we want this type of source position.        if (SetMode(DebugInfoModeFromTag(GetPositionTypeTag()))) {          // Finally read the data before returning.          ReadTaggedData();          return;        }      }    } else {      ASSERT(tag == kDefaultTag);      int extra_tag = GetExtraTag();      if (extra_tag == kPCJumpTag) {        int top_tag = GetTopTag();        if (top_tag == kVariableLengthPCJumpTopTag) {          AdvanceReadVariableLengthPCJump();        } else {          AdvanceReadPC();        }      } else if (extra_tag == kDataJumpTag) {        // Check if we want debug modes (the only ones with data).        if (mode_mask_ & RelocInfo::kDebugMask) {          int top_tag = GetTopTag();          AdvanceReadData();          if (SetMode(DebugInfoModeFromTag(top_tag))) return;        } else {          // Otherwise, just skip over the data.          Advance(kIntSize);        }      } else {        AdvanceReadPC();        if (SetMode(static_cast<RelocInfo::Mode>(extra_tag))) return;      }    }  }  done_ = true;}RelocIterator::RelocIterator(Code* code, int mode_mask) {  rinfo_.pc_ = code->instruction_start();  rinfo_.data_ = 0;  // relocation info is read backwards  pos_ = code->relocation_start() + code->relocation_size();  end_ = code->relocation_start();  done_ = false;  mode_mask_ = mode_mask;  if (mode_mask_ == 0) pos_ = end_;  next();}RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) {  rinfo_.pc_ = desc.buffer;  rinfo_.data_ = 0;  // relocation info is read backwards  pos_ = desc.buffer + desc.buffer_size;  end_ = pos_ - desc.reloc_size;  done_ = false;  mode_mask_ = mode_mask;  if (mode_mask_ == 0) pos_ = end_;  next();}// -----------------------------------------------------------------------------// Implementation of RelocInfo#ifdef ENABLE_DISASSEMBLERconst char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) {  switch (rmode) {    case RelocInfo::NONE:      return "no reloc";    case RelocInfo::EMBEDDED_OBJECT:      return "embedded object";    case RelocInfo::EMBEDDED_STRING:      return "embedded string";    case RelocInfo::CONSTRUCT_CALL:      return "code target (js construct call)";    case RelocInfo::CODE_TARGET_CONTEXT:      return "code target (context)";    case RelocInfo::CODE_TARGET:      return "code target";    case RelocInfo::RUNTIME_ENTRY:      return "runtime entry";    case RelocInfo::JS_RETURN:      return "js return";    case RelocInfo::COMMENT:      return "comment";    case RelocInfo::POSITION:      return "position";    case RelocInfo::STATEMENT_POSITION:      return "statement position";    case RelocInfo::EXTERNAL_REFERENCE:      return "external reference";    case RelocInfo::INTERNAL_REFERENCE:      return "internal reference";    case RelocInfo::NUMBER_OF_MODES:      UNREACHABLE();      return "number_of_modes";  }  return "unknown relocation type";}void RelocInfo::Print() {  PrintF("%p  %s", pc_, RelocModeName(rmode_));  if (IsComment(rmode_)) {    PrintF("  (%s)", data_);  } else if (rmode_ == EMBEDDED_OBJECT) {    PrintF("  (");    target_object()->ShortPrint();    PrintF(")");  } else if (rmode_ == EXTERNAL_REFERENCE) {    ExternalReferenceEncoder ref_encoder;    PrintF(" (%s)  (%p)",           ref_encoder.NameOfAddress(*target_reference_address()),           *target_reference_address());  } else if (IsCodeTarget(rmode_)) {    Code* code = Debug::GetCodeTarget(target_address());    PrintF(" (%s)  (%p)", Code::Kind2String(code->kind()), target_address());  } else if (IsPosition(rmode_)) {    PrintF("  (%d)", data());  }  PrintF("\n");}#endif  // ENABLE_DISASSEMBLER#ifdef DEBUGvoid RelocInfo::Verify() {  switch (rmode_) {    case EMBEDDED_OBJECT:      Object::VerifyPointer(target_object());      break;    case CONSTRUCT_CALL:    case CODE_TARGET_CONTEXT:    case CODE_TARGET: {      // convert inline target address to code object      Address addr = target_address();      ASSERT(addr != NULL);      // Check that we can find the right code object.      HeapObject* code = HeapObject::FromAddress(addr - Code::kHeaderSize);      Object* found = Heap::FindCodeObject(addr);      ASSERT(found->IsCode());      ASSERT(code->address() == HeapObject::cast(found)->address());      break;    }    case RelocInfo::EMBEDDED_STRING:    case RUNTIME_ENTRY:    case JS_RETURN:    case COMMENT:    case POSITION:    case STATEMENT_POSITION:    case EXTERNAL_REFERENCE:    case INTERNAL_REFERENCE:    case NONE:      break;    case NUMBER_OF_MODES:      UNREACHABLE();      break;  }}#endif  // DEBUG// -----------------------------------------------------------------------------// Implementation of ExternalReferenceExternalReference::ExternalReference(Builtins::CFunctionId id)  : address_(Builtins::c_function_address(id)) {}ExternalReference::ExternalReference(Builtins::Name name)  : address_(Builtins::builtin_address(name)) {}ExternalReference::ExternalReference(Runtime::FunctionId id)  : address_(Runtime::FunctionForId(id)->entry) {}ExternalReference::ExternalReference(Runtime::Function* f)  : address_(f->entry) {}ExternalReference::ExternalReference(const IC_Utility& ic_utility)  : address_(ic_utility.address()) {}ExternalReference::ExternalReference(const Debug_Address& debug_address)  : address_(debug_address.address()) {}ExternalReference::ExternalReference(StatsCounter* counter)  : address_(reinterpret_cast<Address>(counter->GetInternalPointer())) {}ExternalReference::ExternalReference(Top::AddressId id)  : address_(Top::get_address_from_id(id)) {}ExternalReference::ExternalReference(const SCTableReference& table_ref)  : address_(table_ref.address()) {}ExternalReference ExternalReference::builtin_passed_function() {  return ExternalReference(&Builtins::builtin_passed_function);}ExternalReference ExternalReference::the_hole_value_location() {  return ExternalReference(Factory::the_hole_value().location());}ExternalReference ExternalReference::address_of_stack_guard_limit() {  return ExternalReference(StackGuard::address_of_jslimit());}ExternalReference ExternalReference::debug_break() {  return ExternalReference(FUNCTION_ADDR(Debug::Break));}ExternalReference ExternalReference::new_space_start() {  return ExternalReference(Heap::NewSpaceStart());}ExternalReference ExternalReference::new_space_allocation_top_address() {  return ExternalReference(Heap::NewSpaceAllocationTopAddress());}ExternalReference ExternalReference::new_space_allocation_limit_address() {  return ExternalReference(Heap::NewSpaceAllocationLimitAddress());}ExternalReference ExternalReference::debug_step_in_fp_address() {  return ExternalReference(Debug::step_in_fp_addr());}} }  // namespace v8::internal

⌨️ 快捷键说明

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