| 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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 5341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5352 break; | 5352 break; |
| 5353 case RawFunction::kMethodExtractor: | 5353 case RawFunction::kMethodExtractor: |
| 5354 return "kMethodExtractor"; | 5354 return "kMethodExtractor"; |
| 5355 break; | 5355 break; |
| 5356 case RawFunction::kNoSuchMethodDispatcher: | 5356 case RawFunction::kNoSuchMethodDispatcher: |
| 5357 return "kNoSuchMethodDispatcher"; | 5357 return "kNoSuchMethodDispatcher"; |
| 5358 break; | 5358 break; |
| 5359 case RawFunction::kInvokeFieldDispatcher: | 5359 case RawFunction::kInvokeFieldDispatcher: |
| 5360 return "kInvokeFieldDispatcher"; | 5360 return "kInvokeFieldDispatcher"; |
| 5361 break; | 5361 break; |
| 5362 case RawFunction::kIrregexpFunction: |
| 5363 return "kIrregexpFunction"; |
| 5364 break; |
| 5362 default: | 5365 default: |
| 5363 UNREACHABLE(); | 5366 UNREACHABLE(); |
| 5364 return NULL; | 5367 return NULL; |
| 5365 } | 5368 } |
| 5366 } | 5369 } |
| 5367 | 5370 |
| 5368 | 5371 |
| 5369 void Function::SetRedirectionType(const Type& type) const { | 5372 void Function::SetRedirectionType(const Type& type) const { |
| 5370 ASSERT(IsFactory()); | 5373 ASSERT(IsFactory()); |
| 5371 Object& obj = Object::Handle(raw_ptr()->data_); | 5374 Object& obj = Object::Handle(raw_ptr()->data_); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5437 StorePointer(&raw_ptr()->name_, value.raw()); | 5440 StorePointer(&raw_ptr()->name_, value.raw()); |
| 5438 } | 5441 } |
| 5439 | 5442 |
| 5440 | 5443 |
| 5441 void Function::set_owner(const Object& value) const { | 5444 void Function::set_owner(const Object& value) const { |
| 5442 ASSERT(!value.IsNull()); | 5445 ASSERT(!value.IsNull()); |
| 5443 StorePointer(&raw_ptr()->owner_, value.raw()); | 5446 StorePointer(&raw_ptr()->owner_, value.raw()); |
| 5444 } | 5447 } |
| 5445 | 5448 |
| 5446 | 5449 |
| 5450 RawJSRegExp* Function::regexp() const { |
| 5451 ASSERT(kind() == RawFunction::kIrregexpFunction); |
| 5452 const Object& obj = Object::Handle(raw_ptr()->data_); |
| 5453 ASSERT(obj.IsJSRegExp()); |
| 5454 return JSRegExp::Cast(obj).raw(); |
| 5455 } |
| 5456 |
| 5457 |
| 5458 void Function::set_regexp(const JSRegExp& value) const { |
| 5459 ASSERT(kind() == RawFunction::kIrregexpFunction); |
| 5460 ASSERT(raw_ptr()->data_ == Object::null()); |
| 5461 set_data(value); |
| 5462 } |
| 5463 |
| 5464 void Function::set_regexp_cid(intptr_t regexp_cid) const { |
| 5465 StoreNonPointer(&raw_ptr()->regexp_cid_, regexp_cid); |
| 5466 } |
| 5467 |
| 5447 void Function::set_result_type(const AbstractType& value) const { | 5468 void Function::set_result_type(const AbstractType& value) const { |
| 5448 ASSERT(!value.IsNull()); | 5469 ASSERT(!value.IsNull()); |
| 5449 StorePointer(&raw_ptr()->result_type_, value.raw()); | 5470 StorePointer(&raw_ptr()->result_type_, value.raw()); |
| 5450 } | 5471 } |
| 5451 | 5472 |
| 5452 | 5473 |
| 5453 RawAbstractType* Function::ParameterTypeAt(intptr_t index) const { | 5474 RawAbstractType* Function::ParameterTypeAt(intptr_t index) const { |
| 5454 const Array& parameter_types = Array::Handle(raw_ptr()->parameter_types_); | 5475 const Array& parameter_types = Array::Handle(raw_ptr()->parameter_types_); |
| 5455 return AbstractType::RawCast(parameter_types.At(index)); | 5476 return AbstractType::RawCast(parameter_types.At(index)); |
| 5456 } | 5477 } |
| (...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6697 break; | 6718 break; |
| 6698 case RawFunction::kMethodExtractor: | 6719 case RawFunction::kMethodExtractor: |
| 6699 kind_str = " method-extractor"; | 6720 kind_str = " method-extractor"; |
| 6700 break; | 6721 break; |
| 6701 case RawFunction::kNoSuchMethodDispatcher: | 6722 case RawFunction::kNoSuchMethodDispatcher: |
| 6702 kind_str = " no-such-method-dispatcher"; | 6723 kind_str = " no-such-method-dispatcher"; |
| 6703 break; | 6724 break; |
| 6704 case RawFunction::kInvokeFieldDispatcher: | 6725 case RawFunction::kInvokeFieldDispatcher: |
| 6705 kind_str = "invoke-field-dispatcher"; | 6726 kind_str = "invoke-field-dispatcher"; |
| 6706 break; | 6727 break; |
| 6728 case RawFunction::kIrregexpFunction: |
| 6729 kind_str = "irregexp-function"; |
| 6730 break; |
| 6707 default: | 6731 default: |
| 6708 UNREACHABLE(); | 6732 UNREACHABLE(); |
| 6709 } | 6733 } |
| 6710 const char* kFormat = "Function '%s':%s%s%s%s."; | 6734 const char* kFormat = "Function '%s':%s%s%s%s."; |
| 6711 const char* function_name = String::Handle(name()).ToCString(); | 6735 const char* function_name = String::Handle(name()).ToCString(); |
| 6712 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, | 6736 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, |
| 6713 static_str, abstract_str, kind_str, const_str) + 1; | 6737 static_str, abstract_str, kind_str, const_str) + 1; |
| 6714 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 6738 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 6715 OS::SNPrint(chars, len, kFormat, function_name, | 6739 OS::SNPrint(chars, len, kFormat, function_name, |
| 6716 static_str, abstract_str, kind_str, const_str); | 6740 static_str, abstract_str, kind_str, const_str); |
| (...skipping 3656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10373 OS::Print("Function not found %s.%s\n", #class_name, #function_name); \ | 10397 OS::Print("Function not found %s.%s\n", #class_name, #function_name); \ |
| 10374 } else if (func.SourceFingerprint() != fp) { \ | 10398 } else if (func.SourceFingerprint() != fp) { \ |
| 10375 has_errors = true; \ | 10399 has_errors = true; \ |
| 10376 OS::Print("Wrong fingerprint for '%s': expecting %d found %d\n", \ | 10400 OS::Print("Wrong fingerprint for '%s': expecting %d found %d\n", \ |
| 10377 func.ToFullyQualifiedCString(), fp, func.SourceFingerprint()); \ | 10401 func.ToFullyQualifiedCString(), fp, func.SourceFingerprint()); \ |
| 10378 collected_fp_diffs.Add(FpDiff(fp, func.SourceFingerprint())); \ | 10402 collected_fp_diffs.Add(FpDiff(fp, func.SourceFingerprint())); \ |
| 10379 } \ | 10403 } \ |
| 10380 | 10404 |
| 10381 all_libs.Add(&Library::ZoneHandle(Library::CoreLibrary())); | 10405 all_libs.Add(&Library::ZoneHandle(Library::CoreLibrary())); |
| 10382 CORE_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); | 10406 CORE_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); |
| 10407 CORE_REGEXP_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); |
| 10383 CORE_INTEGER_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); | 10408 CORE_INTEGER_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); |
| 10384 | 10409 |
| 10385 all_libs.Add(&Library::ZoneHandle(Library::MathLibrary())); | 10410 all_libs.Add(&Library::ZoneHandle(Library::MathLibrary())); |
| 10386 all_libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary())); | 10411 all_libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary())); |
| 10387 OTHER_RECOGNIZED_LIST(CHECK_FINGERPRINTS); | 10412 OTHER_RECOGNIZED_LIST(CHECK_FINGERPRINTS); |
| 10388 INLINE_WHITE_LIST(CHECK_FINGERPRINTS); | 10413 INLINE_WHITE_LIST(CHECK_FINGERPRINTS); |
| 10389 POLYMORPHIC_TARGET_LIST(CHECK_FINGERPRINTS); | 10414 POLYMORPHIC_TARGET_LIST(CHECK_FINGERPRINTS); |
| 10390 | 10415 |
| 10391 all_libs.Clear(); | 10416 all_libs.Clear(); |
| 10392 all_libs.Add(&Library::ZoneHandle(Library::MathLibrary())); | 10417 all_libs.Add(&Library::ZoneHandle(Library::MathLibrary())); |
| (...skipping 9585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19978 chars[total_len] = '\0'; | 20003 chars[total_len] = '\0'; |
| 19979 return chars; | 20004 return chars; |
| 19980 } | 20005 } |
| 19981 | 20006 |
| 19982 | 20007 |
| 19983 void JSRegExp::set_pattern(const String& pattern) const { | 20008 void JSRegExp::set_pattern(const String& pattern) const { |
| 19984 StorePointer(&raw_ptr()->pattern_, pattern.raw()); | 20009 StorePointer(&raw_ptr()->pattern_, pattern.raw()); |
| 19985 } | 20010 } |
| 19986 | 20011 |
| 19987 | 20012 |
| 20013 void JSRegExp::set_function(intptr_t cid, const Function& value) const { |
| 20014 StorePointer(FunctionAddr(cid), value.raw()); |
| 20015 } |
| 20016 |
| 20017 |
| 19988 void JSRegExp::set_num_bracket_expressions(intptr_t value) const { | 20018 void JSRegExp::set_num_bracket_expressions(intptr_t value) const { |
| 19989 StoreSmi(&raw_ptr()->num_bracket_expressions_, Smi::New(value)); | 20019 StoreSmi(&raw_ptr()->num_bracket_expressions_, Smi::New(value)); |
| 19990 } | 20020 } |
| 19991 | 20021 |
| 19992 | 20022 |
| 19993 RawJSRegExp* JSRegExp::New(intptr_t len, Heap::Space space) { | 20023 RawJSRegExp* JSRegExp::New(intptr_t len, Heap::Space space) { |
| 19994 if (len < 0 || len > kMaxElements) { | 20024 if (len < 0 || len > kMaxElements) { |
| 19995 // This should be caught before we reach here. | 20025 // This should be caught before we reach here. |
| 19996 FATAL1("Fatal error in JSRegexp::New: invalid len %" Pd "\n", len); | 20026 FATAL1("Fatal error in JSRegexp::New: invalid len %" Pd "\n", len); |
| 19997 } | 20027 } |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20314 return tag_label.ToCString(); | 20344 return tag_label.ToCString(); |
| 20315 } | 20345 } |
| 20316 | 20346 |
| 20317 | 20347 |
| 20318 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20348 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20319 Instance::PrintJSONImpl(stream, ref); | 20349 Instance::PrintJSONImpl(stream, ref); |
| 20320 } | 20350 } |
| 20321 | 20351 |
| 20322 | 20352 |
| 20323 } // namespace dart | 20353 } // namespace dart |
| OLD | NEW |