| 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 2722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2733 false, // Not native. | 2733 false, // Not native. |
| 2734 owner, TokenPosition::kMethodExtractor)); | 2734 owner, TokenPosition::kMethodExtractor)); |
| 2735 | 2735 |
| 2736 // Initialize signature: receiver is a single fixed parameter. | 2736 // Initialize signature: receiver is a single fixed parameter. |
| 2737 const intptr_t kNumParameters = 1; | 2737 const intptr_t kNumParameters = 1; |
| 2738 extractor.set_num_fixed_parameters(kNumParameters); | 2738 extractor.set_num_fixed_parameters(kNumParameters); |
| 2739 extractor.SetNumOptionalParameters(0, 0); | 2739 extractor.SetNumOptionalParameters(0, 0); |
| 2740 extractor.set_parameter_types(Object::extractor_parameter_types()); | 2740 extractor.set_parameter_types(Object::extractor_parameter_types()); |
| 2741 extractor.set_parameter_names(Object::extractor_parameter_names()); | 2741 extractor.set_parameter_names(Object::extractor_parameter_names()); |
| 2742 extractor.set_result_type(Object::dynamic_type()); | 2742 extractor.set_result_type(Object::dynamic_type()); |
| 2743 extractor.set_kernel_offset(kernel_offset()); | 2743 extractor.set_kernel_function(kernel_function()); |
| 2744 | 2744 |
| 2745 extractor.set_extracted_method_closure(closure_function); | 2745 extractor.set_extracted_method_closure(closure_function); |
| 2746 extractor.set_is_debuggable(false); | 2746 extractor.set_is_debuggable(false); |
| 2747 extractor.set_is_visible(false); | 2747 extractor.set_is_visible(false); |
| 2748 | 2748 |
| 2749 owner.AddFunction(extractor); | 2749 owner.AddFunction(extractor); |
| 2750 | 2750 |
| 2751 return extractor.raw(); | 2751 return extractor.raw(); |
| 2752 } | 2752 } |
| 2753 | 2753 |
| (...skipping 4053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6807 NOT_IN_PRECOMPILED(result.set_was_compiled(false)); | 6807 NOT_IN_PRECOMPILED(result.set_was_compiled(false)); |
| 6808 result.set_owner(owner); | 6808 result.set_owner(owner); |
| 6809 NOT_IN_PRECOMPILED(result.set_token_pos(token_pos)); | 6809 NOT_IN_PRECOMPILED(result.set_token_pos(token_pos)); |
| 6810 NOT_IN_PRECOMPILED(result.set_end_token_pos(token_pos)); | 6810 NOT_IN_PRECOMPILED(result.set_end_token_pos(token_pos)); |
| 6811 result.set_num_fixed_parameters(0); | 6811 result.set_num_fixed_parameters(0); |
| 6812 result.set_num_optional_parameters(0); | 6812 result.set_num_optional_parameters(0); |
| 6813 NOT_IN_PRECOMPILED(result.set_usage_counter(0)); | 6813 NOT_IN_PRECOMPILED(result.set_usage_counter(0)); |
| 6814 NOT_IN_PRECOMPILED(result.set_deoptimization_counter(0)); | 6814 NOT_IN_PRECOMPILED(result.set_deoptimization_counter(0)); |
| 6815 NOT_IN_PRECOMPILED(result.set_optimized_instruction_count(0)); | 6815 NOT_IN_PRECOMPILED(result.set_optimized_instruction_count(0)); |
| 6816 NOT_IN_PRECOMPILED(result.set_optimized_call_site_count(0)); | 6816 NOT_IN_PRECOMPILED(result.set_optimized_call_site_count(0)); |
| 6817 result.set_kernel_offset(0); | 6817 result.set_kernel_function(NULL); |
| 6818 result.set_is_optimizable(is_native ? false : true); | 6818 result.set_is_optimizable(is_native ? false : true); |
| 6819 result.set_is_inlinable(true); | 6819 result.set_is_inlinable(true); |
| 6820 result.set_allows_hoisting_check_class(true); | 6820 result.set_allows_hoisting_check_class(true); |
| 6821 result.set_allows_bounds_check_generalization(true); | 6821 result.set_allows_bounds_check_generalization(true); |
| 6822 result.SetInstructionsSafe( | 6822 result.SetInstructionsSafe( |
| 6823 Code::Handle(StubCode::LazyCompile_entry()->code())); | 6823 Code::Handle(StubCode::LazyCompile_entry()->code())); |
| 6824 if (kind == RawFunction::kClosureFunction) { | 6824 if (kind == RawFunction::kClosureFunction) { |
| 6825 ASSERT(space == Heap::kOld); | 6825 ASSERT(space == Heap::kOld); |
| 6826 const ClosureData& data = ClosureData::Handle(ClosureData::New()); | 6826 const ClosureData& data = ClosureData::Handle(ClosureData::New()); |
| 6827 result.set_data(data); | 6827 result.set_data(data); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6847 const Class& origin = Class::Handle(zone, this->origin()); | 6847 const Class& origin = Class::Handle(zone, this->origin()); |
| 6848 const PatchClass& clone_owner = | 6848 const PatchClass& clone_owner = |
| 6849 PatchClass::Handle(zone, PatchClass::New(new_owner, origin)); | 6849 PatchClass::Handle(zone, PatchClass::New(new_owner, origin)); |
| 6850 clone.set_owner(clone_owner); | 6850 clone.set_owner(clone_owner); |
| 6851 clone.ClearICDataArray(); | 6851 clone.ClearICDataArray(); |
| 6852 clone.ClearCode(); | 6852 clone.ClearCode(); |
| 6853 clone.set_usage_counter(0); | 6853 clone.set_usage_counter(0); |
| 6854 clone.set_deoptimization_counter(0); | 6854 clone.set_deoptimization_counter(0); |
| 6855 clone.set_optimized_instruction_count(0); | 6855 clone.set_optimized_instruction_count(0); |
| 6856 clone.set_optimized_call_site_count(0); | 6856 clone.set_optimized_call_site_count(0); |
| 6857 clone.set_kernel_offset(kernel_offset()); | 6857 clone.set_kernel_function(kernel_function()); |
| 6858 if (new_owner.NumTypeParameters() > 0) { | 6858 if (new_owner.NumTypeParameters() > 0) { |
| 6859 // Adjust uninstantiated types to refer to type parameters of the new owner. | 6859 // Adjust uninstantiated types to refer to type parameters of the new owner. |
| 6860 const TypeArguments& type_params = | 6860 const TypeArguments& type_params = |
| 6861 TypeArguments::Handle(zone, type_parameters()); | 6861 TypeArguments::Handle(zone, type_parameters()); |
| 6862 if (!type_params.IsNull()) { | 6862 if (!type_params.IsNull()) { |
| 6863 const intptr_t num_type_params = type_params.Length(); | 6863 const intptr_t num_type_params = type_params.Length(); |
| 6864 const TypeArguments& type_params_clone = | 6864 const TypeArguments& type_params_clone = |
| 6865 TypeArguments::Handle(zone, TypeArguments::New(num_type_params)); | 6865 TypeArguments::Handle(zone, TypeArguments::New(num_type_params)); |
| 6866 TypeParameter& type_param = TypeParameter::Handle(zone); | 6866 TypeParameter& type_param = TypeParameter::Handle(zone); |
| 6867 for (intptr_t i = 0; i < num_type_params; i++) { | 6867 for (intptr_t i = 0; i < num_type_params; i++) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7003 // Add implicit closure object parameter. | 7003 // Add implicit closure object parameter. |
| 7004 param_type = Type::DynamicType(); | 7004 param_type = Type::DynamicType(); |
| 7005 closure_function.SetParameterTypeAt(0, param_type); | 7005 closure_function.SetParameterTypeAt(0, param_type); |
| 7006 closure_function.SetParameterNameAt(0, Symbols::ClosureParameter()); | 7006 closure_function.SetParameterNameAt(0, Symbols::ClosureParameter()); |
| 7007 for (int i = kClosure; i < num_params; i++) { | 7007 for (int i = kClosure; i < num_params; i++) { |
| 7008 param_type = ParameterTypeAt(has_receiver - kClosure + i); | 7008 param_type = ParameterTypeAt(has_receiver - kClosure + i); |
| 7009 closure_function.SetParameterTypeAt(i, param_type); | 7009 closure_function.SetParameterTypeAt(i, param_type); |
| 7010 param_name = ParameterNameAt(has_receiver - kClosure + i); | 7010 param_name = ParameterNameAt(has_receiver - kClosure + i); |
| 7011 closure_function.SetParameterNameAt(i, param_name); | 7011 closure_function.SetParameterNameAt(i, param_name); |
| 7012 } | 7012 } |
| 7013 closure_function.set_kernel_offset(kernel_offset()); | 7013 closure_function.set_kernel_function(kernel_function()); |
| 7014 | 7014 |
| 7015 const Type& signature_type = | 7015 const Type& signature_type = |
| 7016 Type::Handle(zone, closure_function.SignatureType()); | 7016 Type::Handle(zone, closure_function.SignatureType()); |
| 7017 if (!signature_type.IsFinalized()) { | 7017 if (!signature_type.IsFinalized()) { |
| 7018 ClassFinalizer::FinalizeType(Class::Handle(zone, Owner()), signature_type); | 7018 ClassFinalizer::FinalizeType(Class::Handle(zone, Owner()), signature_type); |
| 7019 } | 7019 } |
| 7020 set_implicit_closure_function(closure_function); | 7020 set_implicit_closure_function(closure_function); |
| 7021 ASSERT(closure_function.IsImplicitClosureFunction()); | 7021 ASSERT(closure_function.IsImplicitClosureFunction()); |
| 7022 return closure_function.raw(); | 7022 return closure_function.raw(); |
| 7023 } | 7023 } |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7473 for (intptr_t i = 1; i < array.Length(); i++) { | 7473 for (intptr_t i = 1; i < array.Length(); i++) { |
| 7474 ic_data ^= array.At(i); | 7474 ic_data ^= array.At(i); |
| 7475 if (ic_data.deopt_id() == deopt_id) { | 7475 if (ic_data.deopt_id() == deopt_id) { |
| 7476 ic_data.AddDeoptReason(reason); | 7476 ic_data.AddDeoptReason(reason); |
| 7477 } | 7477 } |
| 7478 } | 7478 } |
| 7479 } | 7479 } |
| 7480 | 7480 |
| 7481 | 7481 |
| 7482 bool Function::CheckSourceFingerprint(const char* prefix, int32_t fp) const { | 7482 bool Function::CheckSourceFingerprint(const char* prefix, int32_t fp) const { |
| 7483 if ((kernel_offset() <= 0) && (SourceFingerprint() != fp)) { | 7483 if ((kernel_function() == NULL) && (SourceFingerprint() != fp)) { |
| 7484 const bool recalculatingFingerprints = false; | 7484 const bool recalculatingFingerprints = false; |
| 7485 if (recalculatingFingerprints) { | 7485 if (recalculatingFingerprints) { |
| 7486 // This output can be copied into a file, then used with sed | 7486 // This output can be copied into a file, then used with sed |
| 7487 // to replace the old values. | 7487 // to replace the old values. |
| 7488 // sed -i.bak -f /tmp/newkeys runtime/vm/method_recognizer.h | 7488 // sed -i.bak -f /tmp/newkeys runtime/vm/method_recognizer.h |
| 7489 THR_Print("s/0x%08x/0x%08x/\n", fp, SourceFingerprint()); | 7489 THR_Print("s/0x%08x/0x%08x/\n", fp, SourceFingerprint()); |
| 7490 } else { | 7490 } else { |
| 7491 THR_Print( | 7491 THR_Print( |
| 7492 "FP mismatch while recognizing method %s:" | 7492 "FP mismatch while recognizing method %s:" |
| 7493 " expecting 0x%08x found 0x%08x\n", | 7493 " expecting 0x%08x found 0x%08x\n", |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7857 result.SetOffset(0); | 7857 result.SetOffset(0); |
| 7858 } | 7858 } |
| 7859 result.set_is_final(is_final); | 7859 result.set_is_final(is_final); |
| 7860 result.set_is_const(is_const); | 7860 result.set_is_const(is_const); |
| 7861 result.set_is_reflectable(is_reflectable); | 7861 result.set_is_reflectable(is_reflectable); |
| 7862 result.set_is_double_initialized(false); | 7862 result.set_is_double_initialized(false); |
| 7863 result.set_owner(owner); | 7863 result.set_owner(owner); |
| 7864 result.set_token_pos(token_pos); | 7864 result.set_token_pos(token_pos); |
| 7865 result.set_has_initializer(false); | 7865 result.set_has_initializer(false); |
| 7866 result.set_is_unboxing_candidate(true); | 7866 result.set_is_unboxing_candidate(true); |
| 7867 result.set_kernel_offset(0); | 7867 result.set_kernel_field(NULL); |
| 7868 Isolate* isolate = Isolate::Current(); | 7868 Isolate* isolate = Isolate::Current(); |
| 7869 | 7869 |
| 7870 // Use field guards if they are enabled and the isolate has never reloaded. | 7870 // Use field guards if they are enabled and the isolate has never reloaded. |
| 7871 // TODO(johnmccutchan): The reload case assumes the worst case (everything is | 7871 // TODO(johnmccutchan): The reload case assumes the worst case (everything is |
| 7872 // dynamic and possibly null). Attempt to relax this later. | 7872 // dynamic and possibly null). Attempt to relax this later. |
| 7873 const bool use_guarded_cid = | 7873 const bool use_guarded_cid = |
| 7874 FLAG_precompiled_mode || | 7874 FLAG_precompiled_mode || |
| 7875 (isolate->use_field_guards() && !isolate->HasAttemptedReload()); | 7875 (isolate->use_field_guards() && !isolate->HasAttemptedReload()); |
| 7876 result.set_guarded_cid(use_guarded_cid ? kIllegalCid : kDynamicCid); | 7876 result.set_guarded_cid(use_guarded_cid ? kIllegalCid : kDynamicCid); |
| 7877 result.set_is_nullable(use_guarded_cid ? false : true); | 7877 result.set_is_nullable(use_guarded_cid ? false : true); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7937 | 7937 |
| 7938 | 7938 |
| 7939 RawField* Field::Clone(const Field& original) const { | 7939 RawField* Field::Clone(const Field& original) const { |
| 7940 if (original.IsNull()) { | 7940 if (original.IsNull()) { |
| 7941 return Field::null(); | 7941 return Field::null(); |
| 7942 } | 7942 } |
| 7943 ASSERT(original.IsOriginal()); | 7943 ASSERT(original.IsOriginal()); |
| 7944 Field& clone = Field::Handle(); | 7944 Field& clone = Field::Handle(); |
| 7945 clone ^= Object::Clone(*this, Heap::kOld); | 7945 clone ^= Object::Clone(*this, Heap::kOld); |
| 7946 clone.SetOriginal(original); | 7946 clone.SetOriginal(original); |
| 7947 clone.set_kernel_offset(original.kernel_offset()); | 7947 clone.set_kernel_field(original.kernel_field()); |
| 7948 return clone.raw(); | 7948 return clone.raw(); |
| 7949 } | 7949 } |
| 7950 | 7950 |
| 7951 | 7951 |
| 7952 RawString* Field::InitializingExpression() const { | 7952 RawString* Field::InitializingExpression() const { |
| 7953 Thread* thread = Thread::Current(); | 7953 Thread* thread = Thread::Current(); |
| 7954 Zone* zone = thread->zone(); | 7954 Zone* zone = thread->zone(); |
| 7955 const class Script& scr = Script::Handle(zone, Script()); | 7955 const class Script& scr = Script::Handle(zone, Script()); |
| 7956 ASSERT(!scr.IsNull()); | 7956 ASSERT(!scr.IsNull()); |
| 7957 const TokenStream& tkns = TokenStream::Handle(zone, scr.tokens()); | 7957 const TokenStream& tkns = TokenStream::Handle(zone, scr.tokens()); |
| (...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9114 } | 9114 } |
| 9115 return token_stream.GenerateSource(); | 9115 return token_stream.GenerateSource(); |
| 9116 } | 9116 } |
| 9117 | 9117 |
| 9118 | 9118 |
| 9119 void Script::set_compile_time_constants(const Array& value) const { | 9119 void Script::set_compile_time_constants(const Array& value) const { |
| 9120 StorePointer(&raw_ptr()->compile_time_constants_, value.raw()); | 9120 StorePointer(&raw_ptr()->compile_time_constants_, value.raw()); |
| 9121 } | 9121 } |
| 9122 | 9122 |
| 9123 | 9123 |
| 9124 void Script::set_kernel_data(const uint8_t* kernel_data) const { | |
| 9125 StoreNonPointer(&raw_ptr()->kernel_data_, kernel_data); | |
| 9126 } | |
| 9127 | |
| 9128 | |
| 9129 void Script::set_kernel_data_size(const intptr_t kernel_data_size) const { | |
| 9130 StoreNonPointer(&raw_ptr()->kernel_data_size_, kernel_data_size); | |
| 9131 } | |
| 9132 | |
| 9133 | |
| 9134 void Script::set_kernel_string_offsets(const TypedData& offsets) const { | 9124 void Script::set_kernel_string_offsets(const TypedData& offsets) const { |
| 9135 StorePointer(&raw_ptr()->kernel_string_offsets_, offsets.raw()); | 9125 StorePointer(&raw_ptr()->kernel_string_offsets_, offsets.raw()); |
| 9136 } | 9126 } |
| 9137 | 9127 |
| 9138 | 9128 |
| 9139 void Script::set_kernel_string_data(const TypedData& data) const { | 9129 void Script::set_kernel_string_data(const TypedData& data) const { |
| 9140 StorePointer(&raw_ptr()->kernel_string_data_, data.raw()); | 9130 StorePointer(&raw_ptr()->kernel_string_data_, data.raw()); |
| 9141 } | 9131 } |
| 9142 | 9132 |
| 9143 | 9133 |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10088 pieces.Add(cname); | 10078 pieces.Add(cname); |
| 10089 pieces.Add(Symbols::At()); | 10079 pieces.Add(Symbols::At()); |
| 10090 pieces.Add(String::Handle(param.name())); | 10080 pieces.Add(String::Handle(param.name())); |
| 10091 return Symbols::FromConcatAll(thread, pieces); | 10081 return Symbols::FromConcatAll(thread, pieces); |
| 10092 } | 10082 } |
| 10093 | 10083 |
| 10094 | 10084 |
| 10095 void Library::AddMetadata(const Object& owner, | 10085 void Library::AddMetadata(const Object& owner, |
| 10096 const String& name, | 10086 const String& name, |
| 10097 TokenPosition token_pos, | 10087 TokenPosition token_pos, |
| 10098 intptr_t kernel_offset) const { | 10088 kernel::TreeNode* kernel_node) const { |
| 10099 Thread* thread = Thread::Current(); | 10089 Thread* thread = Thread::Current(); |
| 10100 ASSERT(thread->IsMutatorThread()); | 10090 ASSERT(thread->IsMutatorThread()); |
| 10101 Zone* zone = thread->zone(); | 10091 Zone* zone = thread->zone(); |
| 10102 const String& metaname = String::Handle(zone, Symbols::New(thread, name)); | 10092 const String& metaname = String::Handle(zone, Symbols::New(thread, name)); |
| 10103 const Field& field = | 10093 const Field& field = |
| 10104 Field::Handle(zone, Field::NewTopLevel(metaname, | 10094 Field::Handle(zone, Field::NewTopLevel(metaname, |
| 10105 false, // is_final | 10095 false, // is_final |
| 10106 false, // is_const | 10096 false, // is_const |
| 10107 owner, token_pos)); | 10097 owner, token_pos)); |
| 10108 field.SetFieldType(Object::dynamic_type()); | 10098 field.SetFieldType(Object::dynamic_type()); |
| 10109 field.set_is_reflectable(false); | 10099 field.set_is_reflectable(false); |
| 10110 field.SetStaticValue(Array::empty_array(), true); | 10100 field.SetStaticValue(Array::empty_array(), true); |
| 10111 field.set_kernel_offset(kernel_offset); | 10101 field.set_kernel_field(kernel_node); |
| 10112 GrowableObjectArray& metadata = | 10102 GrowableObjectArray& metadata = |
| 10113 GrowableObjectArray::Handle(zone, this->metadata()); | 10103 GrowableObjectArray::Handle(zone, this->metadata()); |
| 10114 metadata.Add(field, Heap::kOld); | 10104 metadata.Add(field, Heap::kOld); |
| 10115 } | 10105 } |
| 10116 | 10106 |
| 10117 | 10107 |
| 10118 void Library::AddClassMetadata(const Class& cls, | 10108 void Library::AddClassMetadata(const Class& cls, |
| 10119 const Object& tl_owner, | 10109 const Object& tl_owner, |
| 10120 TokenPosition token_pos, | 10110 TokenPosition token_pos, |
| 10121 intptr_t kernel_offset) const { | 10111 kernel::TreeNode* kernel_node) const { |
| 10122 Thread* thread = Thread::Current(); | 10112 Thread* thread = Thread::Current(); |
| 10123 Zone* zone = thread->zone(); | 10113 Zone* zone = thread->zone(); |
| 10124 // We use the toplevel class as the owner of a class's metadata field because | 10114 // We use the toplevel class as the owner of a class's metadata field because |
| 10125 // a class's metadata is in scope of the library, not the class. | 10115 // a class's metadata is in scope of the library, not the class. |
| 10126 AddMetadata(tl_owner, | 10116 AddMetadata(tl_owner, |
| 10127 String::Handle(zone, MakeClassMetaName(thread, zone, cls)), | 10117 String::Handle(zone, MakeClassMetaName(thread, zone, cls)), |
| 10128 token_pos, kernel_offset); | 10118 token_pos, kernel_node); |
| 10129 } | 10119 } |
| 10130 | 10120 |
| 10131 | 10121 |
| 10132 void Library::AddFieldMetadata(const Field& field, | 10122 void Library::AddFieldMetadata(const Field& field, |
| 10133 TokenPosition token_pos, | 10123 TokenPosition token_pos, |
| 10134 intptr_t kernel_offset) const { | 10124 kernel::TreeNode* kernel_node) const { |
| 10135 Thread* thread = Thread::Current(); | 10125 Thread* thread = Thread::Current(); |
| 10136 Zone* zone = thread->zone(); | 10126 Zone* zone = thread->zone(); |
| 10137 AddMetadata(Object::Handle(zone, field.RawOwner()), | 10127 AddMetadata(Object::Handle(zone, field.RawOwner()), |
| 10138 String::Handle(zone, MakeFieldMetaName(thread, zone, field)), | 10128 String::Handle(zone, MakeFieldMetaName(thread, zone, field)), |
| 10139 token_pos, kernel_offset); | 10129 token_pos, kernel_node); |
| 10140 } | 10130 } |
| 10141 | 10131 |
| 10142 | 10132 |
| 10143 void Library::AddFunctionMetadata(const Function& func, | 10133 void Library::AddFunctionMetadata(const Function& func, |
| 10144 TokenPosition token_pos, | 10134 TokenPosition token_pos, |
| 10145 intptr_t kernel_offset) const { | 10135 kernel::TreeNode* kernel_node) const { |
| 10146 Thread* thread = Thread::Current(); | 10136 Thread* thread = Thread::Current(); |
| 10147 Zone* zone = thread->zone(); | 10137 Zone* zone = thread->zone(); |
| 10148 AddMetadata(Object::Handle(zone, func.RawOwner()), | 10138 AddMetadata(Object::Handle(zone, func.RawOwner()), |
| 10149 String::Handle(zone, MakeFunctionMetaName(thread, zone, func)), | 10139 String::Handle(zone, MakeFunctionMetaName(thread, zone, func)), |
| 10150 token_pos, kernel_offset); | 10140 token_pos, kernel_node); |
| 10151 } | 10141 } |
| 10152 | 10142 |
| 10153 | 10143 |
| 10154 void Library::AddTypeParameterMetadata(const TypeParameter& param, | 10144 void Library::AddTypeParameterMetadata(const TypeParameter& param, |
| 10155 TokenPosition token_pos) const { | 10145 TokenPosition token_pos) const { |
| 10156 Thread* thread = Thread::Current(); | 10146 Thread* thread = Thread::Current(); |
| 10157 Zone* zone = thread->zone(); | 10147 Zone* zone = thread->zone(); |
| 10158 AddMetadata( | 10148 AddMetadata( |
| 10159 Class::Handle(zone, param.parameterized_class()), | 10149 Class::Handle(zone, param.parameterized_class()), |
| 10160 String::Handle(zone, MakeTypeParameterMetaName(thread, zone, param)), | 10150 String::Handle(zone, MakeTypeParameterMetaName(thread, zone, param)), |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10216 } | 10206 } |
| 10217 const String& metaname = String::Handle(MakeMetadataName(obj)); | 10207 const String& metaname = String::Handle(MakeMetadataName(obj)); |
| 10218 Field& field = Field::Handle(GetMetadataField(metaname)); | 10208 Field& field = Field::Handle(GetMetadataField(metaname)); |
| 10219 if (field.IsNull()) { | 10209 if (field.IsNull()) { |
| 10220 // There is no metadata for this object. | 10210 // There is no metadata for this object. |
| 10221 return Object::empty_array().raw(); | 10211 return Object::empty_array().raw(); |
| 10222 } | 10212 } |
| 10223 Object& metadata = Object::Handle(); | 10213 Object& metadata = Object::Handle(); |
| 10224 metadata = field.StaticValue(); | 10214 metadata = field.StaticValue(); |
| 10225 if (field.StaticValue() == Object::empty_array().raw()) { | 10215 if (field.StaticValue() == Object::empty_array().raw()) { |
| 10226 if (field.kernel_offset() > 0) { | 10216 if (field.kernel_field() != NULL) { |
| 10227 metadata = kernel::EvaluateMetadata(field); | 10217 metadata = kernel::EvaluateMetadata(field); |
| 10228 } else { | 10218 } else { |
| 10229 metadata = Parser::ParseMetadata(field); | 10219 metadata = Parser::ParseMetadata(field); |
| 10230 } | 10220 } |
| 10231 if (metadata.IsArray()) { | 10221 if (metadata.IsArray()) { |
| 10232 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw()); | 10222 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw()); |
| 10233 field.SetStaticValue(Array::Cast(metadata), true); | 10223 field.SetStaticValue(Array::Cast(metadata), true); |
| 10234 } | 10224 } |
| 10235 } | 10225 } |
| 10236 return metadata.raw(); | 10226 return metadata.raw(); |
| (...skipping 13149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23386 return UserTag::null(); | 23376 return UserTag::null(); |
| 23387 } | 23377 } |
| 23388 | 23378 |
| 23389 | 23379 |
| 23390 const char* UserTag::ToCString() const { | 23380 const char* UserTag::ToCString() const { |
| 23391 const String& tag_label = String::Handle(label()); | 23381 const String& tag_label = String::Handle(label()); |
| 23392 return tag_label.ToCString(); | 23382 return tag_label.ToCString(); |
| 23393 } | 23383 } |
| 23394 | 23384 |
| 23395 } // namespace dart | 23385 } // namespace dart |
| OLD | NEW |