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

Side by Side Diff: src/serialize.cc

Issue 11590005: Fix -Wstrict-aliasing warnings.
Patch Set: Created 8 years 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/hydrogen.cc ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 i++) { 1147 i++) {
1148 Object* entry = isolate->serialize_partial_snapshot_cache()[i]; 1148 Object* entry = isolate->serialize_partial_snapshot_cache()[i];
1149 if (entry == heap_object) return i; 1149 if (entry == heap_object) return i;
1150 } 1150 }
1151 1151
1152 // We didn't find the object in the cache. So we add it to the cache and 1152 // We didn't find the object in the cache. So we add it to the cache and
1153 // then visit the pointer so that it becomes part of the startup snapshot 1153 // then visit the pointer so that it becomes part of the startup snapshot
1154 // and we can refer to it from the partial snapshot. 1154 // and we can refer to it from the partial snapshot.
1155 int length = isolate->serialize_partial_snapshot_cache_length(); 1155 int length = isolate->serialize_partial_snapshot_cache_length();
1156 isolate->PushToPartialSnapshotCache(heap_object); 1156 isolate->PushToPartialSnapshotCache(heap_object);
1157 startup_serializer_->VisitPointer(reinterpret_cast<Object**>(&heap_object)); 1157
1158 // Avoid type-punning compiler warnings.
1159 union {
1160 HeapObject** in;
1161 Object** out;
1162 } u;
1163 u.in = &heap_object;
1164 startup_serializer_->VisitPointer(u.out);
1165
1158 // We don't recurse from the startup snapshot generator into the partial 1166 // We don't recurse from the startup snapshot generator into the partial
1159 // snapshot generator. 1167 // snapshot generator.
1160 ASSERT(length == isolate->serialize_partial_snapshot_cache_length() - 1); 1168 ASSERT(length == isolate->serialize_partial_snapshot_cache_length() - 1);
1161 return length; 1169 return length;
1162 } 1170 }
1163 1171
1164 1172
1165 int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) { 1173 int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) {
1166 Heap* heap = HEAP; 1174 Heap* heap = HEAP;
1167 if (heap->InNewSpace(heap_object)) return kInvalidRootIndex; 1175 if (heap->InNewSpace(heap_object)) return kInvalidRootIndex;
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 1631
1624 bool SnapshotByteSource::AtEOF() { 1632 bool SnapshotByteSource::AtEOF() {
1625 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; 1633 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false;
1626 for (int x = position_; x < length_; x++) { 1634 for (int x = position_; x < length_; x++) {
1627 if (data_[x] != SerializerDeserializer::nop()) return false; 1635 if (data_[x] != SerializerDeserializer::nop()) return false;
1628 } 1636 }
1629 return true; 1637 return true;
1630 } 1638 }
1631 1639
1632 } } // namespace v8::internal 1640 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698