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

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

Issue 12473002: Complete implementation of bounds checking in the vm, by introducing a vm object (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/intermediate_language.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 #include "vm/heap_profiler.h" 5 #include "vm/heap_profiler.h"
6 6
7 #include "vm/dart_api_state.h" 7 #include "vm/dart_api_state.h"
8 #include "vm/object.h" 8 #include "vm/object.h"
9 #include "vm/raw_object.h" 9 #include "vm/raw_object.h"
10 #include "vm/stack_frame.h" 10 #include "vm/stack_frame.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 202
203 203
204 const RawClass* HeapProfiler::GetClass(const RawObject* raw_obj) { 204 const RawClass* HeapProfiler::GetClass(const RawObject* raw_obj) {
205 return Isolate::Current()->class_table()->At(raw_obj->GetClassId()); 205 return Isolate::Current()->class_table()->At(raw_obj->GetClassId());
206 } 206 }
207 207
208 208
209 const RawClass* HeapProfiler::GetSuperClass(const RawClass* raw_class) { 209 const RawClass* HeapProfiler::GetSuperClass(const RawClass* raw_class) {
210 ASSERT(raw_class != Class::null()); 210 ASSERT(raw_class != Class::null());
211 const RawType* super_type = raw_class->ptr()->super_type_; 211 const RawAbstractType* super_type = raw_class->ptr()->super_type_;
212 if (super_type == Type::null()) { 212 if (super_type == AbstractType::null()) {
213 return Class::null(); 213 return Class::null();
214 } 214 }
215 return reinterpret_cast<const RawClass*>(super_type->ptr()->type_class_); 215 while (super_type->GetClassId() == kBoundedTypeCid) {
216 super_type =
217 reinterpret_cast<const RawBoundedType*>(super_type)->ptr()->type_;
218 }
219 ASSERT(super_type->GetClassId() == kTypeCid);
220 return reinterpret_cast<const RawClass*>(
221 reinterpret_cast<const RawType*>(super_type)->ptr()->type_class_);
216 } 222 }
217 223
218 224
219 void HeapProfiler::WriteRoot(const RawObject* raw_obj) { 225 void HeapProfiler::WriteRoot(const RawObject* raw_obj) {
220 SubRecord sub(kRootUnknown, this); 226 SubRecord sub(kRootUnknown, this);
221 sub.WriteObjectId(ObjectId(raw_obj)); 227 sub.WriteObjectId(ObjectId(raw_obj));
222 } 228 }
223 229
224 230
225 void HeapProfiler::WriteObject(const RawObject* raw_obj) { 231 void HeapProfiler::WriteObject(const RawObject* raw_obj) {
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 RawObject* raw_obj = handle->raw(); 807 RawObject* raw_obj = handle->raw();
802 visitor_->VisitPointer(&raw_obj); 808 visitor_->VisitPointer(&raw_obj);
803 } 809 }
804 810
805 811
806 void HeapProfilerObjectVisitor::VisitObject(RawObject* raw_obj) { 812 void HeapProfilerObjectVisitor::VisitObject(RawObject* raw_obj) {
807 profiler_->WriteObject(raw_obj); 813 profiler_->WriteObject(raw_obj);
808 } 814 }
809 815
810 } // namespace dart 816 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698