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

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

Issue 2452563002: Create runtime type in new space and canonicalize to old space (fixes #27663). (Closed)
Patch Set: Created 4 years, 1 month 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 | 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/become.h" 10 #include "vm/become.h"
(...skipping 15637 matching lines...) Expand 10 before | Expand all | Expand 10 after
15648 // Type is not parameterized. 15648 // Type is not parameterized.
15649 if (!type.IsCanonical()) { 15649 if (!type.IsCanonical()) {
15650 type ^= type.Canonicalize(); 15650 type ^= type.Canonicalize();
15651 signature.SetSignatureType(type); 15651 signature.SetSignatureType(type);
15652 } 15652 }
15653 return type.raw(); 15653 return type.raw();
15654 } 15654 }
15655 const Class& scope_cls = Class::Handle(type.type_class()); 15655 const Class& scope_cls = Class::Handle(type.type_class());
15656 ASSERT(scope_cls.NumTypeArguments() > 0); 15656 ASSERT(scope_cls.NumTypeArguments() > 0);
15657 TypeArguments& type_arguments = TypeArguments::Handle(GetTypeArguments()); 15657 TypeArguments& type_arguments = TypeArguments::Handle(GetTypeArguments());
15658 type = Type::New(scope_cls, type_arguments, TokenPosition::kNoSource); 15658 type = Type::New(
15659 scope_cls, type_arguments, TokenPosition::kNoSource, Heap::kNew);
15659 type.set_signature(signature); 15660 type.set_signature(signature);
15660 type.SetIsFinalized(); 15661 type.SetIsFinalized();
15661 type ^= type.Canonicalize(); 15662 type ^= type.Canonicalize();
15662 return type.raw(); 15663 return type.raw();
15663 } 15664 }
15664 Type& type = Type::Handle(); 15665 Type& type = Type::Handle();
15665 if (!cls.IsGeneric()) { 15666 if (!cls.IsGeneric()) {
15666 type = cls.CanonicalType(); 15667 type = cls.CanonicalType();
15667 } 15668 }
15668 if (type.IsNull()) { 15669 if (type.IsNull()) {
(...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after
17398 } 17399 }
17399 } 17400 }
17400 17401
17401 // Check to see if the type got added to canonical list as part of the 17402 // Check to see if the type got added to canonical list as part of the
17402 // type arguments canonicalization. 17403 // type arguments canonicalization.
17403 SafepointMutexLocker ml(isolate->type_canonicalization_mutex()); 17404 SafepointMutexLocker ml(isolate->type_canonicalization_mutex());
17404 CanonicalTypeSet table(zone, object_store->canonical_types()); 17405 CanonicalTypeSet table(zone, object_store->canonical_types());
17405 type ^= table.GetOrNull(CanonicalTypeKey(*this)); 17406 type ^= table.GetOrNull(CanonicalTypeKey(*this));
17406 if (type.IsNull()) { 17407 if (type.IsNull()) {
17407 // Add this Type into the canonical list of types. 17408 // Add this Type into the canonical list of types.
17408 type ^= raw(); 17409 if (this->IsNew()) {
17410 type ^= Object::Clone(*this, Heap::kOld);
17411 } else {
17412 type ^= this->raw();
17413 }
17409 ASSERT(type.IsOld()); 17414 ASSERT(type.IsOld());
17410 type.SetCanonical(); // Mark object as being canonical. 17415 type.SetCanonical(); // Mark object as being canonical.
17411 bool present = table.Insert(type); 17416 bool present = table.Insert(type);
17412 ASSERT(!present); 17417 ASSERT(!present);
17413 } 17418 }
17414 object_store->set_canonical_types(table.Release()); 17419 object_store->set_canonical_types(table.Release());
17415 } 17420 }
17416 return type.raw(); 17421 return type.raw();
17417 } 17422 }
17418 17423
(...skipping 5611 matching lines...) Expand 10 before | Expand all | Expand 10 after
23030 return UserTag::null(); 23035 return UserTag::null();
23031 } 23036 }
23032 23037
23033 23038
23034 const char* UserTag::ToCString() const { 23039 const char* UserTag::ToCString() const {
23035 const String& tag_label = String::Handle(label()); 23040 const String& tag_label = String::Handle(label());
23036 return tag_label.ToCString(); 23041 return tag_label.ToCString();
23037 } 23042 }
23038 23043
23039 } // namespace dart 23044 } // 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