| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/snapshot/deserializer.h" | 5 #include "src/snapshot/deserializer.h" |
| 6 | 6 |
| 7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
| 8 #include "src/external-reference-table.h" | 8 #include "src/external-reference-table.h" |
| 9 #include "src/heap/heap.h" | 9 #include "src/heap/heap.h" |
| 10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 // Since multiple large objects cannot be folded into one large object | 407 // Since multiple large objects cannot be folded into one large object |
| 408 // space allocation, we have to do an actual allocation when deserializing | 408 // space allocation, we have to do an actual allocation when deserializing |
| 409 // each large object. Instead of tracking offset for back references, we | 409 // each large object. Instead of tracking offset for back references, we |
| 410 // reference large objects by index. | 410 // reference large objects by index. |
| 411 Address Deserializer::Allocate(int space_index, int size) { | 411 Address Deserializer::Allocate(int space_index, int size) { |
| 412 if (space_index == LO_SPACE) { | 412 if (space_index == LO_SPACE) { |
| 413 AlwaysAllocateScope scope(isolate_); | 413 AlwaysAllocateScope scope(isolate_); |
| 414 LargeObjectSpace* lo_space = isolate_->heap()->lo_space(); | 414 LargeObjectSpace* lo_space = isolate_->heap()->lo_space(); |
| 415 Executability exec = static_cast<Executability>(source_.Get()); | 415 Executability exec = static_cast<Executability>(source_.Get()); |
| 416 AllocationResult result = lo_space->AllocateRaw(size, exec); | 416 AllocationResult result = lo_space->AllocateRaw(size, exec); |
| 417 HeapObject* obj = HeapObject::cast(result.ToObjectChecked()); | 417 HeapObject* obj = result.ToObjectChecked(); |
| 418 deserialized_large_objects_.Add(obj); | 418 deserialized_large_objects_.Add(obj); |
| 419 return obj->address(); | 419 return obj->address(); |
| 420 } else if (space_index == MAP_SPACE) { | 420 } else if (space_index == MAP_SPACE) { |
| 421 DCHECK_EQ(Map::kSize, size); | 421 DCHECK_EQ(Map::kSize, size); |
| 422 return allocated_maps_[next_map_index_++]; | 422 return allocated_maps_[next_map_index_++]; |
| 423 } else { | 423 } else { |
| 424 DCHECK(space_index < kNumberOfPreallocatedSpaces); | 424 DCHECK(space_index < kNumberOfPreallocatedSpaces); |
| 425 Address address = high_water_[space_index]; | 425 Address address = high_water_[space_index]; |
| 426 DCHECK_NOT_NULL(address); | 426 DCHECK_NOT_NULL(address); |
| 427 high_water_[space_index] += size; | 427 high_water_[space_index] += size; |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 | 825 |
| 826 default: | 826 default: |
| 827 CHECK(false); | 827 CHECK(false); |
| 828 } | 828 } |
| 829 } | 829 } |
| 830 CHECK_EQ(limit, current); | 830 CHECK_EQ(limit, current); |
| 831 return true; | 831 return true; |
| 832 } | 832 } |
| 833 } // namespace internal | 833 } // namespace internal |
| 834 } // namespace v8 | 834 } // namespace v8 |
| OLD | NEW |