| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 Address object_address = pages_[space][page_of_pointee] + | 643 Address object_address = pages_[space][page_of_pointee] + |
| 644 (offset & Page::kPageAlignmentMask); | 644 (offset & Page::kPageAlignmentMask); |
| 645 return HeapObject::FromAddress(object_address); | 645 return HeapObject::FromAddress(object_address); |
| 646 } | 646 } |
| 647 | 647 |
| 648 | 648 |
| 649 void Deserializer::Deserialize() { | 649 void Deserializer::Deserialize() { |
| 650 isolate_ = Isolate::Current(); | 650 isolate_ = Isolate::Current(); |
| 651 ASSERT(isolate_ != NULL); | 651 ASSERT(isolate_ != NULL); |
| 652 // Don't GC while deserializing - just expand the heap. | 652 // Don't GC while deserializing - just expand the heap. |
| 653 Address* store_buffer_top = | |
| 654 reinterpret_cast<Address*>(isolate_->heap()->store_buffer_top()); | |
| 655 AlwaysAllocateScope always_allocate; | 653 AlwaysAllocateScope always_allocate; |
| 656 // Don't use the free lists while deserializing. | 654 // Don't use the free lists while deserializing. |
| 657 LinearAllocationScope allocate_linearly; | 655 LinearAllocationScope allocate_linearly; |
| 658 // No active threads. | 656 // No active threads. |
| 659 ASSERT_EQ(NULL, isolate_->thread_manager()->FirstThreadStateInUse()); | 657 ASSERT_EQ(NULL, isolate_->thread_manager()->FirstThreadStateInUse()); |
| 660 // No active handles. | 658 // No active handles. |
| 661 ASSERT(isolate_->handle_scope_implementer()->blocks()->is_empty()); | 659 ASSERT(isolate_->handle_scope_implementer()->blocks()->is_empty()); |
| 662 // Make sure the entire partial snapshot cache is traversed, filling it with | 660 // Make sure the entire partial snapshot cache is traversed, filling it with |
| 663 // valid object pointers. | 661 // valid object pointers. |
| 664 isolate_->set_serialize_partial_snapshot_cache_length( | 662 isolate_->set_serialize_partial_snapshot_cache_length( |
| 665 Isolate::kPartialSnapshotCacheCapacity); | 663 Isolate::kPartialSnapshotCacheCapacity); |
| 666 ASSERT_EQ(NULL, external_reference_decoder_); | 664 ASSERT_EQ(NULL, external_reference_decoder_); |
| 667 external_reference_decoder_ = new ExternalReferenceDecoder(); | 665 external_reference_decoder_ = new ExternalReferenceDecoder(); |
| 668 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG); | 666 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG); |
| 669 isolate_->heap()->IterateWeakRoots(this, VISIT_ALL); | 667 isolate_->heap()->IterateWeakRoots(this, VISIT_ALL); |
| 670 | 668 |
| 671 isolate_->heap()->set_global_contexts_list( | 669 isolate_->heap()->set_global_contexts_list( |
| 672 isolate_->heap()->undefined_value()); | 670 isolate_->heap()->undefined_value()); |
| 673 isolate_->heap()->public_set_store_buffer_top(store_buffer_top); | |
| 674 } | 671 } |
| 675 | 672 |
| 676 | 673 |
| 677 void Deserializer::DeserializePartial(Object** root) { | 674 void Deserializer::DeserializePartial(Object** root) { |
| 678 isolate_ = Isolate::Current(); | 675 isolate_ = Isolate::Current(); |
| 679 // Don't GC while deserializing - just expand the heap. | 676 // Don't GC while deserializing - just expand the heap. |
| 680 AlwaysAllocateScope always_allocate; | 677 AlwaysAllocateScope always_allocate; |
| 681 // Don't use the free lists while deserializing. | 678 // Don't use the free lists while deserializing. |
| 682 LinearAllocationScope allocate_linearly; | 679 LinearAllocationScope allocate_linearly; |
| 683 if (external_reference_decoder_ == NULL) { | 680 if (external_reference_decoder_ == NULL) { |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1556 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
| 1560 } | 1557 } |
| 1561 } | 1558 } |
| 1562 int allocation_address = fullness_[space]; | 1559 int allocation_address = fullness_[space]; |
| 1563 fullness_[space] = allocation_address + size; | 1560 fullness_[space] = allocation_address + size; |
| 1564 return allocation_address; | 1561 return allocation_address; |
| 1565 } | 1562 } |
| 1566 | 1563 |
| 1567 | 1564 |
| 1568 } } // namespace v8::internal | 1565 } } // namespace v8::internal |
| OLD | NEW |