OLD | NEW |
---|---|
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 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1650 sink_->Put(kNewObject + reference_representation_ + space, | 1650 sink_->Put(kNewObject + reference_representation_ + space, |
1651 "NewLargeObject"); | 1651 "NewLargeObject"); |
1652 sink_->PutInt(size >> kObjectAlignmentBits, "ObjectSizeInWords"); | 1652 sink_->PutInt(size >> kObjectAlignmentBits, "ObjectSizeInWords"); |
1653 if (object_->IsCode()) { | 1653 if (object_->IsCode()) { |
1654 sink_->Put(EXECUTABLE, "executable large object"); | 1654 sink_->Put(EXECUTABLE, "executable large object"); |
1655 } else { | 1655 } else { |
1656 sink_->Put(NOT_EXECUTABLE, "not executable large object"); | 1656 sink_->Put(NOT_EXECUTABLE, "not executable large object"); |
1657 } | 1657 } |
1658 back_reference = serializer_->AllocateLargeObject(size); | 1658 back_reference = serializer_->AllocateLargeObject(size); |
1659 } else { | 1659 } else { |
1660 bool needs_double_align = false; | |
1660 if (object_->NeedsToEnsureDoubleAlignment()) { | 1661 if (object_->NeedsToEnsureDoubleAlignment()) { |
1661 // Add wriggle room for double alignment padding. | 1662 // Add wriggle room for double alignment padding. |
1662 back_reference = serializer_->Allocate(space, size + kPointerSize); | 1663 back_reference = serializer_->Allocate(space, size + kPointerSize); |
1663 sink_->PutInt(kDoubleAlignmentSentinel, "DoubleAlignSentinel"); | 1664 needs_double_align = true; |
1664 } else { | 1665 } else { |
1665 back_reference = serializer_->Allocate(space, size); | 1666 back_reference = serializer_->Allocate(space, size); |
1666 } | 1667 } |
1667 sink_->Put(kNewObject + reference_representation_ + space, "NewObject"); | 1668 sink_->Put(kNewObject + reference_representation_ + space, "NewObject"); |
Yang
2014/12/10 20:47:58
How about we simply put this line (outputting the
Slava Chigrin
2014/12/11 09:16:40
I am afraid this will not work - Serializer::Alloc
| |
1669 if (needs_double_align) | |
Slava Chigrin
2014/12/10 18:13:58
Deserializer::ReadObject expects DoubleAlignmentSe
Yang
2014/12/10 20:45:48
Thanks for catching this! I guess I got confused w
| |
1670 sink_->PutInt(kDoubleAlignmentSentinel, "DoubleAlignSentinel"); | |
1668 int encoded_size = size >> kObjectAlignmentBits; | 1671 int encoded_size = size >> kObjectAlignmentBits; |
1669 DCHECK_NE(kDoubleAlignmentSentinel, encoded_size); | 1672 DCHECK_NE(kDoubleAlignmentSentinel, encoded_size); |
1670 sink_->PutInt(encoded_size, "ObjectSizeInWords"); | 1673 sink_->PutInt(encoded_size, "ObjectSizeInWords"); |
1671 } | 1674 } |
1672 | 1675 |
1673 // Mark this object as already serialized. | 1676 // Mark this object as already serialized. |
1674 serializer_->back_reference_map()->Add(object_, back_reference); | 1677 serializer_->back_reference_map()->Add(object_, back_reference); |
1675 | 1678 |
1676 // Serialize the map (first word of the object). | 1679 // Serialize the map (first word of the object). |
1677 serializer_->SerializeObject(map, kPlain, kStartOfObject, 0); | 1680 serializer_->SerializeObject(map, kPlain, kStartOfObject, 0); |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2476 return GetHeaderValue(kNumInternalizedStringsOffset); | 2479 return GetHeaderValue(kNumInternalizedStringsOffset); |
2477 } | 2480 } |
2478 | 2481 |
2479 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { | 2482 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { |
2480 int reservations_size = GetHeaderValue(kReservationsOffset) * kInt32Size; | 2483 int reservations_size = GetHeaderValue(kReservationsOffset) * kInt32Size; |
2481 const byte* start = data_ + kHeaderSize + reservations_size; | 2484 const byte* start = data_ + kHeaderSize + reservations_size; |
2482 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), | 2485 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), |
2483 GetHeaderValue(kNumCodeStubKeysOffset)); | 2486 GetHeaderValue(kNumCodeStubKeysOffset)); |
2484 } | 2487 } |
2485 } } // namespace v8::internal | 2488 } } // namespace v8::internal |
OLD | NEW |