Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: src/serialize.cc

Issue 8635011: Introduce short external strings without pointer cache. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 }
672 } 680 }
673 681
674 682
675 void Deserializer::DeserializePartial(Object** root) { 683 void Deserializer::DeserializePartial(Object** root) {
676 isolate_ = Isolate::Current(); 684 isolate_ = Isolate::Current();
677 // Don't GC while deserializing - just expand the heap. 685 // Don't GC while deserializing - just expand the heap.
678 AlwaysAllocateScope always_allocate; 686 AlwaysAllocateScope always_allocate;
679 // Don't use the free lists while deserializing. 687 // Don't use the free lists while deserializing.
680 LinearAllocationScope allocate_linearly; 688 LinearAllocationScope allocate_linearly;
681 if (external_reference_decoder_ == NULL) { 689 if (external_reference_decoder_ == NULL) {
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { 1565 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
1558 Object* source = HEAP->natives_source_cache()->get(i); 1566 Object* source = HEAP->natives_source_cache()->get(i);
1559 if (!source->IsUndefined()) { 1567 if (!source->IsUndefined()) {
1560 ExternalAsciiString* string = ExternalAsciiString::cast(source); 1568 ExternalAsciiString* string = ExternalAsciiString::cast(source);
1561 typedef v8::String::ExternalAsciiStringResource Resource; 1569 typedef v8::String::ExternalAsciiStringResource Resource;
1562 const Resource* resource = string->resource(); 1570 const Resource* resource = string->resource();
1563 if (resource == *resource_pointer) { 1571 if (resource == *resource_pointer) {
1564 sink_->Put(kNativesStringResource, "NativesStringResource"); 1572 sink_->Put(kNativesStringResource, "NativesStringResource");
1565 sink_->PutSection(i, "NativesStringResourceEnd"); 1573 sink_->PutSection(i, "NativesStringResourceEnd");
1566 bytes_processed_so_far_ += sizeof(resource); 1574 bytes_processed_so_far_ += sizeof(resource);
1567 string->clear_data_cache();
1568 return; 1575 return;
1569 } 1576 }
1570 } 1577 }
1571 } 1578 }
1572 // One of the strings in the natives cache should match the resource. We 1579 // One of the strings in the natives cache should match the resource. We
1573 // can't serialize any other kinds of external strings. 1580 // can't serialize any other kinds of external strings.
1574 UNREACHABLE(); 1581 UNREACHABLE();
1575 } 1582 }
1576 1583
1577 1584
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); 1671 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize);
1665 } 1672 }
1666 } 1673 }
1667 int allocation_address = fullness_[space]; 1674 int allocation_address = fullness_[space];
1668 fullness_[space] = allocation_address + size; 1675 fullness_[space] = allocation_address + size;
1669 return allocation_address; 1676 return allocation_address;
1670 } 1677 }
1671 1678
1672 1679
1673 } } // namespace v8::internal 1680 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698