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

Side by Side Diff: vm/object.cc

Issue 8588027: - Allocate instantiated type arguments in new gen. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 9 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 | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/assert.h" 8 #include "vm/assert.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 const TypeArguments& instantiator_type_arguments, 2052 const TypeArguments& instantiator_type_arguments,
2053 intptr_t offset) const { 2053 intptr_t offset) const {
2054 ASSERT(IsFinalized()); 2054 ASSERT(IsFinalized());
2055 ASSERT(!IsInstantiated()); 2055 ASSERT(!IsInstantiated());
2056 TypeArguments& type_arguments = TypeArguments::Handle(arguments()); 2056 TypeArguments& type_arguments = TypeArguments::Handle(arguments());
2057 type_arguments = type_arguments.InstantiateFrom(instantiator_type_arguments, 2057 type_arguments = type_arguments.InstantiateFrom(instantiator_type_arguments,
2058 offset); 2058 offset);
2059 const Class& cls = Class::Handle(type_class()); 2059 const Class& cls = Class::Handle(type_class());
2060 ASSERT(cls.is_finalized()); 2060 ASSERT(cls.is_finalized());
2061 ParameterizedType& instantiated_type = ParameterizedType::Handle( 2061 ParameterizedType& instantiated_type = ParameterizedType::Handle(
2062 ParameterizedType::New(cls, type_arguments)); 2062 ParameterizedType::New(cls, type_arguments));
regis 2011/11/17 16:46:23 This call to ParameterizedType::New happens when i
2063 ASSERT(type_arguments.IsNull() || 2063 ASSERT(type_arguments.IsNull() ||
2064 (type_arguments.Length() == cls.NumTypeArguments())); 2064 (type_arguments.Length() == cls.NumTypeArguments()));
2065 instantiated_type.set_is_finalized(); 2065 instantiated_type.set_is_finalized();
2066 return instantiated_type.raw(); 2066 return instantiated_type.raw();
2067 } 2067 }
2068 2068
2069 2069
2070 bool ParameterizedType::Equals(const Type& other) const { 2070 bool ParameterizedType::Equals(const Type& other) const {
2071 ASSERT(IsFinalized() && other.IsFinalized()); 2071 ASSERT(IsFinalized() && other.IsFinalized());
2072 if (raw() == other.raw()) { 2072 if (raw() == other.raw()) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 const TypeArguments& value) const { 2255 const TypeArguments& value) const {
2256 StorePointer(&raw_ptr()->instantiator_type_arguments_, value.raw()); 2256 StorePointer(&raw_ptr()->instantiator_type_arguments_, value.raw());
2257 } 2257 }
2258 2258
2259 2259
2260 RawInstantiatedType* InstantiatedType::New() { 2260 RawInstantiatedType* InstantiatedType::New() {
2261 const Class& instantiated_type_class = 2261 const Class& instantiated_type_class =
2262 Class::Handle(Object::instantiated_type_class()); 2262 Class::Handle(Object::instantiated_type_class());
2263 RawObject* raw = Object::Allocate(instantiated_type_class, 2263 RawObject* raw = Object::Allocate(instantiated_type_class,
2264 InstantiatedType::InstanceSize(), 2264 InstantiatedType::InstanceSize(),
2265 Heap::kOld); 2265 Heap::kOld);
regis 2011/11/17 16:46:23 You can also use Heap::kNew here.
2266 return reinterpret_cast<RawInstantiatedType*>(raw); 2266 return reinterpret_cast<RawInstantiatedType*>(raw);
2267 } 2267 }
2268 2268
2269 2269
2270 RawInstantiatedType* InstantiatedType::New( 2270 RawInstantiatedType* InstantiatedType::New(
2271 const Type& uninstantiated_type, 2271 const Type& uninstantiated_type,
2272 const TypeArguments& instantiator_type_arguments) { 2272 const TypeArguments& instantiator_type_arguments) {
2273 const InstantiatedType& result = 2273 const InstantiatedType& result =
2274 InstantiatedType::Handle(InstantiatedType::New()); 2274 InstantiatedType::Handle(InstantiatedType::New());
2275 result.set_uninstantiated_type(uninstantiated_type); 2275 result.set_uninstantiated_type(uninstantiated_type);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 const TypeArguments& instantiator_type_arguments, 2494 const TypeArguments& instantiator_type_arguments,
2495 intptr_t offset) const { 2495 intptr_t offset) const {
2496 ASSERT(!IsInstantiated()); 2496 ASSERT(!IsInstantiated());
2497 if ((offset == 0) && 2497 if ((offset == 0) &&
2498 !instantiator_type_arguments.IsNull() && 2498 !instantiator_type_arguments.IsNull() &&
2499 IsUninstantiatedIdentity() && 2499 IsUninstantiatedIdentity() &&
2500 (instantiator_type_arguments.Length() == Length())) { 2500 (instantiator_type_arguments.Length() == Length())) {
2501 return instantiator_type_arguments.raw(); 2501 return instantiator_type_arguments.raw();
2502 } 2502 }
2503 const intptr_t num_types = Length(); 2503 const intptr_t num_types = Length();
2504 TypeArray& instantiated_array = TypeArray::Handle(TypeArray::New(num_types)); 2504 TypeArray& instantiated_array = TypeArray::Handle(TypeArray::New(num_types));
regis 2011/11/17 16:46:23 The same applies here to TypeArray::New as to Para
2505 Type& type = Type::Handle(); 2505 Type& type = Type::Handle();
2506 for (intptr_t i = 0; i < num_types; i++) { 2506 for (intptr_t i = 0; i < num_types; i++) {
2507 type = TypeAt(i); 2507 type = TypeAt(i);
2508 if (!type.IsInstantiated()) { 2508 if (!type.IsInstantiated()) {
2509 type = type.InstantiateFrom(instantiator_type_arguments, offset); 2509 type = type.InstantiateFrom(instantiator_type_arguments, offset);
2510 } 2510 }
2511 instantiated_array.SetTypeAt(i, type); 2511 instantiated_array.SetTypeAt(i, type);
2512 } 2512 }
2513 return instantiated_array.raw(); 2513 return instantiated_array.raw();
2514 } 2514 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 const TypeArguments& value) const { 2596 const TypeArguments& value) const {
2597 StorePointer(&raw_ptr()->instantiator_type_arguments_, value.raw()); 2597 StorePointer(&raw_ptr()->instantiator_type_arguments_, value.raw());
2598 } 2598 }
2599 2599
2600 2600
2601 RawInstantiatedTypeArguments* InstantiatedTypeArguments::New() { 2601 RawInstantiatedTypeArguments* InstantiatedTypeArguments::New() {
2602 const Class& instantiated_type_arguments_class = 2602 const Class& instantiated_type_arguments_class =
2603 Class::Handle(Object::instantiated_type_arguments_class()); 2603 Class::Handle(Object::instantiated_type_arguments_class());
2604 RawObject* raw = Object::Allocate(instantiated_type_arguments_class, 2604 RawObject* raw = Object::Allocate(instantiated_type_arguments_class,
2605 InstantiatedTypeArguments::InstanceSize(), 2605 InstantiatedTypeArguments::InstanceSize(),
2606 Heap::kOld); 2606 Heap::kNew);
2607 return reinterpret_cast<RawInstantiatedTypeArguments*>(raw); 2607 return reinterpret_cast<RawInstantiatedTypeArguments*>(raw);
2608 } 2608 }
2609 2609
2610 2610
2611 RawInstantiatedTypeArguments* InstantiatedTypeArguments::New( 2611 RawInstantiatedTypeArguments* InstantiatedTypeArguments::New(
2612 const TypeArguments& uninstantiated_type_arguments, 2612 const TypeArguments& uninstantiated_type_arguments,
2613 const TypeArguments& instantiator_type_arguments) { 2613 const TypeArguments& instantiator_type_arguments) {
2614 const InstantiatedTypeArguments& result = 2614 const InstantiatedTypeArguments& result =
2615 InstantiatedTypeArguments::Handle(InstantiatedTypeArguments::New()); 2615 InstantiatedTypeArguments::Handle(InstantiatedTypeArguments::New());
2616 result.set_uninstantiated_type_arguments(uninstantiated_type_arguments); 2616 result.set_uninstantiated_type_arguments(uninstantiated_type_arguments);
(...skipping 4471 matching lines...) Expand 10 before | Expand all | Expand 10 after
7088 const String& str = String::Handle(pattern()); 7088 const String& str = String::Handle(pattern());
7089 const char* format = "JSRegExp: pattern=%s flags=%s"; 7089 const char* format = "JSRegExp: pattern=%s flags=%s";
7090 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 7090 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
7091 char* chars = reinterpret_cast<char*>( 7091 char* chars = reinterpret_cast<char*>(
7092 Isolate::Current()->current_zone()->Allocate(len + 1)); 7092 Isolate::Current()->current_zone()->Allocate(len + 1));
7093 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 7093 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
7094 return chars; 7094 return chars;
7095 } 7095 }
7096 7096
7097 } // namespace dart 7097 } // 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