V8 Project
mksnapshot.cc
Go to the documentation of this file.
1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <errno.h>
6 #include <stdio.h>
7 #ifdef COMPRESS_STARTUP_DATA_BZ2
8 #include <bzlib.h>
9 #endif
10 #include <signal.h>
11 
12 #include "src/v8.h"
13 
15 #include "src/assembler.h"
17 #include "src/bootstrapper.h"
18 #include "src/flags.h"
19 #include "src/list.h"
20 #include "src/natives.h"
21 #include "src/serialize.h"
22 
23 
24 using namespace v8;
25 
26 
27 class Compressor {
28  public:
29  virtual ~Compressor() {}
30  virtual bool Compress(i::Vector<i::byte> input) = 0;
31  virtual i::Vector<i::byte>* output() = 0;
32 };
33 
34 
36  public:
37  explicit SnapshotWriter(const char* snapshot_file)
38  : fp_(GetFileDescriptorOrDie(snapshot_file))
39  , raw_file_(NULL)
40  , raw_context_file_(NULL)
41  , startup_blob_file_(NULL)
42  , compressor_(NULL) {
43  }
44 
46  fclose(fp_);
47  if (raw_file_) fclose(raw_file_);
48  if (raw_context_file_) fclose(raw_context_file_);
49  if (startup_blob_file_) fclose(startup_blob_file_);
50  }
51 
52  void SetCompressor(Compressor* compressor) {
53  compressor_ = compressor;
54  }
55 
56  void SetRawFiles(const char* raw_file, const char* raw_context_file) {
57  raw_file_ = GetFileDescriptorOrDie(raw_file);
58  raw_context_file_ = GetFileDescriptorOrDie(raw_context_file);
59  }
60 
61  void SetStartupBlobFile(const char* startup_blob_file) {
62  if (startup_blob_file != NULL)
63  startup_blob_file_ = GetFileDescriptorOrDie(startup_blob_file);
64  }
65 
66  void WriteSnapshot(const i::List<i::byte>& snapshot_data,
67  const i::Serializer& serializer,
68  const i::List<i::byte>& context_snapshot_data,
69  const i::Serializer& context_serializer) const {
70  WriteSnapshotFile(snapshot_data, serializer,
71  context_snapshot_data, context_serializer);
72  MaybeWriteStartupBlob(snapshot_data, serializer,
73  context_snapshot_data, context_serializer);
74  }
75 
76  private:
77  void MaybeWriteStartupBlob(const i::List<i::byte>& snapshot_data,
78  const i::Serializer& serializer,
79  const i::List<i::byte>& context_snapshot_data,
80  const i::Serializer& context_serializer) const {
81  if (!startup_blob_file_)
82  return;
83 
84  i::List<i::byte> startup_blob;
85  i::ListSnapshotSink sink(&startup_blob);
86 
87  int spaces[] = {i::NEW_SPACE, i::OLD_POINTER_SPACE,
91 
92  i::byte* snapshot_bytes = snapshot_data.begin();
93  sink.PutBlob(snapshot_bytes, snapshot_data.length(), "snapshot");
94  for (size_t i = 0; i < arraysize(spaces); ++i)
95  sink.PutInt(serializer.CurrentAllocationAddress(spaces[i]), "spaces");
96 
97  i::byte* context_bytes = context_snapshot_data.begin();
98  sink.PutBlob(context_bytes, context_snapshot_data.length(), "context");
99  for (size_t i = 0; i < arraysize(spaces); ++i)
100  sink.PutInt(context_serializer.CurrentAllocationAddress(spaces[i]),
101  "spaces");
102 
103  size_t written = fwrite(startup_blob.begin(), 1, startup_blob.length(),
104  startup_blob_file_);
105  if (written != (size_t)startup_blob.length()) {
106  i::PrintF("Writing snapshot file failed.. Aborting.\n");
107  exit(1);
108  }
109  }
110 
111  void WriteSnapshotFile(const i::List<i::byte>& snapshot_data,
112  const i::Serializer& serializer,
113  const i::List<i::byte>& context_snapshot_data,
114  const i::Serializer& context_serializer) const {
115  WriteFilePrefix();
116  WriteData("", snapshot_data, raw_file_);
117  WriteData("context_", context_snapshot_data, raw_context_file_);
118  WriteMeta("context_", context_serializer);
119  WriteMeta("", serializer);
120  WriteFileSuffix();
121  }
122 
123  void WriteFilePrefix() const {
124  fprintf(fp_, "// Autogenerated snapshot file. Do not edit.\n\n");
125  fprintf(fp_, "#include \"src/v8.h\"\n");
126  fprintf(fp_, "#include \"src/base/platform/platform.h\"\n\n");
127  fprintf(fp_, "#include \"src/snapshot.h\"\n\n");
128  fprintf(fp_, "namespace v8 {\n");
129  fprintf(fp_, "namespace internal {\n\n");
130  }
131 
132  void WriteFileSuffix() const {
133  fprintf(fp_, "} // namespace internal\n");
134  fprintf(fp_, "} // namespace v8\n");
135  }
136 
137  void WriteData(const char* prefix, const i::List<i::byte>& source_data,
138  FILE* raw_file) const {
139  const i::List<i::byte>* data_to_be_written = NULL;
140  i::List<i::byte> compressed_data;
141  if (!compressor_) {
142  data_to_be_written = &source_data;
143  } else if (compressor_->Compress(source_data.ToVector())) {
144  compressed_data.AddAll(*compressor_->output());
145  data_to_be_written = &compressed_data;
146  } else {
147  i::PrintF("Compression failed. Aborting.\n");
148  exit(1);
149  }
150 
151  DCHECK(data_to_be_written);
152  MaybeWriteRawFile(data_to_be_written, raw_file);
153  WriteData(prefix, source_data, data_to_be_written);
154  }
155 
156  void MaybeWriteRawFile(const i::List<i::byte>* data, FILE* raw_file) const {
157  if (!data || !raw_file)
158  return;
159 
160  // Sanity check, whether i::List iterators truly return pointers to an
161  // internal array.
162  DCHECK(data->end() - data->begin() == data->length());
163 
164  size_t written = fwrite(data->begin(), 1, data->length(), raw_file);
165  if (written != (size_t)data->length()) {
166  i::PrintF("Writing raw file failed.. Aborting.\n");
167  exit(1);
168  }
169  }
170 
171  void WriteData(const char* prefix, const i::List<i::byte>& source_data,
172  const i::List<i::byte>* data_to_be_written) const {
173  fprintf(fp_, "const byte Snapshot::%sdata_[] = {\n", prefix);
174  WriteSnapshotData(data_to_be_written);
175  fprintf(fp_, "};\n");
176  fprintf(fp_, "const int Snapshot::%ssize_ = %d;\n", prefix,
177  data_to_be_written->length());
178 
179  if (data_to_be_written == &source_data) {
180  fprintf(fp_, "const byte* Snapshot::%sraw_data_ = Snapshot::%sdata_;\n",
181  prefix, prefix);
182  fprintf(fp_, "const int Snapshot::%sraw_size_ = Snapshot::%ssize_;\n",
183  prefix, prefix);
184  } else {
185  fprintf(fp_, "const byte* Snapshot::%sraw_data_ = NULL;\n", prefix);
186  fprintf(fp_, "const int Snapshot::%sraw_size_ = %d;\n",
187  prefix, source_data.length());
188  }
189  fprintf(fp_, "\n");
190  }
191 
192  void WriteMeta(const char* prefix, const i::Serializer& ser) const {
193  WriteSizeVar(ser, prefix, "new", i::NEW_SPACE);
194  WriteSizeVar(ser, prefix, "pointer", i::OLD_POINTER_SPACE);
195  WriteSizeVar(ser, prefix, "data", i::OLD_DATA_SPACE);
196  WriteSizeVar(ser, prefix, "code", i::CODE_SPACE);
197  WriteSizeVar(ser, prefix, "map", i::MAP_SPACE);
198  WriteSizeVar(ser, prefix, "cell", i::CELL_SPACE);
199  WriteSizeVar(ser, prefix, "property_cell", i::PROPERTY_CELL_SPACE);
200  WriteSizeVar(ser, prefix, "lo", i::LO_SPACE);
201  fprintf(fp_, "\n");
202  }
203 
204  void WriteSizeVar(const i::Serializer& ser, const char* prefix,
205  const char* name, int space) const {
206  fprintf(fp_, "const int Snapshot::%s%s_space_used_ = %d;\n",
207  prefix, name, ser.CurrentAllocationAddress(space));
208  }
209 
210  void WriteSnapshotData(const i::List<i::byte>* data) const {
211  for (int i = 0; i < data->length(); i++) {
212  if ((i & 0x1f) == 0x1f)
213  fprintf(fp_, "\n");
214  if (i > 0)
215  fprintf(fp_, ",");
216  fprintf(fp_, "%u", static_cast<unsigned char>(data->at(i)));
217  }
218  fprintf(fp_, "\n");
219  }
220 
221  FILE* GetFileDescriptorOrDie(const char* filename) {
222  FILE* fp = base::OS::FOpen(filename, "wb");
223  if (fp == NULL) {
224  i::PrintF("Unable to open file \"%s\" for writing.\n", filename);
225  exit(1);
226  }
227  return fp;
228  }
229 
230  FILE* fp_;
231  FILE* raw_file_;
235 };
236 
237 
238 #ifdef COMPRESS_STARTUP_DATA_BZ2
239 class BZip2Compressor : public Compressor {
240  public:
241  BZip2Compressor() : output_(NULL) {}
242  virtual ~BZip2Compressor() {
243  delete output_;
244  }
245  virtual bool Compress(i::Vector<char> input) {
246  delete output_;
247  output_ = new i::ScopedVector<char>((input.length() * 101) / 100 + 1000);
248  unsigned int output_length_ = output_->length();
249  int result = BZ2_bzBuffToBuffCompress(output_->start(), &output_length_,
250  input.start(), input.length(),
251  9, 1, 0);
252  if (result == BZ_OK) {
253  output_->Truncate(output_length_);
254  return true;
255  } else {
256  fprintf(stderr, "bzlib error code: %d\n", result);
257  return false;
258  }
259  }
260  virtual i::Vector<char>* output() { return output_; }
261 
262  private:
263  i::ScopedVector<char>* output_;
264 };
265 
266 
267 class BZip2Decompressor : public StartupDataDecompressor {
268  public:
269  virtual ~BZip2Decompressor() { }
270 
271  protected:
272  virtual int DecompressData(char* raw_data,
273  int* raw_data_size,
274  const char* compressed_data,
275  int compressed_data_size) {
278  unsigned int decompressed_size = *raw_data_size;
279  int result =
280  BZ2_bzBuffToBuffDecompress(raw_data,
281  &decompressed_size,
282  const_cast<char*>(compressed_data),
283  compressed_data_size,
284  0, 1);
285  if (result == BZ_OK) {
286  *raw_data_size = decompressed_size;
287  }
288  return result;
289  }
290 };
291 #endif
292 
293 
295  String::Utf8Value message_string(message->Get());
296  String::Utf8Value message_line(message->GetSourceLine());
297  fprintf(stderr, "%s at line %d\n", *message_string, message->GetLineNumber());
298  fprintf(stderr, "%s\n", *message_line);
299  for (int i = 0; i <= message->GetEndColumn(); ++i) {
300  fprintf(stderr, "%c", i < message->GetStartColumn() ? ' ' : '^');
301  }
302  fprintf(stderr, "\n");
303 }
304 
305 
306 int main(int argc, char** argv) {
307  // By default, log code create information in the snapshot.
308  i::FLAG_log_code = true;
309 
310  // Print the usage if an error occurs when parsing the command line
311  // flags or if the help flag is set.
312  int result = i::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
313  if (result > 0 || argc != 2 || i::FLAG_help) {
314  ::printf("Usage: %s [flag] ... outfile\n", argv[0]);
316  return !i::FLAG_help;
317  }
318 
319  i::CpuFeatures::Probe(true);
322  v8::V8::InitializePlatform(platform);
324 
325 #ifdef COMPRESS_STARTUP_DATA_BZ2
326  BZip2Decompressor natives_decompressor;
327  int bz2_result = natives_decompressor.Decompress();
328  if (bz2_result != BZ_OK) {
329  fprintf(stderr, "bzip error code: %d\n", bz2_result);
330  exit(1);
331  }
332 #endif
333  i::FLAG_logfile_per_isolate = false;
334 
335  Isolate::CreateParams params;
336  params.enable_serializer = true;
337  Isolate* isolate = v8::Isolate::New(params);
338  { Isolate::Scope isolate_scope(isolate);
339  i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
340 
341  Persistent<Context> context;
342  {
343  HandleScope handle_scope(isolate);
344  context.Reset(isolate, Context::New(isolate));
345  }
346 
347  if (context.IsEmpty()) {
348  fprintf(stderr,
349  "\nException thrown while compiling natives - see above.\n\n");
350  exit(1);
351  }
352  if (i::FLAG_extra_code != NULL) {
353  // Capture 100 frames if anything happens.
355  HandleScope scope(isolate);
356  v8::Context::Scope cscope(v8::Local<v8::Context>::New(isolate, context));
357  const char* name = i::FLAG_extra_code;
358  FILE* file = base::OS::FOpen(name, "rb");
359  if (file == NULL) {
360  fprintf(stderr, "Failed to open '%s': errno %d\n", name, errno);
361  exit(1);
362  }
363 
364  fseek(file, 0, SEEK_END);
365  int size = ftell(file);
366  rewind(file);
367 
368  char* chars = new char[size + 1];
369  chars[size] = '\0';
370  for (int i = 0; i < size;) {
371  int read = static_cast<int>(fread(&chars[i], 1, size - i, file));
372  if (read < 0) {
373  fprintf(stderr, "Failed to read '%s': errno %d\n", name, errno);
374  exit(1);
375  }
376  i += read;
377  }
378  fclose(file);
379  Local<String> source = String::NewFromUtf8(isolate, chars);
380  TryCatch try_catch;
381  Local<Script> script = Script::Compile(source);
382  if (try_catch.HasCaught()) {
383  fprintf(stderr, "Failure compiling '%s'\n", name);
384  DumpException(try_catch.Message());
385  exit(1);
386  }
387  script->Run();
388  if (try_catch.HasCaught()) {
389  fprintf(stderr, "Failure running '%s'\n", name);
390  DumpException(try_catch.Message());
391  exit(1);
392  }
393  }
394  // Make sure all builtin scripts are cached.
395  { HandleScope scope(isolate);
396  for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) {
397  internal_isolate->bootstrapper()->NativesSourceLookup(i);
398  }
399  }
400  // If we don't do this then we end up with a stray root pointing at the
401  // context even after we have disposed of the context.
402  internal_isolate->heap()->CollectAllGarbage(
403  i::Heap::kNoGCFlags, "mksnapshot");
404  i::Object* raw_context = *v8::Utils::OpenPersistent(context);
405  context.Reset();
406 
407  // This results in a somewhat smaller snapshot, probably because it gets
408  // rid of some things that are cached between garbage collections.
409  i::List<i::byte> snapshot_data;
410  i::ListSnapshotSink snapshot_sink(&snapshot_data);
411  i::StartupSerializer ser(internal_isolate, &snapshot_sink);
413 
414  i::List<i::byte> context_data;
415  i::ListSnapshotSink contex_sink(&context_data);
416  i::PartialSerializer context_ser(internal_isolate, &ser, &contex_sink);
417  context_ser.Serialize(&raw_context);
419 
420  {
421  SnapshotWriter writer(argv[1]);
422  if (i::FLAG_raw_file && i::FLAG_raw_context_file)
423  writer.SetRawFiles(i::FLAG_raw_file, i::FLAG_raw_context_file);
424  if (i::FLAG_startup_blob)
425  writer.SetStartupBlobFile(i::FLAG_startup_blob);
426  #ifdef COMPRESS_STARTUP_DATA_BZ2
427  BZip2Compressor bzip2;
428  writer.SetCompressor(&bzip2);
429  #endif
430  writer.WriteSnapshot(snapshot_data, ser, context_data, context_ser);
431  }
432  }
433 
434  isolate->Dispose();
435  V8::Dispose();
437  delete platform;
438  return 0;
439 }
virtual ~Compressor()
Definition: mksnapshot.cc:29
virtual i::Vector< i::byte > * output()=0
virtual bool Compress(i::Vector< i::byte > input)=0
void WriteSnapshot(const i::List< i::byte > &snapshot_data, const i::Serializer &serializer, const i::List< i::byte > &context_snapshot_data, const i::Serializer &context_serializer) const
Definition: mksnapshot.cc:66
void WriteData(const char *prefix, const i::List< i::byte > &source_data, const i::List< i::byte > *data_to_be_written) const
Definition: mksnapshot.cc:171
void WriteSnapshotFile(const i::List< i::byte > &snapshot_data, const i::Serializer &serializer, const i::List< i::byte > &context_snapshot_data, const i::Serializer &context_serializer) const
Definition: mksnapshot.cc:111
FILE * GetFileDescriptorOrDie(const char *filename)
Definition: mksnapshot.cc:221
void MaybeWriteStartupBlob(const i::List< i::byte > &snapshot_data, const i::Serializer &serializer, const i::List< i::byte > &context_snapshot_data, const i::Serializer &context_serializer) const
Definition: mksnapshot.cc:77
void WriteSnapshotData(const i::List< i::byte > *data) const
Definition: mksnapshot.cc:210
void WriteSizeVar(const i::Serializer &ser, const char *prefix, const char *name, int space) const
Definition: mksnapshot.cc:204
FILE * startup_blob_file_
Definition: mksnapshot.cc:233
SnapshotWriter(const char *snapshot_file)
Definition: mksnapshot.cc:37
void WriteFilePrefix() const
Definition: mksnapshot.cc:123
FILE * raw_context_file_
Definition: mksnapshot.cc:232
void WriteFileSuffix() const
Definition: mksnapshot.cc:132
void WriteData(const char *prefix, const i::List< i::byte > &source_data, FILE *raw_file) const
Definition: mksnapshot.cc:137
void SetStartupBlobFile(const char *startup_blob_file)
Definition: mksnapshot.cc:61
void SetRawFiles(const char *raw_file, const char *raw_context_file)
Definition: mksnapshot.cc:56
void SetCompressor(Compressor *compressor)
Definition: mksnapshot.cc:52
FILE * raw_file_
Definition: mksnapshot.cc:231
void MaybeWriteRawFile(const i::List< i::byte > *data, FILE *raw_file) const
Definition: mksnapshot.cc:156
void WriteMeta(const char *prefix, const i::Serializer &ser) const
Definition: mksnapshot.cc:192
Compressor * compressor_
Definition: mksnapshot.cc:234
Stack-allocated class which sets the execution context for all operations executed within a local sco...
Definition: v8.h:5579
static Local< Context > New(Isolate *isolate, ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
Creates a new context and returns a handle to the newly allocated context.
Definition: api.cc:5217
A stack-allocated class that governs a number of local handles.
Definition: v8.h:802
An object reference managed by the v8 garbage collector.
Definition: v8.h:198
Stack-allocated class which sets the isolate for all operations executed within a local scope.
Definition: v8.h:4398
Isolate represents an isolated instance of the V8 engine.
Definition: v8.h:4356
void Dispose()
Disposes the isolate.
Definition: api.cc:6609
static Isolate * New(const CreateParams &params=CreateParams())
Creates a new isolate.
Definition: api.cc:6583
A light-weight stack-allocated object handle.
Definition: v8.h:334
void Reset()
If non-empty, destroy the underlying storage cell IsEmpty() will return true after this call.
Definition: v8.h:6082
bool IsEmpty() const
Definition: v8.h:469
A PersistentBase which allows copy and assignment.
Definition: v8.h:627
V8 Platform abstraction layer.
Definition: v8-platform.h:28
static Local< Script > Compile(Handle< String > source, ScriptOrigin *origin=NULL)
A shorthand for ScriptCompiler::Compile().
Definition: api.cc:1880
A helper class for driving V8 startup data decompression.
Definition: v8.h:4899
Converts an object to a UTF-8-encoded character array.
Definition: v8.h:2048
static Local< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=kNormalString, int length=-1)
Allocates a new string from UTF-8 data.
Definition: api.cc:5447
An external exception handler.
Definition: v8.h:5271
Local< v8::Message > Message() const
Returns the message associated with this exception.
Definition: api.cc:2012
bool HasCaught() const
Returns true if an exception has been caught by this try/catch block.
Definition: api.cc:1954
static v8::internal::Handle< v8::internal::Object > OpenPersistent(const v8::Persistent< T > &persistent)
Definition: api.h:275
static bool InitializeICU(const char *icu_data_file=NULL)
Initialize the ICU library bundled with V8.
Definition: api.cc:5141
static StartupData::CompressionAlgorithm GetCompressedStartupDataAlgorithm()
The following 4 functions are to be used when V8 is built with the 'compress_startup_data' flag enabl...
Definition: api.cc:246
static void SetCaptureStackTraceForUncaughtExceptions(bool capture, int frame_limit=10, StackTrace::StackTraceOptions options=StackTrace::kOverview)
Tells V8 to capture current stack trace when uncaught exception occurs and report it to the message l...
Definition: api.cc:6340
static void InitializePlatform(Platform *platform)
Sets the v8::Platform to use.
Definition: api.cc:5048
static void ShutdownPlatform()
Clears all references to the v8::Platform.
Definition: api.cc:5053
static bool Dispose()
Releases any resources used by v8 and stops any utility threads that may be running.
Definition: api.cc:5084
static bool Initialize()
Initializes V8.
Definition: api.cc:5058
static FILE * FOpen(const char *path, const char *mode)
static void Probe(bool cross_compile)
Definition: assembler.h:172
static int SetFlagsFromCommandLine(int *argc, char **argv, bool remove_flags)
Definition: flags.cc:334
static void PrintHelp()
Definition: flags.cc:516
static const int kNoGCFlags
Definition: heap.h:716
void CollectAllGarbage(int flags, const char *gc_reason=NULL, const GCCallbackFlags gc_callback_flags=kNoGCCallbackFlags)
Definition: heap.cc:724
Bootstrapper * bootstrapper()
Definition: isolate.h:856
T & at(int i) const
Definition: list.h:69
iterator end() const
Definition: list.h:75
void AddAll(const List< T, AllocationPolicy > &other, AllocationPolicy allocator=AllocationPolicy())
Vector< T > ToVector() const
Definition: list.h:81
iterator begin() const
Definition: list.h:74
int CurrentAllocationAddress(int space) const
Definition: serialize.h:385
void PutInt(uintptr_t integer, const char *description)
void PutBlob(byte *data, int number_of_bytes, const char *description)
virtual void SerializeStrongReferences()
Definition: serialize.cc:1233
T * start() const
Definition: vector.h:47
int length() const
Definition: vector.h:41
enable harmony numeric enable harmony object literal extensions Optimize object size
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 expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
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 expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi space(in MBytes)
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 expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes A file to write the raw context snapshot bytes Write V8 startup blob file(mksnapshot only)") DEFINE_BOOL(profile_hydrogen_code_stub_compilation
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
#define DCHECK(condition)
Definition: logging.h:205
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206
#define arraysize(array)
Definition: macros.h:86
void DumpException(Handle< Message > message)
Definition: mksnapshot.cc:294
int main(int argc, char **argv)
Definition: mksnapshot.cc:306
const Register fp
void PrintF(const char *format,...)
Definition: utils.cc:80
@ OLD_DATA_SPACE
Definition: globals.h:361
@ PROPERTY_CELL_SPACE
Definition: globals.h:365
@ OLD_POINTER_SPACE
Definition: globals.h:360
uint8_t byte
Definition: globals.h:100
v8::Platform * CreateDefaultPlatform(int thread_pool_size)
Returns a new instance of the default v8::Platform implementation.
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20
Initial configuration parameters for a new Isolate.
Definition: v8.h:4361
bool enable_serializer
This flag currently renders the Isolate unusable.
Definition: v8.h:4390