| 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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 | 923 |
| 924 Serializer::~Serializer() { | 924 Serializer::~Serializer() { |
| 925 for (int i = 0; i <= LAST_SPACE; i++) { | 925 for (int i = 0; i <= LAST_SPACE; i++) { |
| 926 delete allocator_[i]; | 926 delete allocator_[i]; |
| 927 } | 927 } |
| 928 if (reference_encoder_) delete reference_encoder_; | 928 if (reference_encoder_) delete reference_encoder_; |
| 929 delete writer_; | 929 delete writer_; |
| 930 } | 930 } |
| 931 | 931 |
| 932 | 932 |
| 933 bool Serializer::serialization_enabled_ = true; | 933 bool Serializer::serialization_enabled_ = false; |
| 934 | 934 |
| 935 | 935 |
| 936 #ifdef DEBUG | 936 #ifdef DEBUG |
| 937 static const int kMaxTagLength = 32; | 937 static const int kMaxTagLength = 32; |
| 938 | 938 |
| 939 void Serializer::Synchronize(const char* tag) { | 939 void Serializer::Synchronize(const char* tag) { |
| 940 if (FLAG_debug_serialization) { | 940 if (FLAG_debug_serialization) { |
| 941 int length = strlen(tag); | 941 int length = strlen(tag); |
| 942 ASSERT(length <= kMaxTagLength); | 942 ASSERT(length <= kMaxTagLength); |
| 943 writer_->PutC('S'); | 943 writer_->PutC('S'); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 // We need a counter function during serialization to resolve the | 986 // We need a counter function during serialization to resolve the |
| 987 // references to counters in the code on the heap. | 987 // references to counters in the code on the heap. |
| 988 CHECK(StatsTable::HasCounterFunction()); | 988 CHECK(StatsTable::HasCounterFunction()); |
| 989 CHECK(enabled()); | 989 CHECK(enabled()); |
| 990 InitializeAllocators(); | 990 InitializeAllocators(); |
| 991 reference_encoder_ = new ExternalReferenceEncoder(); | 991 reference_encoder_ = new ExternalReferenceEncoder(); |
| 992 PutHeader(); | 992 PutHeader(); |
| 993 Heap::IterateRoots(this); | 993 Heap::IterateRoots(this); |
| 994 PutLog(); | 994 PutLog(); |
| 995 PutContextStack(); | 995 PutContextStack(); |
| 996 disable(); | 996 Disable(); |
| 997 } | 997 } |
| 998 | 998 |
| 999 | 999 |
| 1000 void Serializer::Finalize(byte** str, int* len) { | 1000 void Serializer::Finalize(byte** str, int* len) { |
| 1001 writer_->GetBytes(str, len); | 1001 writer_->GetBytes(str, len); |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 | 1004 |
| 1005 // Serialize objects by writing them into the stream. | 1005 // Serialize objects by writing them into the stream. |
| 1006 | 1006 |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1587 ASSERT(index < large_objects_.length()); | 1587 ASSERT(index < large_objects_.length()); |
| 1588 } | 1588 } |
| 1589 return large_objects_[index]; // s.page_offset() is ignored. | 1589 return large_objects_[index]; // s.page_offset() is ignored. |
| 1590 } | 1590 } |
| 1591 UNREACHABLE(); | 1591 UNREACHABLE(); |
| 1592 return NULL; | 1592 return NULL; |
| 1593 } | 1593 } |
| 1594 | 1594 |
| 1595 | 1595 |
| 1596 } } // namespace v8::internal | 1596 } } // namespace v8::internal |
| OLD | NEW |