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

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
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. 2897 // TODO(18854): Need to implement a way of recreating the irrexp functions.
rmacnak 2016/11/17 00:49:52 Remove this todo.
Vyacheslav Egorov (Google) 2016/11/17 16:51:33 Done.
2898 const Function& no_function = Function::Handle(reader->zone()); 2898 const Function& no_function = Function::Handle(reader->zone());
2899 regex.set_function(kOneByteStringCid, no_function); 2899 for (intptr_t cid = kOneByteStringCid; cid <= kExternalTwoByteStringCid;
erikcorry 2016/11/17 13:56:17 Here and elsewhere you put in a loop. Perhaps ther
Vyacheslav Egorov (Google) 2016/11/17 16:51:33 Yeah, that sounds like a nice improvement - but I
2900 regex.set_function(kTwoByteStringCid, no_function); 2900 cid++) {
2901 regex.set_function(kExternalOneByteStringCid, no_function); 2901 regex.set_function(cid, /*sticky=*/false, no_function);
2902 regex.set_function(kExternalTwoByteStringCid, no_function); 2902 regex.set_function(cid, /*sticky=*/true, no_function);
2903 2903 }
2904 const TypedData& no_bytecode = TypedData::Handle(reader->zone());
2905 regex.set_bytecode(true, no_bytecode);
2906 regex.set_bytecode(false, no_bytecode);
2907 2904
2908 return regex.raw(); 2905 return regex.raw();
2909 } 2906 }
2910 2907
2911 2908
2912 void RawRegExp::WriteTo(SnapshotWriter* writer, 2909 void RawRegExp::WriteTo(SnapshotWriter* writer,
2913 intptr_t object_id, 2910 intptr_t object_id,
2914 Snapshot::Kind kind, 2911 Snapshot::Kind kind,
2915 bool as_reference) { 2912 bool as_reference) {
2916 ASSERT(writer != NULL); 2913 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. 3009 // We do not allow objects with native fields in an isolate message.
3013 writer->SetWriteException(Exceptions::kArgument, 3010 writer->SetWriteException(Exceptions::kArgument,
3014 "Illegal argument in isolate message" 3011 "Illegal argument in isolate message"
3015 " : (object is a UserTag)"); 3012 " : (object is a UserTag)");
3016 } else { 3013 } else {
3017 UNREACHABLE(); 3014 UNREACHABLE();
3018 } 3015 }
3019 } 3016 }
3020 3017
3021 } // namespace dart 3018 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698