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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 5363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5374 break; | 5374 break; |
| 5375 case RawFunction::kMethodExtractor: | 5375 case RawFunction::kMethodExtractor: |
| 5376 return "kMethodExtractor"; | 5376 return "kMethodExtractor"; |
| 5377 break; | 5377 break; |
| 5378 case RawFunction::kNoSuchMethodDispatcher: | 5378 case RawFunction::kNoSuchMethodDispatcher: |
| 5379 return "kNoSuchMethodDispatcher"; | 5379 return "kNoSuchMethodDispatcher"; |
| 5380 break; | 5380 break; |
| 5381 case RawFunction::kInvokeFieldDispatcher: | 5381 case RawFunction::kInvokeFieldDispatcher: |
| 5382 return "kInvokeFieldDispatcher"; | 5382 return "kInvokeFieldDispatcher"; |
| 5383 break; | 5383 break; |
| 5384 case RawFunction::kIrregexpFunction: | |
| 5385 return "kIrregexpFunction"; | |
| 5386 break; | |
| 5384 default: | 5387 default: |
| 5385 UNREACHABLE(); | 5388 UNREACHABLE(); |
| 5386 return NULL; | 5389 return NULL; |
| 5387 } | 5390 } |
| 5388 } | 5391 } |
| 5389 | 5392 |
| 5390 | 5393 |
| 5391 void Function::SetRedirectionType(const Type& type) const { | 5394 void Function::SetRedirectionType(const Type& type) const { |
| 5392 ASSERT(IsFactory()); | 5395 ASSERT(IsFactory()); |
| 5393 Object& obj = Object::Handle(raw_ptr()->data_); | 5396 Object& obj = Object::Handle(raw_ptr()->data_); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5459 StorePointer(&raw_ptr()->name_, value.raw()); | 5462 StorePointer(&raw_ptr()->name_, value.raw()); |
| 5460 } | 5463 } |
| 5461 | 5464 |
| 5462 | 5465 |
| 5463 void Function::set_owner(const Object& value) const { | 5466 void Function::set_owner(const Object& value) const { |
| 5464 ASSERT(!value.IsNull()); | 5467 ASSERT(!value.IsNull()); |
| 5465 StorePointer(&raw_ptr()->owner_, value.raw()); | 5468 StorePointer(&raw_ptr()->owner_, value.raw()); |
| 5466 } | 5469 } |
| 5467 | 5470 |
| 5468 | 5471 |
| 5472 void Function::set_regexp(const JSRegExp& value) const { | |
| 5473 ASSERT(!value.IsNull()); | |
| 5474 StorePointer(&raw_ptr()->regexp_, value.raw()); | |
| 5475 } | |
| 5476 | |
| 5477 | |
| 5469 void Function::set_result_type(const AbstractType& value) const { | 5478 void Function::set_result_type(const AbstractType& value) const { |
| 5470 ASSERT(!value.IsNull()); | 5479 ASSERT(!value.IsNull()); |
| 5471 StorePointer(&raw_ptr()->result_type_, value.raw()); | 5480 StorePointer(&raw_ptr()->result_type_, value.raw()); |
| 5472 } | 5481 } |
| 5473 | 5482 |
| 5474 | 5483 |
| 5475 RawAbstractType* Function::ParameterTypeAt(intptr_t index) const { | 5484 RawAbstractType* Function::ParameterTypeAt(intptr_t index) const { |
| 5476 const Array& parameter_types = Array::Handle(raw_ptr()->parameter_types_); | 5485 const Array& parameter_types = Array::Handle(raw_ptr()->parameter_types_); |
| 5477 return AbstractType::RawCast(parameter_types.At(index)); | 5486 return AbstractType::RawCast(parameter_types.At(index)); |
| 5478 } | 5487 } |
| (...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6775 break; | 6784 break; |
| 6776 case RawFunction::kMethodExtractor: | 6785 case RawFunction::kMethodExtractor: |
| 6777 kind_str = " method-extractor"; | 6786 kind_str = " method-extractor"; |
| 6778 break; | 6787 break; |
| 6779 case RawFunction::kNoSuchMethodDispatcher: | 6788 case RawFunction::kNoSuchMethodDispatcher: |
| 6780 kind_str = " no-such-method-dispatcher"; | 6789 kind_str = " no-such-method-dispatcher"; |
| 6781 break; | 6790 break; |
| 6782 case RawFunction::kInvokeFieldDispatcher: | 6791 case RawFunction::kInvokeFieldDispatcher: |
| 6783 kind_str = "invoke-field-dispatcher"; | 6792 kind_str = "invoke-field-dispatcher"; |
| 6784 break; | 6793 break; |
| 6794 case RawFunction::kIrregexpFunction: | |
| 6795 kind_str = "irregexp-function"; | |
| 6796 break; | |
| 6785 default: | 6797 default: |
| 6786 UNREACHABLE(); | 6798 UNREACHABLE(); |
| 6787 } | 6799 } |
| 6788 const char* kFormat = "Function '%s':%s%s%s%s."; | 6800 const char* kFormat = "Function '%s':%s%s%s%s."; |
| 6789 const char* function_name = String::Handle(name()).ToCString(); | 6801 const char* function_name = String::Handle(name()).ToCString(); |
| 6790 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, | 6802 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, |
| 6791 static_str, abstract_str, kind_str, const_str) + 1; | 6803 static_str, abstract_str, kind_str, const_str) + 1; |
| 6792 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 6804 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 6793 OS::SNPrint(chars, len, kFormat, function_name, | 6805 OS::SNPrint(chars, len, kFormat, function_name, |
| 6794 static_str, abstract_str, kind_str, const_str); | 6806 static_str, abstract_str, kind_str, const_str); |
| (...skipping 3639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10434 OS::Print("Function not found %s.%s\n", #class_name, #function_name); \ | 10446 OS::Print("Function not found %s.%s\n", #class_name, #function_name); \ |
| 10435 } else if (func.SourceFingerprint() != fp) { \ | 10447 } else if (func.SourceFingerprint() != fp) { \ |
| 10436 has_errors = true; \ | 10448 has_errors = true; \ |
| 10437 OS::Print("Wrong fingerprint for '%s': expecting %d found %d\n", \ | 10449 OS::Print("Wrong fingerprint for '%s': expecting %d found %d\n", \ |
| 10438 func.ToFullyQualifiedCString(), fp, func.SourceFingerprint()); \ | 10450 func.ToFullyQualifiedCString(), fp, func.SourceFingerprint()); \ |
| 10439 collected_fp_diffs.Add(FpDiff(fp, func.SourceFingerprint())); \ | 10451 collected_fp_diffs.Add(FpDiff(fp, func.SourceFingerprint())); \ |
| 10440 } \ | 10452 } \ |
| 10441 | 10453 |
| 10442 all_libs.Add(&Library::ZoneHandle(Library::CoreLibrary())); | 10454 all_libs.Add(&Library::ZoneHandle(Library::CoreLibrary())); |
| 10443 CORE_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); | 10455 CORE_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); |
| 10456 CORE_REGEXP_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); | |
| 10444 CORE_INTEGER_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); | 10457 CORE_INTEGER_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); |
| 10445 | 10458 |
| 10446 all_libs.Add(&Library::ZoneHandle(Library::MathLibrary())); | 10459 all_libs.Add(&Library::ZoneHandle(Library::MathLibrary())); |
| 10447 all_libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary())); | 10460 all_libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary())); |
| 10448 OTHER_RECOGNIZED_LIST(CHECK_FINGERPRINTS); | 10461 OTHER_RECOGNIZED_LIST(CHECK_FINGERPRINTS); |
| 10449 INLINE_WHITE_LIST(CHECK_FINGERPRINTS); | 10462 INLINE_WHITE_LIST(CHECK_FINGERPRINTS); |
| 10450 POLYMORPHIC_TARGET_LIST(CHECK_FINGERPRINTS); | 10463 POLYMORPHIC_TARGET_LIST(CHECK_FINGERPRINTS); |
| 10451 | 10464 |
| 10452 all_libs.Clear(); | 10465 all_libs.Clear(); |
| 10453 all_libs.Add(&Library::ZoneHandle(Library::MathLibrary())); | 10466 all_libs.Add(&Library::ZoneHandle(Library::MathLibrary())); |
| (...skipping 9571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20025 chars[total_len] = '\0'; | 20038 chars[total_len] = '\0'; |
| 20026 return chars; | 20039 return chars; |
| 20027 } | 20040 } |
| 20028 | 20041 |
| 20029 | 20042 |
| 20030 void JSRegExp::set_pattern(const String& pattern) const { | 20043 void JSRegExp::set_pattern(const String& pattern) const { |
| 20031 StorePointer(&raw_ptr()->pattern_, pattern.raw()); | 20044 StorePointer(&raw_ptr()->pattern_, pattern.raw()); |
| 20032 } | 20045 } |
| 20033 | 20046 |
| 20034 | 20047 |
| 20048 void JSRegExp::set_function(intptr_t cid, const Function& value) { | |
| 20049 RawFunction** dest = NULL; | |
| 20050 switch (cid) { | |
| 20051 case kOneByteStringCid: dest = &raw_ptr()->one_byte_function_; break; | |
|
Florian Schneider
2014/10/01 17:04:15
break lines after if there is more than one statem
| |
| 20052 case kTwoByteStringCid: dest = &raw_ptr()->two_byte_function_; break; | |
| 20053 case kExternalOneByteStringCid: | |
| 20054 dest = &raw_ptr()->external_one_byte_function_; break; | |
| 20055 case kExternalTwoByteStringCid: | |
| 20056 dest = &raw_ptr()->external_two_byte_function_; break; | |
| 20057 default: UNREACHABLE(); | |
| 20058 } | |
| 20059 ASSERT(dest != NULL); | |
| 20060 | |
| 20061 StorePointer(dest, value.raw()); | |
| 20062 } | |
| 20063 | |
| 20064 | |
| 20065 void JSRegExp::set_sample_subject(intptr_t cid, const String& value) const { | |
| 20066 RawString** dest = NULL; | |
| 20067 switch (cid) { | |
| 20068 case kOneByteStringCid: dest = &raw_ptr()->one_byte_subject_; break; | |
|
Florian Schneider
2014/10/01 17:04:15
Also here.
| |
| 20069 case kTwoByteStringCid: dest = &raw_ptr()->two_byte_subject_; break; | |
| 20070 case kExternalOneByteStringCid: | |
| 20071 dest = &raw_ptr()->external_one_byte_subject_; break; | |
| 20072 case kExternalTwoByteStringCid: | |
| 20073 dest = &raw_ptr()->external_two_byte_subject_; break; | |
| 20074 default: UNREACHABLE(); | |
| 20075 } | |
| 20076 ASSERT(dest != NULL); | |
| 20077 | |
| 20078 StorePointer(dest, value.raw()); | |
| 20079 } | |
| 20080 | |
| 20081 | |
| 20082 | |
| 20035 void JSRegExp::set_num_bracket_expressions(intptr_t value) const { | 20083 void JSRegExp::set_num_bracket_expressions(intptr_t value) const { |
| 20036 raw_ptr()->num_bracket_expressions_ = Smi::New(value); | 20084 raw_ptr()->num_bracket_expressions_ = Smi::New(value); |
| 20037 } | 20085 } |
| 20038 | 20086 |
| 20039 | 20087 |
| 20040 RawJSRegExp* JSRegExp::New(intptr_t len, Heap::Space space) { | 20088 RawJSRegExp* JSRegExp::New(intptr_t len, Heap::Space space) { |
| 20041 if (len < 0 || len > kMaxElements) { | 20089 if (len < 0 || len > kMaxElements) { |
| 20042 // This should be caught before we reach here. | 20090 // This should be caught before we reach here. |
| 20043 FATAL1("Fatal error in JSRegexp::New: invalid len %" Pd "\n", len); | 20091 FATAL1("Fatal error in JSRegexp::New: invalid len %" Pd "\n", len); |
| 20044 } | 20092 } |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20361 return tag_label.ToCString(); | 20409 return tag_label.ToCString(); |
| 20362 } | 20410 } |
| 20363 | 20411 |
| 20364 | 20412 |
| 20365 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20413 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20366 Instance::PrintJSONImpl(stream, ref); | 20414 Instance::PrintJSONImpl(stream, ref); |
| 20367 } | 20415 } |
| 20368 | 20416 |
| 20369 | 20417 |
| 20370 } // namespace dart | 20418 } // namespace dart |
| OLD | NEW |