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

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

Issue 11299170: - Do not visit length and hash of string objects. They are guaranteed to be Smi. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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/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/freelist.h" 8 #include "vm/freelist.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 intptr_t RawString::VisitStringPointers(RawString* raw_obj, 664 intptr_t RawString::VisitStringPointers(RawString* raw_obj,
665 ObjectPointerVisitor* visitor) { 665 ObjectPointerVisitor* visitor) {
666 // String is an abstract class. 666 // String is an abstract class.
667 UNREACHABLE(); 667 UNREACHABLE();
668 return 0; 668 return 0;
669 } 669 }
670 670
671 671
672 intptr_t RawOneByteString::VisitOneByteStringPointers( 672 intptr_t RawOneByteString::VisitOneByteStringPointers(
673 RawOneByteString* raw_obj, ObjectPointerVisitor* visitor) { 673 RawOneByteString* raw_obj, ObjectPointerVisitor* visitor) {
674 ASSERT(!raw_obj->ptr()->length_->IsHeapObject());
675 ASSERT(!raw_obj->ptr()->hash_->IsHeapObject());
674 intptr_t length = Smi::Value(raw_obj->ptr()->length_); 676 intptr_t length = Smi::Value(raw_obj->ptr()->length_);
675 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
676 return OneByteString::InstanceSize(length); 677 return OneByteString::InstanceSize(length);
677 } 678 }
678 679
679 680
680 intptr_t RawTwoByteString::VisitTwoByteStringPointers( 681 intptr_t RawTwoByteString::VisitTwoByteStringPointers(
681 RawTwoByteString* raw_obj, ObjectPointerVisitor* visitor) { 682 RawTwoByteString* raw_obj, ObjectPointerVisitor* visitor) {
683 ASSERT(!raw_obj->ptr()->length_->IsHeapObject());
684 ASSERT(!raw_obj->ptr()->hash_->IsHeapObject());
682 intptr_t length = Smi::Value(raw_obj->ptr()->length_); 685 intptr_t length = Smi::Value(raw_obj->ptr()->length_);
683 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
684 return TwoByteString::InstanceSize(length); 686 return TwoByteString::InstanceSize(length);
685 } 687 }
686 688
687 689
688 intptr_t RawExternalOneByteString::VisitExternalOneByteStringPointers( 690 intptr_t RawExternalOneByteString::VisitExternalOneByteStringPointers(
689 RawExternalOneByteString* raw_obj, ObjectPointerVisitor* visitor) { 691 RawExternalOneByteString* raw_obj, ObjectPointerVisitor* visitor) {
690 // Make sure that we got here with the tagged pointer as this. 692 // Make sure that we got here with the tagged pointer as this.
691 ASSERT(raw_obj->IsHeapObject()); 693 ASSERT(raw_obj->IsHeapObject());
692 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 694 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
693 return ExternalOneByteString::InstanceSize(); 695 return ExternalOneByteString::InstanceSize();
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 961
960 intptr_t RawWeakProperty::VisitWeakPropertyPointers( 962 intptr_t RawWeakProperty::VisitWeakPropertyPointers(
961 RawWeakProperty* raw_obj, ObjectPointerVisitor* visitor) { 963 RawWeakProperty* raw_obj, ObjectPointerVisitor* visitor) {
962 // Make sure that we got here with the tagged pointer as this. 964 // Make sure that we got here with the tagged pointer as this.
963 ASSERT(raw_obj->IsHeapObject()); 965 ASSERT(raw_obj->IsHeapObject());
964 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 966 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
965 return WeakProperty::InstanceSize(); 967 return WeakProperty::InstanceSize();
966 } 968 }
967 969
968 } // namespace dart 970 } // 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