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

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

Issue 1914293002: Cleanup some handle creation code, was showing up in the CompileAll testing that we are doing with … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | runtime/vm/parser.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/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/cpu.h" 10 #include "vm/cpu.h"
(...skipping 16318 matching lines...) Expand 10 before | Expand all | Expand 10 after
16329 } 16329 }
16330 16330
16331 16331
16332 void Type::SetIsResolved() const { 16332 void Type::SetIsResolved() const {
16333 ASSERT(!IsResolved()); 16333 ASSERT(!IsResolved());
16334 set_type_state(RawType::kResolved); 16334 set_type_state(RawType::kResolved);
16335 } 16335 }
16336 16336
16337 16337
16338 bool Type::HasResolvedTypeClass() const { 16338 bool Type::HasResolvedTypeClass() const {
16339 const Object& type_class = Object::Handle(raw_ptr()->type_class_); 16339 return (raw_ptr()->type_class_->GetClassId() == kClassCid);
16340 return !type_class.IsNull() && type_class.IsClass();
16341 } 16340 }
16342 16341
16343 16342
16344 RawClass* Type::type_class() const { 16343 RawClass* Type::type_class() const {
16344 #ifdef DEBUG
16345 ASSERT(HasResolvedTypeClass()); 16345 ASSERT(HasResolvedTypeClass());
16346 #ifdef DEBUG
16347 Class& type_class = Class::Handle(); 16346 Class& type_class = Class::Handle();
16348 type_class ^= raw_ptr()->type_class_; 16347 type_class ^= raw_ptr()->type_class_;
16349 return type_class.raw(); 16348 return type_class.raw();
16350 #else 16349 #else
16351 return reinterpret_cast<RawClass*>(raw_ptr()->type_class_); 16350 return reinterpret_cast<RawClass*>(raw_ptr()->type_class_);
16352 #endif 16351 #endif
16353 } 16352 }
16354 16353
16355 16354
16356 RawUnresolvedClass* Type::unresolved_class() const { 16355 RawUnresolvedClass* Type::unresolved_class() const {
16356 #ifdef DEBUG
16357 ASSERT(!HasResolvedTypeClass()); 16357 ASSERT(!HasResolvedTypeClass());
16358 #ifdef DEBUG
16359 UnresolvedClass& unresolved_class = UnresolvedClass::Handle(); 16358 UnresolvedClass& unresolved_class = UnresolvedClass::Handle();
16360 unresolved_class ^= raw_ptr()->type_class_; 16359 unresolved_class ^= raw_ptr()->type_class_;
16361 ASSERT(!unresolved_class.IsNull()); 16360 ASSERT(!unresolved_class.IsNull());
16362 return unresolved_class.raw(); 16361 return unresolved_class.raw();
16363 #else 16362 #else
16364 ASSERT(!Object::Handle(raw_ptr()->type_class_).IsNull()); 16363 ASSERT(!Object::Handle(raw_ptr()->type_class_).IsNull());
16365 ASSERT(Object::Handle(raw_ptr()->type_class_).IsUnresolvedClass()); 16364 ASSERT(Object::Handle(raw_ptr()->type_class_).IsUnresolvedClass());
16366 return reinterpret_cast<RawUnresolvedClass*>(raw_ptr()->type_class_); 16365 return reinterpret_cast<RawUnresolvedClass*>(raw_ptr()->type_class_);
16367 #endif 16366 #endif
16368 } 16367 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
16485 if (!IsFinalized() || !other_type.IsFinalized()) { 16484 if (!IsFinalized() || !other_type.IsFinalized()) {
16486 return false; // Too early to decide if equal. 16485 return false; // Too early to decide if equal.
16487 } 16486 }
16488 if ((arguments() == other_type.arguments()) && 16487 if ((arguments() == other_type.arguments()) &&
16489 (signature() == other_type.signature())) { 16488 (signature() == other_type.signature())) {
16490 return true; 16489 return true;
16491 } 16490 }
16492 Thread* thread = Thread::Current(); 16491 Thread* thread = Thread::Current();
16493 Zone* zone = thread->zone(); 16492 Zone* zone = thread->zone();
16494 if (arguments() != other_type.arguments()) { 16493 if (arguments() != other_type.arguments()) {
16495 const Class& cls = Class::Handle(zone, type_class()); 16494 const Class& cls = Class::Handle(zone, type_class());
16496 const intptr_t num_type_params = cls.NumTypeParameters(thread); 16495 const intptr_t num_type_params = cls.NumTypeParameters(thread);
16497 // Shortcut unnecessary handle allocation below if non-generic. 16496 // Shortcut unnecessary handle allocation below if non-generic.
16498 if (num_type_params > 0) { 16497 if (num_type_params > 0) {
16499 const intptr_t num_type_args = cls.NumTypeArguments(); 16498 const intptr_t num_type_args = cls.NumTypeArguments();
16500 const intptr_t from_index = num_type_args - num_type_params; 16499 const intptr_t from_index = num_type_args - num_type_params;
16501 const TypeArguments& type_args = TypeArguments::Handle(zone, arguments()); 16500 const TypeArguments& type_args = TypeArguments::Handle(zone, arguments());
16502 const TypeArguments& other_type_args = TypeArguments::Handle( 16501 const TypeArguments& other_type_args = TypeArguments::Handle(
16503 zone, other_type.arguments()); 16502 zone, other_type.arguments());
16504 if (type_args.IsNull()) { 16503 if (type_args.IsNull()) {
16505 // Ignore from_index. 16504 // Ignore from_index.
(...skipping 5781 matching lines...) Expand 10 before | Expand all | Expand 10 after
22287 return UserTag::null(); 22286 return UserTag::null();
22288 } 22287 }
22289 22288
22290 22289
22291 const char* UserTag::ToCString() const { 22290 const char* UserTag::ToCString() const {
22292 const String& tag_label = String::Handle(label()); 22291 const String& tag_label = String::Handle(label());
22293 return tag_label.ToCString(); 22292 return tag_label.ToCString();
22294 } 22293 }
22295 22294
22296 } // namespace dart 22295 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698