OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 | 1254 |
1255 RelativeAddress Serializer::Allocate(HeapObject* obj) { | 1255 RelativeAddress Serializer::Allocate(HeapObject* obj) { |
1256 // Find out which AllocationSpace 'obj' is in. | 1256 // Find out which AllocationSpace 'obj' is in. |
1257 AllocationSpace s; | 1257 AllocationSpace s; |
1258 bool found = false; | 1258 bool found = false; |
1259 for (int i = FIRST_SPACE; !found && i <= LAST_SPACE; i++) { | 1259 for (int i = FIRST_SPACE; !found && i <= LAST_SPACE; i++) { |
1260 s = static_cast<AllocationSpace>(i); | 1260 s = static_cast<AllocationSpace>(i); |
1261 found = Heap::InSpace(obj, s); | 1261 found = Heap::InSpace(obj, s); |
1262 } | 1262 } |
1263 CHECK(found); | 1263 CHECK(found); |
| 1264 int size = obj->Size(); |
1264 if (s == NEW_SPACE) { | 1265 if (s == NEW_SPACE) { |
1265 Space* space = Heap::TargetSpace(obj); | 1266 if (size > Heap::MaxObjectSizeInPagedSpace()) { |
1266 ASSERT(space == Heap::old_pointer_space() || | 1267 s = LO_SPACE; |
1267 space == Heap::old_data_space()); | 1268 } else { |
1268 s = (space == Heap::old_pointer_space()) ? | 1269 OldSpace* space = Heap::TargetSpace(obj); |
1269 OLD_POINTER_SPACE : | 1270 ASSERT(space == Heap::old_pointer_space() || |
1270 OLD_DATA_SPACE; | 1271 space == Heap::old_data_space()); |
| 1272 s = (space == Heap::old_pointer_space()) ? |
| 1273 OLD_POINTER_SPACE : |
| 1274 OLD_DATA_SPACE; |
| 1275 } |
1271 } | 1276 } |
1272 int size = obj->Size(); | |
1273 GCTreatment gc_treatment = DataObject; | 1277 GCTreatment gc_treatment = DataObject; |
1274 if (obj->IsFixedArray()) gc_treatment = PointerObject; | 1278 if (obj->IsFixedArray()) gc_treatment = PointerObject; |
1275 else if (obj->IsCode()) gc_treatment = CodeObject; | 1279 else if (obj->IsCode()) gc_treatment = CodeObject; |
1276 return allocator_[s]->Allocate(size, gc_treatment); | 1280 return allocator_[s]->Allocate(size, gc_treatment); |
1277 } | 1281 } |
1278 | 1282 |
1279 | 1283 |
1280 //------------------------------------------------------------------------------ | 1284 //------------------------------------------------------------------------------ |
1281 // Implementation of Deserializer | 1285 // Implementation of Deserializer |
1282 | 1286 |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1623 ASSERT(index < large_objects_.length()); | 1627 ASSERT(index < large_objects_.length()); |
1624 } | 1628 } |
1625 return large_objects_[index]; // s.page_offset() is ignored. | 1629 return large_objects_[index]; // s.page_offset() is ignored. |
1626 } | 1630 } |
1627 UNREACHABLE(); | 1631 UNREACHABLE(); |
1628 return NULL; | 1632 return NULL; |
1629 } | 1633 } |
1630 | 1634 |
1631 | 1635 |
1632 } } // namespace v8::internal | 1636 } } // namespace v8::internal |
OLD | NEW |