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

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

Issue 1458833003: Version 4.6.85.32 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.6
Patch Set: Created 5 years, 1 month 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 | « src/snapshot/serialize.h ('k') | test/mjsunit/regress/regress-crbug-523919.js » ('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 // 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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 // process. It is also called on the body of each function. 653 // process. It is also called on the body of each function.
654 void Deserializer::VisitPointers(Object** start, Object** end) { 654 void Deserializer::VisitPointers(Object** start, Object** end) {
655 // The space must be new space. Any other space would cause ReadChunk to try 655 // The space must be new space. Any other space would cause ReadChunk to try
656 // to update the remembered using NULL as the address. 656 // to update the remembered using NULL as the address.
657 ReadData(start, end, NEW_SPACE, NULL); 657 ReadData(start, end, NEW_SPACE, NULL);
658 } 658 }
659 659
660 660
661 void Deserializer::DeserializeDeferredObjects() { 661 void Deserializer::DeserializeDeferredObjects() {
662 for (int code = source_.Get(); code != kSynchronize; code = source_.Get()) { 662 for (int code = source_.Get(); code != kSynchronize; code = source_.Get()) {
663 int space = code & kSpaceMask; 663 switch (code) {
664 DCHECK(space <= kNumberOfSpaces); 664 case kAlignmentPrefix:
665 DCHECK(code - space == kNewObject); 665 case kAlignmentPrefix + 1:
666 HeapObject* object = GetBackReferencedObject(space); 666 case kAlignmentPrefix + 2:
667 int size = source_.GetInt() << kPointerSizeLog2; 667 SetAlignment(code);
668 Address obj_address = object->address(); 668 break;
669 Object** start = reinterpret_cast<Object**>(obj_address + kPointerSize); 669 default: {
670 Object** end = reinterpret_cast<Object**>(obj_address + size); 670 int space = code & kSpaceMask;
671 bool filled = ReadData(start, end, space, obj_address); 671 DCHECK(space <= kNumberOfSpaces);
672 CHECK(filled); 672 DCHECK(code - space == kNewObject);
673 DCHECK(CanBeDeferred(object)); 673 HeapObject* object = GetBackReferencedObject(space);
674 PostProcessNewObject(object, space); 674 int size = source_.GetInt() << kPointerSizeLog2;
675 Address obj_address = object->address();
676 Object** start = reinterpret_cast<Object**>(obj_address + kPointerSize);
677 Object** end = reinterpret_cast<Object**>(obj_address + size);
678 bool filled = ReadData(start, end, space, obj_address);
679 CHECK(filled);
680 DCHECK(CanBeDeferred(object));
681 PostProcessNewObject(object, space);
682 }
683 }
675 } 684 }
676 } 685 }
677 686
678 687
679 // Used to insert a deserialized internalized string into the string table. 688 // Used to insert a deserialized internalized string into the string table.
680 class StringTableInsertionKey : public HashTableKey { 689 class StringTableInsertionKey : public HashTableKey {
681 public: 690 public:
682 explicit StringTableInsertionKey(String* string) 691 explicit StringTableInsertionKey(String* string)
683 : string_(string), hash_(HashForObject(string)) { 692 : string_(string), hash_(HashForObject(string)) {
684 DCHECK(string->IsInternalizedString()); 693 DCHECK(string->IsInternalizedString());
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 case kVariableRepeat: { 1204 case kVariableRepeat: {
1196 int repeats = source_.GetInt(); 1205 int repeats = source_.GetInt();
1197 Object* object = current[-1]; 1206 Object* object = current[-1];
1198 DCHECK(!isolate->heap()->InNewSpace(object)); 1207 DCHECK(!isolate->heap()->InNewSpace(object));
1199 for (int i = 0; i < repeats; i++) UnalignedCopy(current++, &object); 1208 for (int i = 0; i < repeats; i++) UnalignedCopy(current++, &object);
1200 break; 1209 break;
1201 } 1210 }
1202 1211
1203 case kAlignmentPrefix: 1212 case kAlignmentPrefix:
1204 case kAlignmentPrefix + 1: 1213 case kAlignmentPrefix + 1:
1205 case kAlignmentPrefix + 2: { 1214 case kAlignmentPrefix + 2:
1206 DCHECK_EQ(kWordAligned, next_alignment_); 1215 SetAlignment(data);
1207 next_alignment_ =
1208 static_cast<AllocationAlignment>(data - (kAlignmentPrefix - 1));
1209 break; 1216 break;
1210 }
1211 1217
1212 STATIC_ASSERT(kNumberOfRootArrayConstants == Heap::kOldSpaceRoots); 1218 STATIC_ASSERT(kNumberOfRootArrayConstants == Heap::kOldSpaceRoots);
1213 STATIC_ASSERT(kNumberOfRootArrayConstants == 32); 1219 STATIC_ASSERT(kNumberOfRootArrayConstants == 32);
1214 SIXTEEN_CASES(kRootArrayConstantsWithSkip) 1220 SIXTEEN_CASES(kRootArrayConstantsWithSkip)
1215 SIXTEEN_CASES(kRootArrayConstantsWithSkip + 16) { 1221 SIXTEEN_CASES(kRootArrayConstantsWithSkip + 16) {
1216 int skip = source_.GetInt(); 1222 int skip = source_.GetInt();
1217 current = reinterpret_cast<Object**>( 1223 current = reinterpret_cast<Object**>(
1218 reinterpret_cast<intptr_t>(current) + skip); 1224 reinterpret_cast<intptr_t>(current) + skip);
1219 // Fall through. 1225 // Fall through.
1220 } 1226 }
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 } 1981 }
1976 1982
1977 int size = object_->Size(); 1983 int size = object_->Size();
1978 Map* map = object_->map(); 1984 Map* map = object_->map();
1979 BackReference reference = serializer_->back_reference_map()->Lookup(object_); 1985 BackReference reference = serializer_->back_reference_map()->Lookup(object_);
1980 1986
1981 // Serialize the rest of the object. 1987 // Serialize the rest of the object.
1982 CHECK_EQ(0, bytes_processed_so_far_); 1988 CHECK_EQ(0, bytes_processed_so_far_);
1983 bytes_processed_so_far_ = kPointerSize; 1989 bytes_processed_so_far_ = kPointerSize;
1984 1990
1991 serializer_->PutAlignmentPrefix(object_);
1985 sink_->Put(kNewObject + reference.space(), "deferred object"); 1992 sink_->Put(kNewObject + reference.space(), "deferred object");
1986 serializer_->PutBackReference(object_, reference); 1993 serializer_->PutBackReference(object_, reference);
1987 sink_->PutInt(size >> kPointerSizeLog2, "deferred object size"); 1994 sink_->PutInt(size >> kPointerSizeLog2, "deferred object size");
1988 1995
1989 UnlinkWeakCellScope unlink_weak_cell(object_); 1996 UnlinkWeakCellScope unlink_weak_cell(object_);
1990 1997
1991 object_->IterateBody(map->instance_type(), size, this); 1998 object_->IterateBody(map->instance_type(), size, this);
1992 OutputRawData(object_->address() + size); 1999 OutputRawData(object_->address() + size);
1993 } 2000 }
1994 2001
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
2775 SerializedCodeData* scd = new SerializedCodeData(cached_data); 2782 SerializedCodeData* scd = new SerializedCodeData(cached_data);
2776 SanityCheckResult r = scd->SanityCheck(isolate, source); 2783 SanityCheckResult r = scd->SanityCheck(isolate, source);
2777 if (r == CHECK_SUCCESS) return scd; 2784 if (r == CHECK_SUCCESS) return scd;
2778 cached_data->Reject(); 2785 cached_data->Reject();
2779 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); 2786 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r);
2780 delete scd; 2787 delete scd;
2781 return NULL; 2788 return NULL;
2782 } 2789 }
2783 } // namespace internal 2790 } // namespace internal
2784 } // namespace v8 2791 } // namespace v8
OLDNEW
« no previous file with comments | « src/snapshot/serialize.h ('k') | test/mjsunit/regress/regress-crbug-523919.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698