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

Side by Side Diff: runtime/vm/object.h

Issue 207153003: Assert that FreeListElement is never wrapped in a handle. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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 | runtime/vm/object.cc » ('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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 6610 matching lines...) Expand 10 before | Expand all | Expand 10 after
6621 DART_FORCE_INLINE void Object::SetRaw(RawObject* value) { 6621 DART_FORCE_INLINE void Object::SetRaw(RawObject* value) {
6622 // NOTE: The assignment "raw_ = value" should be the first statement in 6622 // NOTE: The assignment "raw_ = value" should be the first statement in
6623 // this function. Also do not use 'value' in this function after the 6623 // this function. Also do not use 'value' in this function after the
6624 // assignment (use 'raw_' instead). 6624 // assignment (use 'raw_' instead).
6625 raw_ = value; 6625 raw_ = value;
6626 if ((reinterpret_cast<uword>(value) & kSmiTagMask) == kSmiTag) { 6626 if ((reinterpret_cast<uword>(value) & kSmiTagMask) == kSmiTag) {
6627 set_vtable(Smi::handle_vtable_); 6627 set_vtable(Smi::handle_vtable_);
6628 return; 6628 return;
6629 } 6629 }
6630 intptr_t cid = value->GetClassId(); 6630 intptr_t cid = value->GetClassId();
6631 // Free-list elements cannot be wrapped in a handle.
6632 ASSERT(cid != kFreeListElement);
6631 if (cid >= kNumPredefinedCids) { 6633 if (cid >= kNumPredefinedCids) {
6632 cid = kInstanceCid; 6634 cid = kInstanceCid;
6633 } 6635 }
6634 set_vtable(builtin_vtables_[cid]); 6636 set_vtable(builtin_vtables_[cid]);
6635 #if defined(DEBUG) 6637 #if defined(DEBUG)
6636 if (FLAG_verify_handles) { 6638 if (FLAG_verify_handles) {
6637 Isolate* isolate = Isolate::Current(); 6639 Isolate* isolate = Isolate::Current();
6638 Heap* isolate_heap = isolate->heap(); 6640 Heap* isolate_heap = isolate->heap();
6639 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); 6641 Heap* vm_isolate_heap = Dart::vm_isolate()->heap();
6640 ASSERT(isolate_heap->Contains(RawObject::ToAddr(raw_)) || 6642 ASSERT(isolate_heap->Contains(RawObject::ToAddr(raw_)) ||
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
6744 6746
6745 6747
6746 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6748 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6747 intptr_t index) { 6749 intptr_t index) {
6748 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6750 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6749 } 6751 }
6750 6752
6751 } // namespace dart 6753 } // namespace dart
6752 6754
6753 #endif // VM_OBJECT_H_ 6755 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698