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

Side by Side Diff: src/serialize.h

Issue 339103005: Remove unnecessary virtual methods in the serializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_SERIALIZE_H_ 5 #ifndef V8_SERIALIZE_H_
6 #define V8_SERIALIZE_H_ 6 #define V8_SERIALIZE_H_
7 7
8 #include "src/hashmap.h" 8 #include "src/hashmap.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 void PutRoot(int index, 449 void PutRoot(int index,
450 HeapObject* object, 450 HeapObject* object,
451 HowToCode how, 451 HowToCode how,
452 WhereToPoint where, 452 WhereToPoint where,
453 int skip); 453 int skip);
454 454
455 protected: 455 protected:
456 static const int kInvalidRootIndex = -1; 456 static const int kInvalidRootIndex = -1;
457 457
458 int RootIndex(HeapObject* heap_object, HowToCode from); 458 int RootIndex(HeapObject* heap_object, HowToCode from);
459 virtual bool ShouldBeInThePartialSnapshotCache(HeapObject* o) = 0;
460 intptr_t root_index_wave_front() { return root_index_wave_front_; } 459 intptr_t root_index_wave_front() { return root_index_wave_front_; }
461 void set_root_index_wave_front(intptr_t value) { 460 void set_root_index_wave_front(intptr_t value) {
462 ASSERT(value >= root_index_wave_front_); 461 ASSERT(value >= root_index_wave_front_);
463 root_index_wave_front_ = value; 462 root_index_wave_front_ = value;
464 } 463 }
465 464
466 class ObjectSerializer : public ObjectVisitor { 465 class ObjectSerializer : public ObjectVisitor {
467 public: 466 public:
468 ObjectSerializer(Serializer* serializer, 467 ObjectSerializer(Serializer* serializer,
469 Object* o, 468 Object* o,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 PartialSerializer(Isolate* isolate, 564 PartialSerializer(Isolate* isolate,
566 Serializer* startup_snapshot_serializer, 565 Serializer* startup_snapshot_serializer,
567 SnapshotByteSink* sink) 566 SnapshotByteSink* sink)
568 : Serializer(isolate, sink), 567 : Serializer(isolate, sink),
569 startup_serializer_(startup_snapshot_serializer) { 568 startup_serializer_(startup_snapshot_serializer) {
570 set_root_index_wave_front(Heap::kStrongRootListLength); 569 set_root_index_wave_front(Heap::kStrongRootListLength);
571 InitializeCodeAddressMap(); 570 InitializeCodeAddressMap();
572 } 571 }
573 572
574 // Serialize the objects reachable from a single object pointer. 573 // Serialize the objects reachable from a single object pointer.
575 virtual void Serialize(Object** o); 574 void Serialize(Object** o);
576 virtual void SerializeObject(Object* o, 575 virtual void SerializeObject(Object* o,
577 HowToCode how_to_code, 576 HowToCode how_to_code,
578 WhereToPoint where_to_point, 577 WhereToPoint where_to_point,
579 int skip); 578 int skip);
580 579
581 protected: 580 private:
582 virtual int PartialSnapshotCacheIndex(HeapObject* o); 581 int PartialSnapshotCacheIndex(HeapObject* o);
583 virtual bool ShouldBeInThePartialSnapshotCache(HeapObject* o) { 582 bool ShouldBeInThePartialSnapshotCache(HeapObject* o) {
584 // Scripts should be referred only through shared function infos. We can't 583 // Scripts should be referred only through shared function infos. We can't
585 // allow them to be part of the partial snapshot because they contain a 584 // allow them to be part of the partial snapshot because they contain a
586 // unique ID, and deserializing several partial snapshots containing script 585 // unique ID, and deserializing several partial snapshots containing script
587 // would cause dupes. 586 // would cause dupes.
588 ASSERT(!o->IsScript()); 587 ASSERT(!o->IsScript());
589 return o->IsName() || o->IsSharedFunctionInfo() || 588 return o->IsName() || o->IsSharedFunctionInfo() ||
590 o->IsHeapNumber() || o->IsCode() || 589 o->IsHeapNumber() || o->IsCode() ||
591 o->IsScopeInfo() || 590 o->IsScopeInfo() ||
592 o->map() == 591 o->map() ==
593 startup_serializer_->isolate()->heap()->fixed_cow_array_map(); 592 startup_serializer_->isolate()->heap()->fixed_cow_array_map();
594 } 593 }
595 594
596 private: 595
597 Serializer* startup_serializer_; 596 Serializer* startup_serializer_;
598 DISALLOW_COPY_AND_ASSIGN(PartialSerializer); 597 DISALLOW_COPY_AND_ASSIGN(PartialSerializer);
599 }; 598 };
600 599
601 600
602 class StartupSerializer : public Serializer { 601 class StartupSerializer : public Serializer {
603 public: 602 public:
604 StartupSerializer(Isolate* isolate, SnapshotByteSink* sink) 603 StartupSerializer(Isolate* isolate, SnapshotByteSink* sink)
605 : Serializer(isolate, sink) { 604 : Serializer(isolate, sink) {
606 // Clear the cache of objects used by the partial snapshot. After the 605 // Clear the cache of objects used by the partial snapshot. After the
(...skipping 11 matching lines...) Expand all
618 virtual void SerializeObject(Object* o, 617 virtual void SerializeObject(Object* o,
619 HowToCode how_to_code, 618 HowToCode how_to_code,
620 WhereToPoint where_to_point, 619 WhereToPoint where_to_point,
621 int skip); 620 int skip);
622 void SerializeWeakReferences(); 621 void SerializeWeakReferences();
623 void Serialize() { 622 void Serialize() {
624 SerializeStrongReferences(); 623 SerializeStrongReferences();
625 SerializeWeakReferences(); 624 SerializeWeakReferences();
626 Pad(); 625 Pad();
627 } 626 }
628
629 private:
630 virtual bool ShouldBeInThePartialSnapshotCache(HeapObject* o) {
631 return false;
632 }
633 }; 627 };
634 628
635 629
636 } } // namespace v8::internal 630 } } // namespace v8::internal
637 631
638 #endif // V8_SERIALIZE_H_ 632 #endif // V8_SERIALIZE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698