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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 // valid object pointers. | 662 // valid object pointers. |
663 isolate_->set_serialize_partial_snapshot_cache_length( | 663 isolate_->set_serialize_partial_snapshot_cache_length( |
664 Isolate::kPartialSnapshotCacheCapacity); | 664 Isolate::kPartialSnapshotCacheCapacity); |
665 ASSERT_EQ(NULL, external_reference_decoder_); | 665 ASSERT_EQ(NULL, external_reference_decoder_); |
666 external_reference_decoder_ = new ExternalReferenceDecoder(); | 666 external_reference_decoder_ = new ExternalReferenceDecoder(); |
667 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG); | 667 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG); |
668 isolate_->heap()->IterateWeakRoots(this, VISIT_ALL); | 668 isolate_->heap()->IterateWeakRoots(this, VISIT_ALL); |
669 | 669 |
670 isolate_->heap()->set_global_contexts_list( | 670 isolate_->heap()->set_global_contexts_list( |
671 isolate_->heap()->undefined_value()); | 671 isolate_->heap()->undefined_value()); |
672 | |
673 // Update data pointers to the external strings containing natives sources. | |
674 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { | |
675 Object* source = isolate_->heap()->natives_source_cache()->get(i); | |
676 if (!source->IsUndefined()) { | |
677 ExternalAsciiString::cast(source)->update_data_cache(); | |
678 } | |
679 } | |
680 } | 672 } |
681 | 673 |
682 | 674 |
683 void Deserializer::DeserializePartial(Object** root) { | 675 void Deserializer::DeserializePartial(Object** root) { |
684 isolate_ = Isolate::Current(); | 676 isolate_ = Isolate::Current(); |
685 // Don't GC while deserializing - just expand the heap. | 677 // Don't GC while deserializing - just expand the heap. |
686 AlwaysAllocateScope always_allocate; | 678 AlwaysAllocateScope always_allocate; |
687 // Don't use the free lists while deserializing. | 679 // Don't use the free lists while deserializing. |
688 LinearAllocationScope allocate_linearly; | 680 LinearAllocationScope allocate_linearly; |
689 if (external_reference_decoder_ == NULL) { | 681 if (external_reference_decoder_ == NULL) { |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { | 1557 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { |
1566 Object* source = HEAP->natives_source_cache()->get(i); | 1558 Object* source = HEAP->natives_source_cache()->get(i); |
1567 if (!source->IsUndefined()) { | 1559 if (!source->IsUndefined()) { |
1568 ExternalAsciiString* string = ExternalAsciiString::cast(source); | 1560 ExternalAsciiString* string = ExternalAsciiString::cast(source); |
1569 typedef v8::String::ExternalAsciiStringResource Resource; | 1561 typedef v8::String::ExternalAsciiStringResource Resource; |
1570 const Resource* resource = string->resource(); | 1562 const Resource* resource = string->resource(); |
1571 if (resource == *resource_pointer) { | 1563 if (resource == *resource_pointer) { |
1572 sink_->Put(kNativesStringResource, "NativesStringResource"); | 1564 sink_->Put(kNativesStringResource, "NativesStringResource"); |
1573 sink_->PutSection(i, "NativesStringResourceEnd"); | 1565 sink_->PutSection(i, "NativesStringResourceEnd"); |
1574 bytes_processed_so_far_ += sizeof(resource); | 1566 bytes_processed_so_far_ += sizeof(resource); |
| 1567 string->clear_data_cache(); |
1575 return; | 1568 return; |
1576 } | 1569 } |
1577 } | 1570 } |
1578 } | 1571 } |
1579 // One of the strings in the natives cache should match the resource. We | 1572 // One of the strings in the natives cache should match the resource. We |
1580 // can't serialize any other kinds of external strings. | 1573 // can't serialize any other kinds of external strings. |
1581 UNREACHABLE(); | 1574 UNREACHABLE(); |
1582 } | 1575 } |
1583 | 1576 |
1584 | 1577 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1664 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
1672 } | 1665 } |
1673 } | 1666 } |
1674 int allocation_address = fullness_[space]; | 1667 int allocation_address = fullness_[space]; |
1675 fullness_[space] = allocation_address + size; | 1668 fullness_[space] = allocation_address + size; |
1676 return allocation_address; | 1669 return allocation_address; |
1677 } | 1670 } |
1678 | 1671 |
1679 | 1672 |
1680 } } // namespace v8::internal | 1673 } } // namespace v8::internal |
OLD | NEW |