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 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1740 } | 1740 } |
1741 | 1741 |
1742 | 1742 |
1743 void Serializer::ObjectSerializer::Serialize() { | 1743 void Serializer::ObjectSerializer::Serialize() { |
1744 if (FLAG_trace_serializer) { | 1744 if (FLAG_trace_serializer) { |
1745 PrintF(" Encoding heap object: "); | 1745 PrintF(" Encoding heap object: "); |
1746 object_->ShortPrint(); | 1746 object_->ShortPrint(); |
1747 PrintF("\n"); | 1747 PrintF("\n"); |
1748 } | 1748 } |
1749 | 1749 |
| 1750 if (object_->IsScript()) { |
| 1751 // Clear cached line ends. |
| 1752 Object* undefined = serializer_->isolate()->heap()->undefined_value(); |
| 1753 Script::cast(object_)->set_line_ends(undefined); |
| 1754 } |
| 1755 |
1750 if (object_->IsExternalString()) { | 1756 if (object_->IsExternalString()) { |
1751 Heap* heap = serializer_->isolate()->heap(); | 1757 Heap* heap = serializer_->isolate()->heap(); |
1752 if (object_->map() != heap->native_source_string_map()) { | 1758 if (object_->map() != heap->native_source_string_map()) { |
1753 // Usually we cannot recreate resources for external strings. To work | 1759 // Usually we cannot recreate resources for external strings. To work |
1754 // around this, external strings are serialized to look like ordinary | 1760 // around this, external strings are serialized to look like ordinary |
1755 // sequential strings. | 1761 // sequential strings. |
1756 // The exception are native source code strings, since we can recreate | 1762 // The exception are native source code strings, since we can recreate |
1757 // their resources. In that case we fall through and leave it to | 1763 // their resources. In that case we fall through and leave it to |
1758 // VisitExternalOneByteString further down. | 1764 // VisitExternalOneByteString further down. |
1759 SerializeExternalString(); | 1765 SerializeExternalString(); |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2470 return GetHeaderValue(kNumInternalizedStringsOffset); | 2476 return GetHeaderValue(kNumInternalizedStringsOffset); |
2471 } | 2477 } |
2472 | 2478 |
2473 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { | 2479 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { |
2474 int reservations_size = GetHeaderValue(kReservationsOffset) * kInt32Size; | 2480 int reservations_size = GetHeaderValue(kReservationsOffset) * kInt32Size; |
2475 const byte* start = data_ + kHeaderSize + reservations_size; | 2481 const byte* start = data_ + kHeaderSize + reservations_size; |
2476 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), | 2482 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), |
2477 GetHeaderValue(kNumCodeStubKeysOffset)); | 2483 GetHeaderValue(kNumCodeStubKeysOffset)); |
2478 } | 2484 } |
2479 } } // namespace v8::internal | 2485 } } // namespace v8::internal |
OLD | NEW |