v8  3.11.10(node0.8.26)
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  int large_space_used);
201 
202  private:
203  FILE* fp_;
204  const char* file_name_;
205 };
206 
207 
209  int new_space_used,
210  int pointer_space_used,
211  int data_space_used,
212  int code_space_used,
213  int map_space_used,
214  int cell_space_used,
215  int large_space_used) {
216  int file_name_length = StrLength(file_name_) + 10;
217  Vector<char> name = Vector<char>::New(file_name_length + 1);
218  OS::SNPrintF(name, "%s.size", file_name_);
219  FILE* fp = OS::FOpen(name.start(), "w");
220  name.Dispose();
221  fprintf(fp, "new %d\n", new_space_used);
222  fprintf(fp, "pointer %d\n", pointer_space_used);
223  fprintf(fp, "data %d\n", data_space_used);
224  fprintf(fp, "code %d\n", code_space_used);
225  fprintf(fp, "map %d\n", map_space_used);
226  fprintf(fp, "cell %d\n", cell_space_used);
227  fprintf(fp, "large %d\n", large_space_used);
228  fclose(fp);
229 }
230 
231 
232 static bool WriteToFile(const char* snapshot_file) {
233  FileByteSink file(snapshot_file);
234  StartupSerializer ser(&file);
235  ser.Serialize();
236  return true;
237 }
238 
239 
240 static void Serialize() {
241  // We have to create one context. One reason for this is so that the builtins
242  // can be loaded from v8natives.js and their addresses can be processed. This
243  // will clear the pending fixups array, which would otherwise contain GC roots
244  // that would confuse the serialization/deserialization process.
246  env.Dispose();
247  WriteToFile(FLAG_testing_serialization_file);
248 }
249 
250 
251 // Test that the whole heap can be serialized.
252 TEST(Serialize) {
255  Serialize();
256 }
257 
258 
259 // Test that heap serialization is non-destructive.
260 TEST(SerializeTwice) {
263  Serialize();
264  Serialize();
265 }
266 
267 
268 //----------------------------------------------------------------------------
269 // Tests that the heap can be deserialized.
270 
271 static void Deserialize() {
272  CHECK(Snapshot::Initialize(FLAG_testing_serialization_file));
273 }
274 
275 
276 static void SanityCheck() {
277  v8::HandleScope scope;
278 #ifdef DEBUG
279  HEAP->Verify();
280 #endif
281  CHECK(Isolate::Current()->global()->IsJSObject());
282  CHECK(Isolate::Current()->global_context()->IsContext());
283  CHECK(HEAP->symbol_table()->IsSymbolTable());
284  CHECK(!FACTORY->LookupAsciiSymbol("Empty")->IsFailure());
285 }
286 
287 
288 DEPENDENT_TEST(Deserialize, Serialize) {
289  // The serialize-deserialize tests only work if the VM is built without
290  // serialization. That doesn't matter. We don't need to be able to
291  // serialize a snapshot in a VM that is booted from a snapshot.
292  if (!Snapshot::IsEnabled()) {
293  v8::HandleScope scope;
294  Deserialize();
295 
297  env->Enter();
298 
299  SanityCheck();
300  }
301 }
302 
303 
304 DEPENDENT_TEST(DeserializeFromSecondSerialization, SerializeTwice) {
305  if (!Snapshot::IsEnabled()) {
306  v8::HandleScope scope;
307  Deserialize();
308 
310  env->Enter();
311 
312  SanityCheck();
313  }
314 }
315 
316 
317 DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) {
318  if (!Snapshot::IsEnabled()) {
319  v8::HandleScope scope;
320  Deserialize();
321 
323  env->Enter();
324 
325  const char* c_source = "\"1234\".length";
326  v8::Local<v8::String> source = v8::String::New(c_source);
328  CHECK_EQ(4, script->Run()->Int32Value());
329  }
330 }
331 
332 
333 DEPENDENT_TEST(DeserializeFromSecondSerializationAndRunScript2,
334  SerializeTwice) {
335  if (!Snapshot::IsEnabled()) {
336  v8::HandleScope scope;
337  Deserialize();
338 
340  env->Enter();
341 
342  const char* c_source = "\"1234\".length";
343  v8::Local<v8::String> source = v8::String::New(c_source);
345  CHECK_EQ(4, script->Run()->Int32Value());
346  }
347 }
348 
349 
350 TEST(PartialSerialization) {
353 
355  ASSERT(!env.IsEmpty());
356  env->Enter();
357  // Make sure all builtin scripts are cached.
358  { HandleScope scope;
359  for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
360  Isolate::Current()->bootstrapper()->NativesSourceLookup(i);
361  }
362  }
363  HEAP->CollectAllGarbage(Heap::kNoGCFlags);
364  HEAP->CollectAllGarbage(Heap::kNoGCFlags);
365 
366  Object* raw_foo;
367  {
368  v8::HandleScope handle_scope;
370  ASSERT(!foo.IsEmpty());
371  raw_foo = *(v8::Utils::OpenHandle(*foo));
372  }
373 
374  int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
375  Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
376  OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
377 
378  env->Exit();
379  env.Dispose();
380 
381  FileByteSink startup_sink(startup_name.start());
382  startup_name.Dispose();
383  StartupSerializer startup_serializer(&startup_sink);
384  startup_serializer.SerializeStrongReferences();
385 
386  FileByteSink partial_sink(FLAG_testing_serialization_file);
387  PartialSerializer p_ser(&startup_serializer, &partial_sink);
388  p_ser.Serialize(&raw_foo);
389  startup_serializer.SerializeWeakReferences();
397 }
398 
399 
400 static void ReserveSpaceForPartialSnapshot(const char* file_name) {
401  int file_name_length = StrLength(file_name) + 10;
402  Vector<char> name = Vector<char>::New(file_name_length + 1);
403  OS::SNPrintF(name, "%s.size", file_name);
404  FILE* fp = OS::FOpen(name.start(), "r");
405  name.Dispose();
406  int new_size, pointer_size, data_size, code_size, map_size, cell_size;
407  int large_size;
408 #ifdef _MSC_VER
409  // Avoid warning about unsafe fscanf from MSVC.
410  // Please note that this is only fine if %c and %s are not being used.
411 #define fscanf fscanf_s
412 #endif
413  CHECK_EQ(1, fscanf(fp, "new %d\n", &new_size));
414  CHECK_EQ(1, fscanf(fp, "pointer %d\n", &pointer_size));
415  CHECK_EQ(1, fscanf(fp, "data %d\n", &data_size));
416  CHECK_EQ(1, fscanf(fp, "code %d\n", &code_size));
417  CHECK_EQ(1, fscanf(fp, "map %d\n", &map_size));
418  CHECK_EQ(1, fscanf(fp, "cell %d\n", &cell_size));
419  CHECK_EQ(1, fscanf(fp, "large %d\n", &large_size));
420 #ifdef _MSC_VER
421 #undef fscanf
422 #endif
423  fclose(fp);
424  HEAP->ReserveSpace(new_size,
425  pointer_size,
426  data_size,
427  code_size,
428  map_size,
429  cell_size,
430  large_size);
431 }
432 
433 
434 DEPENDENT_TEST(PartialDeserialization, PartialSerialization) {
435  if (!Snapshot::IsEnabled()) {
436  int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
437  Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
438  OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
439 
440  CHECK(Snapshot::Initialize(startup_name.start()));
441  startup_name.Dispose();
442 
443  const char* file_name = FLAG_testing_serialization_file;
444  ReserveSpaceForPartialSnapshot(file_name);
445 
446  int snapshot_size = 0;
447  byte* snapshot = ReadBytes(file_name, &snapshot_size);
448 
449  Object* root;
450  {
451  SnapshotByteSource source(snapshot, snapshot_size);
452  Deserializer deserializer(&source);
453  deserializer.DeserializePartial(&root);
454  CHECK(root->IsString());
455  }
456  v8::HandleScope handle_scope;
457  Handle<Object> root_handle(root);
458 
459  ReserveSpaceForPartialSnapshot(file_name);
460 
461  Object* root2;
462  {
463  SnapshotByteSource source(snapshot, snapshot_size);
464  Deserializer deserializer(&source);
465  deserializer.DeserializePartial(&root2);
466  CHECK(root2->IsString());
467  CHECK(*root_handle == root2);
468  }
469  }
470 }
471 
472 
473 TEST(ContextSerialization) {
476 
478  ASSERT(!env.IsEmpty());
479  env->Enter();
480  // Make sure all builtin scripts are cached.
481  { HandleScope scope;
482  for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
483  Isolate::Current()->bootstrapper()->NativesSourceLookup(i);
484  }
485  }
486  // If we don't do this then we end up with a stray root pointing at the
487  // context even after we have disposed of env.
488  HEAP->CollectAllGarbage(Heap::kNoGCFlags);
489 
490  int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
491  Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
492  OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
493 
494  env->Exit();
495 
496  Object* raw_context = *(v8::Utils::OpenHandle(*env));
497 
498  env.Dispose();
499 
500  FileByteSink startup_sink(startup_name.start());
501  startup_name.Dispose();
502  StartupSerializer startup_serializer(&startup_sink);
503  startup_serializer.SerializeStrongReferences();
504 
505  FileByteSink partial_sink(FLAG_testing_serialization_file);
506  PartialSerializer p_ser(&startup_serializer, &partial_sink);
507  p_ser.Serialize(&raw_context);
508  startup_serializer.SerializeWeakReferences();
516 }
517 
518 
519 DEPENDENT_TEST(ContextDeserialization, ContextSerialization) {
520  if (!Snapshot::IsEnabled()) {
521  int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
522  Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
523  OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
524 
525  CHECK(Snapshot::Initialize(startup_name.start()));
526  startup_name.Dispose();
527 
528  const char* file_name = FLAG_testing_serialization_file;
529  ReserveSpaceForPartialSnapshot(file_name);
530 
531  int snapshot_size = 0;
532  byte* snapshot = ReadBytes(file_name, &snapshot_size);
533 
534  Object* root;
535  {
536  SnapshotByteSource source(snapshot, snapshot_size);
537  Deserializer deserializer(&source);
538  deserializer.DeserializePartial(&root);
539  CHECK(root->IsContext());
540  }
541  v8::HandleScope handle_scope;
542  Handle<Object> root_handle(root);
543 
544  ReserveSpaceForPartialSnapshot(file_name);
545 
546  Object* root2;
547  {
548  SnapshotByteSource source(snapshot, snapshot_size);
549  Deserializer deserializer(&source);
550  deserializer.DeserializePartial(&root2);
551  CHECK(root2->IsContext());
552  CHECK(*root_handle != root2);
553  }
554  }
555 }
556 
557 
558 TEST(LinearAllocation) {
560  int new_space_max = 512 * KB;
561  int paged_space_max = Page::kMaxNonCodeHeapObjectSize;
562  int code_space_max = HEAP->code_space()->AreaSize();
563 
564  for (int size = 1000; size < 5 * MB; size += size >> 1) {
565  size &= ~8; // Round.
566  int new_space_size = (size < new_space_max) ? size : new_space_max;
567  int paged_space_size = (size < paged_space_max) ? size : paged_space_max;
568  HEAP->ReserveSpace(
569  new_space_size,
570  paged_space_size, // Old pointer space.
571  paged_space_size, // Old data space.
572  HEAP->code_space()->RoundSizeDownToObjectAlignment(code_space_max),
573  HEAP->map_space()->RoundSizeDownToObjectAlignment(paged_space_size),
574  HEAP->cell_space()->RoundSizeDownToObjectAlignment(paged_space_size),
575  size); // Large object space.
576  LinearAllocationScope linear_allocation_scope;
577  const int kSmallFixedArrayLength = 4;
578  const int kSmallFixedArraySize =
579  FixedArray::kHeaderSize + kSmallFixedArrayLength * kPointerSize;
580  const int kSmallStringLength = 16;
581  const int kSmallStringSize =
582  (SeqAsciiString::kHeaderSize + kSmallStringLength +
584  const int kMapSize = Map::kSize;
585 
586  Object* new_last = NULL;
587  for (int i = 0;
588  i + kSmallFixedArraySize <= new_space_size;
589  i += kSmallFixedArraySize) {
590  Object* obj =
591  HEAP->AllocateFixedArray(kSmallFixedArrayLength)->ToObjectChecked();
592  if (new_last != NULL) {
593  CHECK(reinterpret_cast<char*>(obj) ==
594  reinterpret_cast<char*>(new_last) + kSmallFixedArraySize);
595  }
596  new_last = obj;
597  }
598 
599  Object* pointer_last = NULL;
600  for (int i = 0;
601  i + kSmallFixedArraySize <= paged_space_size;
602  i += kSmallFixedArraySize) {
603  Object* obj = HEAP->AllocateFixedArray(kSmallFixedArrayLength,
604  TENURED)->ToObjectChecked();
605  int old_page_fullness = i % Page::kPageSize;
606  int page_fullness = (i + kSmallFixedArraySize) % Page::kPageSize;
607  if (page_fullness < old_page_fullness ||
608  page_fullness > HEAP->old_pointer_space()->AreaSize()) {
609  i = RoundUp(i, Page::kPageSize);
610  pointer_last = NULL;
611  }
612  if (pointer_last != NULL) {
613  CHECK(reinterpret_cast<char*>(obj) ==
614  reinterpret_cast<char*>(pointer_last) + kSmallFixedArraySize);
615  }
616  pointer_last = obj;
617  }
618 
619  Object* data_last = NULL;
620  for (int i = 0;
621  i + kSmallStringSize <= paged_space_size;
622  i += kSmallStringSize) {
623  Object* obj = HEAP->AllocateRawAsciiString(kSmallStringLength,
624  TENURED)->ToObjectChecked();
625  int old_page_fullness = i % Page::kPageSize;
626  int page_fullness = (i + kSmallStringSize) % Page::kPageSize;
627  if (page_fullness < old_page_fullness ||
628  page_fullness > HEAP->old_data_space()->AreaSize()) {
629  i = RoundUp(i, Page::kPageSize);
630  data_last = NULL;
631  }
632  if (data_last != NULL) {
633  CHECK(reinterpret_cast<char*>(obj) ==
634  reinterpret_cast<char*>(data_last) + kSmallStringSize);
635  }
636  data_last = obj;
637  }
638 
639  Object* map_last = NULL;
640  for (int i = 0; i + kMapSize <= paged_space_size; i += kMapSize) {
641  Object* obj = HEAP->AllocateMap(JS_OBJECT_TYPE,
642  42 * kPointerSize)->ToObjectChecked();
643  int old_page_fullness = i % Page::kPageSize;
644  int page_fullness = (i + kMapSize) % Page::kPageSize;
645  if (page_fullness < old_page_fullness ||
646  page_fullness > HEAP->map_space()->AreaSize()) {
647  i = RoundUp(i, Page::kPageSize);
648  map_last = NULL;
649  }
650  if (map_last != NULL) {
651  CHECK(reinterpret_cast<char*>(obj) ==
652  reinterpret_cast<char*>(map_last) + kMapSize);
653  }
654  map_last = obj;
655  }
656 
657  if (size > Page::kMaxNonCodeHeapObjectSize) {
658  // Support for reserving space in large object space is not there yet,
659  // but using an always-allocate scope is fine for now.
661  int large_object_array_length =
662  (size - FixedArray::kHeaderSize) / kPointerSize;
663  Object* obj = HEAP->AllocateFixedArray(large_object_array_length,
664  TENURED)->ToObjectChecked();
665  CHECK(!obj->IsFailure());
666  }
667  }
668 }
669 
670 
671 TEST(TestThatAlwaysSucceeds) {
672 }
673 
674 
675 TEST(TestThatAlwaysFails) {
676  bool ArtificialFailure = false;
677  CHECK(ArtificialFailure);
678 }
679 
680 
681 DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) {
682  bool ArtificialFailure2 = false;
683  CHECK(ArtificialFailure2);
684 }
byte * Address
Definition: globals.h:172
virtual int Position()
int CurrentAllocationAddress(int space)
Definition: serialize.h:464
static Local< Script > Compile(Handle< String > source, ScriptOrigin *origin=NULL, ScriptData *pre_data=NULL, Handle< String > script_data=Handle< String >())
Definition: api.cc:1560
#define CHECK_EQ(expected, value)
Definition: checks.h:219
void Dispose()
Definition: v8.h:4065
const int kReferenceTypeShift
Definition: serialize.h:58
void PrintF(const char *format,...)
Definition: v8utils.cc:40
virtual void Serialize(Object **o)
Definition: serialize.cc:1150
const int KB
Definition: globals.h:221
StatsTable * stats_table()
Definition: isolate.cc:1885
value format" "after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false, "print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false, "print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false, "report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true, "garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true, "flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true, "use incremental marking") DEFINE_bool(incremental_marking_steps, true, "do incremental marking steps") DEFINE_bool(trace_incremental_marking, false, "trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true, "Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false, "Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true, "use inline caching") DEFINE_bool(native_code_counters, false, "generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false, "Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true, "Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false, "Never perform compaction on full GC-testing only") DEFINE_bool(compact_code_space, true, "Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true, "Flush inline caches prior to mark compact collection and" "flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0, "Default seed for initializing random generator" "(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true, "allows verbose printing") DEFINE_bool(allow_natives_syntax, false, "allow natives syntax") DEFINE_bool(trace_sim, false, "Trace simulator execution") DEFINE_bool(check_icache, false, "Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0, "Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8, "Stack alingment in bytes in simulator(4 or 8, 8 is default)") DEFINE_bool(trace_exception, false, "print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false, "preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true, "randomize hashes to avoid predictable hash collisions" "(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0, "Fixed seed to use to hash property keys(0 means random)" "(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false, "activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") DEFINE_int(testing_int_flag, 13, "testing_int_flag") DEFINE_float(testing_float_flag, 2.5, "float-flag") DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") DEFINE_int(testing_prng_seed, 42, "Seed used for threading test randomness") DEFINE_string(testing_serialization_file, "/tmp/serdes", "file in which to serialize heap") DEFINE_bool(help, false, "Print usage message, including flags, on console") DEFINE_bool(dump_counters, false, "Dump counters on exit") DEFINE_string(map_counters, "", "Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT, "Pass all remaining arguments to the script.Alias for\"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#43"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2#define FLAG_MODE_DEFINE_DEFAULTS#1"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flag-definitions.h"1#define FLAG_FULL(ftype, ctype, nam, def, cmt)#define FLAG_READONLY(ftype, ctype, nam, def, cmt)#define DEFINE_implication(whenflag, thenflag)#define DEFINE_bool(nam, def, cmt)#define DEFINE_int(nam, def, cmt)#define DEFINE_float(nam, def, cmt)#define DEFINE_string(nam, def, cmt)#define DEFINE_args(nam, def, cmt)#define FLAG DEFINE_bool(use_strict, false,"enforce strict mode") DEFINE_bool(es5_readonly, false,"activate correct semantics for inheriting readonliness") DEFINE_bool(es52_globals, false,"activate new semantics for global var declarations") DEFINE_bool(harmony_typeof, false,"enable harmony semantics for typeof") DEFINE_bool(harmony_scoping, false,"enable harmony block scoping") DEFINE_bool(harmony_modules, false,"enable harmony modules (implies block scoping)") DEFINE_bool(harmony_proxies, false,"enable harmony proxies") DEFINE_bool(harmony_collections, false,"enable harmony collections (sets, maps, and weak maps)") DEFINE_bool(harmony, false,"enable all harmony features (except typeof)") DEFINE_implication(harmony, harmony_scoping) DEFINE_implication(harmony, harmony_modules) DEFINE_implication(harmony, harmony_proxies) DEFINE_implication(harmony, harmony_collections) DEFINE_implication(harmony_modules, harmony_scoping) DEFINE_bool(packed_arrays, false,"optimizes arrays that have no holes") DEFINE_bool(smi_only_arrays, true,"tracks arrays with only smi values") DEFINE_bool(clever_optimizations, true,"Optimize object size, Array shift, DOM strings and string +") DEFINE_bool(unbox_double_arrays, true,"automatically unbox arrays of doubles") DEFINE_bool(string_slices, true,"use string slices") DEFINE_bool(crankshaft, true,"use crankshaft") DEFINE_string(hydrogen_filter,"","optimization filter") DEFINE_bool(use_range, true,"use hydrogen range analysis") DEFINE_bool(eliminate_dead_phis, true,"eliminate dead phis") DEFINE_bool(use_gvn, true,"use hydrogen global value numbering") DEFINE_bool(use_canonicalizing, true,"use hydrogen instruction canonicalizing") DEFINE_bool(use_inlining, true,"use function inlining") DEFINE_int(max_inlined_source_size, 600,"maximum source size in bytes considered for a single inlining") DEFINE_int(max_inlined_nodes, 196,"maximum number of AST nodes considered for a single inlining") DEFINE_int(max_inlined_nodes_cumulative, 196,"maximum cumulative number of AST nodes considered for inlining") DEFINE_bool(loop_invariant_code_motion, true,"loop invariant code motion") DEFINE_bool(collect_megamorphic_maps_from_stub_cache, true,"crankshaft harvests type feedback from stub cache") DEFINE_bool(hydrogen_stats, false,"print statistics for hydrogen") DEFINE_bool(trace_hydrogen, false,"trace generated hydrogen to file") DEFINE_string(trace_phase,"Z","trace generated IR for specified phases") DEFINE_bool(trace_inlining, false,"trace inlining decisions") DEFINE_bool(trace_alloc, false,"trace register allocator") DEFINE_bool(trace_all_uses, false,"trace all use positions") DEFINE_bool(trace_range, false,"trace range analysis") DEFINE_bool(trace_gvn, false,"trace global value numbering") DEFINE_bool(trace_representation, false,"trace representation types") DEFINE_bool(stress_pointer_maps, false,"pointer map for every instruction") DEFINE_bool(stress_environments, false,"environment for every instruction") DEFINE_int(deopt_every_n_times, 0,"deoptimize every n times a deopt point is passed") DEFINE_bool(trap_on_deopt, false,"put a break point before deoptimizing") DEFINE_bool(deoptimize_uncommon_cases, true,"deoptimize uncommon cases") DEFINE_bool(polymorphic_inlining, true,"polymorphic inlining") DEFINE_bool(use_osr, true,"use on-stack replacement") DEFINE_bool(array_bounds_checks_elimination, false,"perform array bounds checks elimination") DEFINE_bool(array_index_dehoisting, false,"perform array index dehoisting") DEFINE_bool(trace_osr, false,"trace on-stack replacement") DEFINE_int(stress_runs, 0,"number of stress runs") DEFINE_bool(optimize_closures, true,"optimize closures") DEFINE_bool(inline_construct, true,"inline constructor calls") DEFINE_bool(inline_arguments, true,"inline functions with arguments object") DEFINE_int(loop_weight, 1,"loop weight for representation inference") DEFINE_bool(optimize_for_in, true,"optimize functions containing for-in loops") DEFINE_bool(experimental_profiler, true,"enable all profiler experiments") DEFINE_bool(watch_ic_patching, false,"profiler considers IC stability") DEFINE_int(frame_count, 1,"number of stack frames inspected by the profiler") DEFINE_bool(self_optimization, false,"primitive functions trigger their own optimization") DEFINE_bool(direct_self_opt, false,"call recompile stub directly when self-optimizing") DEFINE_bool(retry_self_opt, false,"re-try self-optimization if it failed") DEFINE_bool(count_based_interrupts, false,"trigger profiler ticks based on counting instead of timing") DEFINE_bool(interrupt_at_exit, false,"insert an interrupt check at function exit") DEFINE_bool(weighted_back_edges, false,"weight back edges by jump distance for interrupt triggering") DEFINE_int(interrupt_budget, 5900,"execution budget before interrupt is triggered") DEFINE_int(type_info_threshold, 15,"percentage of ICs that must have type info to allow optimization") DEFINE_int(self_opt_count, 130,"call count before self-optimization") DEFINE_implication(experimental_profiler, watch_ic_patching) DEFINE_implication(experimental_profiler, self_optimization) DEFINE_implication(experimental_profiler, retry_self_opt) DEFINE_implication(experimental_profiler, count_based_interrupts) DEFINE_implication(experimental_profiler, interrupt_at_exit) DEFINE_implication(experimental_profiler, weighted_back_edges) DEFINE_bool(trace_opt_verbose, false,"extra verbose compilation tracing") DEFINE_implication(trace_opt_verbose, trace_opt) DEFINE_bool(debug_code, false,"generate extra code (assertions) for debugging") DEFINE_bool(code_comments, false,"emit comments in code disassembly") DEFINE_bool(enable_sse2, true,"enable use of SSE2 instructions if available") DEFINE_bool(enable_sse3, true,"enable use of SSE3 instructions if available") DEFINE_bool(enable_sse4_1, true,"enable use of SSE4.1 instructions if available") DEFINE_bool(enable_cmov, true,"enable use of CMOV instruction if available") DEFINE_bool(enable_rdtsc, true,"enable use of RDTSC instruction if available") DEFINE_bool(enable_sahf, true,"enable use of SAHF instruction if available (X64 only)") DEFINE_bool(enable_vfp3, true,"enable use of VFP3 instructions if available - this implies ""enabling ARMv7 instructions (ARM only)") DEFINE_bool(enable_armv7, true,"enable use of ARMv7 instructions if available (ARM only)") DEFINE_bool(enable_fpu, true,"enable use of MIPS FPU instructions if available (MIPS only)") DEFINE_string(expose_natives_as, NULL,"expose natives in global object") DEFINE_string(expose_debug_as, NULL,"expose debug in global object") DEFINE_bool(expose_gc, false,"expose gc extension") DEFINE_bool(expose_externalize_string, false,"expose externalize string extension") DEFINE_int(stack_trace_limit, 10,"number of stack frames to capture") DEFINE_bool(builtins_in_stack_traces, false,"show built-in functions in stack traces") DEFINE_bool(disable_native_files, false,"disable builtin natives files") DEFINE_bool(inline_new, true,"use fast inline allocation") DEFINE_bool(stack_trace_on_abort, true,"print a stack trace if an assertion failure occurs") DEFINE_bool(trace, false,"trace function calls") DEFINE_bool(mask_constants_with_cookie, true,"use random jit cookie to mask large constants") DEFINE_bool(lazy, true,"use lazy compilation") DEFINE_bool(trace_opt, false,"trace lazy optimization") DEFINE_bool(trace_opt_stats, false,"trace lazy optimization statistics") DEFINE_bool(opt, true,"use adaptive optimizations") DEFINE_bool(always_opt, false,"always try to optimize functions") DEFINE_bool(prepare_always_opt, false,"prepare for turning on always opt") DEFINE_bool(trace_deopt, false,"trace deoptimization") DEFINE_int(min_preparse_length, 1024,"minimum length for automatic enable preparsing") DEFINE_bool(always_full_compiler, false,"try to use the dedicated run-once backend for all code") DEFINE_bool(trace_bailout, false,"print reasons for falling back to using the classic V8 backend") DEFINE_bool(compilation_cache, true,"enable compilation cache") DEFINE_bool(cache_prototype_transitions, true,"cache prototype transitions") DEFINE_bool(trace_debug_json, false,"trace debugging JSON request/response") DEFINE_bool(debugger_auto_break, true,"automatically set the debug break flag when debugger commands are ""in the queue") DEFINE_bool(enable_liveedit, true,"enable liveedit experimental feature") DEFINE_bool(break_on_abort, true,"always cause a debug break before aborting") DEFINE_int(stack_size, kPointerSize *123,"default size of stack region v8 is allowed to use (in kBytes)") DEFINE_int(max_stack_trace_source_length, 300,"maximum length of function source code printed in a stack trace.") DEFINE_bool(always_inline_smi_code, false,"always inline smi code in non-opt code") DEFINE_int(max_new_space_size, 0,"max size of the new generation (in kBytes)") DEFINE_int(max_old_space_size, 0,"max size of the old generation (in Mbytes)") DEFINE_int(max_executable_size, 0,"max size of executable memory (in Mbytes)") DEFINE_bool(gc_global, false,"always perform global GCs") DEFINE_int(gc_interval,-1,"garbage collect after <n> allocations") DEFINE_bool(trace_gc, false,"print one trace line following each garbage collection") DEFINE_bool(trace_gc_nvp, false,"print one detailed trace line in name=value format ""after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false,"print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false,"print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false,"report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true,"garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true,"flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true,"use incremental marking") DEFINE_bool(incremental_marking_steps, true,"do incremental marking steps") DEFINE_bool(trace_incremental_marking, false,"trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true,"Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false,"Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true,"use inline caching") DEFINE_bool(native_code_counters, false,"generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false,"Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true,"Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false,"Never perform compaction on full GC - testing only") DEFINE_bool(compact_code_space, true,"Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true,"Flush inline caches prior to mark compact collection and ""flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0,"Default seed for initializing random generator ""(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true,"allows verbose printing") DEFINE_bool(allow_natives_syntax, false,"allow natives syntax") DEFINE_bool(trace_sim, false,"Trace simulator execution") DEFINE_bool(check_icache, false,"Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0,"Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8,"Stack alingment in bytes in simulator (4 or 8, 8 is default)") DEFINE_bool(trace_exception, false,"print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false,"preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true,"randomize hashes to avoid predictable hash collisions ""(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0,"Fixed seed to use to hash property keys (0 means random)""(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false,"activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true,"generate optimized regexp code") DEFINE_bool(testing_bool_flag, true,"testing_bool_flag") DEFINE_int(testing_int_flag, 13,"testing_int_flag") DEFINE_float(testing_float_flag, 2.5,"float-flag") DEFINE_string(testing_string_flag,"Hello, world!","string-flag") DEFINE_int(testing_prng_seed, 42,"Seed used for threading test randomness") DEFINE_string(testing_serialization_file,"/tmp/serdes","file in which to serialize heap") DEFINE_bool(help, false,"Print usage message, including flags, on console") DEFINE_bool(dump_counters, false,"Dump counters on exit") DEFINE_string(map_counters,"","Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT,"Pass all remaining arguments to the script. Alias for \"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#47"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2 namespace{struct Flag{enum FlagType{TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_ARGS} name
Definition: flags.cc:1349
static V8EXPORT Local< String > New(const char *data, int length=-1)
Definition: api.cc:4655
virtual void SerializeStrongReferences()
Definition: serialize.cc:1136
#define ASSERT(condition)
Definition: checks.h:270
static bool IsEnabled()
Definition: snapshot.h:47
void DeserializePartial(Object **root)
Definition: serialize.cc:699
#define CHECK(condition)
Definition: checks.h:56
byte * ReadBytes(const char *filename, int *size, bool verbose)
Definition: v8utils.cc:154
Address Decode(uint32_t key) const
Definition: serialize.h:138
const intptr_t kObjectAlignmentMask
Definition: v8globals.h:45
static const int kPageSize
Definition: spaces.h:695
void SetCounterFunction(CounterLookupCallback f)
Definition: counters.h:45
int foo
uint8_t byte
Definition: globals.h:171
T * start() const
Definition: utils.h:389
static const int kNoGCFlags
Definition: heap.h:1049
const int kPointerSize
Definition: globals.h:234
static FILE * FOpen(const char *path, const char *mode)
static void Enable()
Definition: serialize.h:469
T RoundUp(T x, intptr_t m)
Definition: utils.h:150
static const int kSize
Definition: objects.h:4972
static const int kMaxNonCodeHeapObjectSize
Definition: spaces.h:701
static const int kHeaderSize
Definition: objects.h:7282
uint32_t Encode(Address key) const
Definition: serialize.cc:527
static Vector< T > New(int length)
Definition: utils.h:369
int StrLength(const char *string)
Definition: utils.h:234
#define T(name, string, precedence)
Definition: token.cc:48
static const int kHeaderSize
Definition: objects.h:2233
static int SNPrintF(Vector< char > str, const char *format,...)
virtual void Put(int byte, const char *description)
DEPENDENT_TEST(Deserialize, Serialize)
#define HEAP
Definition: isolate.h:1408
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 trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt 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 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
Definition: flags.cc:274
void USE(T)
Definition: globals.h:303
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, int large_space_used)
Counters * counters()
Definition: isolate.h:804
bool IsEmpty() const
Definition: v8.h:208
Local< Value > Run()
Definition: api.cc:1590
#define FACTORY
Definition: isolate.h:1409
static Persistent< Context > New(ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
Definition: api.cc:4308
FileByteSink(const char *snapshot_file)
const Register fp
static bool Initialize(const char *snapshot_file=NULL)
virtual ~FileByteSink()
Definition: v8.h:105
static bool Initialize()
Definition: api.cc:4204
FlagType type() const
Definition: flags.cc:1358
static v8::internal::Handle< v8::internal::TemplateInfo > OpenHandle(const Template *that)