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

Side by Side Diff: src/snapshot/serialize.cc

Issue 1227823004: Version 4.4.63.15 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.4
Patch Set: Created 5 years, 5 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
« no previous file with comments | « include/v8-version.h ('k') | no next file » | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 // This routine writes the new object into the pointer provided and then 739 // This routine writes the new object into the pointer provided and then
740 // returns true if the new object was in young space and false otherwise. 740 // returns true if the new object was in young space and false otherwise.
741 // The reason for this strange interface is that otherwise the object is 741 // The reason for this strange interface is that otherwise the object is
742 // written very late, which means the FreeSpace map is not set up by the 742 // written very late, which means the FreeSpace map is not set up by the
743 // time we need to use it to mark the space at the end of a page free. 743 // time we need to use it to mark the space at the end of a page free.
744 void Deserializer::ReadObject(int space_number, Object** write_back) { 744 void Deserializer::ReadObject(int space_number, Object** write_back) {
745 Address address; 745 Address address;
746 HeapObject* obj; 746 HeapObject* obj;
747 int next_int = source_.GetInt(); 747 int next_int = source_.GetInt();
748 748
749 bool double_align = false;
750 #ifndef V8_HOST_ARCH_64_BIT
751 double_align = next_int == kDoubleAlignmentSentinel;
752 if (double_align) next_int = source_.GetInt();
753 #endif
754
755 DCHECK_NE(kDoubleAlignmentSentinel, next_int); 749 DCHECK_NE(kDoubleAlignmentSentinel, next_int);
756 int size = next_int << kObjectAlignmentBits; 750 int size = next_int << kObjectAlignmentBits;
757 int reserved_size = size + (double_align ? kPointerSize : 0); 751 address = Allocate(space_number, size);
758 address = Allocate(space_number, reserved_size);
759 obj = HeapObject::FromAddress(address); 752 obj = HeapObject::FromAddress(address);
760 if (double_align) {
761 obj = isolate_->heap()->DoubleAlignForDeserialization(obj, reserved_size);
762 address = obj->address();
763 }
764 753
765 isolate_->heap()->OnAllocationEvent(obj, size); 754 isolate_->heap()->OnAllocationEvent(obj, size);
766 Object** current = reinterpret_cast<Object**>(address); 755 Object** current = reinterpret_cast<Object**>(address);
767 Object** limit = current + (size >> kPointerSizeLog2); 756 Object** limit = current + (size >> kPointerSizeLog2);
768 if (FLAG_log_snapshot_positions) { 757 if (FLAG_log_snapshot_positions) {
769 LOG(isolate_, SnapshotPositionEvent(address, source_.position())); 758 LOG(isolate_, SnapshotPositionEvent(address, source_.position()));
770 } 759 }
771 ReadData(current, limit, space_number, address); 760 ReadData(current, limit, space_number, address);
772 761
773 // TODO(mvstanton): consider treating the heap()->allocation_sites_list() 762 // TODO(mvstanton): consider treating the heap()->allocation_sites_list()
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 sink_->Put(kNewObject + reference_representation_ + space, 1653 sink_->Put(kNewObject + reference_representation_ + space,
1665 "NewLargeObject"); 1654 "NewLargeObject");
1666 sink_->PutInt(size >> kObjectAlignmentBits, "ObjectSizeInWords"); 1655 sink_->PutInt(size >> kObjectAlignmentBits, "ObjectSizeInWords");
1667 if (object_->IsCode()) { 1656 if (object_->IsCode()) {
1668 sink_->Put(EXECUTABLE, "executable large object"); 1657 sink_->Put(EXECUTABLE, "executable large object");
1669 } else { 1658 } else {
1670 sink_->Put(NOT_EXECUTABLE, "not executable large object"); 1659 sink_->Put(NOT_EXECUTABLE, "not executable large object");
1671 } 1660 }
1672 back_reference = serializer_->AllocateLargeObject(size); 1661 back_reference = serializer_->AllocateLargeObject(size);
1673 } else { 1662 } else {
1674 bool needs_double_align = false; 1663 back_reference = serializer_->Allocate(space, size);
1675 if (object_->NeedsToEnsureDoubleAlignment()) {
1676 // Add wriggle room for double alignment padding.
1677 back_reference = serializer_->Allocate(space, size + kPointerSize);
1678 needs_double_align = true;
1679 } else {
1680 back_reference = serializer_->Allocate(space, size);
1681 }
1682 sink_->Put(kNewObject + reference_representation_ + space, "NewObject"); 1664 sink_->Put(kNewObject + reference_representation_ + space, "NewObject");
1683 if (needs_double_align)
1684 sink_->PutInt(kDoubleAlignmentSentinel, "DoubleAlignSentinel");
1685 int encoded_size = size >> kObjectAlignmentBits; 1665 int encoded_size = size >> kObjectAlignmentBits;
1686 DCHECK_NE(kDoubleAlignmentSentinel, encoded_size); 1666 DCHECK_NE(kDoubleAlignmentSentinel, encoded_size);
1687 sink_->PutInt(encoded_size, "ObjectSizeInWords"); 1667 sink_->PutInt(encoded_size, "ObjectSizeInWords");
1688 } 1668 }
1689 1669
1690 #ifdef OBJECT_PRINT 1670 #ifdef OBJECT_PRINT
1691 if (FLAG_serialization_statistics) { 1671 if (FLAG_serialization_statistics) {
1692 serializer_->CountInstanceType(map, size); 1672 serializer_->CountInstanceType(map, size);
1693 } 1673 }
1694 #endif // OBJECT_PRINT 1674 #endif // OBJECT_PRINT
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
2592 DisallowHeapAllocation no_gc; 2572 DisallowHeapAllocation no_gc;
2593 SerializedCodeData* scd = new SerializedCodeData(cached_data); 2573 SerializedCodeData* scd = new SerializedCodeData(cached_data);
2594 SanityCheckResult r = scd->SanityCheck(isolate, source); 2574 SanityCheckResult r = scd->SanityCheck(isolate, source);
2595 if (r == CHECK_SUCCESS) return scd; 2575 if (r == CHECK_SUCCESS) return scd;
2596 cached_data->Reject(); 2576 cached_data->Reject();
2597 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); 2577 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r);
2598 delete scd; 2578 delete scd;
2599 return NULL; 2579 return NULL;
2600 } 2580 }
2601 } } // namespace v8::internal 2581 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8-version.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698