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

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

Issue 465403003: Use class id directly in snapshot reader and avoid object store access. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 // Validate the class table. 412 // Validate the class table.
413 #if defined(DEBUG) 413 #if defined(DEBUG)
414 isolate->ValidateClassTable(); 414 isolate->ValidateClassTable();
415 #endif 415 #endif
416 416
417 // Setup native resolver for bootstrap impl. 417 // Setup native resolver for bootstrap impl.
418 Bootstrap::SetupNativeResolver(); 418 Bootstrap::SetupNativeResolver();
419 } 419 }
420 420
421 421
422 #define ALLOC_NEW_OBJECT_WITH_LEN(type, class_obj, length) \ 422 #define ALLOC_NEW_OBJECT_WITH_LEN(type, length) \
423 ASSERT(kind_ == Snapshot::kFull); \ 423 ASSERT(kind_ == Snapshot::kFull); \
424 ASSERT(isolate()->no_gc_scope_depth() != 0); \ 424 ASSERT(isolate()->no_gc_scope_depth() != 0); \
425 cls_ = class_obj; \
426 Raw##type* obj = reinterpret_cast<Raw##type*>( \ 425 Raw##type* obj = reinterpret_cast<Raw##type*>( \
427 AllocateUninitialized(cls_.id(), type::InstanceSize(length))); \ 426 AllocateUninitialized(k##type##Cid, type::InstanceSize(length))); \
428 obj->ptr()->length_ = Smi::New(length); \ 427 obj->ptr()->length_ = Smi::New(length); \
429 return obj; \ 428 return obj; \
430 429
431 430
432 RawArray* SnapshotReader::NewArray(intptr_t len) { 431 RawArray* SnapshotReader::NewArray(intptr_t len) {
433 ALLOC_NEW_OBJECT_WITH_LEN(Array, object_store()->array_class(), len); 432 ALLOC_NEW_OBJECT_WITH_LEN(Array, len);
434 } 433 }
435 434
436 435
437 RawImmutableArray* SnapshotReader::NewImmutableArray(intptr_t len) { 436 RawImmutableArray* SnapshotReader::NewImmutableArray(intptr_t len) {
438 ALLOC_NEW_OBJECT_WITH_LEN(ImmutableArray, 437 ALLOC_NEW_OBJECT_WITH_LEN(ImmutableArray, len);
439 object_store()->immutable_array_class(),
440 len);
441 } 438 }
442 439
443 440
444 RawOneByteString* SnapshotReader::NewOneByteString(intptr_t len) { 441 RawOneByteString* SnapshotReader::NewOneByteString(intptr_t len) {
445 ALLOC_NEW_OBJECT_WITH_LEN(OneByteString, 442 ALLOC_NEW_OBJECT_WITH_LEN(OneByteString, len);
446 object_store()->one_byte_string_class(),
447 len);
448 } 443 }
449 444
450 445
451 RawTwoByteString* SnapshotReader::NewTwoByteString(intptr_t len) { 446 RawTwoByteString* SnapshotReader::NewTwoByteString(intptr_t len) {
452 ALLOC_NEW_OBJECT_WITH_LEN(TwoByteString, 447 ALLOC_NEW_OBJECT_WITH_LEN(TwoByteString, len);
453 object_store()->two_byte_string_class(),
454 len);
455 } 448 }
456 449
457 450
458 RawTypeArguments* SnapshotReader::NewTypeArguments(intptr_t len) { 451 RawTypeArguments* SnapshotReader::NewTypeArguments(intptr_t len) {
459 ALLOC_NEW_OBJECT_WITH_LEN(TypeArguments, 452 ALLOC_NEW_OBJECT_WITH_LEN(TypeArguments, len);
460 Object::type_arguments_class(),
461 len);
462 } 453 }
463 454
464 455
465 RawTokenStream* SnapshotReader::NewTokenStream(intptr_t len) { 456 RawTokenStream* SnapshotReader::NewTokenStream(intptr_t len) {
466 ASSERT(kind_ == Snapshot::kFull); 457 ASSERT(kind_ == Snapshot::kFull);
467 ASSERT(isolate()->no_gc_scope_depth() != 0); 458 ASSERT(isolate()->no_gc_scope_depth() != 0);
468 cls_ = Object::token_stream_class();
469 stream_ = reinterpret_cast<RawTokenStream*>( 459 stream_ = reinterpret_cast<RawTokenStream*>(
470 AllocateUninitialized(cls_.id(), TokenStream::InstanceSize())); 460 AllocateUninitialized(kTokenStreamCid, TokenStream::InstanceSize()));
471 cls_ = isolate()->class_table()->At(kExternalTypedDataUint8ArrayCid);
472 uint8_t* array = const_cast<uint8_t*>(CurrentBufferAddress()); 461 uint8_t* array = const_cast<uint8_t*>(CurrentBufferAddress());
473 ASSERT(array != NULL); 462 ASSERT(array != NULL);
474 Advance(len); 463 Advance(len);
475 data_ = reinterpret_cast<RawExternalTypedData*>( 464 data_ = reinterpret_cast<RawExternalTypedData*>(
476 AllocateUninitialized(cls_.id(), ExternalTypedData::InstanceSize())); 465 AllocateUninitialized(kExternalTypedDataUint8ArrayCid,
466 ExternalTypedData::InstanceSize()));
477 data_.SetData(array); 467 data_.SetData(array);
478 data_.SetLength(len); 468 data_.SetLength(len);
479 stream_.SetStream(data_); 469 stream_.SetStream(data_);
480 return stream_.raw(); 470 return stream_.raw();
481 } 471 }
482 472
483 473
484 RawContext* SnapshotReader::NewContext(intptr_t num_variables) { 474 RawContext* SnapshotReader::NewContext(intptr_t num_variables) {
485 ASSERT(kind_ == Snapshot::kFull); 475 ASSERT(kind_ == Snapshot::kFull);
486 ASSERT(isolate()->no_gc_scope_depth() != 0); 476 ASSERT(isolate()->no_gc_scope_depth() != 0);
487 cls_ = Object::context_class();
488 RawContext* obj = reinterpret_cast<RawContext*>( 477 RawContext* obj = reinterpret_cast<RawContext*>(
489 AllocateUninitialized(cls_.id(), Context::InstanceSize(num_variables))); 478 AllocateUninitialized(kContextCid, Context::InstanceSize(num_variables)));
490 obj->ptr()->num_variables_ = num_variables; 479 obj->ptr()->num_variables_ = num_variables;
491 return obj; 480 return obj;
492 } 481 }
493 482
494 483
495 RawClass* SnapshotReader::NewClass(intptr_t class_id) { 484 RawClass* SnapshotReader::NewClass(intptr_t class_id) {
496 ASSERT(kind_ == Snapshot::kFull); 485 ASSERT(kind_ == Snapshot::kFull);
497 ASSERT(isolate()->no_gc_scope_depth() != 0); 486 ASSERT(isolate()->no_gc_scope_depth() != 0);
498 if (class_id < kNumPredefinedCids) { 487 if (class_id < kNumPredefinedCids) {
499 ASSERT((class_id >= kInstanceCid) && 488 ASSERT((class_id >= kInstanceCid) &&
500 (class_id <= kNullCid)); 489 (class_id <= kNullCid));
501 return isolate()->class_table()->At(class_id); 490 return isolate()->class_table()->At(class_id);
502 } 491 }
503 cls_ = Object::class_class();
504 RawClass* obj = reinterpret_cast<RawClass*>( 492 RawClass* obj = reinterpret_cast<RawClass*>(
505 AllocateUninitialized(cls_.id(), Class::InstanceSize())); 493 AllocateUninitialized(kClassCid, Class::InstanceSize()));
506 Instance fake; 494 Instance fake;
507 obj->ptr()->handle_vtable_ = fake.vtable(); 495 obj->ptr()->handle_vtable_ = fake.vtable();
508 cls_ = obj; 496 cls_ = obj;
509 cls_.set_id(class_id); 497 cls_.set_id(class_id);
510 isolate()->RegisterClassAt(class_id, cls_); 498 isolate()->RegisterClassAt(class_id, cls_);
511 return cls_.raw(); 499 return cls_.raw();
512 } 500 }
513 501
514 502
515 RawInstance* SnapshotReader::NewInstance() { 503 RawInstance* SnapshotReader::NewInstance() {
516 ASSERT(kind_ == Snapshot::kFull); 504 ASSERT(kind_ == Snapshot::kFull);
517 ASSERT(isolate()->no_gc_scope_depth() != 0); 505 ASSERT(isolate()->no_gc_scope_depth() != 0);
518 cls_ = object_store()->object_class();
519 RawInstance* obj = reinterpret_cast<RawInstance*>( 506 RawInstance* obj = reinterpret_cast<RawInstance*>(
520 AllocateUninitialized(cls_.id(), Instance::InstanceSize())); 507 AllocateUninitialized(kObjectCid, Instance::InstanceSize()));
521 return obj; 508 return obj;
522 } 509 }
523 510
524 511
525 RawMint* SnapshotReader::NewMint(int64_t value) { 512 RawMint* SnapshotReader::NewMint(int64_t value) {
526 ASSERT(kind_ == Snapshot::kFull); 513 ASSERT(kind_ == Snapshot::kFull);
527 ASSERT(isolate()->no_gc_scope_depth() != 0); 514 ASSERT(isolate()->no_gc_scope_depth() != 0);
528 cls_ = object_store()->mint_class();
529 RawMint* obj = reinterpret_cast<RawMint*>( 515 RawMint* obj = reinterpret_cast<RawMint*>(
530 AllocateUninitialized(cls_.id(), Mint::InstanceSize())); 516 AllocateUninitialized(kMintCid, Mint::InstanceSize()));
531 obj->ptr()->value_ = value; 517 obj->ptr()->value_ = value;
532 return obj; 518 return obj;
533 } 519 }
534 520
535 521
536 RawBigint* SnapshotReader::NewBigint(const char* hex_string) { 522 RawBigint* SnapshotReader::NewBigint(const char* hex_string) {
537 ASSERT(kind_ == Snapshot::kFull); 523 ASSERT(kind_ == Snapshot::kFull);
538 ASSERT(isolate()->no_gc_scope_depth() != 0); 524 ASSERT(isolate()->no_gc_scope_depth() != 0);
539 cls_ = object_store()->bigint_class();
540 intptr_t bigint_length = BigintOperations::ComputeChunkLength(hex_string); 525 intptr_t bigint_length = BigintOperations::ComputeChunkLength(hex_string);
541 RawBigint* obj = reinterpret_cast<RawBigint*>( 526 RawBigint* obj = reinterpret_cast<RawBigint*>(
542 AllocateUninitialized(cls_.id(), Bigint::InstanceSize(bigint_length))); 527 AllocateUninitialized(kBigintCid, Bigint::InstanceSize(bigint_length)));
543 obj->ptr()->allocated_length_ = bigint_length; 528 obj->ptr()->allocated_length_ = bigint_length;
544 obj->ptr()->signed_length_ = bigint_length; 529 obj->ptr()->signed_length_ = bigint_length;
545 BigintOperations::FromHexCString(hex_string, Bigint::Handle(obj)); 530 BigintOperations::FromHexCString(hex_string, Bigint::Handle(obj));
546 return obj; 531 return obj;
547 } 532 }
548 533
549 534
550 RawDouble* SnapshotReader::NewDouble(double value) { 535 RawDouble* SnapshotReader::NewDouble(double value) {
551 ASSERT(kind_ == Snapshot::kFull); 536 ASSERT(kind_ == Snapshot::kFull);
552 ASSERT(isolate()->no_gc_scope_depth() != 0); 537 ASSERT(isolate()->no_gc_scope_depth() != 0);
553 cls_ = object_store()->double_class();
554 RawDouble* obj = reinterpret_cast<RawDouble*>( 538 RawDouble* obj = reinterpret_cast<RawDouble*>(
555 AllocateUninitialized(cls_.id(), Double::InstanceSize())); 539 AllocateUninitialized(kDoubleCid, Double::InstanceSize()));
556 obj->ptr()->value_ = value; 540 obj->ptr()->value_ = value;
557 return obj; 541 return obj;
558 } 542 }
559 543
560 544
561 RawTypedData* SnapshotReader::NewTypedData(intptr_t class_id, intptr_t len) { 545 RawTypedData* SnapshotReader::NewTypedData(intptr_t class_id, intptr_t len) {
562 ASSERT(kind_ == Snapshot::kFull); 546 ASSERT(kind_ == Snapshot::kFull);
563 ASSERT(isolate()->no_gc_scope_depth() != 0); 547 ASSERT(isolate()->no_gc_scope_depth() != 0);
564 const intptr_t lengthInBytes = len * TypedData::ElementSizeInBytes(class_id); 548 const intptr_t lengthInBytes = len * TypedData::ElementSizeInBytes(class_id);
565 RawTypedData* obj = reinterpret_cast<RawTypedData*>( 549 RawTypedData* obj = reinterpret_cast<RawTypedData*>(
566 AllocateUninitialized(class_id, TypedData::InstanceSize(lengthInBytes))); 550 AllocateUninitialized(class_id, TypedData::InstanceSize(lengthInBytes)));
567 obj->ptr()->length_ = Smi::New(len); 551 obj->ptr()->length_ = Smi::New(len);
568 return obj; 552 return obj;
569 } 553 }
570 554
571 555
572 #define ALLOC_NEW_OBJECT(type, class_obj) \ 556 #define ALLOC_NEW_OBJECT(type) \
573 ASSERT(kind_ == Snapshot::kFull); \ 557 ASSERT(kind_ == Snapshot::kFull); \
574 ASSERT(isolate()->no_gc_scope_depth() != 0); \ 558 ASSERT(isolate()->no_gc_scope_depth() != 0); \
575 cls_ = class_obj; \
576 return reinterpret_cast<Raw##type*>( \ 559 return reinterpret_cast<Raw##type*>( \
577 AllocateUninitialized(cls_.id(), type::InstanceSize())); \ 560 AllocateUninitialized(k##type##Cid, type::InstanceSize())); \
578 561
579 562
580 RawUnresolvedClass* SnapshotReader::NewUnresolvedClass() { 563 RawUnresolvedClass* SnapshotReader::NewUnresolvedClass() {
581 ALLOC_NEW_OBJECT(UnresolvedClass, Object::unresolved_class_class()); 564 ALLOC_NEW_OBJECT(UnresolvedClass);
582 } 565 }
583 566
584 567
585 RawType* SnapshotReader::NewType() { 568 RawType* SnapshotReader::NewType() {
586 ALLOC_NEW_OBJECT(Type, object_store()->type_class()); 569 ALLOC_NEW_OBJECT(Type);
587 } 570 }
588 571
589 572
590 RawTypeRef* SnapshotReader::NewTypeRef() { 573 RawTypeRef* SnapshotReader::NewTypeRef() {
591 ALLOC_NEW_OBJECT(TypeRef, object_store()->type_ref_class()); 574 ALLOC_NEW_OBJECT(TypeRef);
592 } 575 }
593 576
594 577
595 RawTypeParameter* SnapshotReader::NewTypeParameter() { 578 RawTypeParameter* SnapshotReader::NewTypeParameter() {
596 ALLOC_NEW_OBJECT(TypeParameter, object_store()->type_parameter_class()); 579 ALLOC_NEW_OBJECT(TypeParameter);
597 } 580 }
598 581
599 582
600 RawBoundedType* SnapshotReader::NewBoundedType() { 583 RawBoundedType* SnapshotReader::NewBoundedType() {
601 ALLOC_NEW_OBJECT(BoundedType, object_store()->bounded_type_class()); 584 ALLOC_NEW_OBJECT(BoundedType);
602 } 585 }
603 586
604 587
605 RawMixinAppType* SnapshotReader::NewMixinAppType() { 588 RawMixinAppType* SnapshotReader::NewMixinAppType() {
606 ALLOC_NEW_OBJECT(MixinAppType, object_store()->mixin_app_type_class()); 589 ALLOC_NEW_OBJECT(MixinAppType);
607 } 590 }
608 591
609 592
610 RawPatchClass* SnapshotReader::NewPatchClass() { 593 RawPatchClass* SnapshotReader::NewPatchClass() {
611 ALLOC_NEW_OBJECT(PatchClass, Object::patch_class_class()); 594 ALLOC_NEW_OBJECT(PatchClass);
612 } 595 }
613 596
614 597
615 RawClosureData* SnapshotReader::NewClosureData() { 598 RawClosureData* SnapshotReader::NewClosureData() {
616 ALLOC_NEW_OBJECT(ClosureData, Object::closure_data_class()); 599 ALLOC_NEW_OBJECT(ClosureData);
617 } 600 }
618 601
619 602
620 RawRedirectionData* SnapshotReader::NewRedirectionData() { 603 RawRedirectionData* SnapshotReader::NewRedirectionData() {
621 ALLOC_NEW_OBJECT(RedirectionData, Object::redirection_data_class()); 604 ALLOC_NEW_OBJECT(RedirectionData);
622 } 605 }
623 606
624 607
625 RawFunction* SnapshotReader::NewFunction() { 608 RawFunction* SnapshotReader::NewFunction() {
626 ALLOC_NEW_OBJECT(Function, Object::function_class()); 609 ALLOC_NEW_OBJECT(Function);
627 } 610 }
628 611
629 612
630 RawField* SnapshotReader::NewField() { 613 RawField* SnapshotReader::NewField() {
631 ALLOC_NEW_OBJECT(Field, Object::field_class()); 614 ALLOC_NEW_OBJECT(Field);
632 } 615 }
633 616
634 617
635 RawLibrary* SnapshotReader::NewLibrary() { 618 RawLibrary* SnapshotReader::NewLibrary() {
636 ALLOC_NEW_OBJECT(Library, Object::library_class()); 619 ALLOC_NEW_OBJECT(Library);
637 } 620 }
638 621
639 622
640 RawLibraryPrefix* SnapshotReader::NewLibraryPrefix() { 623 RawLibraryPrefix* SnapshotReader::NewLibraryPrefix() {
641 ALLOC_NEW_OBJECT(LibraryPrefix, object_store()->library_prefix_class()); 624 ALLOC_NEW_OBJECT(LibraryPrefix);
642 } 625 }
643 626
644 627
645 RawNamespace* SnapshotReader::NewNamespace() { 628 RawNamespace* SnapshotReader::NewNamespace() {
646 ALLOC_NEW_OBJECT(Namespace, Object::namespace_class()); 629 ALLOC_NEW_OBJECT(Namespace);
647 } 630 }
648 631
649 632
650 RawScript* SnapshotReader::NewScript() { 633 RawScript* SnapshotReader::NewScript() {
651 ALLOC_NEW_OBJECT(Script, Object::script_class()); 634 ALLOC_NEW_OBJECT(Script);
652 } 635 }
653 636
654 637
655 RawLiteralToken* SnapshotReader::NewLiteralToken() { 638 RawLiteralToken* SnapshotReader::NewLiteralToken() {
656 ALLOC_NEW_OBJECT(LiteralToken, Object::literal_token_class()); 639 ALLOC_NEW_OBJECT(LiteralToken);
657 } 640 }
658 641
659 642
660 RawGrowableObjectArray* SnapshotReader::NewGrowableObjectArray() { 643 RawGrowableObjectArray* SnapshotReader::NewGrowableObjectArray() {
661 ALLOC_NEW_OBJECT(GrowableObjectArray, 644 ALLOC_NEW_OBJECT(GrowableObjectArray);
662 object_store()->growable_object_array_class());
663 } 645 }
664 646
665 647
666 RawFloat32x4* SnapshotReader::NewFloat32x4(float v0, float v1, float v2, 648 RawFloat32x4* SnapshotReader::NewFloat32x4(float v0, float v1, float v2,
667 float v3) { 649 float v3) {
668 ASSERT(kind_ == Snapshot::kFull); 650 ASSERT(kind_ == Snapshot::kFull);
669 ASSERT(isolate()->no_gc_scope_depth() != 0); 651 ASSERT(isolate()->no_gc_scope_depth() != 0);
670 cls_ = object_store()->float32x4_class();
671 RawFloat32x4* obj = reinterpret_cast<RawFloat32x4*>( 652 RawFloat32x4* obj = reinterpret_cast<RawFloat32x4*>(
672 AllocateUninitialized(cls_.id(), Float32x4::InstanceSize())); 653 AllocateUninitialized(kFloat32x4Cid, Float32x4::InstanceSize()));
673 obj->ptr()->value_[0] = v0; 654 obj->ptr()->value_[0] = v0;
674 obj->ptr()->value_[1] = v1; 655 obj->ptr()->value_[1] = v1;
675 obj->ptr()->value_[2] = v2; 656 obj->ptr()->value_[2] = v2;
676 obj->ptr()->value_[3] = v3; 657 obj->ptr()->value_[3] = v3;
677 return obj; 658 return obj;
678 } 659 }
679 660
680 661
681 RawInt32x4* SnapshotReader::NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2, 662 RawInt32x4* SnapshotReader::NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2,
682 uint32_t v3) { 663 uint32_t v3) {
683 ASSERT(kind_ == Snapshot::kFull); 664 ASSERT(kind_ == Snapshot::kFull);
684 ASSERT(isolate()->no_gc_scope_depth() != 0); 665 ASSERT(isolate()->no_gc_scope_depth() != 0);
685 cls_ = object_store()->int32x4_class();
686 RawInt32x4* obj = reinterpret_cast<RawInt32x4*>( 666 RawInt32x4* obj = reinterpret_cast<RawInt32x4*>(
687 AllocateUninitialized(cls_.id(), Int32x4::InstanceSize())); 667 AllocateUninitialized(kInt32x4Cid, Int32x4::InstanceSize()));
688 obj->ptr()->value_[0] = v0; 668 obj->ptr()->value_[0] = v0;
689 obj->ptr()->value_[1] = v1; 669 obj->ptr()->value_[1] = v1;
690 obj->ptr()->value_[2] = v2; 670 obj->ptr()->value_[2] = v2;
691 obj->ptr()->value_[3] = v3; 671 obj->ptr()->value_[3] = v3;
692 return obj; 672 return obj;
693 } 673 }
694 674
695 675
696 RawFloat64x2* SnapshotReader::NewFloat64x2(double v0, double v1) { 676 RawFloat64x2* SnapshotReader::NewFloat64x2(double v0, double v1) {
697 ASSERT(kind_ == Snapshot::kFull); 677 ASSERT(kind_ == Snapshot::kFull);
698 ASSERT(isolate()->no_gc_scope_depth() != 0); 678 ASSERT(isolate()->no_gc_scope_depth() != 0);
699 cls_ = object_store()->float64x2_class();
700 RawFloat64x2* obj = reinterpret_cast<RawFloat64x2*>( 679 RawFloat64x2* obj = reinterpret_cast<RawFloat64x2*>(
701 AllocateUninitialized(cls_.id(), Float64x2::InstanceSize())); 680 AllocateUninitialized(kFloat64x2Cid, Float64x2::InstanceSize()));
702 obj->ptr()->value_[0] = v0; 681 obj->ptr()->value_[0] = v0;
703 obj->ptr()->value_[1] = v1; 682 obj->ptr()->value_[1] = v1;
704 return obj; 683 return obj;
705 } 684 }
706 685
707 686
708 RawApiError* SnapshotReader::NewApiError() { 687 RawApiError* SnapshotReader::NewApiError() {
709 ALLOC_NEW_OBJECT(ApiError, Object::api_error_class()); 688 ALLOC_NEW_OBJECT(ApiError);
710 } 689 }
711 690
712 691
713 RawLanguageError* SnapshotReader::NewLanguageError() { 692 RawLanguageError* SnapshotReader::NewLanguageError() {
714 ALLOC_NEW_OBJECT(LanguageError, Object::language_error_class()); 693 ALLOC_NEW_OBJECT(LanguageError);
715 } 694 }
716 695
717 696
718 RawUnhandledException* SnapshotReader::NewUnhandledException() { 697 RawUnhandledException* SnapshotReader::NewUnhandledException() {
719 ALLOC_NEW_OBJECT(UnhandledException, Object::unhandled_exception_class()); 698 ALLOC_NEW_OBJECT(UnhandledException);
720 } 699 }
721 700
722 701
723 RawObject* SnapshotReader::NewInteger(int64_t value) { 702 RawObject* SnapshotReader::NewInteger(int64_t value) {
724 ASSERT((value & kSmiTagMask) == kSmiTag); 703 ASSERT((value & kSmiTagMask) == kSmiTag);
725 value = value >> kSmiTagShift; 704 value = value >> kSmiTagShift;
726 if (Smi::IsValid(value)) { 705 if (Smi::IsValid(value)) {
727 return Smi::New(static_cast<intptr_t>(value)); 706 return Smi::New(static_cast<intptr_t>(value));
728 } 707 }
729 if (kind_ == Snapshot::kFull) { 708 if (kind_ == Snapshot::kFull) {
730 return NewMint(value); 709 return NewMint(value);
731 } 710 }
732 return Mint::NewCanonical(value); 711 return Mint::NewCanonical(value);
733 } 712 }
734 713
735 714
736 RawStacktrace* SnapshotReader::NewStacktrace() { 715 RawStacktrace* SnapshotReader::NewStacktrace() {
737 ALLOC_NEW_OBJECT(Stacktrace, object_store()->stacktrace_class()); 716 ALLOC_NEW_OBJECT(Stacktrace);
738 } 717 }
739 718
740 719
741 RawClass* SnapshotReader::LookupInternalClass(intptr_t class_header) { 720 RawClass* SnapshotReader::LookupInternalClass(intptr_t class_header) {
742 // If the header is an object Id, lookup singleton VM classes or classes 721 // If the header is an object Id, lookup singleton VM classes or classes
743 // stored in the object store. 722 // stored in the object store.
744 if (IsVMIsolateObject(class_header)) { 723 if (IsVMIsolateObject(class_header)) {
745 intptr_t class_id = GetVMIsolateObjectId(class_header); 724 intptr_t class_id = GetVMIsolateObjectId(class_header);
746 if (IsSingletonClassId(class_id)) { 725 if (IsSingletonClassId(class_id)) {
747 return isolate()->class_table()->At(class_id); // get singleton class. 726 return isolate()->class_table()->At(class_id); // get singleton class.
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 NoGCScope no_gc; 1630 NoGCScope no_gc;
1652 WriteObject(obj.raw()); 1631 WriteObject(obj.raw());
1653 UnmarkAll(); 1632 UnmarkAll();
1654 } else { 1633 } else {
1655 ThrowException(exception_type(), exception_msg()); 1634 ThrowException(exception_type(), exception_msg());
1656 } 1635 }
1657 } 1636 }
1658 1637
1659 1638
1660 } // namespace dart 1639 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698