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
serialize.h
Go to the documentation of this file.
1 // Copyright 2012 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 #ifndef V8_SERIALIZE_H_
29 #define V8_SERIALIZE_H_
30 
31 #include "hashmap.h"
32 
33 namespace v8 {
34 namespace internal {
35 
36 // A TypeCode is used to distinguish different kinds of external reference.
37 // It is a single bit to make testing for types easy.
38 enum TypeCode {
39  UNCLASSIFIED, // One-of-a-kind references.
51 };
52 
55 
56 const int kReferenceIdBits = 16;
57 const int kReferenceIdMask = (1 << kReferenceIdBits) - 1;
59 const int kDebugRegisterBits = 4;
61 
62 
63 // ExternalReferenceTable is a helper class that defines the relationship
64 // between external references and their encodings. It is used to build
65 // hashmaps in ExternalReferenceEncoder and ExternalReferenceDecoder.
67  public:
68  static ExternalReferenceTable* instance(Isolate* isolate);
69 
71 
72  int size() const { return refs_.length(); }
73 
74  Address address(int i) { return refs_[i].address; }
75 
76  uint32_t code(int i) { return refs_[i].code; }
77 
78  const char* name(int i) { return refs_[i].name; }
79 
80  int max_id(int code) { return max_id_[code]; }
81 
82  private:
83  explicit ExternalReferenceTable(Isolate* isolate) : refs_(64) {
84  PopulateTable(isolate);
85  }
86 
87  struct ExternalReferenceEntry {
89  uint32_t code;
90  const char* name;
91  };
92 
93  void PopulateTable(Isolate* isolate);
94 
95  // For a few types of references, we can get their address from their id.
96  void AddFromId(TypeCode type,
97  uint16_t id,
98  const char* name,
99  Isolate* isolate);
100 
101  // For other types of references, the caller will figure out the address.
102  void Add(Address address, TypeCode type, uint16_t id, const char* name);
103 
104  List<ExternalReferenceEntry> refs_;
105  int max_id_[kTypeCodeCount];
106 };
107 
108 
110  public:
112 
113  uint32_t Encode(Address key) const;
114 
115  const char* NameOfAddress(Address key) const;
116 
117  private:
118  HashMap encodings_;
119  static uint32_t Hash(Address key) {
120  return static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key) >> 2);
121  }
122 
123  int IndexOf(Address key) const;
124 
125  static bool Match(void* key1, void* key2) { return key1 == key2; }
126 
127  void Put(Address key, int index);
128 
129  Isolate* isolate_;
130 };
131 
132 
134  public:
137 
138  Address Decode(uint32_t key) const {
139  if (key == 0) return NULL;
140  return *Lookup(key);
141  }
142 
143  private:
144  Address** encodings_;
145 
146  Address* Lookup(uint32_t key) const {
147  int type = key >> kReferenceTypeShift;
148  ASSERT(kFirstTypeCode <= type && type < kTypeCodeCount);
149  int id = key & kReferenceIdMask;
150  return &encodings_[type][id];
151  }
152 
153  void Put(uint32_t key, Address value) {
154  *Lookup(key) = value;
155  }
156 
157  Isolate* isolate_;
158 };
159 
160 
162  public:
163  SnapshotByteSource(const byte* array, int length)
164  : data_(array), length_(length), position_(0) { }
165 
166  bool HasMore() { return position_ < length_; }
167 
168  int Get() {
169  ASSERT(position_ < length_);
170  return data_[position_++];
171  }
172 
174 #if defined(V8_HOST_CAN_READ_UNALIGNED) && __BYTE_ORDER == __LITTLE_ENDIAN
175  int32_t answer;
176  ASSERT(position_ + sizeof(answer) <= length_ + 0u);
177  answer = *reinterpret_cast<const int32_t*>(data_ + position_);
178 #else
179  int32_t answer = data_[position_];
180  answer |= data_[position_ + 1] << 8;
181  answer |= data_[position_ + 2] << 16;
182  answer |= data_[position_ + 3] << 24;
183 #endif
184  return answer;
185  }
186 
187  void Advance(int by) { position_ += by; }
188 
189  inline void CopyRaw(byte* to, int number_of_bytes);
190 
191  inline int GetInt();
192 
193  bool AtEOF();
194 
195  int position() { return position_; }
196 
197  private:
198  const byte* data_;
199  int length_;
200  int position_;
201 };
202 
203 
204 // The Serializer/Deserializer class is a common superclass for Serializer and
205 // Deserializer which is used to store common constants and methods used by
206 // both.
207 class SerializerDeserializer: public ObjectVisitor {
208  public:
209  static void Iterate(ObjectVisitor* visitor);
210 
211  static int nop() { return kNop; }
212 
213  protected:
214  // Where the pointed-to object can be found:
215  enum Where {
216  kNewObject = 0, // Object is next in snapshot.
217  // 1-6 One per space.
218  kRootArray = 0x9, // Object is found in root array.
219  kPartialSnapshotCache = 0xa, // Object is in the cache.
220  kExternalReference = 0xb, // Pointer to an external reference.
221  kSkip = 0xc, // Skip n bytes.
222  kNop = 0xd, // Does nothing, used to pad.
223  // 0xe-0xf Free.
224  kBackref = 0x10, // Object is described relative to end.
225  // 0x11-0x16 One per space.
226  kBackrefWithSkip = 0x18, // Object is described relative to end.
227  // 0x19-0x1e One per space.
228  // 0x20-0x3f Used by misc. tags below.
230  };
231 
232  // How to code the pointer to the object.
233  enum HowToCode {
234  kPlain = 0, // Straight pointer.
235  // What this means depends on the architecture:
236  kFromCode = 0x40, // A pointer inlined in code.
238  };
239 
240  // For kRootArrayConstants
241  enum WithSkip {
245  };
246 
247  // Where to point within the object.
250  kInnerPointer = 0x80, // First insn in code object or payload of cell.
252  };
253 
254  // Misc.
255  // Raw data to be copied from the snapshot. This byte code does not advance
256  // the current pointer, which is used for code objects, where we write the
257  // entire code in one memcpy, then fix up stuff with kSkip and other byte
258  // codes that overwrite data.
259  static const int kRawData = 0x20;
260  // Some common raw lengths: 0x21-0x3f. These autoadvance the current pointer.
261  // A tag emitted at strategic points in the snapshot to delineate sections.
262  // If the deserializer does not find these at the expected moments then it
263  // is an indication that the snapshot and the VM do not fit together.
264  // Examine the build process for architecture, version or configuration
265  // mismatches.
266  static const int kSynchronize = 0x70;
267  // Used for the source code of the natives, which is in the executable, but
268  // is referred to from external strings in the snapshot.
269  static const int kNativesStringResource = 0x71;
270  static const int kRepeat = 0x72;
271  static const int kConstantRepeat = 0x73;
272  // 0x73-0x7f Repeat last word (subtract 0x72 to get the count).
273  static const int kMaxRepeats = 0x7f - 0x72;
274  static int CodeForRepeats(int repeats) {
275  ASSERT(repeats >= 1 && repeats <= kMaxRepeats);
276  return 0x72 + repeats;
277  }
278  static int RepeatsForCode(int byte_code) {
279  ASSERT(byte_code >= kConstantRepeat && byte_code <= 0x7f);
280  return byte_code - 0x72;
281  }
282  static const int kRootArrayConstants = 0xa0;
283  // 0xa0-0xbf Things from the first 32 elements of the root array.
284  static const int kRootArrayNumberOfConstantEncodings = 0x20;
285  static int RootArrayConstantFromByteCode(int byte_code) {
286  return byte_code & 0x1f;
287  }
288 
289  static const int kNumberOfSpaces = LO_SPACE;
290  static const int kAnyOldSpace = -1;
291 
292  // A bitmask for getting the space out of an instruction.
293  static const int kSpaceMask = 7;
294 };
295 
296 
298  // This way of variable-length encoding integers does not suffer from branch
299  // mispredictions.
300  uint32_t answer = GetUnalignedInt();
301  int bytes = answer & 3;
302  Advance(bytes);
303  uint32_t mask = 0xffffffffu;
304  mask >>= 32 - (bytes << 3);
305  answer &= mask;
306  answer >>= 2;
307  return answer;
308 }
309 
310 
311 void SnapshotByteSource::CopyRaw(byte* to, int number_of_bytes) {
312  memcpy(to, data_ + position_, number_of_bytes);
313  position_ += number_of_bytes;
314 }
315 
316 
317 // A Deserializer reads a snapshot and reconstructs the Object graph it defines.
319  public:
320  // Create a deserializer from a snapshot byte source.
321  explicit Deserializer(SnapshotByteSource* source);
322 
323  virtual ~Deserializer();
324 
325  // Deserialize the snapshot into an empty heap.
326  void Deserialize();
327 
328  // Deserialize a single object and the objects reachable from it.
329  void DeserializePartial(Object** root);
330 
331  void set_reservation(int space_number, int reservation) {
332  ASSERT(space_number >= 0);
333  ASSERT(space_number <= LAST_SPACE);
334  reservations_[space_number] = reservation;
335  }
336 
337  private:
338  virtual void VisitPointers(Object** start, Object** end);
339 
340  virtual void VisitExternalReferences(Address* start, Address* end) {
341  UNREACHABLE();
342  }
343 
344  virtual void VisitRuntimeEntry(RelocInfo* rinfo) {
345  UNREACHABLE();
346  }
347 
348  // Fills in some heap data in an area from start to end (non-inclusive). The
349  // space id is used for the write barrier. The object_address is the address
350  // of the object we are writing into, or NULL if we are not writing into an
351  // object, i.e. if we are writing a series of tagged values that are not on
352  // the heap.
353  void ReadChunk(
354  Object** start, Object** end, int space, Address object_address);
355  void ReadObject(int space_number, Object** write_back);
356 
357  // This routine both allocates a new object, and also keeps
358  // track of where objects have been allocated so that we can
359  // fix back references when deserializing.
360  Address Allocate(int space_index, int size) {
361  Address address = high_water_[space_index];
362  high_water_[space_index] = address + size;
363  return address;
364  }
365 
366  // This returns the address of an object that has been described in the
367  // snapshot as being offset bytes back in a particular space.
368  HeapObject* GetAddressFromEnd(int space) {
369  int offset = source_->GetInt();
370  offset <<= kObjectAlignmentBits;
371  return HeapObject::FromAddress(high_water_[space] - offset);
372  }
373 
374 
375  // Cached current isolate.
376  Isolate* isolate_;
377 
378  SnapshotByteSource* source_;
379  // This is the address of the next object that will be allocated in each
380  // space. It is used to calculate the addresses of back-references.
381  Address high_water_[LAST_SPACE + 1];
382 
383  int reservations_[LAST_SPACE + 1];
384  static const intptr_t kUninitializedReservation = -1;
385 
386  ExternalReferenceDecoder* external_reference_decoder_;
387 
388  DISALLOW_COPY_AND_ASSIGN(Deserializer);
389 };
390 
391 
393  public:
394  virtual ~SnapshotByteSink() { }
395  virtual void Put(int byte, const char* description) = 0;
396  virtual void PutSection(int byte, const char* description) {
397  Put(byte, description);
398  }
399  void PutInt(uintptr_t integer, const char* description);
400  virtual int Position() = 0;
401 };
402 
403 
404 // Mapping objects to their location after deserialization.
405 // This is used during building, but not at runtime by V8.
407  public:
409  : serialization_map_(new HashMap(&SerializationMatchFun)),
410  no_allocation_(new AssertNoAllocation()) { }
411 
413  delete serialization_map_;
414  delete no_allocation_;
415  }
416 
417  bool IsMapped(HeapObject* obj) {
418  return serialization_map_->Lookup(Key(obj), Hash(obj), false) != NULL;
419  }
420 
421  int MappedTo(HeapObject* obj) {
422  ASSERT(IsMapped(obj));
423  return static_cast<int>(reinterpret_cast<intptr_t>(
424  serialization_map_->Lookup(Key(obj), Hash(obj), false)->value));
425  }
426 
427  void AddMapping(HeapObject* obj, int to) {
428  ASSERT(!IsMapped(obj));
429  HashMap::Entry* entry =
430  serialization_map_->Lookup(Key(obj), Hash(obj), true);
431  entry->value = Value(to);
432  }
433 
434  private:
435  static bool SerializationMatchFun(void* key1, void* key2) {
436  return key1 == key2;
437  }
438 
439  static uint32_t Hash(HeapObject* obj) {
440  return static_cast<int32_t>(reinterpret_cast<intptr_t>(obj->address()));
441  }
442 
443  static void* Key(HeapObject* obj) {
444  return reinterpret_cast<void*>(obj->address());
445  }
446 
447  static void* Value(int v) {
448  return reinterpret_cast<void*>(v);
449  }
450 
451  HashMap* serialization_map_;
452  AssertNoAllocation* no_allocation_;
453  DISALLOW_COPY_AND_ASSIGN(SerializationAddressMapper);
454 };
455 
456 
457 // There can be only one serializer per V8 process.
459  public:
460  explicit Serializer(SnapshotByteSink* sink);
461  ~Serializer();
462  void VisitPointers(Object** start, Object** end);
463  // You can call this after serialization to find out how much space was used
464  // in each space.
465  int CurrentAllocationAddress(int space) {
466  ASSERT(space < kNumberOfSpaces);
467  return fullness_[space];
468  }
469 
470  static void Enable() {
471  if (!serialization_enabled_) {
473  }
474  serialization_enabled_ = true;
475  }
476 
477  static void Disable() { serialization_enabled_ = false; }
478  // Call this when you have made use of the fact that there is no serialization
479  // going on.
480  static void TooLateToEnableNow() { too_late_to_enable_now_ = true; }
481  static bool enabled() { return serialization_enabled_; }
483  void PutRoot(int index,
484  HeapObject* object,
485  HowToCode how,
486  WhereToPoint where,
487  int skip);
488 
489  protected:
490  static const int kInvalidRootIndex = -1;
491 
492  int RootIndex(HeapObject* heap_object, HowToCode from);
493  virtual bool ShouldBeInThePartialSnapshotCache(HeapObject* o) = 0;
495  void set_root_index_wave_front(intptr_t value) {
496  ASSERT(value >= root_index_wave_front_);
497  root_index_wave_front_ = value;
498  }
499 
500  class ObjectSerializer : public ObjectVisitor {
501  public:
503  Object* o,
504  SnapshotByteSink* sink,
505  HowToCode how_to_code,
506  WhereToPoint where_to_point)
507  : serializer_(serializer),
508  object_(HeapObject::cast(o)),
509  sink_(sink),
510  reference_representation_(how_to_code + where_to_point),
511  bytes_processed_so_far_(0),
512  code_object_(o->IsCode()),
513  code_has_been_output_(false) { }
514  void Serialize();
515  void VisitPointers(Object** start, Object** end);
516  void VisitEmbeddedPointer(RelocInfo* target);
517  void VisitExternalReferences(Address* start, Address* end);
518  void VisitExternalReference(RelocInfo* rinfo);
519  void VisitCodeTarget(RelocInfo* target);
520  void VisitCodeEntry(Address entry_address);
521  void VisitGlobalPropertyCell(RelocInfo* rinfo);
522  void VisitRuntimeEntry(RelocInfo* reloc);
523  // Used for seralizing the external strings that hold the natives source.
526  // We can't serialize a heap with external two byte strings.
529  UNREACHABLE();
530  }
531 
532  private:
533  enum ReturnSkip { kCanReturnSkipInsteadOfSkipping, kIgnoringReturn };
534  // This function outputs or skips the raw data between the last pointer and
535  // up to the current position. It optionally can just return the number of
536  // bytes to skip instead of performing a skip instruction, in case the skip
537  // can be merged into the next instruction.
538  int OutputRawData(Address up_to, ReturnSkip return_skip = kIgnoringReturn);
539 
540  Serializer* serializer_;
541  HeapObject* object_;
542  SnapshotByteSink* sink_;
543  int reference_representation_;
544  int bytes_processed_so_far_;
545  bool code_object_;
546  bool code_has_been_output_;
547  };
548 
549  virtual void SerializeObject(Object* o,
550  HowToCode how_to_code,
551  WhereToPoint where_to_point,
552  int skip) = 0;
554  int space,
555  int address,
556  HowToCode how_to_code,
557  WhereToPoint where_to_point,
558  int skip);
559  void InitializeAllocators();
560  // This will return the space for an object.
561  static int SpaceOfObject(HeapObject* object);
562  int Allocate(int space, int size);
564  return external_reference_encoder_->Encode(addr);
565  }
566 
567  int SpaceAreaSize(int space);
568 
570  // Keep track of the fullness of each space in order to generate
571  // relative addresses for back references.
577  // Did we already make use of the fact that serialization was not enabled?
581  void Pad();
582 
583  friend class ObjectSerializer;
584  friend class Deserializer;
585 
586  private:
588 };
589 
590 
592  public:
593  PartialSerializer(Serializer* startup_snapshot_serializer,
594  SnapshotByteSink* sink)
595  : Serializer(sink),
596  startup_serializer_(startup_snapshot_serializer) {
598  }
599 
600  // Serialize the objects reachable from a single object pointer.
601  virtual void Serialize(Object** o);
602  virtual void SerializeObject(Object* o,
603  HowToCode how_to_code,
604  WhereToPoint where_to_point,
605  int skip);
606 
607  protected:
608  virtual int PartialSnapshotCacheIndex(HeapObject* o);
610  // Scripts should be referred only through shared function infos. We can't
611  // allow them to be part of the partial snapshot because they contain a
612  // unique ID, and deserializing several partial snapshots containing script
613  // would cause dupes.
614  ASSERT(!o->IsScript());
615  return o->IsString() || o->IsSharedFunctionInfo() ||
616  o->IsHeapNumber() || o->IsCode() ||
617  o->IsScopeInfo() ||
618  o->map() == HEAP->fixed_cow_array_map();
619  }
620 
621  private:
622  Serializer* startup_serializer_;
623  DISALLOW_COPY_AND_ASSIGN(PartialSerializer);
624 };
625 
626 
628  public:
630  // Clear the cache of objects used by the partial snapshot. After the
631  // strong roots have been serialized we can create a partial snapshot
632  // which will repopulate the cache with objects needed by that partial
633  // snapshot.
634  Isolate::Current()->set_serialize_partial_snapshot_cache_length(0);
635  }
636  // Serialize the current state of the heap. The order is:
637  // 1) Strong references.
638  // 2) Partial snapshot cache.
639  // 3) Weak references (e.g. the symbol table).
640  virtual void SerializeStrongReferences();
641  virtual void SerializeObject(Object* o,
642  HowToCode how_to_code,
643  WhereToPoint where_to_point,
644  int skip);
646  void Serialize() {
649  Pad();
650  }
651 
652  private:
653  virtual bool ShouldBeInThePartialSnapshotCache(HeapObject* o) {
654  return false;
655  }
656 };
657 
658 
659 } } // namespace v8::internal
660 
661 #endif // V8_SERIALIZE_H_
byte * Address
Definition: globals.h:157
virtual void SerializeObject(Object *o, HowToCode how_to_code, WhereToPoint where_to_point, int skip)=0
static const int kInvalidRootIndex
Definition: serialize.h:490
void VisitCodeTarget(RelocInfo *target)
Definition: serialize.cc:1483
int CurrentAllocationAddress(int space)
Definition: serialize.h:465
SerializationAddressMapper address_mapper_
Definition: serialize.h:579
void CopyRaw(byte *to, int number_of_bytes)
Definition: serialize.h:311
ObjectSerializer(Serializer *serializer, Object *o, SnapshotByteSink *sink, HowToCode how_to_code, WhereToPoint where_to_point)
Definition: serialize.h:502
const int kReferenceTypeShift
Definition: serialize.h:58
void AddMapping(HeapObject *obj, int to)
Definition: serialize.h:427
virtual void Serialize(Object **o)
Definition: serialize.cc:1080
static bool too_late_to_enable_now_
Definition: serialize.h:578
Definition: v8.h:869
const int kTypeCodeCount
Definition: serialize.h:53
static int RootArrayConstantFromByteCode(int byte_code)
Definition: serialize.h:285
intptr_t root_index_wave_front()
Definition: serialize.h:494
virtual void SerializeStrongReferences()
Definition: serialize.cc:1066
Serializer(SnapshotByteSink *sink)
Definition: serialize.cc:1046
int int32_t
Definition: unicode.cc:47
int SpaceAreaSize(int space)
Definition: serialize.cc:1602
static bool enabled()
Definition: serialize.h:481
void VisitRuntimeEntry(RelocInfo *reloc)
Definition: serialize.cc:1463
#define ASSERT(condition)
Definition: checks.h:270
int EncodeExternalReference(Address addr)
Definition: serialize.h:563
unsigned short uint16_t
Definition: unicode.cc:46
void VisitPointers(Object **start, Object **end)
Definition: serialize.cc:1086
void DeserializePartial(Object **root)
Definition: serialize.cc:639
static int CodeForRepeats(int repeats)
Definition: serialize.h:274
const int kReferenceIdMask
Definition: serialize.h:57
static void Iterate(ObjectVisitor *visitor)
Definition: serialize.cc:1118
void PutInt(uintptr_t integer, const char *description)
Definition: serialize.cc:1033
Address Decode(uint32_t key) const
Definition: serialize.h:138
intptr_t root_index_wave_front_
Definition: serialize.h:580
SnapshotByteSink * sink_
Definition: serialize.h:573
void PutRoot(int index, HeapObject *object, HowToCode how, WhereToPoint where, int skip)
Definition: serialize.cc:1260
void VisitCodeEntry(Address entry_address)
Definition: serialize.cc:1493
void set_reservation(int space_number, int reservation)
Definition: serialize.h:331
void VisitPointers(Object **start, Object **end)
Definition: serialize.cc:1380
uint8_t byte
Definition: globals.h:156
void VisitExternalTwoByteString(v8::String::ExternalStringResource **resource)
Definition: serialize.h:527
#define UNREACHABLE()
Definition: checks.h:50
int fullness_[LAST_SPACE+1]
Definition: serialize.h:572
Deserializer(SnapshotByteSource *source)
Definition: serialize.cc:598
virtual int PartialSnapshotCacheIndex(HeapObject *o)
Definition: serialize.cc:1138
static const int kRootArrayConstants
Definition: serialize.h:282
static int SpaceOfObject(HeapObject *object)
Definition: serialize.cc:1581
SerializationAddressMapper * address_mapper()
Definition: serialize.h:482
static void TooLateToEnableNow()
Definition: serialize.h:480
static void Enable()
Definition: serialize.h:470
virtual void SerializeObject(Object *o, HowToCode how_to_code, WhereToPoint where_to_point, int skip)
Definition: serialize.cc:1288
static void Disable()
Definition: serialize.h:477
ExternalReferenceEncoder * external_reference_encoder_
Definition: serialize.h:575
Entry * Lookup(void *key, uint32_t hash, bool insert, AllocationPolicy allocator=AllocationPolicy())
Definition: hashmap.h:131
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: globals.h:307
const int kDebugIdShift
Definition: serialize.h:60
int Allocate(int space, int size)
Definition: serialize.cc:1594
static const int kRootArrayNumberOfConstantEncodings
Definition: serialize.h:284
uint32_t Encode(Address key) const
Definition: serialize.cc:540
static bool serialization_enabled_
Definition: serialize.h:576
static int RepeatsForCode(int byte_code)
Definition: serialize.h:278
activate correct semantics for inheriting readonliness false
Definition: flags.cc:141
void VisitExternalReferences(Address *start, Address *end)
Definition: serialize.cc:1432
void SerializeReferenceToPreviousObject(int space, int address, HowToCode how_to_code, WhereToPoint where_to_point, int skip)
Definition: serialize.cc:1187
const int kDebugRegisterBits
Definition: serialize.h:59
StartupSerializer(SnapshotByteSink *sink)
Definition: serialize.h:629
const int kObjectAlignmentBits
Definition: v8globals.h:43
TemplateHashMapImpl< FreeStoreAllocationPolicy > HashMap
Definition: hashmap.h:113
#define HEAP
Definition: isolate.h:1433
void VisitExternalAsciiString(v8::String::ExternalAsciiStringResource **resource)
Definition: serialize.cc:1510
virtual void SerializeObject(Object *o, HowToCode how_to_code, WhereToPoint where_to_point, int skip)
Definition: serialize.cc:1207
PartialSerializer(Serializer *startup_snapshot_serializer, SnapshotByteSink *sink)
Definition: serialize.h:593
void set_root_index_wave_front(intptr_t value)
Definition: serialize.h:495
static HeapObject * FromAddress(Address address)
Definition: objects-inl.h:1171
const int kFirstTypeCode
Definition: serialize.h:54
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
const int kReferenceIdBits
Definition: serialize.h:56
static const int kNativesStringResource
Definition: serialize.h:269
int RootIndex(HeapObject *heap_object, HowToCode from)
Definition: serialize.cc:1161
virtual bool ShouldBeInThePartialSnapshotCache(HeapObject *o)=0
virtual void Put(int byte, const char *description)=0
void VisitGlobalPropertyCell(RelocInfo *rinfo)
Definition: serialize.cc:1501
static ExternalReferenceTable * instance(Isolate *isolate)
Definition: serialize.cc:66
virtual bool ShouldBeInThePartialSnapshotCache(HeapObject *o)
Definition: serialize.h:609
SnapshotByteSource(const byte *array, int length)
Definition: serialize.h:163
virtual void PutSection(int byte, const char *description)
Definition: serialize.h:396
void VisitExternalReference(RelocInfo *rinfo)
Definition: serialize.cc:1448
void VisitEmbeddedPointer(RelocInfo *target)
Definition: serialize.cc:1421
const char * NameOfAddress(Address key) const
Definition: serialize.cc:548