Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: src/serialize.h

Issue 39973003: Merge bleeding_edge. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: again Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/scopes.cc ('k') | src/serialize.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 332
333 void set_reservation(int space_number, int reservation) { 333 void set_reservation(int space_number, int reservation) {
334 ASSERT(space_number >= 0); 334 ASSERT(space_number >= 0);
335 ASSERT(space_number <= LAST_SPACE); 335 ASSERT(space_number <= LAST_SPACE);
336 reservations_[space_number] = reservation; 336 reservations_[space_number] = reservation;
337 } 337 }
338 338
339 private: 339 private:
340 virtual void VisitPointers(Object** start, Object** end); 340 virtual void VisitPointers(Object** start, Object** end);
341 341
342 virtual void VisitExternalReferences(Address* start, Address* end) {
343 UNREACHABLE();
344 }
345
346 virtual void VisitRuntimeEntry(RelocInfo* rinfo) { 342 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {
347 UNREACHABLE(); 343 UNREACHABLE();
348 } 344 }
349 345
350 // Allocation sites are present in the snapshot, and must be linked into 346 // Allocation sites are present in the snapshot, and must be linked into
351 // a list at deserialization time. 347 // a list at deserialization time.
352 void RelinkAllocationSite(AllocationSite* site); 348 void RelinkAllocationSite(AllocationSite* site);
353 349
354 // Fills in some heap data in an area from start to end (non-inclusive). The 350 // Fills in some heap data in an area from start to end (non-inclusive). The
355 // space id is used for the write barrier. The object_address is the address 351 // space id is used for the write barrier. The object_address is the address
356 // of the object we are writing into, or NULL if we are not writing into an 352 // of the object we are writing into, or NULL if we are not writing into an
357 // object, i.e. if we are writing a series of tagged values that are not on 353 // object, i.e. if we are writing a series of tagged values that are not on
358 // the heap. 354 // the heap.
359 void ReadChunk( 355 void ReadChunk(
360 Object** start, Object** end, int space, Address object_address); 356 Object** start, Object** end, int space, Address object_address);
361 void ReadObject(int space_number, Object** write_back); 357 void ReadObject(int space_number, Object** write_back);
362 358
363 // This routine both allocates a new object, and also keeps 359 // This routine both allocates a new object, and also keeps
364 // track of where objects have been allocated so that we can 360 // track of where objects have been allocated so that we can
365 // fix back references when deserializing. 361 // fix back references when deserializing.
366 Address Allocate(int space_index, int size) { 362 Address Allocate(int space_index, int size) {
367 Address address = high_water_[space_index]; 363 Address address = high_water_[space_index];
368 high_water_[space_index] = address + size; 364 high_water_[space_index] = address + size;
365 HeapProfiler* profiler = isolate_->heap_profiler();
366 if (profiler->is_tracking_allocations()) {
367 profiler->NewObjectEvent(address, size);
368 }
369 return address; 369 return address;
370 } 370 }
371 371
372 // This returns the address of an object that has been described in the 372 // This returns the address of an object that has been described in the
373 // snapshot as being offset bytes back in a particular space. 373 // snapshot as being offset bytes back in a particular space.
374 HeapObject* GetAddressFromEnd(int space) { 374 HeapObject* GetAddressFromEnd(int space) {
375 int offset = source_->GetInt(); 375 int offset = source_->GetInt();
376 offset <<= kObjectAlignmentBits; 376 offset <<= kObjectAlignmentBits;
377 return HeapObject::FromAddress(high_water_[space] - offset); 377 return HeapObject::FromAddress(high_water_[space] - offset);
378 } 378 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 : serializer_(serializer), 510 : serializer_(serializer),
511 object_(HeapObject::cast(o)), 511 object_(HeapObject::cast(o)),
512 sink_(sink), 512 sink_(sink),
513 reference_representation_(how_to_code + where_to_point), 513 reference_representation_(how_to_code + where_to_point),
514 bytes_processed_so_far_(0), 514 bytes_processed_so_far_(0),
515 code_object_(o->IsCode()), 515 code_object_(o->IsCode()),
516 code_has_been_output_(false) { } 516 code_has_been_output_(false) { }
517 void Serialize(); 517 void Serialize();
518 void VisitPointers(Object** start, Object** end); 518 void VisitPointers(Object** start, Object** end);
519 void VisitEmbeddedPointer(RelocInfo* target); 519 void VisitEmbeddedPointer(RelocInfo* target);
520 void VisitExternalReferences(Address* start, Address* end); 520 void VisitExternalReference(Address* p);
521 void VisitExternalReference(RelocInfo* rinfo); 521 void VisitExternalReference(RelocInfo* rinfo);
522 void VisitCodeTarget(RelocInfo* target); 522 void VisitCodeTarget(RelocInfo* target);
523 void VisitCodeEntry(Address entry_address); 523 void VisitCodeEntry(Address entry_address);
524 void VisitCell(RelocInfo* rinfo); 524 void VisitCell(RelocInfo* rinfo);
525 void VisitRuntimeEntry(RelocInfo* reloc); 525 void VisitRuntimeEntry(RelocInfo* reloc);
526 // Used for seralizing the external strings that hold the natives source. 526 // Used for seralizing the external strings that hold the natives source.
527 void VisitExternalAsciiString( 527 void VisitExternalAsciiString(
528 v8::String::ExternalAsciiStringResource** resource); 528 v8::String::ExternalAsciiStringResource** resource);
529 // We can't serialize a heap with external two byte strings. 529 // We can't serialize a heap with external two byte strings.
530 void VisitExternalTwoByteString( 530 void VisitExternalTwoByteString(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 void InitializeAllocators(); 562 void InitializeAllocators();
563 // This will return the space for an object. 563 // This will return the space for an object.
564 static int SpaceOfObject(HeapObject* object); 564 static int SpaceOfObject(HeapObject* object);
565 int Allocate(int space, int size); 565 int Allocate(int space, int size);
566 int EncodeExternalReference(Address addr) { 566 int EncodeExternalReference(Address addr) {
567 return external_reference_encoder_->Encode(addr); 567 return external_reference_encoder_->Encode(addr);
568 } 568 }
569 569
570 int SpaceAreaSize(int space); 570 int SpaceAreaSize(int space);
571 571
572 // Some roots should not be serialized, because their actual value depends on
573 // absolute addresses and they are reset after deserialization, anyway.
574 bool ShouldBeSkipped(Object** current);
575
572 Isolate* isolate_; 576 Isolate* isolate_;
573 // Keep track of the fullness of each space in order to generate 577 // Keep track of the fullness of each space in order to generate
574 // relative addresses for back references. 578 // relative addresses for back references.
575 int fullness_[LAST_SPACE + 1]; 579 int fullness_[LAST_SPACE + 1];
576 SnapshotByteSink* sink_; 580 SnapshotByteSink* sink_;
577 int current_root_index_; 581 int current_root_index_;
578 ExternalReferenceEncoder* external_reference_encoder_; 582 ExternalReferenceEncoder* external_reference_encoder_;
579 static bool serialization_enabled_; 583 static bool serialization_enabled_;
580 // Did we already make use of the fact that serialization was not enabled? 584 // Did we already make use of the fact that serialization was not enabled?
581 static bool too_late_to_enable_now_; 585 static bool too_late_to_enable_now_;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 private: 663 private:
660 virtual bool ShouldBeInThePartialSnapshotCache(HeapObject* o) { 664 virtual bool ShouldBeInThePartialSnapshotCache(HeapObject* o) {
661 return false; 665 return false;
662 } 666 }
663 }; 667 };
664 668
665 669
666 } } // namespace v8::internal 670 } } // namespace v8::internal
667 671
668 #endif // V8_SERIALIZE_H_ 672 #endif // V8_SERIALIZE_H_
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698