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

Side by Side Diff: src/serialize.cc

Issue 893533003: Revert "Make GCC happy again." and "Initial switch to Chromium-style CHECK_* and DCHECK_* macros.". (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « src/serialize.h ('k') | src/unique.h » ('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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 return; 88 return;
89 } 89 }
90 Add(address, type, id, name); 90 Add(address, type, id, name);
91 } 91 }
92 92
93 93
94 void ExternalReferenceTable::Add(Address address, 94 void ExternalReferenceTable::Add(Address address,
95 TypeCode type, 95 TypeCode type,
96 uint16_t id, 96 uint16_t id,
97 const char* name) { 97 const char* name) {
98 DCHECK_NOT_NULL(address); 98 DCHECK_NE(NULL, address);
99 ExternalReferenceEntry entry; 99 ExternalReferenceEntry entry;
100 entry.address = address; 100 entry.address = address;
101 entry.code = EncodeExternal(type, id); 101 entry.code = EncodeExternal(type, id);
102 entry.name = name; 102 entry.name = name;
103 DCHECK_NE(0u, entry.code); 103 DCHECK_NE(0, entry.code);
104 // Assert that the code is added in ascending order to rule out duplicates. 104 // Assert that the code is added in ascending order to rule out duplicates.
105 DCHECK((size() == 0) || (code(size() - 1) < entry.code)); 105 DCHECK((size() == 0) || (code(size() - 1) < entry.code));
106 refs_.Add(entry); 106 refs_.Add(entry);
107 if (id > max_id_[type]) max_id_[type] = id; 107 if (id > max_id_[type]) max_id_[type] = id;
108 } 108 }
109 109
110 110
111 void ExternalReferenceTable::PopulateTable(Isolate* isolate) { 111 void ExternalReferenceTable::PopulateTable(Isolate* isolate) {
112 for (int type_code = 0; type_code < kTypeCodeCount; type_code++) { 112 for (int type_code = 0; type_code < kTypeCodeCount; type_code++) {
113 max_id_[type_code] = 0; 113 max_id_[type_code] = 0;
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 #endif // DEBUG 640 #endif // DEBUG
641 if (!isolate_->heap()->ReserveSpace(reservations_)) return false; 641 if (!isolate_->heap()->ReserveSpace(reservations_)) return false;
642 for (int i = 0; i < kNumberOfPreallocatedSpaces; i++) { 642 for (int i = 0; i < kNumberOfPreallocatedSpaces; i++) {
643 high_water_[i] = reservations_[i][0].start; 643 high_water_[i] = reservations_[i][0].start;
644 } 644 }
645 return true; 645 return true;
646 } 646 }
647 647
648 648
649 void Deserializer::Initialize(Isolate* isolate) { 649 void Deserializer::Initialize(Isolate* isolate) {
650 DCHECK_NULL(isolate_); 650 DCHECK_EQ(NULL, isolate_);
651 DCHECK_NOT_NULL(isolate); 651 DCHECK_NE(NULL, isolate);
652 isolate_ = isolate; 652 isolate_ = isolate;
653 DCHECK_NULL(external_reference_decoder_); 653 DCHECK_EQ(NULL, external_reference_decoder_);
654 external_reference_decoder_ = new ExternalReferenceDecoder(isolate); 654 external_reference_decoder_ = new ExternalReferenceDecoder(isolate);
655 } 655 }
656 656
657 657
658 void Deserializer::Deserialize(Isolate* isolate) { 658 void Deserializer::Deserialize(Isolate* isolate) {
659 Initialize(isolate); 659 Initialize(isolate);
660 if (!ReserveSpace()) FatalProcessOutOfMemory("deserializing context"); 660 if (!ReserveSpace()) FatalProcessOutOfMemory("deserializing context");
661 // No active threads. 661 // No active threads.
662 DCHECK_NULL(isolate_->thread_manager()->FirstThreadStateInUse()); 662 DCHECK_EQ(NULL, isolate_->thread_manager()->FirstThreadStateInUse());
663 // No active handles. 663 // No active handles.
664 DCHECK(isolate_->handle_scope_implementer()->blocks()->is_empty()); 664 DCHECK(isolate_->handle_scope_implementer()->blocks()->is_empty());
665 isolate_->heap()->IterateSmiRoots(this); 665 isolate_->heap()->IterateSmiRoots(this);
666 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG); 666 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG);
667 isolate_->heap()->RepairFreeListsAfterDeserialization(); 667 isolate_->heap()->RepairFreeListsAfterDeserialization();
668 isolate_->heap()->IterateWeakRoots(this, VISIT_ALL); 668 isolate_->heap()->IterateWeakRoots(this, VISIT_ALL);
669 669
670 isolate_->heap()->set_native_contexts_list( 670 isolate_->heap()->set_native_contexts_list(
671 isolate_->heap()->undefined_value()); 671 isolate_->heap()->undefined_value());
672 isolate_->heap()->set_array_buffers_list( 672 isolate_->heap()->set_array_buffers_list(
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 AlwaysAllocateScope scope(isolate_); 918 AlwaysAllocateScope scope(isolate_);
919 LargeObjectSpace* lo_space = isolate_->heap()->lo_space(); 919 LargeObjectSpace* lo_space = isolate_->heap()->lo_space();
920 Executability exec = static_cast<Executability>(source_.Get()); 920 Executability exec = static_cast<Executability>(source_.Get());
921 AllocationResult result = lo_space->AllocateRaw(size, exec); 921 AllocationResult result = lo_space->AllocateRaw(size, exec);
922 HeapObject* obj = HeapObject::cast(result.ToObjectChecked()); 922 HeapObject* obj = HeapObject::cast(result.ToObjectChecked());
923 deserialized_large_objects_.Add(obj); 923 deserialized_large_objects_.Add(obj);
924 return obj->address(); 924 return obj->address();
925 } else { 925 } else {
926 DCHECK(space_index < kNumberOfPreallocatedSpaces); 926 DCHECK(space_index < kNumberOfPreallocatedSpaces);
927 Address address = high_water_[space_index]; 927 Address address = high_water_[space_index];
928 DCHECK_NOT_NULL(address); 928 DCHECK_NE(NULL, address);
929 high_water_[space_index] += size; 929 high_water_[space_index] += size;
930 #ifdef DEBUG 930 #ifdef DEBUG
931 // Assert that the current reserved chunk is still big enough. 931 // Assert that the current reserved chunk is still big enough.
932 const Heap::Reservation& reservation = reservations_[space_index]; 932 const Heap::Reservation& reservation = reservations_[space_index];
933 int chunk_index = current_chunk_[space_index]; 933 int chunk_index = current_chunk_[space_index];
934 CHECK_LE(high_water_[space_index], reservation[chunk_index].end); 934 CHECK_LE(high_water_[space_index], reservation[chunk_index].end);
935 #endif 935 #endif
936 return address; 936 return address;
937 } 937 }
938 } 938 }
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 1359
1360 Serializer::~Serializer() { 1360 Serializer::~Serializer() {
1361 delete external_reference_encoder_; 1361 delete external_reference_encoder_;
1362 if (code_address_map_ != NULL) delete code_address_map_; 1362 if (code_address_map_ != NULL) delete code_address_map_;
1363 } 1363 }
1364 1364
1365 1365
1366 void StartupSerializer::SerializeStrongReferences() { 1366 void StartupSerializer::SerializeStrongReferences() {
1367 Isolate* isolate = this->isolate(); 1367 Isolate* isolate = this->isolate();
1368 // No active threads. 1368 // No active threads.
1369 CHECK_NULL(isolate->thread_manager()->FirstThreadStateInUse()); 1369 CHECK_EQ(NULL, isolate->thread_manager()->FirstThreadStateInUse());
1370 // No active or weak handles. 1370 // No active or weak handles.
1371 CHECK(isolate->handle_scope_implementer()->blocks()->is_empty()); 1371 CHECK(isolate->handle_scope_implementer()->blocks()->is_empty());
1372 CHECK_EQ(0, isolate->global_handles()->NumberOfWeakHandles()); 1372 CHECK_EQ(0, isolate->global_handles()->NumberOfWeakHandles());
1373 CHECK_EQ(0, isolate->eternal_handles()->NumberOfHandles()); 1373 CHECK_EQ(0, isolate->eternal_handles()->NumberOfHandles());
1374 // We don't support serializing installed extensions. 1374 // We don't support serializing installed extensions.
1375 CHECK(!isolate->has_installed_extensions()); 1375 CHECK(!isolate->has_installed_extensions());
1376 isolate->heap()->IterateSmiRoots(this); 1376 isolate->heap()->IterateSmiRoots(this);
1377 isolate->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG); 1377 isolate->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG);
1378 } 1378 }
1379 1379
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2548 return GetHeaderValue(kNumInternalizedStringsOffset); 2548 return GetHeaderValue(kNumInternalizedStringsOffset);
2549 } 2549 }
2550 2550
2551 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { 2551 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const {
2552 int reservations_size = GetHeaderValue(kReservationsOffset) * kInt32Size; 2552 int reservations_size = GetHeaderValue(kReservationsOffset) * kInt32Size;
2553 const byte* start = data_ + kHeaderSize + reservations_size; 2553 const byte* start = data_ + kHeaderSize + reservations_size;
2554 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), 2554 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start),
2555 GetHeaderValue(kNumCodeStubKeysOffset)); 2555 GetHeaderValue(kNumCodeStubKeysOffset));
2556 } 2556 }
2557 } } // namespace v8::internal 2557 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/serialize.h ('k') | src/unique.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698