Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/object.h" | 5 #include "vm/object.h" |
| 6 #include "vm/object_store.h" | 6 #include "vm/object_store.h" |
| 7 #include "vm/snapshot.h" | 7 #include "vm/snapshot.h" |
| 8 #include "vm/stub_code.h" | 8 #include "vm/stub_code.h" |
| 9 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
| 10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
| (...skipping 2733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2744 } | 2744 } |
| 2745 | 2745 |
| 2746 | 2746 |
| 2747 RawJSRegExp* JSRegExp::ReadFrom(SnapshotReader* reader, | 2747 RawJSRegExp* JSRegExp::ReadFrom(SnapshotReader* reader, |
| 2748 intptr_t object_id, | 2748 intptr_t object_id, |
| 2749 intptr_t tags, | 2749 intptr_t tags, |
| 2750 Snapshot::Kind kind) { | 2750 Snapshot::Kind kind) { |
| 2751 ASSERT(reader != NULL); | 2751 ASSERT(reader != NULL); |
| 2752 ASSERT(kind == Snapshot::kMessage); | 2752 ASSERT(kind == Snapshot::kMessage); |
| 2753 | 2753 |
| 2754 // Read the length so that we can determine instance size to allocate. | |
| 2755 intptr_t len = reader->ReadSmiValue(); | |
| 2756 | |
| 2757 // Allocate JSRegExp object. | 2754 // Allocate JSRegExp object. |
| 2758 JSRegExp& regex = JSRegExp::ZoneHandle( | 2755 JSRegExp& regex = JSRegExp::ZoneHandle( |
| 2759 reader->zone(), JSRegExp::New(len, HEAP_SPACE(kind))); | 2756 reader->zone(), JSRegExp::New(HEAP_SPACE(kind))); |
| 2760 reader->AddBackRef(object_id, ®ex, kIsDeserialized); | 2757 reader->AddBackRef(object_id, ®ex, kIsDeserialized); |
| 2761 | 2758 |
| 2762 // Set the object tags. | 2759 // Set the object tags. |
| 2763 regex.set_tags(tags); | 2760 regex.set_tags(tags); |
| 2764 | 2761 |
| 2765 // Read and Set all the other fields. | 2762 // Read and Set all the other fields. |
| 2766 regex.StoreSmi(®ex.raw_ptr()->num_bracket_expressions_, | 2763 regex.StoreSmi(®ex.raw_ptr()->num_bracket_expressions_, |
| 2767 reader->ReadAsSmi()); | 2764 reader->ReadAsSmi()); |
| 2768 *reader->StringHandle() ^= reader->ReadObjectImpl(); | 2765 *reader->StringHandle() ^= reader->ReadObjectImpl(); |
| 2769 regex.set_pattern(*reader->StringHandle()); | 2766 regex.set_pattern(*reader->StringHandle()); |
| 2770 regex.StoreNonPointer(®ex.raw_ptr()->type_flags_, | 2767 regex.StoreNonPointer(®ex.raw_ptr()->type_flags_, |
| 2771 reader->Read<int8_t>()); | 2768 reader->Read<int8_t>()); |
| 2772 | 2769 |
| 2773 // TODO(5411462): Need to implement a way of recompiling the regex. | 2770 // TODO(18854): Need to implement a way of recreating the irrexp functions. |
|
Vyacheslav Egorov (Google)
2015/04/08 23:52:32
I think they can just be written out - lazy compil
Ivan Posva
2015/04/08 23:58:49
Discussing with Siva we would prefer not to send t
| |
| 2774 | |
| 2775 return regex.raw(); | 2771 return regex.raw(); |
| 2776 } | 2772 } |
| 2777 | 2773 |
| 2778 | 2774 |
| 2779 void RawJSRegExp::WriteTo(SnapshotWriter* writer, | 2775 void RawJSRegExp::WriteTo(SnapshotWriter* writer, |
| 2780 intptr_t object_id, | 2776 intptr_t object_id, |
| 2781 Snapshot::Kind kind) { | 2777 Snapshot::Kind kind) { |
| 2782 ASSERT(writer != NULL); | 2778 ASSERT(writer != NULL); |
| 2783 ASSERT(kind == Snapshot::kMessage); | 2779 ASSERT(kind == Snapshot::kMessage); |
| 2784 | 2780 |
| 2785 // Write out the serialization header value for this object. | 2781 // Write out the serialization header value for this object. |
| 2786 writer->WriteInlinedObjectHeader(object_id); | 2782 writer->WriteInlinedObjectHeader(object_id); |
| 2787 | 2783 |
| 2788 // Write out the class and tags information. | 2784 // Write out the class and tags information. |
| 2789 writer->WriteIndexedObject(kJSRegExpCid); | 2785 writer->WriteIndexedObject(kJSRegExpCid); |
| 2790 writer->WriteTags(writer->GetObjectTags(this)); | 2786 writer->WriteTags(writer->GetObjectTags(this)); |
| 2791 | 2787 |
| 2792 // Write out the data length field. | |
| 2793 writer->Write<RawObject*>(ptr()->data_length_); | |
| 2794 | |
| 2795 // Write out all the other fields. | 2788 // Write out all the other fields. |
| 2796 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); | 2789 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); |
| 2797 writer->WriteObjectImpl(ptr()->pattern_); | 2790 writer->WriteObjectImpl(ptr()->pattern_); |
| 2798 writer->Write<int8_t>(ptr()->type_flags_); | 2791 writer->Write<int8_t>(ptr()->type_flags_); |
| 2799 | |
| 2800 // Do not write out the data part which is native. | |
| 2801 } | 2792 } |
| 2802 | 2793 |
| 2803 | 2794 |
| 2804 RawWeakProperty* WeakProperty::ReadFrom(SnapshotReader* reader, | 2795 RawWeakProperty* WeakProperty::ReadFrom(SnapshotReader* reader, |
| 2805 intptr_t object_id, | 2796 intptr_t object_id, |
| 2806 intptr_t tags, | 2797 intptr_t tags, |
| 2807 Snapshot::Kind kind) { | 2798 Snapshot::Kind kind) { |
| 2808 ASSERT(reader != NULL); | 2799 ASSERT(reader != NULL); |
| 2809 | 2800 |
| 2810 // Allocate the weak property object. | 2801 // Allocate the weak property object. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2887 // We do not allow objects with native fields in an isolate message. | 2878 // We do not allow objects with native fields in an isolate message. |
| 2888 writer->SetWriteException(Exceptions::kArgument, | 2879 writer->SetWriteException(Exceptions::kArgument, |
| 2889 "Illegal argument in isolate message" | 2880 "Illegal argument in isolate message" |
| 2890 " : (object is a UserTag)"); | 2881 " : (object is a UserTag)"); |
| 2891 } else { | 2882 } else { |
| 2892 UNREACHABLE(); | 2883 UNREACHABLE(); |
| 2893 } | 2884 } |
| 2894 } | 2885 } |
| 2895 | 2886 |
| 2896 } // namespace dart | 2887 } // namespace dart |
| OLD | NEW |