V8 Project
v8::StartupDataDecompressor Class Referenceabstract

A helper class for driving V8 startup data decompression. More...

#include <v8.h>

+ Collaboration diagram for v8::StartupDataDecompressor:

Public Member Functions

 StartupDataDecompressor ()
 
virtual ~StartupDataDecompressor ()
 
int Decompress ()
 

Protected Member Functions

virtual int DecompressData (char *raw_data, int *raw_data_size, const char *compressed_data, int compressed_data_size)=0
 

Private Attributes

char ** raw_data
 

Detailed Description

A helper class for driving V8 startup data decompression.

It is based on "CompressedStartupData" API functions from the V8 class. It isn't mandatory for an embedder to use this class, instead, API functions can be used directly.

For an example of the class usage, see the "shell.cc" sample application.

Definition at line 4899 of file v8.h.

Constructor & Destructor Documentation

◆ StartupDataDecompressor()

v8::StartupDataDecompressor::StartupDataDecompressor ( )

Definition at line 205 of file api.cc.

206  : raw_data(i::NewArray<char*>(V8::GetCompressedStartupDataCount())) {
207  for (int i = 0; i < V8::GetCompressedStartupDataCount(); ++i) {
208  raw_data[i] = NULL;
209  }
210 }
static int GetCompressedStartupDataCount()
Definition: api.cc:264
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL

References v8::V8::GetCompressedStartupDataCount(), NULL, and raw_data.

+ Here is the call graph for this function:

◆ ~StartupDataDecompressor()

v8::StartupDataDecompressor::~StartupDataDecompressor ( )
virtual

Definition at line 213 of file api.cc.

213  {
214  for (int i = 0; i < V8::GetCompressedStartupDataCount(); ++i) {
216  }
218 }
void DeleteArray(T *array)
Definition: allocation.h:68

References v8::internal::DeleteArray(), v8::V8::GetCompressedStartupDataCount(), and raw_data.

+ Here is the call graph for this function:

Member Function Documentation

◆ Decompress()

int v8::StartupDataDecompressor::Decompress ( )

Definition at line 221 of file api.cc.

221  {
222  int compressed_data_count = V8::GetCompressedStartupDataCount();
223  StartupData* compressed_data =
224  i::NewArray<StartupData>(compressed_data_count);
225  V8::GetCompressedStartupData(compressed_data);
226  for (int i = 0; i < compressed_data_count; ++i) {
227  char* decompressed = raw_data[i] =
228  i::NewArray<char>(compressed_data[i].raw_size);
229  if (compressed_data[i].compressed_size != 0) {
230  int result = DecompressData(decompressed,
231  &compressed_data[i].raw_size,
232  compressed_data[i].data,
233  compressed_data[i].compressed_size);
234  if (result != 0) return result;
235  } else {
236  DCHECK_EQ(0, compressed_data[i].raw_size);
237  }
238  compressed_data[i].data = decompressed;
239  }
240  V8::SetDecompressedStartupData(compressed_data);
241  i::DeleteArray(compressed_data);
242  return 0;
243 }
virtual int DecompressData(char *raw_data, int *raw_data_size, const char *compressed_data, int compressed_data_size)=0
static void GetCompressedStartupData(StartupData *compressed_data)
Definition: api.cc:273
static void SetDecompressedStartupData(StartupData *decompressed_data)
Definition: api.cc:304
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206

References v8::StartupData::data, DCHECK_EQ, DecompressData(), v8::internal::DeleteArray(), v8::V8::GetCompressedStartupData(), v8::V8::GetCompressedStartupDataCount(), raw_data, and v8::V8::SetDecompressedStartupData().

+ Here is the call graph for this function:

◆ DecompressData()

virtual int v8::StartupDataDecompressor::DecompressData ( char *  raw_data,
int raw_data_size,
const char *  compressed_data,
int  compressed_data_size 
)
protectedpure virtual

Referenced by Decompress().

+ Here is the caller graph for this function:

Member Data Documentation

◆ raw_data

char** v8::StartupDataDecompressor::raw_data
private

Definition at line 4912 of file v8.h.

Referenced by Decompress(), StartupDataDecompressor(), and ~StartupDataDecompressor().


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