Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 RawObject* Object::null_ = reinterpret_cast<RawObject*>(RAW_NULL); | 135 RawObject* Object::null_ = reinterpret_cast<RawObject*>(RAW_NULL); |
| 136 RawClass* Object::class_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 136 RawClass* Object::class_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 137 RawClass* Object::dynamic_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 137 RawClass* Object::dynamic_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 138 RawClass* Object::void_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 138 RawClass* Object::void_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 139 RawClass* Object::unresolved_class_class_ = | 139 RawClass* Object::unresolved_class_class_ = |
| 140 reinterpret_cast<RawClass*>(RAW_NULL); | 140 reinterpret_cast<RawClass*>(RAW_NULL); |
| 141 RawClass* Object::type_arguments_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 141 RawClass* Object::type_arguments_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 142 RawClass* Object::patch_class_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 142 RawClass* Object::patch_class_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 143 RawClass* Object::function_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 143 RawClass* Object::function_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 144 RawClass* Object::closure_data_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 144 RawClass* Object::closure_data_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 145 RawClass* Object::signature_data_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | |
| 145 RawClass* Object::redirection_data_class_ = | 146 RawClass* Object::redirection_data_class_ = |
| 146 reinterpret_cast<RawClass*>(RAW_NULL); | 147 reinterpret_cast<RawClass*>(RAW_NULL); |
| 147 RawClass* Object::field_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 148 RawClass* Object::field_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 148 RawClass* Object::literal_token_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 149 RawClass* Object::literal_token_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 149 RawClass* Object::token_stream_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 150 RawClass* Object::token_stream_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 150 RawClass* Object::script_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 151 RawClass* Object::script_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 151 RawClass* Object::library_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 152 RawClass* Object::library_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 152 RawClass* Object::namespace_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 153 RawClass* Object::namespace_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 153 RawClass* Object::code_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 154 RawClass* Object::code_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 154 RawClass* Object::instructions_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 155 RawClass* Object::instructions_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 | 625 |
| 625 cls = Class::New<PatchClass>(); | 626 cls = Class::New<PatchClass>(); |
| 626 patch_class_class_ = cls.raw(); | 627 patch_class_class_ = cls.raw(); |
| 627 | 628 |
| 628 cls = Class::New<Function>(); | 629 cls = Class::New<Function>(); |
| 629 function_class_ = cls.raw(); | 630 function_class_ = cls.raw(); |
| 630 | 631 |
| 631 cls = Class::New<ClosureData>(); | 632 cls = Class::New<ClosureData>(); |
| 632 closure_data_class_ = cls.raw(); | 633 closure_data_class_ = cls.raw(); |
| 633 | 634 |
| 635 cls = Class::New<SignatureData>(); | |
| 636 signature_data_class_ = cls.raw(); | |
| 637 | |
| 634 cls = Class::New<RedirectionData>(); | 638 cls = Class::New<RedirectionData>(); |
| 635 redirection_data_class_ = cls.raw(); | 639 redirection_data_class_ = cls.raw(); |
| 636 | 640 |
| 637 cls = Class::New<Field>(); | 641 cls = Class::New<Field>(); |
| 638 field_class_ = cls.raw(); | 642 field_class_ = cls.raw(); |
| 639 | 643 |
| 640 cls = Class::New<LiteralToken>(); | 644 cls = Class::New<LiteralToken>(); |
| 641 literal_token_class_ = cls.raw(); | 645 literal_token_class_ = cls.raw(); |
| 642 | 646 |
| 643 cls = Class::New<TokenStream>(); | 647 cls = Class::New<TokenStream>(); |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 992 Class& cls = Class::Handle(); | 996 Class& cls = Class::Handle(); |
| 993 | 997 |
| 994 SET_CLASS_NAME(class, Class); | 998 SET_CLASS_NAME(class, Class); |
| 995 SET_CLASS_NAME(dynamic, Dynamic); | 999 SET_CLASS_NAME(dynamic, Dynamic); |
| 996 SET_CLASS_NAME(void, Void); | 1000 SET_CLASS_NAME(void, Void); |
| 997 SET_CLASS_NAME(unresolved_class, UnresolvedClass); | 1001 SET_CLASS_NAME(unresolved_class, UnresolvedClass); |
| 998 SET_CLASS_NAME(type_arguments, TypeArguments); | 1002 SET_CLASS_NAME(type_arguments, TypeArguments); |
| 999 SET_CLASS_NAME(patch_class, PatchClass); | 1003 SET_CLASS_NAME(patch_class, PatchClass); |
| 1000 SET_CLASS_NAME(function, Function); | 1004 SET_CLASS_NAME(function, Function); |
| 1001 SET_CLASS_NAME(closure_data, ClosureData); | 1005 SET_CLASS_NAME(closure_data, ClosureData); |
| 1006 SET_CLASS_NAME(signature_data, SignatureData); | |
| 1002 SET_CLASS_NAME(redirection_data, RedirectionData); | 1007 SET_CLASS_NAME(redirection_data, RedirectionData); |
| 1003 SET_CLASS_NAME(field, Field); | 1008 SET_CLASS_NAME(field, Field); |
| 1004 SET_CLASS_NAME(literal_token, LiteralToken); | 1009 SET_CLASS_NAME(literal_token, LiteralToken); |
| 1005 SET_CLASS_NAME(token_stream, TokenStream); | 1010 SET_CLASS_NAME(token_stream, TokenStream); |
| 1006 SET_CLASS_NAME(script, Script); | 1011 SET_CLASS_NAME(script, Script); |
| 1007 SET_CLASS_NAME(library, LibraryClass); | 1012 SET_CLASS_NAME(library, LibraryClass); |
| 1008 SET_CLASS_NAME(namespace, Namespace); | 1013 SET_CLASS_NAME(namespace, Namespace); |
| 1009 SET_CLASS_NAME(code, Code); | 1014 SET_CLASS_NAME(code, Code); |
| 1010 SET_CLASS_NAME(instructions, Instructions); | 1015 SET_CLASS_NAME(instructions, Instructions); |
| 1011 SET_CLASS_NAME(object_pool, ObjectPool); | 1016 SET_CLASS_NAME(object_pool, ObjectPool); |
| (...skipping 2348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3360 case kUnresolvedClassCid: | 3365 case kUnresolvedClassCid: |
| 3361 return Symbols::UnresolvedClass().raw(); | 3366 return Symbols::UnresolvedClass().raw(); |
| 3362 case kTypeArgumentsCid: | 3367 case kTypeArgumentsCid: |
| 3363 return Symbols::TypeArguments().raw(); | 3368 return Symbols::TypeArguments().raw(); |
| 3364 case kPatchClassCid: | 3369 case kPatchClassCid: |
| 3365 return Symbols::PatchClass().raw(); | 3370 return Symbols::PatchClass().raw(); |
| 3366 case kFunctionCid: | 3371 case kFunctionCid: |
| 3367 return Symbols::Function().raw(); | 3372 return Symbols::Function().raw(); |
| 3368 case kClosureDataCid: | 3373 case kClosureDataCid: |
| 3369 return Symbols::ClosureData().raw(); | 3374 return Symbols::ClosureData().raw(); |
| 3375 case kSignatureDataCid: | |
| 3376 return Symbols::SignatureData().raw(); | |
| 3370 case kRedirectionDataCid: | 3377 case kRedirectionDataCid: |
| 3371 return Symbols::RedirectionData().raw(); | 3378 return Symbols::RedirectionData().raw(); |
| 3372 case kFieldCid: | 3379 case kFieldCid: |
| 3373 return Symbols::Field().raw(); | 3380 return Symbols::Field().raw(); |
| 3374 case kLiteralTokenCid: | 3381 case kLiteralTokenCid: |
| 3375 return Symbols::LiteralToken().raw(); | 3382 return Symbols::LiteralToken().raw(); |
| 3376 case kTokenStreamCid: | 3383 case kTokenStreamCid: |
| 3377 return Symbols::TokenStream().raw(); | 3384 return Symbols::TokenStream().raw(); |
| 3378 case kScriptCid: | 3385 case kScriptCid: |
| 3379 return Symbols::Script().raw(); | 3386 return Symbols::Script().raw(); |
| (...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5430 ASSERT(!field.IsNull()); | 5437 ASSERT(!field.IsNull()); |
| 5431 if (field.token_pos() == token_pos()) { | 5438 if (field.token_pos() == token_pos()) { |
| 5432 return field.raw(); | 5439 return field.raw(); |
| 5433 } | 5440 } |
| 5434 } | 5441 } |
| 5435 return Field::null(); | 5442 return Field::null(); |
| 5436 } | 5443 } |
| 5437 | 5444 |
| 5438 | 5445 |
| 5439 RawFunction* Function::parent_function() const { | 5446 RawFunction* Function::parent_function() const { |
| 5440 if (IsClosureFunction()) { | 5447 if (IsClosureFunction() || IsSignatureFunction()) { |
| 5441 const Object& obj = Object::Handle(raw_ptr()->data_); | 5448 const Object& obj = Object::Handle(raw_ptr()->data_); |
| 5442 ASSERT(!obj.IsNull()); | 5449 ASSERT(!obj.IsNull()); |
| 5443 return ClosureData::Cast(obj).parent_function(); | 5450 if (IsClosureFunction()) { |
| 5444 } else if (IsSignatureFunction()) { | 5451 return ClosureData::Cast(obj).parent_function(); |
| 5445 const Object& obj = Object::Handle(raw_ptr()->data_); | 5452 } else { |
| 5446 // Parent function may be null or data_ may already be set to function type. | 5453 return SignatureData::Cast(obj).parent_function(); |
| 5447 if (!obj.IsNull() && obj.IsFunction()) { | |
| 5448 return Function::Cast(obj).raw(); | |
| 5449 } | 5454 } |
| 5450 } | 5455 } |
| 5451 return Function::null(); | 5456 return Function::null(); |
| 5452 } | 5457 } |
| 5453 | 5458 |
| 5454 | 5459 |
| 5455 void Function::set_parent_function(const Function& value) const { | 5460 void Function::set_parent_function(const Function& value) const { |
| 5461 const Object& obj = Object::Handle(raw_ptr()->data_); | |
| 5462 ASSERT(!obj.IsNull()); | |
| 5456 if (IsClosureFunction()) { | 5463 if (IsClosureFunction()) { |
| 5457 const Object& obj = Object::Handle(raw_ptr()->data_); | |
| 5458 ASSERT(!obj.IsNull()); | |
| 5459 ClosureData::Cast(obj).set_parent_function(value); | 5464 ClosureData::Cast(obj).set_parent_function(value); |
| 5460 return; | 5465 } else { |
| 5461 } else if (IsSignatureFunction()) { | 5466 ASSERT(IsSignatureFunction()); |
| 5462 set_data(value); // Temporarily set during parsing only. | 5467 SignatureData::Cast(obj).set_parent_function(value); |
| 5463 return; | |
| 5464 } | 5468 } |
| 5465 UNREACHABLE(); | |
| 5466 } | 5469 } |
| 5467 | 5470 |
| 5468 | 5471 |
| 5469 RawFunction* Function::implicit_closure_function() const { | 5472 RawFunction* Function::implicit_closure_function() const { |
| 5470 if (IsClosureFunction() || IsSignatureFunction() || IsFactory()) { | 5473 if (IsClosureFunction() || IsSignatureFunction() || IsFactory()) { |
| 5471 return Function::null(); | 5474 return Function::null(); |
| 5472 } | 5475 } |
| 5473 const Object& obj = Object::Handle(raw_ptr()->data_); | 5476 const Object& obj = Object::Handle(raw_ptr()->data_); |
| 5474 ASSERT(obj.IsNull() || obj.IsScript() || obj.IsFunction() || obj.IsArray()); | 5477 ASSERT(obj.IsNull() || obj.IsScript() || obj.IsFunction() || obj.IsArray()); |
| 5475 if (obj.IsNull() || obj.IsScript()) { | 5478 if (obj.IsNull() || obj.IsScript()) { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 5495 } else { | 5498 } else { |
| 5496 ASSERT((raw_ptr()->data_ == Object::null()) || value.IsNull()); | 5499 ASSERT((raw_ptr()->data_ == Object::null()) || value.IsNull()); |
| 5497 set_data(value); | 5500 set_data(value); |
| 5498 } | 5501 } |
| 5499 } | 5502 } |
| 5500 | 5503 |
| 5501 | 5504 |
| 5502 RawType* Function::SignatureType() const { | 5505 RawType* Function::SignatureType() const { |
| 5503 Type& type = Type::Handle(); | 5506 Type& type = Type::Handle(); |
| 5504 const Object& obj = Object::Handle(raw_ptr()->data_); | 5507 const Object& obj = Object::Handle(raw_ptr()->data_); |
| 5508 ASSERT(!obj.IsNull()); | |
| 5505 if (IsSignatureFunction()) { | 5509 if (IsSignatureFunction()) { |
| 5506 ASSERT(obj.IsNull() || Type::Cast(obj).IsFunctionType()); | 5510 type = SignatureData::Cast(obj).signature_type(); |
| 5507 type = obj.IsNull() ? Type::null() : Type::Cast(obj).raw(); | |
| 5508 } else { | 5511 } else { |
| 5509 ASSERT(IsClosureFunction()); | 5512 ASSERT(IsClosureFunction()); |
| 5510 ASSERT(!obj.IsNull()); | |
| 5511 type = ClosureData::Cast(obj).signature_type(); | 5513 type = ClosureData::Cast(obj).signature_type(); |
| 5512 } | 5514 } |
| 5513 if (type.IsNull()) { | 5515 if (type.IsNull()) { |
| 5514 // A function type is parameterized in the same way as the owner class of | 5516 // A function type is parameterized in the same way as the owner class of |
| 5515 // its non-static signature function. | 5517 // its non-static signature function. |
| 5516 // It is not type parameterized if its signature function is static. | 5518 // It is not type parameterized if its signature function is static. |
| 5517 // During type finalization, the type arguments of the super class of the | 5519 // During type finalization, the type arguments of the super class of the |
| 5518 // owner class of its signature function will be prepended to the type | 5520 // owner class of its signature function will be prepended to the type |
| 5519 // argument vector. Therefore, we only need to set the type arguments | 5521 // argument vector. Therefore, we only need to set the type arguments |
| 5520 // matching the type parameters here. | 5522 // matching the type parameters here. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 5541 // Return the still unfinalized signature type. | 5543 // Return the still unfinalized signature type. |
| 5542 type = Type::New(scope_class, signature_type_arguments, token_pos()); | 5544 type = Type::New(scope_class, signature_type_arguments, token_pos()); |
| 5543 type.set_signature(*this); | 5545 type.set_signature(*this); |
| 5544 SetSignatureType(type); | 5546 SetSignatureType(type); |
| 5545 } | 5547 } |
| 5546 return type.raw(); | 5548 return type.raw(); |
| 5547 } | 5549 } |
| 5548 | 5550 |
| 5549 | 5551 |
| 5550 void Function::SetSignatureType(const Type& value) const { | 5552 void Function::SetSignatureType(const Type& value) const { |
| 5553 const Object& obj = Object::Handle(raw_ptr()->data_); | |
| 5554 ASSERT(!obj.IsNull()); | |
| 5551 if (IsSignatureFunction()) { | 5555 if (IsSignatureFunction()) { |
| 5552 set_data(value); | 5556 SignatureData::Cast(obj).set_signature_type(value); |
| 5553 } else { | 5557 } else { |
| 5554 ASSERT(IsClosureFunction()); | 5558 ASSERT(IsClosureFunction()); |
| 5555 const Object& obj = Object::Handle(raw_ptr()->data_); | |
| 5556 ASSERT(!obj.IsNull()); | |
| 5557 ClosureData::Cast(obj).set_signature_type(value); | 5559 ClosureData::Cast(obj).set_signature_type(value); |
| 5558 } | 5560 } |
| 5559 } | 5561 } |
| 5560 | 5562 |
| 5561 | 5563 |
| 5562 bool Function::IsRedirectingFactory() const { | 5564 bool Function::IsRedirectingFactory() const { |
| 5563 if (!IsFactory() || !is_redirecting()) { | 5565 if (!IsFactory() || !is_redirecting()) { |
| 5564 return false; | 5566 return false; |
| 5565 } | 5567 } |
| 5566 ASSERT(!IsClosureFunction()); // A factory cannot also be a closure. | 5568 ASSERT(!IsClosureFunction()); // A factory cannot also be a closure. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5669 if (obj.IsNull()) { | 5671 if (obj.IsNull()) { |
| 5670 obj = RedirectionData::New(); | 5672 obj = RedirectionData::New(); |
| 5671 set_data(obj); | 5673 set_data(obj); |
| 5672 } | 5674 } |
| 5673 RedirectionData::Cast(obj).set_target(target); | 5675 RedirectionData::Cast(obj).set_target(target); |
| 5674 } | 5676 } |
| 5675 | 5677 |
| 5676 | 5678 |
| 5677 // This field is heavily overloaded: | 5679 // This field is heavily overloaded: |
| 5678 // eval function: Script expression source | 5680 // eval function: Script expression source |
| 5679 // signature function: Function type | 5681 // signature function: SignatureData |
| 5680 // method extractor: Function extracted closure function | 5682 // method extractor: Function extracted closure function |
| 5681 // noSuchMethod dispatcher: Array arguments descriptor | 5683 // noSuchMethod dispatcher: Array arguments descriptor |
| 5682 // invoke-field dispatcher: Array arguments descriptor | 5684 // invoke-field dispatcher: Array arguments descriptor |
| 5683 // redirecting constructor: RedirectionData | 5685 // redirecting constructor: RedirectionData |
| 5684 // closure function: ClosureData | 5686 // closure function: ClosureData |
| 5685 // irregexp function: Array[0] = RegExp | 5687 // irregexp function: Array[0] = RegExp |
| 5686 // Array[1] = Smi string specialization cid | 5688 // Array[1] = Smi string specialization cid |
| 5687 // native function: Array[0] = String native name | 5689 // native function: Array[0] = String native name |
| 5688 // Array[1] = Function implicit closure function | 5690 // Array[1] = Function implicit closure function |
| 5689 // regular function: Function for implicit closure function | 5691 // regular function: Function for implicit closure function |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6540 result.set_kernel_function(NULL); | 6542 result.set_kernel_function(NULL); |
| 6541 result.set_is_optimizable(is_native ? false : true); | 6543 result.set_is_optimizable(is_native ? false : true); |
| 6542 result.set_is_inlinable(true); | 6544 result.set_is_inlinable(true); |
| 6543 result.set_allows_hoisting_check_class(true); | 6545 result.set_allows_hoisting_check_class(true); |
| 6544 result.set_allows_bounds_check_generalization(true); | 6546 result.set_allows_bounds_check_generalization(true); |
| 6545 result.SetInstructionsSafe( | 6547 result.SetInstructionsSafe( |
| 6546 Code::Handle(StubCode::LazyCompile_entry()->code())); | 6548 Code::Handle(StubCode::LazyCompile_entry()->code())); |
| 6547 if (kind == RawFunction::kClosureFunction) { | 6549 if (kind == RawFunction::kClosureFunction) { |
| 6548 const ClosureData& data = ClosureData::Handle(ClosureData::New()); | 6550 const ClosureData& data = ClosureData::Handle(ClosureData::New()); |
| 6549 result.set_data(data); | 6551 result.set_data(data); |
| 6552 } else if (kind == RawFunction::kSignatureFunction) { | |
| 6553 const SignatureData& data = SignatureData::Handle(SignatureData::New()); | |
| 6554 result.set_data(data); | |
| 6550 } | 6555 } |
| 6551 return result.raw(); | 6556 return result.raw(); |
| 6552 } | 6557 } |
| 6553 | 6558 |
| 6554 | 6559 |
| 6555 RawFunction* Function::Clone(const Class& new_owner) const { | 6560 RawFunction* Function::Clone(const Class& new_owner) const { |
| 6556 ASSERT(!IsGenerativeConstructor()); | 6561 ASSERT(!IsGenerativeConstructor()); |
| 6557 Function& clone = Function::Handle(); | 6562 Function& clone = Function::Handle(); |
| 6558 clone ^= Object::Clone(*this, Heap::kOld); | 6563 clone ^= Object::Clone(*this, Heap::kOld); |
| 6559 const Class& origin = Class::Handle(this->origin()); | 6564 const Class& origin = Class::Handle(this->origin()); |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7232 ClosureData::InstanceSize(), Heap::kOld); | 7237 ClosureData::InstanceSize(), Heap::kOld); |
| 7233 return reinterpret_cast<RawClosureData*>(raw); | 7238 return reinterpret_cast<RawClosureData*>(raw); |
| 7234 } | 7239 } |
| 7235 | 7240 |
| 7236 | 7241 |
| 7237 const char* ClosureData::ToCString() const { | 7242 const char* ClosureData::ToCString() const { |
| 7238 return "ClosureData class"; | 7243 return "ClosureData class"; |
| 7239 } | 7244 } |
| 7240 | 7245 |
| 7241 | 7246 |
| 7247 void SignatureData::set_parent_function(const Function& value) const { | |
| 7248 StorePointer(&raw_ptr()->parent_function_, value.raw()); | |
| 7249 } | |
| 7250 | |
| 7251 | |
| 7252 void SignatureData::set_signature_type(const Type& value) const { | |
| 7253 StorePointer(&raw_ptr()->signature_type_, value.raw()); | |
| 7254 // If the signature type is resolved, the parent function is not needed | |
| 7255 // anymore (type parameters may be declared by generic parent functions). | |
| 7256 // Keeping the parent function can unnecessarily pull more objects into a | |
| 7257 // snapshot. Also, the parent function is meaningless once the signature type | |
| 7258 // is canonicalized. | |
| 7259 if (value.IsResolved()) { | |
|
siva
2016/12/21 01:00:55
Instead of an if check can we assert here that is
regis
2016/12/21 01:56:20
No, that would not work, because we may set a stil
| |
| 7260 set_parent_function(Function::Handle()); // TODO(rmacnak): Removing this | |
| 7261 // line causes a tree shaking issue in AOT. Please, investigate. | |
| 7262 } | |
| 7263 } | |
| 7264 | |
| 7265 | |
| 7266 RawSignatureData* SignatureData::New() { | |
| 7267 ASSERT(Object::signature_data_class() != Class::null()); | |
| 7268 RawObject* raw = Object::Allocate(SignatureData::kClassId, | |
| 7269 SignatureData::InstanceSize(), Heap::kOld); | |
| 7270 return reinterpret_cast<RawSignatureData*>(raw); | |
| 7271 } | |
| 7272 | |
| 7273 | |
| 7274 const char* SignatureData::ToCString() const { | |
| 7275 return "SignatureData class"; | |
|
siva
2016/12/21 01:00:55
Do you think it would be more beneficial to expand
regis
2016/12/21 01:56:21
Good point. I added more info, here and in Closure
| |
| 7276 } | |
| 7277 | |
| 7278 | |
| 7242 void RedirectionData::set_type(const Type& value) const { | 7279 void RedirectionData::set_type(const Type& value) const { |
| 7243 ASSERT(!value.IsNull()); | 7280 ASSERT(!value.IsNull()); |
| 7244 StorePointer(&raw_ptr()->type_, value.raw()); | 7281 StorePointer(&raw_ptr()->type_, value.raw()); |
| 7245 } | 7282 } |
| 7246 | 7283 |
| 7247 | 7284 |
| 7248 void RedirectionData::set_identifier(const String& value) const { | 7285 void RedirectionData::set_identifier(const String& value) const { |
| 7249 StorePointer(&raw_ptr()->identifier_, value.raw()); | 7286 StorePointer(&raw_ptr()->identifier_, value.raw()); |
| 7250 } | 7287 } |
| 7251 | 7288 |
| (...skipping 15553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 22805 return UserTag::null(); | 22842 return UserTag::null(); |
| 22806 } | 22843 } |
| 22807 | 22844 |
| 22808 | 22845 |
| 22809 const char* UserTag::ToCString() const { | 22846 const char* UserTag::ToCString() const { |
| 22810 const String& tag_label = String::Handle(label()); | 22847 const String& tag_label = String::Handle(label()); |
| 22811 return tag_label.ToCString(); | 22848 return tag_label.ToCString(); |
| 22812 } | 22849 } |
| 22813 | 22850 |
| 22814 } // namespace dart | 22851 } // namespace dart |
| OLD | NEW |