v8  3.14.5(node0.10.28)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
test-serialize.cc
Go to the documentation of this file.
1 // Copyright 2007-2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 #include <signal.h>
29 
30 #include "sys/stat.h"
31 #include "v8.h"
32 
33 #include "debug.h"
34 #include "ic-inl.h"
35 #include "runtime.h"
36 #include "serialize.h"
37 #include "scopeinfo.h"
38 #include "snapshot.h"
39 #include "cctest.h"
40 #include "spaces.h"
41 #include "objects.h"
42 #include "natives.h"
43 #include "bootstrapper.h"
44 
45 using namespace v8::internal;
46 
47 static const unsigned kCounters = 256;
48 static int local_counters[kCounters];
49 static const char* local_counter_names[kCounters];
50 
51 
52 static unsigned CounterHash(const char* s) {
53  unsigned hash = 0;
54  while (*++s) {
55  hash |= hash << 5;
56  hash += *s;
57  }
58  return hash;
59 }
60 
61 
62 // Callback receiver to track counters in test.
63 static int* counter_function(const char* name) {
64  unsigned hash = CounterHash(name) % kCounters;
65  unsigned original_hash = hash;
66  USE(original_hash);
67  while (true) {
68  if (local_counter_names[hash] == name) {
69  return &local_counters[hash];
70  }
71  if (local_counter_names[hash] == 0) {
72  local_counter_names[hash] = name;
73  return &local_counters[hash];
74  }
75  if (strcmp(local_counter_names[hash], name) == 0) {
76  return &local_counters[hash];
77  }
78  hash = (hash + 1) % kCounters;
79  ASSERT(hash != original_hash); // Hash table has been filled up.
80  }
81 }
82 
83 
84 template <class T>
85 static Address AddressOf(T id) {
86  return ExternalReference(id, i::Isolate::Current()).address();
87 }
88 
89 
90 template <class T>
91 static uint32_t Encode(const ExternalReferenceEncoder& encoder, T id) {
92  return encoder.Encode(AddressOf(id));
93 }
94 
95 
96 static int make_code(TypeCode type, int id) {
97  return static_cast<uint32_t>(type) << kReferenceTypeShift | id;
98 }
99 
100 
102  Isolate* isolate = i::Isolate::Current();
103  isolate->stats_table()->SetCounterFunction(counter_function);
105 
106  ExternalReferenceEncoder encoder;
107  CHECK_EQ(make_code(BUILTIN, Builtins::kArrayCode),
108  Encode(encoder, Builtins::kArrayCode));
109  CHECK_EQ(make_code(v8::internal::RUNTIME_FUNCTION, Runtime::kAbort),
110  Encode(encoder, Runtime::kAbort));
111  CHECK_EQ(make_code(IC_UTILITY, IC::kLoadCallbackProperty),
112  Encode(encoder, IC_Utility(IC::kLoadCallbackProperty)));
113  ExternalReference keyed_load_function_prototype =
114  ExternalReference(isolate->counters()->keyed_load_function_prototype());
115  CHECK_EQ(make_code(STATS_COUNTER, Counters::k_keyed_load_function_prototype),
116  encoder.Encode(keyed_load_function_prototype.address()));
117  ExternalReference stack_limit_address =
118  ExternalReference::address_of_stack_limit(isolate);
119  CHECK_EQ(make_code(UNCLASSIFIED, 4),
120  encoder.Encode(stack_limit_address.address()));
121  ExternalReference real_stack_limit_address =
122  ExternalReference::address_of_real_stack_limit(isolate);
123  CHECK_EQ(make_code(UNCLASSIFIED, 5),
124  encoder.Encode(real_stack_limit_address.address()));
125 #ifdef ENABLE_DEBUGGER_SUPPORT
126  CHECK_EQ(make_code(UNCLASSIFIED, 16),
127  encoder.Encode(ExternalReference::debug_break(isolate).address()));
128 #endif // ENABLE_DEBUGGER_SUPPORT
129  CHECK_EQ(make_code(UNCLASSIFIED, 10),
130  encoder.Encode(
131  ExternalReference::new_space_start(isolate).address()));
132  CHECK_EQ(make_code(UNCLASSIFIED, 3),
133  encoder.Encode(
134  ExternalReference::roots_array_start(isolate).address()));
135 }
136 
137 
139  Isolate* isolate = i::Isolate::Current();
140  isolate->stats_table()->SetCounterFunction(counter_function);
142 
143  ExternalReferenceDecoder decoder;
144  CHECK_EQ(AddressOf(Builtins::kArrayCode),
145  decoder.Decode(make_code(BUILTIN, Builtins::kArrayCode)));
146  CHECK_EQ(AddressOf(Runtime::kAbort),
147  decoder.Decode(make_code(v8::internal::RUNTIME_FUNCTION,
148  Runtime::kAbort)));
149  CHECK_EQ(AddressOf(IC_Utility(IC::kLoadCallbackProperty)),
150  decoder.Decode(make_code(IC_UTILITY, IC::kLoadCallbackProperty)));
151  ExternalReference keyed_load_function =
152  ExternalReference(isolate->counters()->keyed_load_function_prototype());
153  CHECK_EQ(keyed_load_function.address(),
154  decoder.Decode(
155  make_code(STATS_COUNTER,
156  Counters::k_keyed_load_function_prototype)));
157  CHECK_EQ(ExternalReference::address_of_stack_limit(isolate).address(),
158  decoder.Decode(make_code(UNCLASSIFIED, 4)));
159  CHECK_EQ(ExternalReference::address_of_real_stack_limit(isolate).address(),
160  decoder.Decode(make_code(UNCLASSIFIED, 5)));
161 #ifdef ENABLE_DEBUGGER_SUPPORT
162  CHECK_EQ(ExternalReference::debug_break(isolate).address(),
163  decoder.Decode(make_code(UNCLASSIFIED, 16)));
164 #endif // ENABLE_DEBUGGER_SUPPORT
165  CHECK_EQ(ExternalReference::new_space_start(isolate).address(),
166  decoder.Decode(make_code(UNCLASSIFIED, 10)));
167 }
168 
169 
171  public:
172  explicit FileByteSink(const char* snapshot_file) {
173  fp_ = OS::FOpen(snapshot_file, "wb");
174  file_name_ = snapshot_file;
175  if (fp_ == NULL) {
176  PrintF("Unable to write to snapshot file \"%s\"\n", snapshot_file);
177  exit(1);
178  }
179  }
180  virtual ~FileByteSink() {
181  if (fp_ != NULL) {
182  fclose(fp_);
183  }
184  }
185  virtual void Put(int byte, const char* description) {
186  if (fp_ != NULL) {
187  fputc(byte, fp_);
188  }
189  }
190  virtual int Position() {
191  return ftell(fp_);
192  }
193  void WriteSpaceUsed(
194  int new_space_used,
195  int pointer_space_used,
196  int data_space_used,
197  int code_space_used,
198  int map_space_used,
199  int cell_space_used);
200 
201  private:
202  FILE* fp_;
203  const char* file_name_;
204 };
205 
206 
208  int new_space_used,
209  int pointer_space_used,
210  int data_space_used,
211  int code_space_used,
212  int map_space_used,
213  int cell_space_used) {
214  int file_name_length = StrLength(file_name_) + 10;
215  Vector<char> name = Vector<char>::New(file_name_length + 1);
216  OS::SNPrintF(name, "%s.size", file_name_);
217  FILE* fp = OS::FOpen(name.start(), "w");
218  name.Dispose();
219  fprintf(fp, "new %d\n", new_space_used);
220  fprintf(fp, "pointer %d\n", pointer_space_used);
221  fprintf(fp, "data %d\n", data_space_used);
222  fprintf(fp, "code %d\n", code_space_used);
223  fprintf(fp, "map %d\n", map_space_used);
224  fprintf(fp, "cell %d\n", cell_space_used);
225  fclose(fp);
226 }
227 
228 
229 static bool WriteToFile(const char* snapshot_file) {
230  FileByteSink file(snapshot_file);
231  StartupSerializer ser(&file);
232  ser.Serialize();
233 
234  file.WriteSpaceUsed(
235  ser.CurrentAllocationAddress(NEW_SPACE),
236  ser.CurrentAllocationAddress(OLD_POINTER_SPACE),
237  ser.CurrentAllocationAddress(OLD_DATA_SPACE),
238  ser.CurrentAllocationAddress(CODE_SPACE),
239  ser.CurrentAllocationAddress(MAP_SPACE),
240  ser.CurrentAllocationAddress(CELL_SPACE));
241 
242  return true;
243 }
244 
245 
246 static void Serialize() {
247  // We have to create one context. One reason for this is so that the builtins
248  // can be loaded from v8natives.js and their addresses can be processed. This
249  // will clear the pending fixups array, which would otherwise contain GC roots
250  // that would confuse the serialization/deserialization process.
252  env.Dispose();
253  WriteToFile(FLAG_testing_serialization_file);
254 }
255 
256 
257 // Test that the whole heap can be serialized.
258 TEST(Serialize) {
262  Serialize();
263  }
264 }
265 
266 
267 // Test that heap serialization is non-destructive.
268 TEST(SerializeTwice) {
272  Serialize();
273  Serialize();
274  }
275 }
276 
277 
278 //----------------------------------------------------------------------------
279 // Tests that the heap can be deserialized.
280 
281 static void Deserialize() {
282  CHECK(Snapshot::Initialize(FLAG_testing_serialization_file));
283 }
284 
285 
286 static void SanityCheck() {
287  v8::HandleScope scope;
288 #ifdef VERIFY_HEAP
289  HEAP->Verify();
290 #endif
291  CHECK(Isolate::Current()->global_object()->IsJSObject());
292  CHECK(Isolate::Current()->native_context()->IsContext());
293  CHECK(HEAP->symbol_table()->IsSymbolTable());
294  CHECK(!FACTORY->LookupAsciiSymbol("Empty")->IsFailure());
295 }
296 
297 
298 DEPENDENT_TEST(Deserialize, Serialize) {
299  // The serialize-deserialize tests only work if the VM is built without
300  // serialization. That doesn't matter. We don't need to be able to
301  // serialize a snapshot in a VM that is booted from a snapshot.
303  v8::HandleScope scope;
304  Deserialize();
305 
307  env->Enter();
308 
309  SanityCheck();
310  }
311 }
312 
313 
314 DEPENDENT_TEST(DeserializeFromSecondSerialization, SerializeTwice) {
316  v8::HandleScope scope;
317  Deserialize();
318 
320  env->Enter();
321 
322  SanityCheck();
323  }
324 }
325 
326 
327 DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) {
329  v8::HandleScope scope;
330  Deserialize();
331 
333  env->Enter();
334 
335  const char* c_source = "\"1234\".length";
336  v8::Local<v8::String> source = v8::String::New(c_source);
338  CHECK_EQ(4, script->Run()->Int32Value());
339  }
340 }
341 
342 
343 DEPENDENT_TEST(DeserializeFromSecondSerializationAndRunScript2,
344  SerializeTwice) {
346  v8::HandleScope scope;
347  Deserialize();
348 
350  env->Enter();
351 
352  const char* c_source = "\"1234\".length";
353  v8::Local<v8::String> source = v8::String::New(c_source);
355  CHECK_EQ(4, script->Run()->Int32Value());
356  }
357 }
358 
359 
360 TEST(PartialSerialization) {
364 
366  ASSERT(!env.IsEmpty());
367  env->Enter();
368  // Make sure all builtin scripts are cached.
369  { HandleScope scope;
370  for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
371  Isolate::Current()->bootstrapper()->NativesSourceLookup(i);
372  }
373  }
374  HEAP->CollectAllGarbage(Heap::kNoGCFlags);
375  HEAP->CollectAllGarbage(Heap::kNoGCFlags);
376 
377  Object* raw_foo;
378  {
379  v8::HandleScope handle_scope;
381  ASSERT(!foo.IsEmpty());
382  raw_foo = *(v8::Utils::OpenHandle(*foo));
383  }
384 
385  int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
386  Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
387  OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
388 
389  env->Exit();
390  env.Dispose();
391 
392  FileByteSink startup_sink(startup_name.start());
393  StartupSerializer startup_serializer(&startup_sink);
394  startup_serializer.SerializeStrongReferences();
395 
396  FileByteSink partial_sink(FLAG_testing_serialization_file);
397  PartialSerializer p_ser(&startup_serializer, &partial_sink);
398  p_ser.Serialize(&raw_foo);
399  startup_serializer.SerializeWeakReferences();
400 
401  partial_sink.WriteSpaceUsed(
408 
409  startup_sink.WriteSpaceUsed(
410  startup_serializer.CurrentAllocationAddress(NEW_SPACE),
411  startup_serializer.CurrentAllocationAddress(OLD_POINTER_SPACE),
412  startup_serializer.CurrentAllocationAddress(OLD_DATA_SPACE),
413  startup_serializer.CurrentAllocationAddress(CODE_SPACE),
414  startup_serializer.CurrentAllocationAddress(MAP_SPACE),
415  startup_serializer.CurrentAllocationAddress(CELL_SPACE));
416  startup_name.Dispose();
417  }
418 }
419 
420 
421 static void ReserveSpaceForSnapshot(Deserializer* deserializer,
422  const char* file_name) {
423  int file_name_length = StrLength(file_name) + 10;
424  Vector<char> name = Vector<char>::New(file_name_length + 1);
425  OS::SNPrintF(name, "%s.size", file_name);
426  FILE* fp = OS::FOpen(name.start(), "r");
427  name.Dispose();
428  int new_size, pointer_size, data_size, code_size, map_size, cell_size;
429 #ifdef _MSC_VER
430  // Avoid warning about unsafe fscanf from MSVC.
431  // Please note that this is only fine if %c and %s are not being used.
432 #define fscanf fscanf_s
433 #endif
434  CHECK_EQ(1, fscanf(fp, "new %d\n", &new_size));
435  CHECK_EQ(1, fscanf(fp, "pointer %d\n", &pointer_size));
436  CHECK_EQ(1, fscanf(fp, "data %d\n", &data_size));
437  CHECK_EQ(1, fscanf(fp, "code %d\n", &code_size));
438  CHECK_EQ(1, fscanf(fp, "map %d\n", &map_size));
439  CHECK_EQ(1, fscanf(fp, "cell %d\n", &cell_size));
440 #ifdef _MSC_VER
441 #undef fscanf
442 #endif
443  fclose(fp);
444  deserializer->set_reservation(NEW_SPACE, new_size);
445  deserializer->set_reservation(OLD_POINTER_SPACE, pointer_size);
446  deserializer->set_reservation(OLD_DATA_SPACE, data_size);
447  deserializer->set_reservation(CODE_SPACE, code_size);
448  deserializer->set_reservation(MAP_SPACE, map_size);
449  deserializer->set_reservation(CELL_SPACE, cell_size);
450 }
451 
452 
453 DEPENDENT_TEST(PartialDeserialization, PartialSerialization) {
454  if (!Snapshot::IsEnabled()) {
455  int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
456  Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
457  OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
458 
459  CHECK(Snapshot::Initialize(startup_name.start()));
460  startup_name.Dispose();
461 
462  const char* file_name = FLAG_testing_serialization_file;
463 
464  int snapshot_size = 0;
465  byte* snapshot = ReadBytes(file_name, &snapshot_size);
466 
467  Object* root;
468  {
469  SnapshotByteSource source(snapshot, snapshot_size);
470  Deserializer deserializer(&source);
471  ReserveSpaceForSnapshot(&deserializer, file_name);
472  deserializer.DeserializePartial(&root);
473  CHECK(root->IsString());
474  }
475  v8::HandleScope handle_scope;
476  Handle<Object> root_handle(root);
477 
478 
479  Object* root2;
480  {
481  SnapshotByteSource source(snapshot, snapshot_size);
482  Deserializer deserializer(&source);
483  ReserveSpaceForSnapshot(&deserializer, file_name);
484  deserializer.DeserializePartial(&root2);
485  CHECK(root2->IsString());
486  CHECK(*root_handle == root2);
487  }
488  }
489 }
490 
491 
492 TEST(ContextSerialization) {
496 
498  ASSERT(!env.IsEmpty());
499  env->Enter();
500  // Make sure all builtin scripts are cached.
501  { HandleScope scope;
502  for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
503  Isolate::Current()->bootstrapper()->NativesSourceLookup(i);
504  }
505  }
506  // If we don't do this then we end up with a stray root pointing at the
507  // context even after we have disposed of env.
508  HEAP->CollectAllGarbage(Heap::kNoGCFlags);
509 
510  int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
511  Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
512  OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
513 
514  env->Exit();
515 
516  Object* raw_context = *(v8::Utils::OpenHandle(*env));
517 
518  env.Dispose();
519 
520  FileByteSink startup_sink(startup_name.start());
521  StartupSerializer startup_serializer(&startup_sink);
522  startup_serializer.SerializeStrongReferences();
523 
524  FileByteSink partial_sink(FLAG_testing_serialization_file);
525  PartialSerializer p_ser(&startup_serializer, &partial_sink);
526  p_ser.Serialize(&raw_context);
527  startup_serializer.SerializeWeakReferences();
528 
529  partial_sink.WriteSpaceUsed(
536 
537  startup_sink.WriteSpaceUsed(
538  startup_serializer.CurrentAllocationAddress(NEW_SPACE),
539  startup_serializer.CurrentAllocationAddress(OLD_POINTER_SPACE),
540  startup_serializer.CurrentAllocationAddress(OLD_DATA_SPACE),
541  startup_serializer.CurrentAllocationAddress(CODE_SPACE),
542  startup_serializer.CurrentAllocationAddress(MAP_SPACE),
543  startup_serializer.CurrentAllocationAddress(CELL_SPACE));
544  startup_name.Dispose();
545  }
546 }
547 
548 
549 DEPENDENT_TEST(ContextDeserialization, ContextSerialization) {
551  int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
552  Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
553  OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
554 
555  CHECK(Snapshot::Initialize(startup_name.start()));
556  startup_name.Dispose();
557 
558  const char* file_name = FLAG_testing_serialization_file;
559 
560  int snapshot_size = 0;
561  byte* snapshot = ReadBytes(file_name, &snapshot_size);
562 
563  Object* root;
564  {
565  SnapshotByteSource source(snapshot, snapshot_size);
566  Deserializer deserializer(&source);
567  ReserveSpaceForSnapshot(&deserializer, file_name);
568  deserializer.DeserializePartial(&root);
569  CHECK(root->IsContext());
570  }
571  v8::HandleScope handle_scope;
572  Handle<Object> root_handle(root);
573 
574 
575  Object* root2;
576  {
577  SnapshotByteSource source(snapshot, snapshot_size);
578  Deserializer deserializer(&source);
579  ReserveSpaceForSnapshot(&deserializer, file_name);
580  deserializer.DeserializePartial(&root2);
581  CHECK(root2->IsContext());
582  CHECK(*root_handle != root2);
583  }
584  }
585 }
586 
587 
588 TEST(TestThatAlwaysSucceeds) {
589 }
590 
591 
592 TEST(TestThatAlwaysFails) {
593  bool ArtificialFailure = false;
594  CHECK(ArtificialFailure);
595 }
596 
597 
598 DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) {
599  bool ArtificialFailure2 = false;
600  CHECK(ArtificialFailure2);
601 }
byte * Address
Definition: globals.h:157
virtual int Position()
int CurrentAllocationAddress(int space)
Definition: serialize.h:465
static Local< Script > Compile(Handle< String > source, ScriptOrigin *origin=NULL, ScriptData *pre_data=NULL, Handle< String > script_data=Handle< String >())
Definition: api.cc:1568
#define CHECK_EQ(expected, value)
Definition: checks.h:219
void Dispose()
Definition: v8.h:4235
const int kReferenceTypeShift
Definition: serialize.h:58
void PrintF(const char *format,...)
Definition: v8utils.cc:40
virtual void Serialize(Object **o)
Definition: serialize.cc:1080
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if expose natives in global object expose gc extension number of stack frames to capture disable builtin natives files print a stack trace if an assertion failure occurs use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations prepare for turning on always opt minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions automatically set the debug break flag when debugger commands are in the queue always cause a debug break before aborting maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print more details following each garbage collection print amount of external allocated memory after each time it is adjusted flush code that we expect not to use again before full gc do incremental marking steps track object counts and memory usage use caching Perform compaction on every full GC Never perform compaction on full GC testing only Compact code space on full incremental collections Default seed for initializing random allows verbose printing trace parsing and preparsing Check icache flushes in ARM and MIPS simulator Stack alingment in bytes in print stack trace when throwing exceptions randomize hashes to avoid predictable hash Fixed seed to use to hash property activate a timer that switches between V8 threads testing_bool_flag float flag Seed used for threading test randomness A filename with extra code to be included in the snapshot(mksnapshot only)") DEFINE_bool(help
StatsTable * stats_table()
Definition: isolate.cc:1952
static V8EXPORT Local< String > New(const char *data, int length=-1)
Definition: api.cc:4779
void WriteSpaceUsed(int new_space_used, int pointer_space_used, int data_space_used, int code_space_used, int map_space_used, int cell_space_used)
#define ASSERT(condition)
Definition: checks.h:270
static bool IsEnabled()
Definition: snapshot.h:49
void DeserializePartial(Object **root)
Definition: serialize.cc:639
#define CHECK(condition)
Definition: checks.h:56
byte * ReadBytes(const char *filename, int *size, bool verbose)
Definition: v8utils.cc:163
Address Decode(uint32_t key) const
Definition: serialize.h:138
void SetCounterFunction(CounterLookupCallback f)
Definition: counters.h:45
void set_reservation(int space_number, int reservation)
Definition: serialize.h:331
int foo
uint8_t byte
Definition: globals.h:156
T * start() const
Definition: utils.h:390
static const int kNoGCFlags
Definition: heap.h:1081
static FILE * FOpen(const char *path, const char *mode)
static void Enable()
Definition: serialize.h:470
uint32_t Encode(Address key) const
Definition: serialize.cc:540
static Vector< T > New(int length)
Definition: utils.h:370
int StrLength(const char *string)
Definition: utils.h:234
#define T(name, string, precedence)
Definition: token.cc:48
static int SNPrintF(Vector< char > str, const char *format,...)
static bool HaveASnapshotToStartFrom()
virtual void Put(int byte, const char *description)
DEPENDENT_TEST(Deserialize, Serialize)
#define HEAP
Definition: isolate.h:1433
void USE(T)
Definition: globals.h:289
Counters * counters()
Definition: isolate.h:819
bool IsEmpty() const
Definition: v8.h:209
Local< Value > Run()
Definition: api.cc:1598
#define FACTORY
Definition: isolate.h:1434
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if NULL
Definition: flags.cc:301
static Persistent< Context > New(ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
Definition: api.cc:4411
FileByteSink(const char *snapshot_file)
const Register fp
static bool Initialize(const char *snapshot_file=NULL)
virtual ~FileByteSink()
Definition: v8.h:106
static bool Initialize()
Definition: api.cc:4269