OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
787 Deserializer::Deserializer(SnapshotByteSource* source) | 787 Deserializer::Deserializer(SnapshotByteSource* source) |
788 : isolate_(NULL), | 788 : isolate_(NULL), |
789 source_(source), | 789 source_(source), |
790 external_reference_decoder_(NULL) { | 790 external_reference_decoder_(NULL) { |
791 for (int i = 0; i < LAST_SPACE + 1; i++) { | 791 for (int i = 0; i < LAST_SPACE + 1; i++) { |
792 reservations_[i] = kUninitializedReservation; | 792 reservations_[i] = kUninitializedReservation; |
793 } | 793 } |
794 } | 794 } |
795 | 795 |
796 | 796 |
797 void Deserializer::FlushICacheForNewCodeObjects() { | |
798 PageIterator it(isolate_->heap()->code_space()); | |
799 while (it.has_next()) { | |
Sven Panne
2013/12/16 12:53:54
Not directly your code, but I need a place to whin
| |
800 Page* p = it.next(); | |
801 CPU::FlushICache(p->area_start(), p->area_end() - p->area_start()); | |
802 } | |
803 } | |
804 | |
805 | |
797 void Deserializer::Deserialize(Isolate* isolate) { | 806 void Deserializer::Deserialize(Isolate* isolate) { |
798 isolate_ = isolate; | 807 isolate_ = isolate; |
799 ASSERT(isolate_ != NULL); | 808 ASSERT(isolate_ != NULL); |
800 isolate_->heap()->ReserveSpace(reservations_, &high_water_[0]); | 809 isolate_->heap()->ReserveSpace(reservations_, &high_water_[0]); |
801 // No active threads. | 810 // No active threads. |
802 ASSERT_EQ(NULL, isolate_->thread_manager()->FirstThreadStateInUse()); | 811 ASSERT_EQ(NULL, isolate_->thread_manager()->FirstThreadStateInUse()); |
803 // No active handles. | 812 // No active handles. |
804 ASSERT(isolate_->handle_scope_implementer()->blocks()->is_empty()); | 813 ASSERT(isolate_->handle_scope_implementer()->blocks()->is_empty()); |
805 ASSERT_EQ(NULL, external_reference_decoder_); | 814 ASSERT_EQ(NULL, external_reference_decoder_); |
806 external_reference_decoder_ = new ExternalReferenceDecoder(isolate); | 815 external_reference_decoder_ = new ExternalReferenceDecoder(isolate); |
(...skipping 16 matching lines...) Expand all Loading... | |
823 isolate_->heap()->InitializeWeakObjectToCodeTable(); | 832 isolate_->heap()->InitializeWeakObjectToCodeTable(); |
824 | 833 |
825 // Update data pointers to the external strings containing natives sources. | 834 // Update data pointers to the external strings containing natives sources. |
826 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { | 835 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { |
827 Object* source = isolate_->heap()->natives_source_cache()->get(i); | 836 Object* source = isolate_->heap()->natives_source_cache()->get(i); |
828 if (!source->IsUndefined()) { | 837 if (!source->IsUndefined()) { |
829 ExternalAsciiString::cast(source)->update_data_cache(); | 838 ExternalAsciiString::cast(source)->update_data_cache(); |
830 } | 839 } |
831 } | 840 } |
832 | 841 |
842 FlushICacheForNewCodeObjects(); | |
843 | |
833 // Issue code events for newly deserialized code objects. | 844 // Issue code events for newly deserialized code objects. |
834 LOG_CODE_EVENT(isolate_, LogCodeObjects()); | 845 LOG_CODE_EVENT(isolate_, LogCodeObjects()); |
835 LOG_CODE_EVENT(isolate_, LogCompiledFunctions()); | 846 LOG_CODE_EVENT(isolate_, LogCompiledFunctions()); |
836 } | 847 } |
837 | 848 |
838 | 849 |
839 void Deserializer::DeserializePartial(Isolate* isolate, Object** root) { | 850 void Deserializer::DeserializePartial(Isolate* isolate, Object** root) { |
840 isolate_ = isolate; | 851 isolate_ = isolate; |
841 for (int i = NEW_SPACE; i < kNumberOfSpaces; i++) { | 852 for (int i = NEW_SPACE; i < kNumberOfSpaces; i++) { |
842 ASSERT(reservations_[i] != kUninitializedReservation); | 853 ASSERT(reservations_[i] != kUninitializedReservation); |
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1861 | 1872 |
1862 bool SnapshotByteSource::AtEOF() { | 1873 bool SnapshotByteSource::AtEOF() { |
1863 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; | 1874 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; |
1864 for (int x = position_; x < length_; x++) { | 1875 for (int x = position_; x < length_; x++) { |
1865 if (data_[x] != SerializerDeserializer::nop()) return false; | 1876 if (data_[x] != SerializerDeserializer::nop()) return false; |
1866 } | 1877 } |
1867 return true; | 1878 return true; |
1868 } | 1879 } |
1869 | 1880 |
1870 } } // namespace v8::internal | 1881 } } // namespace v8::internal |
OLD | NEW |