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

Side by Side Diff: runtime/vm/raw_object_snapshot.cc

Issue 2510783002: VM: Optimize RegExp.matchAsPrefix(...) by generating a sticky RegExp specialization. (Closed)
Patch Set: Done Created 4 years, 1 month 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
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/regexp.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/native_entry.h" 5 #include "vm/native_entry.h"
6 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/snapshot.h" 8 #include "vm/snapshot.h"
9 #include "vm/stub_code.h" 9 #include "vm/stub_code.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 2876 matching lines...) Expand 10 before | Expand all | Expand 10 after
2887 2887
2888 // Read and Set all the other fields. 2888 // Read and Set all the other fields.
2889 regex.StoreSmi(&regex.raw_ptr()->num_bracket_expressions_, 2889 regex.StoreSmi(&regex.raw_ptr()->num_bracket_expressions_,
2890 reader->ReadAsSmi()); 2890 reader->ReadAsSmi());
2891 *reader->StringHandle() ^= reader->ReadObjectImpl(kAsInlinedObject); 2891 *reader->StringHandle() ^= reader->ReadObjectImpl(kAsInlinedObject);
2892 regex.set_pattern(*reader->StringHandle()); 2892 regex.set_pattern(*reader->StringHandle());
2893 regex.StoreNonPointer(&regex.raw_ptr()->num_registers_, 2893 regex.StoreNonPointer(&regex.raw_ptr()->num_registers_,
2894 reader->Read<int32_t>()); 2894 reader->Read<int32_t>());
2895 regex.StoreNonPointer(&regex.raw_ptr()->type_flags_, reader->Read<int8_t>()); 2895 regex.StoreNonPointer(&regex.raw_ptr()->type_flags_, reader->Read<int8_t>());
2896 2896
2897 // TODO(18854): Need to implement a way of recreating the irrexp functions.
2898 const Function& no_function = Function::Handle(reader->zone()); 2897 const Function& no_function = Function::Handle(reader->zone());
2899 regex.set_function(kOneByteStringCid, no_function); 2898 for (intptr_t cid = kOneByteStringCid; cid <= kExternalTwoByteStringCid;
2900 regex.set_function(kTwoByteStringCid, no_function); 2899 cid++) {
2901 regex.set_function(kExternalOneByteStringCid, no_function); 2900 regex.set_function(cid, /*sticky=*/false, no_function);
2902 regex.set_function(kExternalTwoByteStringCid, no_function); 2901 regex.set_function(cid, /*sticky=*/true, no_function);
2903 2902 }
2904 const TypedData& no_bytecode = TypedData::Handle(reader->zone());
2905 regex.set_bytecode(true, no_bytecode);
2906 regex.set_bytecode(false, no_bytecode);
2907 2903
2908 return regex.raw(); 2904 return regex.raw();
2909 } 2905 }
2910 2906
2911 2907
2912 void RawRegExp::WriteTo(SnapshotWriter* writer, 2908 void RawRegExp::WriteTo(SnapshotWriter* writer,
2913 intptr_t object_id, 2909 intptr_t object_id,
2914 Snapshot::Kind kind, 2910 Snapshot::Kind kind,
2915 bool as_reference) { 2911 bool as_reference) {
2916 ASSERT(writer != NULL); 2912 ASSERT(writer != NULL);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
3012 // We do not allow objects with native fields in an isolate message. 3008 // We do not allow objects with native fields in an isolate message.
3013 writer->SetWriteException(Exceptions::kArgument, 3009 writer->SetWriteException(Exceptions::kArgument,
3014 "Illegal argument in isolate message" 3010 "Illegal argument in isolate message"
3015 " : (object is a UserTag)"); 3011 " : (object is a UserTag)");
3016 } else { 3012 } else {
3017 UNREACHABLE(); 3013 UNREACHABLE();
3018 } 3014 }
3019 } 3015 }
3020 3016
3021 } // namespace dart 3017 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/regexp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698