| 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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 ASSERT(SpaceIsPaged(space)); | 645 ASSERT(SpaceIsPaged(space)); |
| 646 int page_of_pointee = offset >> kPageSizeBits; | 646 int page_of_pointee = offset >> kPageSizeBits; |
| 647 Address object_address = pages_[space][page_of_pointee] + | 647 Address object_address = pages_[space][page_of_pointee] + |
| 648 (offset & Page::kPageAlignmentMask); | 648 (offset & Page::kPageAlignmentMask); |
| 649 return HeapObject::FromAddress(object_address); | 649 return HeapObject::FromAddress(object_address); |
| 650 } | 650 } |
| 651 | 651 |
| 652 | 652 |
| 653 void Deserializer::Deserialize() { | 653 void Deserializer::Deserialize() { |
| 654 // Don't GC while deserializing - just expand the heap. | 654 // Don't GC while deserializing - just expand the heap. |
| 655 Address* write_buffer_top = |
| 656 reinterpret_cast<Address*>(Heap::write_buffer_top()); |
| 655 AlwaysAllocateScope always_allocate; | 657 AlwaysAllocateScope always_allocate; |
| 656 // Don't use the free lists while deserializing. | 658 // Don't use the free lists while deserializing. |
| 657 LinearAllocationScope allocate_linearly; | 659 LinearAllocationScope allocate_linearly; |
| 658 // No active threads. | 660 // No active threads. |
| 659 ASSERT_EQ(NULL, ThreadState::FirstInUse()); | 661 ASSERT_EQ(NULL, ThreadState::FirstInUse()); |
| 660 // No active handles. | 662 // No active handles. |
| 661 ASSERT(HandleScopeImplementer::instance()->blocks()->is_empty()); | 663 ASSERT(HandleScopeImplementer::instance()->blocks()->is_empty()); |
| 662 // Make sure the entire partial snapshot cache is traversed, filling it with | 664 // Make sure the entire partial snapshot cache is traversed, filling it with |
| 663 // valid object pointers. | 665 // valid object pointers. |
| 664 partial_snapshot_cache_length_ = kPartialSnapshotCacheCapacity; | 666 partial_snapshot_cache_length_ = kPartialSnapshotCacheCapacity; |
| 665 ASSERT_EQ(NULL, external_reference_decoder_); | 667 ASSERT_EQ(NULL, external_reference_decoder_); |
| 666 external_reference_decoder_ = new ExternalReferenceDecoder(); | 668 external_reference_decoder_ = new ExternalReferenceDecoder(); |
| 667 Heap::IterateStrongRoots(this, VISIT_ONLY_STRONG); | 669 Heap::IterateStrongRoots(this, VISIT_ONLY_STRONG); |
| 668 Heap::IterateWeakRoots(this, VISIT_ALL); | 670 Heap::IterateWeakRoots(this, VISIT_ALL); |
| 669 | 671 |
| 670 Heap::set_global_contexts_list(Heap::undefined_value()); | 672 Heap::set_global_contexts_list(Heap::undefined_value()); |
| 673 Heap::public_set_write_buffer_top(write_buffer_top); |
| 671 } | 674 } |
| 672 | 675 |
| 673 | 676 |
| 674 void Deserializer::DeserializePartial(Object** root) { | 677 void Deserializer::DeserializePartial(Object** root) { |
| 675 // Don't GC while deserializing - just expand the heap. | 678 // Don't GC while deserializing - just expand the heap. |
| 676 AlwaysAllocateScope always_allocate; | 679 AlwaysAllocateScope always_allocate; |
| 677 // Don't use the free lists while deserializing. | 680 // Don't use the free lists while deserializing. |
| 678 LinearAllocationScope allocate_linearly; | 681 LinearAllocationScope allocate_linearly; |
| 679 if (external_reference_decoder_ == NULL) { | 682 if (external_reference_decoder_ == NULL) { |
| 680 external_reference_decoder_ = new ExternalReferenceDecoder(); | 683 external_reference_decoder_ = new ExternalReferenceDecoder(); |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1522 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1525 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
| 1523 } | 1526 } |
| 1524 } | 1527 } |
| 1525 int allocation_address = fullness_[space]; | 1528 int allocation_address = fullness_[space]; |
| 1526 fullness_[space] = allocation_address + size; | 1529 fullness_[space] = allocation_address + size; |
| 1527 return allocation_address; | 1530 return allocation_address; |
| 1528 } | 1531 } |
| 1529 | 1532 |
| 1530 | 1533 |
| 1531 } } // namespace v8::internal | 1534 } } // namespace v8::internal |
| OLD | NEW |