V8 Project
v8::internal::RelocInfoBuffer Class Reference
+ Collaboration diagram for v8::internal::RelocInfoBuffer:

Public Member Functions

 RelocInfoBuffer (int buffer_initial_capicity, byte *pc)
 
 ~RelocInfoBuffer ()
 
void Write (const RelocInfo *rinfo)
 
Vector< byteGetResult ()
 

Private Member Functions

void Grow ()
 

Private Attributes

RelocInfoWriter reloc_info_writer_
 
bytebuffer_
 
int buffer_size_
 

Static Private Attributes

static const int kBufferGap = RelocInfoWriter::kMaxSize
 
static const int kMaximalBufferSize = 512*MB
 

Detailed Description

Definition at line 1300 of file liveedit.cc.

Constructor & Destructor Documentation

◆ RelocInfoBuffer()

v8::internal::RelocInfoBuffer::RelocInfoBuffer ( int  buffer_initial_capicity,
byte pc 
)
inline

Definition at line 1302 of file liveedit.cc.

1302  {
1303  buffer_size_ = buffer_initial_capicity + kBufferGap;
1304  buffer_ = NewArray<byte>(buffer_size_);
1305 
1306  reloc_info_writer_.Reposition(buffer_ + buffer_size_, pc);
1307  }
RelocInfoWriter reloc_info_writer_
Definition: liveedit.cc:1361
static const int kBufferGap
Definition: liveedit.cc:1365
const Register pc

References buffer_, buffer_size_, kBufferGap, v8::internal::pc, and reloc_info_writer_.

◆ ~RelocInfoBuffer()

v8::internal::RelocInfoBuffer::~RelocInfoBuffer ( )
inline

Definition at line 1308 of file liveedit.cc.

1308  {
1310  }
void DeleteArray(T *array)
Definition: allocation.h:68

References buffer_, and v8::internal::DeleteArray().

+ Here is the call graph for this function:

Member Function Documentation

◆ GetResult()

Vector<byte> v8::internal::RelocInfoBuffer::GetResult ( )
inline

Definition at line 1321 of file liveedit.cc.

1321  {
1322  // Return the bytes from pos up to end of buffer.
1323  int result_size =
1324  static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer_.pos());
1325  return Vector<byte>(reloc_info_writer_.pos(), result_size);
1326  }

References buffer_, buffer_size_, and reloc_info_writer_.

Referenced by v8::internal::PatchPositionsInCode().

+ Here is the caller graph for this function:

◆ Grow()

void v8::internal::RelocInfoBuffer::Grow ( )
inlineprivate

Definition at line 1329 of file liveedit.cc.

1329  {
1330  // Compute new buffer size.
1331  int new_buffer_size;
1332  if (buffer_size_ < 2 * KB) {
1333  new_buffer_size = 4 * KB;
1334  } else {
1335  new_buffer_size = 2 * buffer_size_;
1336  }
1337  // Some internal data structures overflow for very large buffers,
1338  // they must ensure that kMaximalBufferSize is not too large.
1339  if (new_buffer_size > kMaximalBufferSize) {
1340  V8::FatalProcessOutOfMemory("RelocInfoBuffer::GrowBuffer");
1341  }
1342 
1343  // Set up new buffer.
1344  byte* new_buffer = NewArray<byte>(new_buffer_size);
1345 
1346  // Copy the data.
1347  int curently_used_size =
1348  static_cast<int>(buffer_ + buffer_size_ - reloc_info_writer_.pos());
1349  MemMove(new_buffer + new_buffer_size - curently_used_size,
1350  reloc_info_writer_.pos(), curently_used_size);
1351 
1352  reloc_info_writer_.Reposition(
1353  new_buffer + new_buffer_size - curently_used_size,
1354  reloc_info_writer_.last_pc());
1355 
1357  buffer_ = new_buffer;
1358  buffer_size_ = new_buffer_size;
1359  }
static const int kMaximalBufferSize
Definition: liveedit.cc:1366
static void FatalProcessOutOfMemory(const char *location, bool take_snapshot=false)
const int KB
Definition: globals.h:106
void MemMove(void *dest, const void *src, size_t size)
Definition: utils.h:353

References buffer_, buffer_size_, v8::internal::DeleteArray(), v8::internal::V8::FatalProcessOutOfMemory(), v8::internal::KB, kMaximalBufferSize, v8::internal::MemMove(), and reloc_info_writer_.

Referenced by Write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Write()

void v8::internal::RelocInfoBuffer::Write ( const RelocInfo rinfo)
inline

Definition at line 1314 of file liveedit.cc.

1314  {
1315  if (buffer_ + kBufferGap >= reloc_info_writer_.pos()) {
1316  Grow();
1317  }
1318  reloc_info_writer_.Write(rinfo);
1319  }

References buffer_, Grow(), kBufferGap, and reloc_info_writer_.

Referenced by v8::internal::PatchPositionsInCode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ buffer_

byte* v8::internal::RelocInfoBuffer::buffer_
private

Definition at line 1362 of file liveedit.cc.

Referenced by GetResult(), Grow(), RelocInfoBuffer(), Write(), and ~RelocInfoBuffer().

◆ buffer_size_

int v8::internal::RelocInfoBuffer::buffer_size_
private

Definition at line 1363 of file liveedit.cc.

Referenced by GetResult(), Grow(), and RelocInfoBuffer().

◆ kBufferGap

const int v8::internal::RelocInfoBuffer::kBufferGap = RelocInfoWriter::kMaxSize
staticprivate

Definition at line 1365 of file liveedit.cc.

Referenced by RelocInfoBuffer(), and Write().

◆ kMaximalBufferSize

const int v8::internal::RelocInfoBuffer::kMaximalBufferSize = 512*MB
staticprivate

Definition at line 1366 of file liveedit.cc.

Referenced by Grow().

◆ reloc_info_writer_

RelocInfoWriter v8::internal::RelocInfoBuffer::reloc_info_writer_
private

Definition at line 1361 of file liveedit.cc.

Referenced by GetResult(), Grow(), RelocInfoBuffer(), and Write().


The documentation for this class was generated from the following file: