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

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

Issue 10444091: Avoid reading RawObject::class_ directly in the runtime. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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/heap.h" 5 #include "vm/heap.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/compiler_stats.h" 9 #include "vm/compiler_stats.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 void Heap::IterateCodePointers(ObjectPointerVisitor* visitor) { 127 void Heap::IterateCodePointers(ObjectPointerVisitor* visitor) {
128 code_space_->VisitObjectPointers(visitor); 128 code_space_->VisitObjectPointers(visitor);
129 } 129 }
130 130
131 131
132 RawInstructions* Heap::FindObjectInCodeSpace(FindObjectVisitor* visitor) { 132 RawInstructions* Heap::FindObjectInCodeSpace(FindObjectVisitor* visitor) {
133 // The code heap can only have RawInstructions objects. 133 // The code heap can only have RawInstructions objects.
134 RawObject* raw_obj = code_space_->FindObject(visitor); 134 RawObject* raw_obj = code_space_->FindObject(visitor);
135 ASSERT((raw_obj == Object::null()) || 135 ASSERT((raw_obj == Object::null()) ||
136 (raw_obj->ptr()->class_->ptr()->instance_kind_ == kInstructions)); 136 (raw_obj->GetClassIndex() == kInstructions));
137 return reinterpret_cast<RawInstructions*>(raw_obj); 137 return reinterpret_cast<RawInstructions*>(raw_obj);
138 } 138 }
139 139
140 140
141 void Heap::CollectGarbage(Space space, ApiCallbacks api_callbacks) { 141 void Heap::CollectGarbage(Space space, ApiCallbacks api_callbacks) {
142 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks); 142 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks);
143 switch (space) { 143 switch (space) {
144 case kNew: 144 case kNew:
145 new_space_->Scavenge(invoke_api_callbacks); 145 new_space_->Scavenge(invoke_api_callbacks);
146 break; 146 break;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 isolate()->IncrementNoGCScopeDepth(); 218 isolate()->IncrementNoGCScopeDepth();
219 } 219 }
220 220
221 221
222 NoGCScope::~NoGCScope() { 222 NoGCScope::~NoGCScope() {
223 isolate()->DecrementNoGCScopeDepth(); 223 isolate()->DecrementNoGCScopeDepth();
224 } 224 }
225 #endif // defined(DEBUG) 225 #endif // defined(DEBUG)
226 226
227 } // namespace dart 227 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/gc_marker.cc ('k') | runtime/vm/object.h » ('j') | runtime/vm/raw_object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698