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

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

Issue 1430993003: Add test precompiling dart2js. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: status file Created 5 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 | « no previous file | runtime/vm/snapshot.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 3322 matching lines...) Expand 10 before | Expand all | Expand 10 after
3333 } 3333 }
3334 } 3334 }
3335 3335
3336 3336
3337 RawJSRegExp* JSRegExp::ReadFrom(SnapshotReader* reader, 3337 RawJSRegExp* JSRegExp::ReadFrom(SnapshotReader* reader,
3338 intptr_t object_id, 3338 intptr_t object_id,
3339 intptr_t tags, 3339 intptr_t tags,
3340 Snapshot::Kind kind, 3340 Snapshot::Kind kind,
3341 bool as_reference) { 3341 bool as_reference) {
3342 ASSERT(reader != NULL); 3342 ASSERT(reader != NULL);
3343 ASSERT(kind == Snapshot::kMessage);
3344 3343
3345 // Allocate JSRegExp object. 3344 // Allocate JSRegExp object.
3346 JSRegExp& regex = JSRegExp::ZoneHandle( 3345 JSRegExp& regex = JSRegExp::ZoneHandle(reader->zone(), NEW_OBJECT(JSRegExp));
3347 reader->zone(), JSRegExp::New(HEAP_SPACE(kind)));
3348 reader->AddBackRef(object_id, &regex, kIsDeserialized); 3346 reader->AddBackRef(object_id, &regex, kIsDeserialized);
3349 3347
3350 // Read and Set all the other fields. 3348 // Read and Set all the other fields.
3351 regex.StoreSmi(&regex.raw_ptr()->num_bracket_expressions_, 3349 regex.StoreSmi(&regex.raw_ptr()->num_bracket_expressions_,
3352 reader->ReadAsSmi()); 3350 reader->ReadAsSmi());
3353 *reader->StringHandle() ^= reader->ReadObjectImpl(kAsInlinedObject); 3351 *reader->StringHandle() ^= reader->ReadObjectImpl(kAsInlinedObject);
3354 regex.set_pattern(*reader->StringHandle()); 3352 regex.set_pattern(*reader->StringHandle());
3355 regex.StoreNonPointer(&regex.raw_ptr()->num_registers_, 3353 regex.StoreNonPointer(&regex.raw_ptr()->num_registers_,
3356 reader->Read<int32_t>()); 3354 reader->Read<int32_t>());
3357 regex.StoreNonPointer(&regex.raw_ptr()->type_flags_, 3355 regex.StoreNonPointer(&regex.raw_ptr()->type_flags_,
3358 reader->Read<int8_t>()); 3356 reader->Read<int8_t>());
3359 3357
3360 // TODO(18854): Need to implement a way of recreating the irrexp functions. 3358 // TODO(18854): Need to implement a way of recreating the irrexp functions.
3359 const Function& no_function = Function::Handle(reader->zone());
3360 regex.set_function(kOneByteStringCid, no_function);
3361 regex.set_function(kTwoByteStringCid, no_function);
3362 regex.set_function(kExternalOneByteStringCid, no_function);
3363 regex.set_function(kExternalTwoByteStringCid, no_function);
3364
3365 const TypedData& no_bytecode = TypedData::Handle(reader->zone());
3366 regex.set_bytecode(true, no_bytecode);
3367 regex.set_bytecode(false, no_bytecode);
3368
3361 return regex.raw(); 3369 return regex.raw();
3362 } 3370 }
3363 3371
3364 3372
3365 void RawJSRegExp::WriteTo(SnapshotWriter* writer, 3373 void RawJSRegExp::WriteTo(SnapshotWriter* writer,
3366 intptr_t object_id, 3374 intptr_t object_id,
3367 Snapshot::Kind kind, 3375 Snapshot::Kind kind,
3368 bool as_reference) { 3376 bool as_reference) {
3369 ASSERT(writer != NULL); 3377 ASSERT(writer != NULL);
3370 ASSERT(kind == Snapshot::kMessage);
3371 3378
3372 // Write out the serialization header value for this object. 3379 // Write out the serialization header value for this object.
3373 writer->WriteInlinedObjectHeader(object_id); 3380 writer->WriteInlinedObjectHeader(object_id);
3374 3381
3375 // Write out the class and tags information. 3382 // Write out the class and tags information.
3376 writer->WriteIndexedObject(kJSRegExpCid); 3383 writer->WriteIndexedObject(kJSRegExpCid);
3377 writer->WriteTags(writer->GetObjectTags(this)); 3384 writer->WriteTags(writer->GetObjectTags(this));
3378 3385
3379 // Write out all the other fields. 3386 // Write out all the other fields.
3380 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); 3387 writer->Write<RawObject*>(ptr()->num_bracket_expressions_);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3467 // We do not allow objects with native fields in an isolate message. 3474 // We do not allow objects with native fields in an isolate message.
3468 writer->SetWriteException(Exceptions::kArgument, 3475 writer->SetWriteException(Exceptions::kArgument,
3469 "Illegal argument in isolate message" 3476 "Illegal argument in isolate message"
3470 " : (object is a UserTag)"); 3477 " : (object is a UserTag)");
3471 } else { 3478 } else {
3472 UNREACHABLE(); 3479 UNREACHABLE();
3473 } 3480 }
3474 } 3481 }
3475 3482
3476 } // namespace dart 3483 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698