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

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

Issue 509153003: New bigint implementation in the vm. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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
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/raw_object.h" 5 #include "vm/raw_object.h"
6 6
7 #include "vm/class_table.h" 7 #include "vm/class_table.h"
8 #include "vm/dart.h" 8 #include "vm/dart.h"
9 #include "vm/freelist.h" 9 #include "vm/freelist.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 instance_size = Context::InstanceSize(num_variables); 90 instance_size = Context::InstanceSize(num_variables);
91 break; 91 break;
92 } 92 }
93 case kContextScopeCid: { 93 case kContextScopeCid: {
94 const RawContextScope* raw_context_scope = 94 const RawContextScope* raw_context_scope =
95 reinterpret_cast<const RawContextScope*>(this); 95 reinterpret_cast<const RawContextScope*>(this);
96 intptr_t num_variables = raw_context_scope->ptr()->num_variables_; 96 intptr_t num_variables = raw_context_scope->ptr()->num_variables_;
97 instance_size = ContextScope::InstanceSize(num_variables); 97 instance_size = ContextScope::InstanceSize(num_variables);
98 break; 98 break;
99 } 99 }
100 case kBigintCid: {
101 const RawBigint* raw_bgi = reinterpret_cast<const RawBigint*>(this);
102 intptr_t length = raw_bgi->ptr()->allocated_length_;
103 instance_size = Bigint::InstanceSize(length);
104 break;
105 }
106 case kOneByteStringCid: { 100 case kOneByteStringCid: {
107 const RawOneByteString* raw_string = 101 const RawOneByteString* raw_string =
108 reinterpret_cast<const RawOneByteString*>(this); 102 reinterpret_cast<const RawOneByteString*>(this);
109 intptr_t string_length = Smi::Value(raw_string->ptr()->length_); 103 intptr_t string_length = Smi::Value(raw_string->ptr()->length_);
110 instance_size = OneByteString::InstanceSize(string_length); 104 instance_size = OneByteString::InstanceSize(string_length);
111 break; 105 break;
112 } 106 }
113 case kTwoByteStringCid: { 107 case kTwoByteStringCid: {
114 const RawTwoByteString* raw_string = 108 const RawTwoByteString* raw_string =
115 reinterpret_cast<const RawTwoByteString*>(this); 109 reinterpret_cast<const RawTwoByteString*>(this);
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 // Make sure that we got here with the tagged pointer as this. 676 // Make sure that we got here with the tagged pointer as this.
683 ASSERT(raw_obj->IsHeapObject()); 677 ASSERT(raw_obj->IsHeapObject());
684 return Mint::InstanceSize(); 678 return Mint::InstanceSize();
685 } 679 }
686 680
687 681
688 intptr_t RawBigint::VisitBigintPointers(RawBigint* raw_obj, 682 intptr_t RawBigint::VisitBigintPointers(RawBigint* raw_obj,
689 ObjectPointerVisitor* visitor) { 683 ObjectPointerVisitor* visitor) {
690 // Make sure that we got here with the tagged pointer as this. 684 // Make sure that we got here with the tagged pointer as this.
691 ASSERT(raw_obj->IsHeapObject()); 685 ASSERT(raw_obj->IsHeapObject());
692 RawBigint* obj = raw_obj->ptr(); 686 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
693 intptr_t length = obj->allocated_length_; 687 return Bigint::InstanceSize();
694 return Bigint::InstanceSize(length);
695 } 688 }
696 689
697 690
698 intptr_t RawDouble::VisitDoublePointers(RawDouble* raw_obj, 691 intptr_t RawDouble::VisitDoublePointers(RawDouble* raw_obj,
699 ObjectPointerVisitor* visitor) { 692 ObjectPointerVisitor* visitor) {
700 // Make sure that we got here with the tagged pointer as this. 693 // Make sure that we got here with the tagged pointer as this.
701 ASSERT(raw_obj->IsHeapObject()); 694 ASSERT(raw_obj->IsHeapObject());
702 return Double::InstanceSize(); 695 return Double::InstanceSize();
703 } 696 }
704 697
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 intptr_t RawUserTag::VisitUserTagPointers( 884 intptr_t RawUserTag::VisitUserTagPointers(
892 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { 885 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) {
893 // Make sure that we got here with the tagged pointer as this. 886 // Make sure that we got here with the tagged pointer as this.
894 ASSERT(raw_obj->IsHeapObject()); 887 ASSERT(raw_obj->IsHeapObject());
895 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 888 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
896 return UserTag::InstanceSize(); 889 return UserTag::InstanceSize();
897 } 890 }
898 891
899 892
900 } // namespace dart 893 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698