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

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

Issue 11500004: Address comments about safely casting handles. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 9298 matching lines...) Expand 10 before | Expand all | Expand 10 after
9309 9309
9310 9310
9311 bool Type::HasResolvedTypeClass() const { 9311 bool Type::HasResolvedTypeClass() const {
9312 const Object& type_class = Object::Handle(raw_ptr()->type_class_); 9312 const Object& type_class = Object::Handle(raw_ptr()->type_class_);
9313 return !type_class.IsNull() && type_class.IsClass(); 9313 return !type_class.IsNull() && type_class.IsClass();
9314 } 9314 }
9315 9315
9316 9316
9317 RawClass* Type::type_class() const { 9317 RawClass* Type::type_class() const {
9318 ASSERT(HasResolvedTypeClass()); 9318 ASSERT(HasResolvedTypeClass());
9319 #ifdef DEBUG
9320 Class& type_class = Class::Handle();
9321 type_class ^= raw_ptr()->type_class_;
9322 return type_class.raw();
9323 #else
9319 return reinterpret_cast<RawClass*>(raw_ptr()->type_class_); 9324 return reinterpret_cast<RawClass*>(raw_ptr()->type_class_);
9325 #endif
9320 } 9326 }
9321 9327
9322 9328
9323 RawUnresolvedClass* Type::unresolved_class() const { 9329 RawUnresolvedClass* Type::unresolved_class() const {
9330 ASSERT(!HasResolvedTypeClass());
9331 #ifdef DEBUG
9332 UnresolvedClass& unresolved_class = UnresolvedClass::Handle();
9333 unresolved_class ^= raw_ptr()->type_class_;
9334 ASSERT(!unresolved_class.IsNull());
9335 return unresolved_class.raw();
9336 #else
9324 ASSERT(!Object::Handle(raw_ptr()->type_class_).IsNull()); 9337 ASSERT(!Object::Handle(raw_ptr()->type_class_).IsNull());
9325 ASSERT(Object::Handle(raw_ptr()->type_class_).IsUnresolvedClass()); 9338 ASSERT(Object::Handle(raw_ptr()->type_class_).IsUnresolvedClass());
9326 return reinterpret_cast<RawUnresolvedClass*>(raw_ptr()->type_class_); 9339 return reinterpret_cast<RawUnresolvedClass*>(raw_ptr()->type_class_);
9340 #endif
9327 } 9341 }
9328 9342
9329 9343
9330 RawString* Type::TypeClassName() const { 9344 RawString* Type::TypeClassName() const {
9331 if (HasResolvedTypeClass()) { 9345 if (HasResolvedTypeClass()) {
9332 const Class& cls = Class::Handle(type_class()); 9346 const Class& cls = Class::Handle(type_class());
9333 return cls.Name(); 9347 return cls.Name();
9334 } else { 9348 } else {
9335 const UnresolvedClass& cls = UnresolvedClass::Handle(unresolved_class()); 9349 const UnresolvedClass& cls = UnresolvedClass::Handle(unresolved_class());
9336 return cls.Name(); 9350 return cls.Name();
(...skipping 3453 matching lines...) Expand 10 before | Expand all | Expand 10 after
12790 } 12804 }
12791 return result.raw(); 12805 return result.raw();
12792 } 12806 }
12793 12807
12794 12808
12795 const char* WeakProperty::ToCString() const { 12809 const char* WeakProperty::ToCString() const {
12796 return "_WeakProperty"; 12810 return "_WeakProperty";
12797 } 12811 }
12798 12812
12799 } // namespace dart 12813 } // 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