| 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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 // Allocate and initialize the empty_array instance. | 673 // Allocate and initialize the empty_array instance. |
| 674 { | 674 { |
| 675 uword address = heap->Allocate(Array::InstanceSize(0), Heap::kOld); | 675 uword address = heap->Allocate(Array::InstanceSize(0), Heap::kOld); |
| 676 InitializeObject(address, kArrayCid, Array::InstanceSize(0)); | 676 InitializeObject(address, kArrayCid, Array::InstanceSize(0)); |
| 677 Array::initializeHandle( | 677 Array::initializeHandle( |
| 678 empty_array_, | 678 empty_array_, |
| 679 reinterpret_cast<RawArray*>(address + kHeapObjectTag)); | 679 reinterpret_cast<RawArray*>(address + kHeapObjectTag)); |
| 680 empty_array_->StoreSmi(&empty_array_->raw_ptr()->length_, Smi::New(0)); | 680 empty_array_->StoreSmi(&empty_array_->raw_ptr()->length_, Smi::New(0)); |
| 681 } | 681 } |
| 682 | 682 |
| 683 Smi& smi = Smi::Handle(); |
| 683 // Allocate and initialize the zero_array instance. | 684 // Allocate and initialize the zero_array instance. |
| 684 { | 685 { |
| 685 uword address = heap->Allocate(Array::InstanceSize(1), Heap::kOld); | 686 uword address = heap->Allocate(Array::InstanceSize(1), Heap::kOld); |
| 686 InitializeObject(address, kArrayCid, Array::InstanceSize(1)); | 687 InitializeObject(address, kArrayCid, Array::InstanceSize(1)); |
| 687 Array::initializeHandle( | 688 Array::initializeHandle( |
| 688 zero_array_, | 689 zero_array_, |
| 689 reinterpret_cast<RawArray*>(address + kHeapObjectTag)); | 690 reinterpret_cast<RawArray*>(address + kHeapObjectTag)); |
| 690 zero_array_->StoreSmi(&zero_array_->raw_ptr()->length_, Smi::New(1)); | 691 zero_array_->StoreSmi(&zero_array_->raw_ptr()->length_, Smi::New(1)); |
| 691 zero_array_->StorePointer(&zero_array_->raw_ptr()->data()[0], | 692 smi = Smi::New(0); |
| 692 static_cast<RawObject*>(Smi::New(0))); | 693 zero_array_->SetAt(0, smi); |
| 693 } | 694 } |
| 694 | 695 |
| 695 // Allocate and initialize the empty_descriptors instance. | 696 // Allocate and initialize the empty_descriptors instance. |
| 696 { | 697 { |
| 697 uword address = heap->Allocate( | 698 uword address = heap->Allocate( |
| 698 PcDescriptors::InstanceSize(0, RawPcDescriptors::kCompressedRecSize), | 699 PcDescriptors::InstanceSize(0, RawPcDescriptors::kCompressedRecSize), |
| 699 Heap::kOld); | 700 Heap::kOld); |
| 700 InitializeObject(address, kPcDescriptorsCid, | 701 InitializeObject(address, kPcDescriptorsCid, |
| 701 PcDescriptors::InstanceSize(0, RawPcDescriptors::kCompressedRecSize)); | 702 PcDescriptors::InstanceSize(0, RawPcDescriptors::kCompressedRecSize)); |
| 702 PcDescriptors::initializeHandle( | 703 PcDescriptors::initializeHandle( |
| 703 empty_descriptors_, | 704 empty_descriptors_, |
| 704 reinterpret_cast<RawPcDescriptors*>(address + kHeapObjectTag)); | 705 reinterpret_cast<RawPcDescriptors*>(address + kHeapObjectTag)); |
| 705 empty_descriptors_->StoreNonPointer(&empty_descriptors_->raw_ptr()->length_, | 706 empty_descriptors_->StoreNonPointer(&empty_descriptors_->raw_ptr()->length_, |
| 706 0); | 707 0); |
| 707 } | 708 } |
| 708 | 709 |
| 709 // Allocate and initialize the canonical empty variable descriptor object. | 710 // Allocate and initialize the canonical empty variable descriptor object. |
| 710 { | 711 { |
| 711 uword address = | 712 uword address = |
| 712 heap->Allocate(LocalVarDescriptors::InstanceSize(0), Heap::kOld); | 713 heap->Allocate(LocalVarDescriptors::InstanceSize(0), Heap::kOld); |
| 713 InitializeObject(address, | 714 InitializeObject(address, |
| 714 kLocalVarDescriptorsCid, | 715 kLocalVarDescriptorsCid, |
| 715 LocalVarDescriptors::InstanceSize(0)); | 716 LocalVarDescriptors::InstanceSize(0)); |
| 716 LocalVarDescriptors::initializeHandle( | 717 LocalVarDescriptors::initializeHandle( |
| 717 empty_var_descriptors_, | 718 empty_var_descriptors_, |
| 718 reinterpret_cast<RawLocalVarDescriptors*>(address + kHeapObjectTag)); | 719 reinterpret_cast<RawLocalVarDescriptors*>(address + kHeapObjectTag)); |
| 719 empty_var_descriptors_->raw_ptr()->num_entries_ = 0; | 720 empty_var_descriptors_->StoreNonPointer( |
| 721 &empty_var_descriptors_->raw_ptr()->num_entries_, 0); |
| 720 } | 722 } |
| 721 | 723 |
| 722 // Allocate and initialize the canonical empty exception handler info object. | 724 // Allocate and initialize the canonical empty exception handler info object. |
| 723 // The vast majority of all functions do not contain an exception handler | 725 // The vast majority of all functions do not contain an exception handler |
| 724 // and can share this canonical descriptor. | 726 // and can share this canonical descriptor. |
| 725 { | 727 { |
| 726 uword address = | 728 uword address = |
| 727 heap->Allocate(ExceptionHandlers::InstanceSize(0), Heap::kOld); | 729 heap->Allocate(ExceptionHandlers::InstanceSize(0), Heap::kOld); |
| 728 InitializeObject(address, | 730 InitializeObject(address, |
| 729 kExceptionHandlersCid, | 731 kExceptionHandlersCid, |
| 730 ExceptionHandlers::InstanceSize(0)); | 732 ExceptionHandlers::InstanceSize(0)); |
| 731 ExceptionHandlers::initializeHandle( | 733 ExceptionHandlers::initializeHandle( |
| 732 empty_exception_handlers_, | 734 empty_exception_handlers_, |
| 733 reinterpret_cast<RawExceptionHandlers*>(address + kHeapObjectTag)); | 735 reinterpret_cast<RawExceptionHandlers*>(address + kHeapObjectTag)); |
| 734 empty_exception_handlers_->raw_ptr()->num_entries_ = 0; | 736 empty_exception_handlers_->StoreNonPointer( |
| 737 &empty_exception_handlers_->raw_ptr()->num_entries_, 0); |
| 735 } | 738 } |
| 736 | 739 |
| 737 cls = Class::New<Instance>(kDynamicCid); | 740 cls = Class::New<Instance>(kDynamicCid); |
| 738 cls.set_is_abstract(); | 741 cls.set_is_abstract(); |
| 739 cls.set_num_type_arguments(0); | 742 cls.set_num_type_arguments(0); |
| 740 cls.set_num_own_type_arguments(0); | 743 cls.set_num_own_type_arguments(0); |
| 741 cls.set_is_type_finalized(); | 744 cls.set_is_type_finalized(); |
| 742 cls.set_is_finalized(); | 745 cls.set_is_finalized(); |
| 743 dynamic_class_ = cls.raw(); | 746 dynamic_class_ = cls.raw(); |
| 744 | 747 |
| (...skipping 4027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4772 } | 4775 } |
| 4773 // The zero array should have been initialized. | 4776 // The zero array should have been initialized. |
| 4774 ASSERT(Object::zero_array().raw() != Array::null()); | 4777 ASSERT(Object::zero_array().raw() != Array::null()); |
| 4775 COMPILE_ASSERT(StubCode::kNoInstantiator == 0); | 4778 COMPILE_ASSERT(StubCode::kNoInstantiator == 0); |
| 4776 result.set_instantiations(Object::zero_array()); | 4779 result.set_instantiations(Object::zero_array()); |
| 4777 return result.raw(); | 4780 return result.raw(); |
| 4778 } | 4781 } |
| 4779 | 4782 |
| 4780 | 4783 |
| 4781 | 4784 |
| 4782 RawAbstractType** TypeArguments::TypeAddr(intptr_t index) const { | 4785 RawAbstractType* const* TypeArguments::TypeAddr(intptr_t index) const { |
| 4783 // TODO(iposva): Determine if we should throw an exception here. | 4786 // TODO(iposva): Determine if we should throw an exception here. |
| 4784 ASSERT((index >= 0) && (index < Length())); | 4787 ASSERT((index >= 0) && (index < Length())); |
| 4785 return &raw_ptr()->types()[index]; | 4788 return &raw_ptr()->types()[index]; |
| 4786 } | 4789 } |
| 4787 | 4790 |
| 4788 | 4791 |
| 4789 void TypeArguments::SetLength(intptr_t value) const { | 4792 void TypeArguments::SetLength(intptr_t value) const { |
| 4790 ASSERT(!IsCanonical()); | 4793 ASSERT(!IsCanonical()); |
| 4791 // This is only safe because we create a new Smi, which does not cause | 4794 // This is only safe because we create a new Smi, which does not cause |
| 4792 // heap allocation. | 4795 // heap allocation. |
| (...skipping 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6995 } | 6998 } |
| 6996 | 6999 |
| 6997 | 7000 |
| 6998 intptr_t Field::guarded_list_length_in_object_offset() const { | 7001 intptr_t Field::guarded_list_length_in_object_offset() const { |
| 6999 return raw_ptr()->guarded_list_length_in_object_offset_ + kHeapObjectTag; | 7002 return raw_ptr()->guarded_list_length_in_object_offset_ + kHeapObjectTag; |
| 7000 } | 7003 } |
| 7001 | 7004 |
| 7002 | 7005 |
| 7003 void Field::set_guarded_list_length_in_object_offset( | 7006 void Field::set_guarded_list_length_in_object_offset( |
| 7004 intptr_t list_length_offset) const { | 7007 intptr_t list_length_offset) const { |
| 7005 raw_ptr()->guarded_list_length_in_object_offset_ = | 7008 StoreNonPointer(&raw_ptr()->guarded_list_length_in_object_offset_, |
| 7006 static_cast<int8_t>(list_length_offset - kHeapObjectTag); | 7009 static_cast<int8_t>(list_length_offset - kHeapObjectTag)); |
| 7007 ASSERT(guarded_list_length_in_object_offset() == list_length_offset); | 7010 ASSERT(guarded_list_length_in_object_offset() == list_length_offset); |
| 7008 } | 7011 } |
| 7009 | 7012 |
| 7010 | 7013 |
| 7011 bool Field::IsUnboxedField() const { | 7014 bool Field::IsUnboxedField() const { |
| 7012 bool valid_class = (FlowGraphCompiler::SupportsUnboxedDoubles() && | 7015 bool valid_class = (FlowGraphCompiler::SupportsUnboxedDoubles() && |
| 7013 (guarded_cid() == kDoubleCid)) || | 7016 (guarded_cid() == kDoubleCid)) || |
| 7014 (FlowGraphCompiler::SupportsUnboxedSimd128() && | 7017 (FlowGraphCompiler::SupportsUnboxedSimd128() && |
| 7015 (guarded_cid() == kFloat32x4Cid)) || | 7018 (guarded_cid() == kFloat32x4Cid)) || |
| 7016 (FlowGraphCompiler::SupportsUnboxedSimd128() && | 7019 (FlowGraphCompiler::SupportsUnboxedSimd128() && |
| (...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8537 void Library::SetLoadInProgress() const { | 8540 void Library::SetLoadInProgress() const { |
| 8538 // Must not already be in the process of being loaded. | 8541 // Must not already be in the process of being loaded. |
| 8539 ASSERT(raw_ptr()->load_state_ <= RawLibrary::kLoadRequested); | 8542 ASSERT(raw_ptr()->load_state_ <= RawLibrary::kLoadRequested); |
| 8540 StoreNonPointer(&raw_ptr()->load_state_, RawLibrary::kLoadInProgress); | 8543 StoreNonPointer(&raw_ptr()->load_state_, RawLibrary::kLoadInProgress); |
| 8541 } | 8544 } |
| 8542 | 8545 |
| 8543 | 8546 |
| 8544 void Library::SetLoadRequested() const { | 8547 void Library::SetLoadRequested() const { |
| 8545 // Must not be already loaded. | 8548 // Must not be already loaded. |
| 8546 ASSERT(raw_ptr()->load_state_ == RawLibrary::kAllocated); | 8549 ASSERT(raw_ptr()->load_state_ == RawLibrary::kAllocated); |
| 8547 raw_ptr()->load_state_ = RawLibrary::kLoadRequested; | 8550 StoreNonPointer(&raw_ptr()->load_state_, RawLibrary::kLoadRequested); |
| 8548 } | 8551 } |
| 8549 | 8552 |
| 8550 | 8553 |
| 8551 void Library::SetLoaded() const { | 8554 void Library::SetLoaded() const { |
| 8552 // Should not be already loaded or just allocated. | 8555 // Should not be already loaded or just allocated. |
| 8553 ASSERT(LoadInProgress() || LoadRequested()); | 8556 ASSERT(LoadInProgress() || LoadRequested()); |
| 8554 StoreNonPointer(&raw_ptr()->load_state_, RawLibrary::kLoaded); | 8557 StoreNonPointer(&raw_ptr()->load_state_, RawLibrary::kLoaded); |
| 8555 } | 8558 } |
| 8556 | 8559 |
| 8557 | 8560 |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9418 result.StorePointer(&result.raw_ptr()->dictionary_, | 9421 result.StorePointer(&result.raw_ptr()->dictionary_, |
| 9419 Object::empty_array().raw()); | 9422 Object::empty_array().raw()); |
| 9420 result.StorePointer(&result.raw_ptr()->metadata_, | 9423 result.StorePointer(&result.raw_ptr()->metadata_, |
| 9421 GrowableObjectArray::New(4, Heap::kOld)); | 9424 GrowableObjectArray::New(4, Heap::kOld)); |
| 9422 result.StorePointer(&result.raw_ptr()->anonymous_classes_, | 9425 result.StorePointer(&result.raw_ptr()->anonymous_classes_, |
| 9423 Object::empty_array().raw()); | 9426 Object::empty_array().raw()); |
| 9424 result.StoreNonPointer(&result.raw_ptr()->num_anonymous_, 0); | 9427 result.StoreNonPointer(&result.raw_ptr()->num_anonymous_, 0); |
| 9425 result.StorePointer(&result.raw_ptr()->imports_, Object::empty_array().raw()); | 9428 result.StorePointer(&result.raw_ptr()->imports_, Object::empty_array().raw()); |
| 9426 result.StorePointer(&result.raw_ptr()->exports_, Object::empty_array().raw()); | 9429 result.StorePointer(&result.raw_ptr()->exports_, Object::empty_array().raw()); |
| 9427 result.StorePointer(&result.raw_ptr()->loaded_scripts_, Array::null()); | 9430 result.StorePointer(&result.raw_ptr()->loaded_scripts_, Array::null()); |
| 9428 result.raw_ptr()->load_error_ = Instance::null(); | 9431 result.StorePointer(&result.raw_ptr()->load_error_, Instance::null()); |
| 9429 result.set_native_entry_resolver(NULL); | 9432 result.set_native_entry_resolver(NULL); |
| 9430 result.set_native_entry_symbol_resolver(NULL); | 9433 result.set_native_entry_symbol_resolver(NULL); |
| 9431 result.StoreNonPointer(&result.raw_ptr()->corelib_imported_, true); | 9434 result.StoreNonPointer(&result.raw_ptr()->corelib_imported_, true); |
| 9432 result.set_debuggable(false); | 9435 result.set_debuggable(false); |
| 9433 result.set_is_dart_scheme(url.StartsWith(Symbols::DartScheme())); | 9436 result.set_is_dart_scheme(url.StartsWith(Symbols::DartScheme())); |
| 9434 result.StoreNonPointer(&result.raw_ptr()->load_state_, | 9437 result.StoreNonPointer(&result.raw_ptr()->load_state_, |
| 9435 RawLibrary::kAllocated); | 9438 RawLibrary::kAllocated); |
| 9436 result.StoreNonPointer(&result.raw_ptr()->index_, -1); | 9439 result.StoreNonPointer(&result.raw_ptr()->index_, -1); |
| 9437 const intptr_t kInitialNameCacheSize = 64; | 9440 const intptr_t kInitialNameCacheSize = 64; |
| 9438 result.InitResolvedNamesCache(kInitialNameCacheSize); | 9441 result.InitResolvedNamesCache(kInitialNameCacheSize); |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10415 StoreNonPointer(&raw_ptr()->length_, value); | 10418 StoreNonPointer(&raw_ptr()->length_, value); |
| 10416 } | 10419 } |
| 10417 | 10420 |
| 10418 | 10421 |
| 10419 intptr_t PcDescriptors::RecordSizeInBytes() const { | 10422 intptr_t PcDescriptors::RecordSizeInBytes() const { |
| 10420 return raw_ptr()->record_size_in_bytes_; | 10423 return raw_ptr()->record_size_in_bytes_; |
| 10421 } | 10424 } |
| 10422 | 10425 |
| 10423 | 10426 |
| 10424 void PcDescriptors::SetRecordSizeInBytes(intptr_t value) const { | 10427 void PcDescriptors::SetRecordSizeInBytes(intptr_t value) const { |
| 10425 raw_ptr()->record_size_in_bytes_ = value; | 10428 StoreNonPointer(&raw_ptr()->record_size_in_bytes_, value); |
| 10426 } | 10429 } |
| 10427 | 10430 |
| 10428 | 10431 |
| 10429 RawPcDescriptors* PcDescriptors::New(intptr_t num_descriptors, | 10432 RawPcDescriptors* PcDescriptors::New(intptr_t num_descriptors, |
| 10430 bool has_try_index) { | 10433 bool has_try_index) { |
| 10431 ASSERT(Object::pc_descriptors_class() != Class::null()); | 10434 ASSERT(Object::pc_descriptors_class() != Class::null()); |
| 10432 if (num_descriptors < 0 || num_descriptors > kMaxElements) { | 10435 if (num_descriptors < 0 || num_descriptors > kMaxElements) { |
| 10433 // This should be caught before we reach here. | 10436 // This should be caught before we reach here. |
| 10434 FATAL1("Fatal error in PcDescriptors::New: " | 10437 FATAL1("Fatal error in PcDescriptors::New: " |
| 10435 "invalid num_descriptors %" Pd "\n", num_descriptors); | 10438 "invalid num_descriptors %" Pd "\n", num_descriptors); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10606 uint8_t byte = raw_ptr()->data()[byte_index]; | 10609 uint8_t byte = raw_ptr()->data()[byte_index]; |
| 10607 return (byte & byte_mask); | 10610 return (byte & byte_mask); |
| 10608 } | 10611 } |
| 10609 | 10612 |
| 10610 | 10613 |
| 10611 void Stackmap::SetBit(intptr_t bit_index, bool value) const { | 10614 void Stackmap::SetBit(intptr_t bit_index, bool value) const { |
| 10612 ASSERT(InRange(bit_index)); | 10615 ASSERT(InRange(bit_index)); |
| 10613 int byte_index = bit_index >> kBitsPerByteLog2; | 10616 int byte_index = bit_index >> kBitsPerByteLog2; |
| 10614 int bit_remainder = bit_index & (kBitsPerByte - 1); | 10617 int bit_remainder = bit_index & (kBitsPerByte - 1); |
| 10615 uint8_t byte_mask = 1U << bit_remainder; | 10618 uint8_t byte_mask = 1U << bit_remainder; |
| 10616 uint8_t* byte_addr = &(raw_ptr()->data()[byte_index]); | 10619 NoGCScope no_gc; |
| 10620 uint8_t* byte_addr = UnsafeMutableNonPointer(&raw_ptr()->data()[byte_index]); |
| 10617 if (value) { | 10621 if (value) { |
| 10618 *byte_addr |= byte_mask; | 10622 *byte_addr |= byte_mask; |
| 10619 } else { | 10623 } else { |
| 10620 *byte_addr &= ~byte_mask; | 10624 *byte_addr &= ~byte_mask; |
| 10621 } | 10625 } |
| 10622 } | 10626 } |
| 10623 | 10627 |
| 10624 | 10628 |
| 10625 RawStackmap* Stackmap::New(intptr_t pc_offset, | 10629 RawStackmap* Stackmap::New(intptr_t pc_offset, |
| 10626 BitmapBuilder* bmap, | 10630 BitmapBuilder* bmap, |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10890 return raw_ptr()->num_entries_; | 10894 return raw_ptr()->num_entries_; |
| 10891 } | 10895 } |
| 10892 | 10896 |
| 10893 | 10897 |
| 10894 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index, | 10898 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index, |
| 10895 intptr_t outer_try_index, | 10899 intptr_t outer_try_index, |
| 10896 intptr_t handler_pc, | 10900 intptr_t handler_pc, |
| 10897 bool needs_stacktrace, | 10901 bool needs_stacktrace, |
| 10898 bool has_catch_all) const { | 10902 bool has_catch_all) const { |
| 10899 ASSERT((try_index >= 0) && (try_index < num_entries())); | 10903 ASSERT((try_index >= 0) && (try_index < num_entries())); |
| 10900 RawExceptionHandlers::HandlerInfo* info = &raw_ptr()->data()[try_index]; | 10904 NoGCScope no_gc; |
| 10905 RawExceptionHandlers::HandlerInfo* info = |
| 10906 UnsafeMutableNonPointer(&raw_ptr()->data()[try_index]); |
| 10901 info->outer_try_index = outer_try_index; | 10907 info->outer_try_index = outer_try_index; |
| 10902 info->handler_pc = handler_pc; | 10908 info->handler_pc = handler_pc; |
| 10903 info->needs_stacktrace = needs_stacktrace; | 10909 info->needs_stacktrace = needs_stacktrace; |
| 10904 info->has_catch_all = has_catch_all; | 10910 info->has_catch_all = has_catch_all; |
| 10905 } | 10911 } |
| 10906 | 10912 |
| 10907 void ExceptionHandlers::GetHandlerInfo( | 10913 void ExceptionHandlers::GetHandlerInfo( |
| 10908 intptr_t try_index, | 10914 intptr_t try_index, |
| 10909 RawExceptionHandlers::HandlerInfo* info) const { | 10915 RawExceptionHandlers::HandlerInfo* info) const { |
| 10910 ASSERT((try_index >= 0) && (try_index < num_entries())); | 10916 ASSERT((try_index >= 0) && (try_index < num_entries())); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11043 Object::PrintJSONImpl(stream, ref); | 11049 Object::PrintJSONImpl(stream, ref); |
| 11044 } | 11050 } |
| 11045 | 11051 |
| 11046 | 11052 |
| 11047 intptr_t DeoptInfo::Length() const { | 11053 intptr_t DeoptInfo::Length() const { |
| 11048 return Smi::Value(raw_ptr()->length_); | 11054 return Smi::Value(raw_ptr()->length_); |
| 11049 } | 11055 } |
| 11050 | 11056 |
| 11051 | 11057 |
| 11052 intptr_t DeoptInfo::FromIndex(intptr_t index) const { | 11058 intptr_t DeoptInfo::FromIndex(intptr_t index) const { |
| 11059 NoGCScope no_gc; |
| 11053 return *(EntryAddr(index, kFromIndex)); | 11060 return *(EntryAddr(index, kFromIndex)); |
| 11054 } | 11061 } |
| 11055 | 11062 |
| 11056 | 11063 |
| 11057 intptr_t DeoptInfo::Instruction(intptr_t index) const { | 11064 intptr_t DeoptInfo::Instruction(intptr_t index) const { |
| 11065 NoGCScope no_gc; |
| 11058 return *(EntryAddr(index, kInstruction)); | 11066 return *(EntryAddr(index, kInstruction)); |
| 11059 } | 11067 } |
| 11060 | 11068 |
| 11061 | 11069 |
| 11062 intptr_t DeoptInfo::FrameSize() const { | 11070 intptr_t DeoptInfo::FrameSize() const { |
| 11063 return TranslationLength() - NumMaterializations(); | 11071 return TranslationLength() - NumMaterializations(); |
| 11064 } | 11072 } |
| 11065 | 11073 |
| 11066 | 11074 |
| 11067 intptr_t DeoptInfo::TranslationLength() const { | 11075 intptr_t DeoptInfo::TranslationLength() const { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11185 void DeoptInfo::SetLength(intptr_t value) const { | 11193 void DeoptInfo::SetLength(intptr_t value) const { |
| 11186 // This is only safe because we create a new Smi, which does not cause | 11194 // This is only safe because we create a new Smi, which does not cause |
| 11187 // heap allocation. | 11195 // heap allocation. |
| 11188 StoreSmi(&raw_ptr()->length_, Smi::New(value)); | 11196 StoreSmi(&raw_ptr()->length_, Smi::New(value)); |
| 11189 } | 11197 } |
| 11190 | 11198 |
| 11191 | 11199 |
| 11192 void DeoptInfo::SetAt(intptr_t index, | 11200 void DeoptInfo::SetAt(intptr_t index, |
| 11193 intptr_t instr_kind, | 11201 intptr_t instr_kind, |
| 11194 intptr_t from_index) const { | 11202 intptr_t from_index) const { |
| 11203 NoGCScope no_gc; |
| 11195 *(EntryAddr(index, kInstruction)) = instr_kind; | 11204 *(EntryAddr(index, kInstruction)) = instr_kind; |
| 11196 *(EntryAddr(index, kFromIndex)) = from_index; | 11205 *(EntryAddr(index, kFromIndex)) = from_index; |
| 11197 } | 11206 } |
| 11198 | 11207 |
| 11199 | 11208 |
| 11200 const char* ICData::ToCString() const { | 11209 const char* ICData::ToCString() const { |
| 11201 const char* kFormat = "ICData target:'%s' num-args: %" Pd | 11210 const char* kFormat = "ICData target:'%s' num-args: %" Pd |
| 11202 " num-checks: %" Pd ""; | 11211 " num-checks: %" Pd ""; |
| 11203 const String& name = String::Handle(target_name()); | 11212 const String& name = String::Handle(target_name()); |
| 11204 const intptr_t num_args = NumArgsTested(); | 11213 const intptr_t num_args = NumArgsTested(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11240 } | 11249 } |
| 11241 | 11250 |
| 11242 | 11251 |
| 11243 intptr_t ICData::NumArgsTested() const { | 11252 intptr_t ICData::NumArgsTested() const { |
| 11244 return NumArgsTestedBits::decode(raw_ptr()->state_bits_); | 11253 return NumArgsTestedBits::decode(raw_ptr()->state_bits_); |
| 11245 } | 11254 } |
| 11246 | 11255 |
| 11247 | 11256 |
| 11248 void ICData::SetNumArgsTested(intptr_t value) const { | 11257 void ICData::SetNumArgsTested(intptr_t value) const { |
| 11249 ASSERT(Utils::IsUint(2, value)); | 11258 ASSERT(Utils::IsUint(2, value)); |
| 11250 raw_ptr()->state_bits_ = | 11259 StoreNonPointer(&raw_ptr()->state_bits_, |
| 11251 NumArgsTestedBits::update(value, raw_ptr()->state_bits_); | 11260 NumArgsTestedBits::update(value, raw_ptr()->state_bits_)); |
| 11252 } | 11261 } |
| 11253 | 11262 |
| 11254 | 11263 |
| 11255 uint32_t ICData::DeoptReasons() const { | 11264 uint32_t ICData::DeoptReasons() const { |
| 11256 return DeoptReasonBits::decode(raw_ptr()->state_bits_); | 11265 return DeoptReasonBits::decode(raw_ptr()->state_bits_); |
| 11257 } | 11266 } |
| 11258 | 11267 |
| 11259 | 11268 |
| 11260 void ICData::SetDeoptReasons(uint32_t reasons) const { | 11269 void ICData::SetDeoptReasons(uint32_t reasons) const { |
| 11261 raw_ptr()->state_bits_ = | 11270 StoreNonPointer(&raw_ptr()->state_bits_, |
| 11262 DeoptReasonBits::update(reasons, raw_ptr()->state_bits_); | 11271 DeoptReasonBits::update(reasons, raw_ptr()->state_bits_)); |
| 11263 } | 11272 } |
| 11264 | 11273 |
| 11265 | 11274 |
| 11266 bool ICData::HasDeoptReason(DeoptReasonId reason) const { | 11275 bool ICData::HasDeoptReason(DeoptReasonId reason) const { |
| 11267 return (DeoptReasons() & (1 << reason)) != 0; | 11276 return (DeoptReasons() & (1 << reason)) != 0; |
| 11268 } | 11277 } |
| 11269 | 11278 |
| 11270 | 11279 |
| 11271 void ICData::AddDeoptReason(DeoptReasonId reason) const { | 11280 void ICData::AddDeoptReason(DeoptReasonId reason) const { |
| 11272 SetDeoptReasons(DeoptReasons() | (1 << reason)); | 11281 SetDeoptReasons(DeoptReasons() | (1 << reason)); |
| 11273 } | 11282 } |
| 11274 | 11283 |
| 11275 | 11284 |
| 11276 bool ICData::IssuedJSWarning() const { | 11285 bool ICData::IssuedJSWarning() const { |
| 11277 return IssuedJSWarningBit::decode(raw_ptr()->state_bits_); | 11286 return IssuedJSWarningBit::decode(raw_ptr()->state_bits_); |
| 11278 } | 11287 } |
| 11279 | 11288 |
| 11280 | 11289 |
| 11281 void ICData::SetIssuedJSWarning() const { | 11290 void ICData::SetIssuedJSWarning() const { |
| 11282 raw_ptr()->state_bits_ = | 11291 StoreNonPointer(&raw_ptr()->state_bits_, |
| 11283 IssuedJSWarningBit::update(true, raw_ptr()->state_bits_); | 11292 IssuedJSWarningBit::update(true, raw_ptr()->state_bits_)); |
| 11284 } | 11293 } |
| 11285 | 11294 |
| 11286 | 11295 |
| 11287 bool ICData::MayCheckForJSWarning() const { | 11296 bool ICData::MayCheckForJSWarning() const { |
| 11288 const String& name = String::Handle(target_name()); | 11297 const String& name = String::Handle(target_name()); |
| 11289 // Warning issued from native code. | 11298 // Warning issued from native code. |
| 11290 // Calling sequence is decoded to obtain ic data in order to check if a | 11299 // Calling sequence is decoded to obtain ic data in order to check if a |
| 11291 // warning has already been issued. | 11300 // warning has already been issued. |
| 11292 if (name.Equals(Library::PrivateCoreLibName(Symbols::_instanceOf())) || | 11301 if (name.Equals(Library::PrivateCoreLibName(Symbols::_instanceOf())) || |
| 11293 name.Equals(Library::PrivateCoreLibName(Symbols::_as()))) { | 11302 name.Equals(Library::PrivateCoreLibName(Symbols::_as()))) { |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12097 const GrowableObjectArray& object_pool = assembler->object_pool(); | 12106 const GrowableObjectArray& object_pool = assembler->object_pool(); |
| 12098 if (object_pool.IsNull()) { | 12107 if (object_pool.IsNull()) { |
| 12099 instrs.set_object_pool(Object::empty_array().raw()); | 12108 instrs.set_object_pool(Object::empty_array().raw()); |
| 12100 } else { | 12109 } else { |
| 12101 // TODO(regis): Once MakeArray takes a Heap::Space argument, call it here | 12110 // TODO(regis): Once MakeArray takes a Heap::Space argument, call it here |
| 12102 // with Heap::kOld and change the ARM and MIPS assemblers to work with a | 12111 // with Heap::kOld and change the ARM and MIPS assemblers to work with a |
| 12103 // GrowableObjectArray in new space. | 12112 // GrowableObjectArray in new space. |
| 12104 instrs.set_object_pool(Array::MakeArray(object_pool)); | 12113 instrs.set_object_pool(Array::MakeArray(object_pool)); |
| 12105 } | 12114 } |
| 12106 if (FLAG_write_protect_code) { | 12115 if (FLAG_write_protect_code) { |
| 12116 uword address = RawObject::ToAddr(instrs.raw()); |
| 12107 bool status = VirtualMemory::Protect( | 12117 bool status = VirtualMemory::Protect( |
| 12108 reinterpret_cast<void*>(instrs.raw_ptr()), instrs.raw()->Size(), | 12118 reinterpret_cast<void*>(address), |
| 12119 instrs.raw()->Size(), |
| 12109 VirtualMemory::kReadExecute); | 12120 VirtualMemory::kReadExecute); |
| 12110 ASSERT(status); | 12121 ASSERT(status); |
| 12111 } | 12122 } |
| 12112 } | 12123 } |
| 12113 code.set_comments(assembler->GetCodeComments()); | 12124 code.set_comments(assembler->GetCodeComments()); |
| 12114 return code.raw(); | 12125 return code.raw(); |
| 12115 } | 12126 } |
| 12116 | 12127 |
| 12117 | 12128 |
| 12118 RawCode* Code::FinalizeCode(const Function& function, | 12129 RawCode* Code::FinalizeCode(const Function& function, |
| (...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13377 return Integer::Cast(*this).Equals(other); | 13388 return Integer::Cast(*this).Equals(other); |
| 13378 } | 13389 } |
| 13379 if (IsDouble() && other.IsDouble()) { | 13390 if (IsDouble() && other.IsDouble()) { |
| 13380 return Double::Cast(*this).CanonicalizeEquals(other); | 13391 return Double::Cast(*this).CanonicalizeEquals(other); |
| 13381 } | 13392 } |
| 13382 return false; | 13393 return false; |
| 13383 } | 13394 } |
| 13384 | 13395 |
| 13385 | 13396 |
| 13386 intptr_t* Instance::NativeFieldsDataAddr() const { | 13397 intptr_t* Instance::NativeFieldsDataAddr() const { |
| 13387 NoGCScope no_gc; | 13398 ASSERT(Isolate::Current()->no_gc_scope_depth() > 0); |
| 13388 RawTypedData* native_fields = | 13399 RawTypedData* native_fields = |
| 13389 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr()); | 13400 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr()); |
| 13390 if (native_fields == TypedData::null()) { | 13401 if (native_fields == TypedData::null()) { |
| 13391 return NULL; | 13402 return NULL; |
| 13392 } | 13403 } |
| 13393 return reinterpret_cast<intptr_t*>(native_fields->ptr()->data()); | 13404 return reinterpret_cast<intptr_t*>(native_fields->ptr()->data()); |
| 13394 } | 13405 } |
| 13395 | 13406 |
| 13396 | 13407 |
| 13397 void Instance::SetNativeField(int index, intptr_t value) const { | 13408 void Instance::SetNativeField(int index, intptr_t value) const { |
| (...skipping 2698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16096 jsobj.AddProperty("valueAsString", ToCString()); | 16107 jsobj.AddProperty("valueAsString", ToCString()); |
| 16097 } | 16108 } |
| 16098 | 16109 |
| 16099 | 16110 |
| 16100 void Bigint::set_neg(const Bool& value) const { | 16111 void Bigint::set_neg(const Bool& value) const { |
| 16101 StorePointer(&raw_ptr()->neg_, value.raw()); | 16112 StorePointer(&raw_ptr()->neg_, value.raw()); |
| 16102 } | 16113 } |
| 16103 | 16114 |
| 16104 | 16115 |
| 16105 void Bigint::set_used(const Smi& value) const { | 16116 void Bigint::set_used(const Smi& value) const { |
| 16106 raw_ptr()->used_ = value.raw(); | 16117 StoreSmi(&raw_ptr()->used_, value.raw()); |
| 16107 } | 16118 } |
| 16108 | 16119 |
| 16109 | 16120 |
| 16110 void Bigint::set_digits(const TypedData& value) const { | 16121 void Bigint::set_digits(const TypedData& value) const { |
| 16111 // The VM expects digits_ to be a Uint32List (not null). | 16122 // The VM expects digits_ to be a Uint32List (not null). |
| 16112 ASSERT(!value.IsNull() && (value.GetClassId() == kTypedDataUint32ArrayCid)); | 16123 ASSERT(!value.IsNull() && (value.GetClassId() == kTypedDataUint32ArrayCid)); |
| 16113 StorePointer(&raw_ptr()->digits_, value.raw()); | 16124 StorePointer(&raw_ptr()->digits_, value.raw()); |
| 16114 } | 16125 } |
| 16115 | 16126 |
| 16116 | 16127 |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16900 uint32_t hash_; | 16911 uint32_t hash_; |
| 16901 }; | 16912 }; |
| 16902 | 16913 |
| 16903 | 16914 |
| 16904 void StringHasher::Add(const String& str, intptr_t begin_index, intptr_t len) { | 16915 void StringHasher::Add(const String& str, intptr_t begin_index, intptr_t len) { |
| 16905 ASSERT(begin_index >= 0); | 16916 ASSERT(begin_index >= 0); |
| 16906 ASSERT(len >= 0); | 16917 ASSERT(len >= 0); |
| 16907 ASSERT((begin_index + len) <= str.Length()); | 16918 ASSERT((begin_index + len) <= str.Length()); |
| 16908 if (str.IsOneByteString()) { | 16919 if (str.IsOneByteString()) { |
| 16909 for (intptr_t i = 0; i < len; i++) { | 16920 for (intptr_t i = 0; i < len; i++) { |
| 16921 NoGCScope no_gc; |
| 16910 Add(*OneByteString::CharAddr(str, i + begin_index)); | 16922 Add(*OneByteString::CharAddr(str, i + begin_index)); |
| 16911 } | 16923 } |
| 16912 } else { | 16924 } else { |
| 16913 String::CodePointIterator it(str, begin_index, len); | 16925 String::CodePointIterator it(str, begin_index, len); |
| 16914 while (it.Next()) { | 16926 while (it.Next()) { |
| 16915 Add(it.Current()); | 16927 Add(it.Current()); |
| 16916 } | 16928 } |
| 16917 } | 16929 } |
| 16918 } | 16930 } |
| 16919 | 16931 |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17774 Object::MakeUnusedSpaceTraversable(*this, original_size, used_size); | 17786 Object::MakeUnusedSpaceTraversable(*this, original_size, used_size); |
| 17775 | 17787 |
| 17776 // Update the class information of the object. | 17788 // Update the class information of the object. |
| 17777 const intptr_t class_id = kExternalOneByteStringCid; | 17789 const intptr_t class_id = kExternalOneByteStringCid; |
| 17778 uword tags = raw_ptr()->tags_; | 17790 uword tags = raw_ptr()->tags_; |
| 17779 uword old_tags; | 17791 uword old_tags; |
| 17780 do { | 17792 do { |
| 17781 old_tags = tags; | 17793 old_tags = tags; |
| 17782 uword new_tags = RawObject::SizeTag::update(used_size, old_tags); | 17794 uword new_tags = RawObject::SizeTag::update(used_size, old_tags); |
| 17783 new_tags = RawObject::ClassIdTag::update(class_id, new_tags); | 17795 new_tags = RawObject::ClassIdTag::update(class_id, new_tags); |
| 17784 tags = AtomicOperations::CompareAndSwapWord( | 17796 tags = CompareAndSwapTags(old_tags, new_tags); |
| 17785 &raw_ptr()->tags_, old_tags, new_tags); | |
| 17786 } while (tags != old_tags); | 17797 } while (tags != old_tags); |
| 17787 result = this->raw(); | 17798 result = this->raw(); |
| 17788 const uint8_t* ext_array = reinterpret_cast<const uint8_t*>(array); | 17799 const uint8_t* ext_array = reinterpret_cast<const uint8_t*>(array); |
| 17789 ExternalStringData<uint8_t>* ext_data = new ExternalStringData<uint8_t>( | 17800 ExternalStringData<uint8_t>* ext_data = new ExternalStringData<uint8_t>( |
| 17790 ext_array, peer, cback); | 17801 ext_array, peer, cback); |
| 17791 ASSERT(result.Length() == str_length); | 17802 ASSERT(result.Length() == str_length); |
| 17792 ASSERT(!result.HasHash() || | 17803 ASSERT(!result.HasHash() || |
| 17793 (result.Hash() == String::Hash(ext_array, str_length))); | 17804 (result.Hash() == String::Hash(ext_array, str_length))); |
| 17794 ExternalOneByteString::SetExternalData(result, ext_data); | 17805 ExternalOneByteString::SetExternalData(result, ext_data); |
| 17795 external_data = ext_data; | 17806 external_data = ext_data; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 17813 Object::MakeUnusedSpaceTraversable(*this, original_size, used_size); | 17824 Object::MakeUnusedSpaceTraversable(*this, original_size, used_size); |
| 17814 | 17825 |
| 17815 // Update the class information of the object. | 17826 // Update the class information of the object. |
| 17816 const intptr_t class_id = kExternalTwoByteStringCid; | 17827 const intptr_t class_id = kExternalTwoByteStringCid; |
| 17817 uword tags = raw_ptr()->tags_; | 17828 uword tags = raw_ptr()->tags_; |
| 17818 uword old_tags; | 17829 uword old_tags; |
| 17819 do { | 17830 do { |
| 17820 old_tags = tags; | 17831 old_tags = tags; |
| 17821 uword new_tags = RawObject::SizeTag::update(used_size, old_tags); | 17832 uword new_tags = RawObject::SizeTag::update(used_size, old_tags); |
| 17822 new_tags = RawObject::ClassIdTag::update(class_id, new_tags); | 17833 new_tags = RawObject::ClassIdTag::update(class_id, new_tags); |
| 17823 tags = AtomicOperations::CompareAndSwapWord( | 17834 tags = CompareAndSwapTags(old_tags, new_tags); |
| 17824 &raw_ptr()->tags_, old_tags, new_tags); | |
| 17825 } while (tags != old_tags); | 17835 } while (tags != old_tags); |
| 17826 result = this->raw(); | 17836 result = this->raw(); |
| 17827 const uint16_t* ext_array = reinterpret_cast<const uint16_t*>(array); | 17837 const uint16_t* ext_array = reinterpret_cast<const uint16_t*>(array); |
| 17828 ExternalStringData<uint16_t>* ext_data = new ExternalStringData<uint16_t>( | 17838 ExternalStringData<uint16_t>* ext_data = new ExternalStringData<uint16_t>( |
| 17829 ext_array, peer, cback); | 17839 ext_array, peer, cback); |
| 17830 ASSERT(result.Length() == str_length); | 17840 ASSERT(result.Length() == str_length); |
| 17831 ASSERT(!result.HasHash() || | 17841 ASSERT(!result.HasHash() || |
| 17832 (result.Hash() == String::Hash(ext_array, str_length))); | 17842 (result.Hash() == String::Hash(ext_array, str_length))); |
| 17833 ExternalTwoByteString::SetExternalData(result, ext_data); | 17843 ExternalTwoByteString::SetExternalData(result, ext_data); |
| 17834 external_data = ext_data; | 17844 external_data = ext_data; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18023 index_ = end_; | 18033 index_ = end_; |
| 18024 return false; | 18034 return false; |
| 18025 } | 18035 } |
| 18026 | 18036 |
| 18027 | 18037 |
| 18028 RawOneByteString* OneByteString::EscapeSpecialCharacters(const String& str) { | 18038 RawOneByteString* OneByteString::EscapeSpecialCharacters(const String& str) { |
| 18029 intptr_t len = str.Length(); | 18039 intptr_t len = str.Length(); |
| 18030 if (len > 0) { | 18040 if (len > 0) { |
| 18031 intptr_t num_escapes = 0; | 18041 intptr_t num_escapes = 0; |
| 18032 for (intptr_t i = 0; i < len; i++) { | 18042 for (intptr_t i = 0; i < len; i++) { |
| 18033 num_escapes += EscapeOverhead(*CharAddr(str, i)); | 18043 num_escapes += EscapeOverhead(CharAt(str, i)); |
| 18034 } | 18044 } |
| 18035 const String& dststr = String::Handle( | 18045 const String& dststr = String::Handle( |
| 18036 OneByteString::New(len + num_escapes, Heap::kNew)); | 18046 OneByteString::New(len + num_escapes, Heap::kNew)); |
| 18037 intptr_t index = 0; | 18047 intptr_t index = 0; |
| 18038 for (intptr_t i = 0; i < len; i++) { | 18048 for (intptr_t i = 0; i < len; i++) { |
| 18039 uint8_t ch = CharAt(str, i); | 18049 uint8_t ch = CharAt(str, i); |
| 18040 if (IsSpecialCharacter(ch)) { | 18050 if (IsSpecialCharacter(ch)) { |
| 18041 SetCharAt(dststr, index, '\\'); | 18051 SetCharAt(dststr, index, '\\'); |
| 18042 SetCharAt(dststr, index + 1, SpecialCharacter(ch)); | 18052 SetCharAt(dststr, index + 1, SpecialCharacter(ch)); |
| 18043 index += 2; | 18053 index += 2; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 18057 return OneByteString::raw(Symbols::Empty()); | 18067 return OneByteString::raw(Symbols::Empty()); |
| 18058 } | 18068 } |
| 18059 | 18069 |
| 18060 | 18070 |
| 18061 RawOneByteString* ExternalOneByteString::EscapeSpecialCharacters( | 18071 RawOneByteString* ExternalOneByteString::EscapeSpecialCharacters( |
| 18062 const String& str) { | 18072 const String& str) { |
| 18063 intptr_t len = str.Length(); | 18073 intptr_t len = str.Length(); |
| 18064 if (len > 0) { | 18074 if (len > 0) { |
| 18065 intptr_t num_escapes = 0; | 18075 intptr_t num_escapes = 0; |
| 18066 for (intptr_t i = 0; i < len; i++) { | 18076 for (intptr_t i = 0; i < len; i++) { |
| 18067 num_escapes += EscapeOverhead(*CharAddr(str, i)); | 18077 num_escapes += EscapeOverhead(CharAt(str, i)); |
| 18068 } | 18078 } |
| 18069 const String& dststr = String::Handle( | 18079 const String& dststr = String::Handle( |
| 18070 OneByteString::New(len + num_escapes, Heap::kNew)); | 18080 OneByteString::New(len + num_escapes, Heap::kNew)); |
| 18071 intptr_t index = 0; | 18081 intptr_t index = 0; |
| 18072 for (intptr_t i = 0; i < len; i++) { | 18082 for (intptr_t i = 0; i < len; i++) { |
| 18073 uint8_t ch = CharAt(str, i); | 18083 uint8_t ch = CharAt(str, i); |
| 18074 if (IsSpecialCharacter(ch)) { | 18084 if (IsSpecialCharacter(ch)) { |
| 18075 OneByteString::SetCharAt(dststr, index, '\\'); | 18085 OneByteString::SetCharAt(dststr, index, '\\'); |
| 18076 OneByteString::SetCharAt(dststr, index + 1, SpecialCharacter(ch)); | 18086 OneByteString::SetCharAt(dststr, index + 1, SpecialCharacter(ch)); |
| 18077 index += 2; | 18087 index += 2; |
| 18078 } else if (IsAsciiNonprintable(ch)) { | 18088 } else if (IsAsciiNonprintable(ch)) { |
| 18079 OneByteString::SetCharAt(dststr, index, '\\'); | 18089 OneByteString::SetCharAt(dststr, index, '\\'); |
| 18080 OneByteString::SetCharAt(dststr, index + 1, 'x'); | 18090 OneByteString::SetCharAt(dststr, index + 1, 'x'); |
| 18081 OneByteString::SetCharAt(dststr, index + 2, GetHexCharacter(ch >> 4)); | 18091 OneByteString::SetCharAt(dststr, index + 2, GetHexCharacter(ch >> 4)); |
| 18082 OneByteString::SetCharAt(dststr, index + 3, GetHexCharacter(ch & 0xF)); | 18092 OneByteString::SetCharAt(dststr, index + 3, GetHexCharacter(ch & 0xF)); |
| 18083 index += 4; | 18093 index += 4; |
| 18084 } else { | 18094 } else { |
| 18085 *(OneByteString::CharAddr(dststr, index)) = ch; | 18095 OneByteString::SetCharAt(dststr, index, ch); |
| 18086 index += 1; | 18096 index += 1; |
| 18087 } | 18097 } |
| 18088 } | 18098 } |
| 18089 return OneByteString::raw(dststr); | 18099 return OneByteString::raw(dststr); |
| 18090 } | 18100 } |
| 18091 return OneByteString::raw(Symbols::Empty()); | 18101 return OneByteString::raw(Symbols::Empty()); |
| 18092 } | 18102 } |
| 18093 | 18103 |
| 18094 | 18104 |
| 18095 RawOneByteString* OneByteString::New(intptr_t len, | 18105 RawOneByteString* OneByteString::New(intptr_t len, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 18123 memmove(CharAddr(result, 0), characters, len); | 18133 memmove(CharAddr(result, 0), characters, len); |
| 18124 } | 18134 } |
| 18125 return OneByteString::raw(result); | 18135 return OneByteString::raw(result); |
| 18126 } | 18136 } |
| 18127 | 18137 |
| 18128 | 18138 |
| 18129 RawOneByteString* OneByteString::New(const uint16_t* characters, | 18139 RawOneByteString* OneByteString::New(const uint16_t* characters, |
| 18130 intptr_t len, | 18140 intptr_t len, |
| 18131 Heap::Space space) { | 18141 Heap::Space space) { |
| 18132 const String& result =String::Handle(OneByteString::New(len, space)); | 18142 const String& result =String::Handle(OneByteString::New(len, space)); |
| 18143 NoGCScope no_gc; |
| 18133 for (intptr_t i = 0; i < len; ++i) { | 18144 for (intptr_t i = 0; i < len; ++i) { |
| 18134 ASSERT(Utf::IsLatin1(characters[i])); | 18145 ASSERT(Utf::IsLatin1(characters[i])); |
| 18135 *CharAddr(result, i) = characters[i]; | 18146 *CharAddr(result, i) = characters[i]; |
| 18136 } | 18147 } |
| 18137 return OneByteString::raw(result); | 18148 return OneByteString::raw(result); |
| 18138 } | 18149 } |
| 18139 | 18150 |
| 18140 | 18151 |
| 18141 RawOneByteString* OneByteString::New(const int32_t* characters, | 18152 RawOneByteString* OneByteString::New(const int32_t* characters, |
| 18142 intptr_t len, | 18153 intptr_t len, |
| 18143 Heap::Space space) { | 18154 Heap::Space space) { |
| 18144 const String& result = String::Handle(OneByteString::New(len, space)); | 18155 const String& result = String::Handle(OneByteString::New(len, space)); |
| 18156 NoGCScope no_gc; |
| 18145 for (intptr_t i = 0; i < len; ++i) { | 18157 for (intptr_t i = 0; i < len; ++i) { |
| 18146 ASSERT(Utf::IsLatin1(characters[i])); | 18158 ASSERT(Utf::IsLatin1(characters[i])); |
| 18147 *CharAddr(result, i) = characters[i]; | 18159 *CharAddr(result, i) = characters[i]; |
| 18148 } | 18160 } |
| 18149 return OneByteString::raw(result); | 18161 return OneByteString::raw(result); |
| 18150 } | 18162 } |
| 18151 | 18163 |
| 18152 | 18164 |
| 18153 RawOneByteString* OneByteString::New(const String& str, | 18165 RawOneByteString* OneByteString::New(const String& str, |
| 18154 Heap::Space space) { | 18166 Heap::Space space) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18241 return OneByteString::raw(result); | 18253 return OneByteString::raw(result); |
| 18242 } | 18254 } |
| 18243 | 18255 |
| 18244 | 18256 |
| 18245 RawOneByteString* OneByteString::Transform(int32_t (*mapping)(int32_t ch), | 18257 RawOneByteString* OneByteString::Transform(int32_t (*mapping)(int32_t ch), |
| 18246 const String& str, | 18258 const String& str, |
| 18247 Heap::Space space) { | 18259 Heap::Space space) { |
| 18248 ASSERT(!str.IsNull()); | 18260 ASSERT(!str.IsNull()); |
| 18249 intptr_t len = str.Length(); | 18261 intptr_t len = str.Length(); |
| 18250 const String& result = String::Handle(OneByteString::New(len, space)); | 18262 const String& result = String::Handle(OneByteString::New(len, space)); |
| 18263 NoGCScope no_gc; |
| 18251 for (intptr_t i = 0; i < len; ++i) { | 18264 for (intptr_t i = 0; i < len; ++i) { |
| 18252 int32_t ch = mapping(str.CharAt(i)); | 18265 int32_t ch = mapping(str.CharAt(i)); |
| 18253 ASSERT(Utf::IsLatin1(ch)); | 18266 ASSERT(Utf::IsLatin1(ch)); |
| 18254 *CharAddr(result, i) = ch; | 18267 *CharAddr(result, i) = ch; |
| 18255 } | 18268 } |
| 18256 return OneByteString::raw(result); | 18269 return OneByteString::raw(result); |
| 18257 } | 18270 } |
| 18258 | 18271 |
| 18259 | 18272 |
| 18260 RawOneByteString* OneByteString::SubStringUnchecked(const String& str, | 18273 RawOneByteString* OneByteString::SubStringUnchecked(const String& str, |
| 18261 intptr_t begin_index, | 18274 intptr_t begin_index, |
| 18262 intptr_t length, | 18275 intptr_t length, |
| 18263 Heap::Space space) { | 18276 Heap::Space space) { |
| 18264 ASSERT(!str.IsNull() && str.IsOneByteString()); | 18277 ASSERT(!str.IsNull() && str.IsOneByteString()); |
| 18265 ASSERT(begin_index >= 0); | 18278 ASSERT(begin_index >= 0); |
| 18266 ASSERT(length >= 0); | 18279 ASSERT(length >= 0); |
| 18267 if (begin_index <= str.Length() && length == 0) { | 18280 if (begin_index <= str.Length() && length == 0) { |
| 18268 return OneByteString::raw(Symbols::Empty()); | 18281 return OneByteString::raw(Symbols::Empty()); |
| 18269 } | 18282 } |
| 18270 ASSERT(begin_index < str.Length()); | 18283 ASSERT(begin_index < str.Length()); |
| 18271 RawOneByteString* result = OneByteString::New(length, space); | 18284 RawOneByteString* result = OneByteString::New(length, space); |
| 18272 NoGCScope no_gc; | 18285 NoGCScope no_gc; |
| 18273 if (length > 0) { | 18286 if (length > 0) { |
| 18274 uint8_t* dest = &result->ptr()->data()[0]; | 18287 uint8_t* dest = &result->ptr()->data()[0]; |
| 18275 uint8_t* src = &raw_ptr(str)->data()[begin_index]; | 18288 const uint8_t* src = &raw_ptr(str)->data()[begin_index]; |
| 18276 memmove(dest, src, length); | 18289 memmove(dest, src, length); |
| 18277 } | 18290 } |
| 18278 return result; | 18291 return result; |
| 18279 } | 18292 } |
| 18280 | 18293 |
| 18281 | 18294 |
| 18282 void OneByteString::SetPeer(const String& str, | 18295 void OneByteString::SetPeer(const String& str, |
| 18283 void* peer, | 18296 void* peer, |
| 18284 Dart_PeerFinalizer cback) { | 18297 Dart_PeerFinalizer cback) { |
| 18285 ASSERT(!str.IsNull() && str.IsOneByteString()); | 18298 ASSERT(!str.IsNull() && str.IsOneByteString()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 18296 void* peer) { | 18309 void* peer) { |
| 18297 delete reinterpret_cast<ExternalStringData<uint8_t>*>(peer); | 18310 delete reinterpret_cast<ExternalStringData<uint8_t>*>(peer); |
| 18298 } | 18311 } |
| 18299 | 18312 |
| 18300 | 18313 |
| 18301 RawTwoByteString* TwoByteString::EscapeSpecialCharacters(const String& str) { | 18314 RawTwoByteString* TwoByteString::EscapeSpecialCharacters(const String& str) { |
| 18302 intptr_t len = str.Length(); | 18315 intptr_t len = str.Length(); |
| 18303 if (len > 0) { | 18316 if (len > 0) { |
| 18304 intptr_t num_escapes = 0; | 18317 intptr_t num_escapes = 0; |
| 18305 for (intptr_t i = 0; i < len; i++) { | 18318 for (intptr_t i = 0; i < len; i++) { |
| 18306 num_escapes += EscapeOverhead(*CharAddr(str, i)); | 18319 num_escapes += EscapeOverhead(CharAt(str, i)); |
| 18307 } | 18320 } |
| 18308 const String& dststr = String::Handle( | 18321 const String& dststr = String::Handle( |
| 18309 TwoByteString::New(len + num_escapes, Heap::kNew)); | 18322 TwoByteString::New(len + num_escapes, Heap::kNew)); |
| 18310 intptr_t index = 0; | 18323 intptr_t index = 0; |
| 18311 for (intptr_t i = 0; i < len; i++) { | 18324 for (intptr_t i = 0; i < len; i++) { |
| 18312 uint16_t ch = CharAt(str, i); | 18325 uint16_t ch = CharAt(str, i); |
| 18313 if (IsSpecialCharacter(ch)) { | 18326 if (IsSpecialCharacter(ch)) { |
| 18314 SetCharAt(dststr, index, '\\'); | 18327 SetCharAt(dststr, index, '\\'); |
| 18315 SetCharAt(dststr, index + 1, SpecialCharacter(ch)); | 18328 SetCharAt(dststr, index + 1, SpecialCharacter(ch)); |
| 18316 index += 2; | 18329 index += 2; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18435 | 18448 |
| 18436 | 18449 |
| 18437 RawTwoByteString* TwoByteString::Transform(int32_t (*mapping)(int32_t ch), | 18450 RawTwoByteString* TwoByteString::Transform(int32_t (*mapping)(int32_t ch), |
| 18438 const String& str, | 18451 const String& str, |
| 18439 Heap::Space space) { | 18452 Heap::Space space) { |
| 18440 ASSERT(!str.IsNull()); | 18453 ASSERT(!str.IsNull()); |
| 18441 intptr_t len = str.Length(); | 18454 intptr_t len = str.Length(); |
| 18442 const String& result = String::Handle(TwoByteString::New(len, space)); | 18455 const String& result = String::Handle(TwoByteString::New(len, space)); |
| 18443 String::CodePointIterator it(str); | 18456 String::CodePointIterator it(str); |
| 18444 intptr_t i = 0; | 18457 intptr_t i = 0; |
| 18458 NoGCScope no_gc; |
| 18445 while (it.Next()) { | 18459 while (it.Next()) { |
| 18446 int32_t src = it.Current(); | 18460 int32_t src = it.Current(); |
| 18447 int32_t dst = mapping(src); | 18461 int32_t dst = mapping(src); |
| 18448 ASSERT(dst >= 0 && dst <= 0x10FFFF); | 18462 ASSERT(dst >= 0 && dst <= 0x10FFFF); |
| 18449 intptr_t len = Utf16::Length(dst); | 18463 intptr_t len = Utf16::Length(dst); |
| 18450 if (len == 1) { | 18464 if (len == 1) { |
| 18451 *CharAddr(result, i) = dst; | 18465 *CharAddr(result, i) = dst; |
| 18452 } else { | 18466 } else { |
| 18453 ASSERT(len == 2); | 18467 ASSERT(len == 2); |
| 18454 Utf16::Encode(dst, CharAddr(result, i)); | 18468 Utf16::Encode(dst, CharAddr(result, i)); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18647 } | 18661 } |
| 18648 | 18662 |
| 18649 | 18663 |
| 18650 RawArray* Array::Slice(intptr_t start, | 18664 RawArray* Array::Slice(intptr_t start, |
| 18651 intptr_t count, | 18665 intptr_t count, |
| 18652 bool with_type_argument) const { | 18666 bool with_type_argument) const { |
| 18653 // TODO(vegorov) introduce an array allocation method that fills newly | 18667 // TODO(vegorov) introduce an array allocation method that fills newly |
| 18654 // allocated array with values from the given source array instead of | 18668 // allocated array with values from the given source array instead of |
| 18655 // null-initializing all elements. | 18669 // null-initializing all elements. |
| 18656 Array& dest = Array::Handle(Array::New(count)); | 18670 Array& dest = Array::Handle(Array::New(count)); |
| 18657 if (dest.raw()->IsNewObject()) { | 18671 dest.StorePointers(dest.ObjectAddr(0), ObjectAddr(start), count); |
| 18658 NoGCScope no_gc_scope; | |
| 18659 memmove(dest.ObjectAddr(0), ObjectAddr(start), count * kWordSize); | |
| 18660 } else { | |
| 18661 PassiveObject& obj = PassiveObject::Handle(); | |
| 18662 for (intptr_t i = 0; i < count; i++) { | |
| 18663 obj = At(start + i); | |
| 18664 dest.SetAt(i, obj); | |
| 18665 } | |
| 18666 } | |
| 18667 | 18672 |
| 18668 if (with_type_argument) { | 18673 if (with_type_argument) { |
| 18669 dest.SetTypeArguments(TypeArguments::Handle(GetTypeArguments())); | 18674 dest.SetTypeArguments(TypeArguments::Handle(GetTypeArguments())); |
| 18670 } | 18675 } |
| 18671 | 18676 |
| 18672 return dest.raw(); | 18677 return dest.raw(); |
| 18673 } | 18678 } |
| 18674 | 18679 |
| 18675 | 18680 |
| 18676 void Array::MakeImmutable() const { | 18681 void Array::MakeImmutable() const { |
| 18677 NoGCScope no_gc; | 18682 NoGCScope no_gc; |
| 18678 uword tags = raw_ptr()->tags_; | 18683 uword tags = raw_ptr()->tags_; |
| 18679 uword old_tags; | 18684 uword old_tags; |
| 18680 do { | 18685 do { |
| 18681 old_tags = tags; | 18686 old_tags = tags; |
| 18682 uword new_tags = RawObject::ClassIdTag::update(kImmutableArrayCid, | 18687 uword new_tags = RawObject::ClassIdTag::update(kImmutableArrayCid, |
| 18683 old_tags); | 18688 old_tags); |
| 18684 tags = AtomicOperations::CompareAndSwapWord( | 18689 tags = CompareAndSwapTags(old_tags, new_tags); |
| 18685 &raw_ptr()->tags_, old_tags, new_tags); | |
| 18686 } while (tags != old_tags); | 18690 } while (tags != old_tags); |
| 18687 } | 18691 } |
| 18688 | 18692 |
| 18689 | 18693 |
| 18690 const char* Array::ToCString() const { | 18694 const char* Array::ToCString() const { |
| 18691 if (IsNull()) { | 18695 if (IsNull()) { |
| 18692 return IsImmutable() ? "_ImmutableList NULL" : "_List NULL"; | 18696 return IsImmutable() ? "_ImmutableList NULL" : "_List NULL"; |
| 18693 } | 18697 } |
| 18694 const char* format = IsImmutable() ? | 18698 const char* format = IsImmutable() ? |
| 18695 "_ImmutableList len:%" Pd : "_List len:%" Pd; | 18699 "_ImmutableList len:%" Pd : "_List len:%" Pd; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18770 // that it can be traversed over successfully during garbage collection. | 18774 // that it can be traversed over successfully during garbage collection. |
| 18771 Object::MakeUnusedSpaceTraversable(array, capacity_size, used_size); | 18775 Object::MakeUnusedSpaceTraversable(array, capacity_size, used_size); |
| 18772 | 18776 |
| 18773 // Update the size in the header field and length of the array object. | 18777 // Update the size in the header field and length of the array object. |
| 18774 uword tags = array.raw_ptr()->tags_; | 18778 uword tags = array.raw_ptr()->tags_; |
| 18775 ASSERT(kArrayCid == RawObject::ClassIdTag::decode(tags)); | 18779 ASSERT(kArrayCid == RawObject::ClassIdTag::decode(tags)); |
| 18776 uword old_tags; | 18780 uword old_tags; |
| 18777 do { | 18781 do { |
| 18778 old_tags = tags; | 18782 old_tags = tags; |
| 18779 uword new_tags = RawObject::SizeTag::update(used_size, old_tags); | 18783 uword new_tags = RawObject::SizeTag::update(used_size, old_tags); |
| 18780 tags = AtomicOperations::CompareAndSwapWord( | 18784 tags = array.CompareAndSwapTags(old_tags, new_tags); |
| 18781 &array.raw_ptr()->tags_, old_tags, new_tags); | |
| 18782 } while (tags != old_tags); | 18785 } while (tags != old_tags); |
| 18783 array.SetLength(used_len); | 18786 array.SetLength(used_len); |
| 18784 | 18787 |
| 18785 // Null the GrowableObjectArray, we are removing it's backing array. | 18788 // Null the GrowableObjectArray, we are removing it's backing array. |
| 18786 growable_array.SetLength(0); | 18789 growable_array.SetLength(0); |
| 18787 growable_array.SetData(Object::empty_array()); | 18790 growable_array.SetData(Object::empty_array()); |
| 18788 | 18791 |
| 18789 return array.raw(); | 18792 return array.raw(); |
| 18790 } | 18793 } |
| 18791 | 18794 |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19162 return result.raw(); | 19165 return result.raw(); |
| 19163 } | 19166 } |
| 19164 | 19167 |
| 19165 | 19168 |
| 19166 simd128_value_t Float32x4::value() const { | 19169 simd128_value_t Float32x4::value() const { |
| 19167 return simd128_value_t().readFrom(&raw_ptr()->value_[0]); | 19170 return simd128_value_t().readFrom(&raw_ptr()->value_[0]); |
| 19168 } | 19171 } |
| 19169 | 19172 |
| 19170 | 19173 |
| 19171 void Float32x4::set_value(simd128_value_t value) const { | 19174 void Float32x4::set_value(simd128_value_t value) const { |
| 19172 value.writeTo(&raw_ptr()->value_[0]); | 19175 StoreSimd128(&raw_ptr()->value_[0], value); |
| 19173 } | 19176 } |
| 19174 | 19177 |
| 19175 | 19178 |
| 19176 void Float32x4::set_x(float value) const { | 19179 void Float32x4::set_x(float value) const { |
| 19177 StoreNonPointer(&raw_ptr()->value_[0], value); | 19180 StoreNonPointer(&raw_ptr()->value_[0], value); |
| 19178 } | 19181 } |
| 19179 | 19182 |
| 19180 | 19183 |
| 19181 void Float32x4::set_y(float value) const { | 19184 void Float32x4::set_y(float value) const { |
| 19182 StoreNonPointer(&raw_ptr()->value_[1], value); | 19185 StoreNonPointer(&raw_ptr()->value_[1], value); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19307 return raw_ptr()->value_[3]; | 19310 return raw_ptr()->value_[3]; |
| 19308 } | 19311 } |
| 19309 | 19312 |
| 19310 | 19313 |
| 19311 simd128_value_t Int32x4::value() const { | 19314 simd128_value_t Int32x4::value() const { |
| 19312 return simd128_value_t().readFrom(&raw_ptr()->value_[0]); | 19315 return simd128_value_t().readFrom(&raw_ptr()->value_[0]); |
| 19313 } | 19316 } |
| 19314 | 19317 |
| 19315 | 19318 |
| 19316 void Int32x4::set_value(simd128_value_t value) const { | 19319 void Int32x4::set_value(simd128_value_t value) const { |
| 19317 value.writeTo(&raw_ptr()->value_[0]); | 19320 StoreSimd128(&raw_ptr()->value_[0], value); |
| 19318 } | 19321 } |
| 19319 | 19322 |
| 19320 | 19323 |
| 19321 const char* Int32x4::ToCString() const { | 19324 const char* Int32x4::ToCString() const { |
| 19322 const char* kFormat = "[%08x, %08x, %08x, %08x]"; | 19325 const char* kFormat = "[%08x, %08x, %08x, %08x]"; |
| 19323 int32_t _x = x(); | 19326 int32_t _x = x(); |
| 19324 int32_t _y = y(); | 19327 int32_t _y = y(); |
| 19325 int32_t _z = z(); | 19328 int32_t _z = z(); |
| 19326 int32_t _w = w(); | 19329 int32_t _w = w(); |
| 19327 // Calculate the size of the string. | 19330 // Calculate the size of the string. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19389 StoreNonPointer(&raw_ptr()->value_[1], y); | 19392 StoreNonPointer(&raw_ptr()->value_[1], y); |
| 19390 } | 19393 } |
| 19391 | 19394 |
| 19392 | 19395 |
| 19393 simd128_value_t Float64x2::value() const { | 19396 simd128_value_t Float64x2::value() const { |
| 19394 return simd128_value_t().readFrom(&raw_ptr()->value_[0]); | 19397 return simd128_value_t().readFrom(&raw_ptr()->value_[0]); |
| 19395 } | 19398 } |
| 19396 | 19399 |
| 19397 | 19400 |
| 19398 void Float64x2::set_value(simd128_value_t value) const { | 19401 void Float64x2::set_value(simd128_value_t value) const { |
| 19399 value.writeTo(&raw_ptr()->value_[0]); | 19402 StoreSimd128(&raw_ptr()->value_[0], value); |
| 19400 } | 19403 } |
| 19401 | 19404 |
| 19402 | 19405 |
| 19403 const char* Float64x2::ToCString() const { | 19406 const char* Float64x2::ToCString() const { |
| 19404 const char* kFormat = "[%f, %f]"; | 19407 const char* kFormat = "[%f, %f]"; |
| 19405 double _x = x(); | 19408 double _x = x(); |
| 19406 double _y = y(); | 19409 double _y = y(); |
| 19407 // Calculate the size of the string. | 19410 // Calculate the size of the string. |
| 19408 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y) + 1; | 19411 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y) + 1; |
| 19409 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 19412 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19448 const TypedData& other_typed_data = TypedData::Cast(other); | 19451 const TypedData& other_typed_data = TypedData::Cast(other); |
| 19449 | 19452 |
| 19450 if (this->ElementType() != other_typed_data.ElementType()) { | 19453 if (this->ElementType() != other_typed_data.ElementType()) { |
| 19451 return false; | 19454 return false; |
| 19452 } | 19455 } |
| 19453 | 19456 |
| 19454 const intptr_t len = this->LengthInBytes(); | 19457 const intptr_t len = this->LengthInBytes(); |
| 19455 if (len != other_typed_data.LengthInBytes()) { | 19458 if (len != other_typed_data.LengthInBytes()) { |
| 19456 return false; | 19459 return false; |
| 19457 } | 19460 } |
| 19458 | 19461 NoGCScope no_gc; |
| 19459 return (len == 0) || | 19462 return (len == 0) || |
| 19460 (memcmp(DataAddr(0), other_typed_data.DataAddr(0), len) == 0); | 19463 (memcmp(DataAddr(0), other_typed_data.DataAddr(0), len) == 0); |
| 19461 } | 19464 } |
| 19462 | 19465 |
| 19463 | 19466 |
| 19464 RawTypedData* TypedData::New(intptr_t class_id, | 19467 RawTypedData* TypedData::New(intptr_t class_id, |
| 19465 intptr_t len, | 19468 intptr_t len, |
| 19466 Heap::Space space) { | 19469 Heap::Space space) { |
| 19467 if (len < 0 || len > TypedData::MaxElements(class_id)) { | 19470 if (len < 0 || len > TypedData::MaxElements(class_id)) { |
| 19468 FATAL1("Fatal error in TypedData::New: invalid len %" Pd "\n", len); | 19471 FATAL1("Fatal error in TypedData::New: invalid len %" Pd "\n", len); |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20262 return tag_label.ToCString(); | 20265 return tag_label.ToCString(); |
| 20263 } | 20266 } |
| 20264 | 20267 |
| 20265 | 20268 |
| 20266 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20269 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20267 Instance::PrintJSONImpl(stream, ref); | 20270 Instance::PrintJSONImpl(stream, ref); |
| 20268 } | 20271 } |
| 20269 | 20272 |
| 20270 | 20273 |
| 20271 } // namespace dart | 20274 } // namespace dart |
| OLD | NEW |