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/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 12592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12603 8, // kTypedDataFloat64ArrayCid. | 12603 8, // kTypedDataFloat64ArrayCid. |
| 12604 16, // kTypedDataFloat32x4ArrayCid. | 12604 16, // kTypedDataFloat32x4ArrayCid. |
| 12605 }; | 12605 }; |
| 12606 | 12606 |
| 12607 | 12607 |
| 12608 void TypedData::Copy(const TypedData& dst, | 12608 void TypedData::Copy(const TypedData& dst, |
| 12609 intptr_t dst_offset_in_bytes, | 12609 intptr_t dst_offset_in_bytes, |
| 12610 const TypedData& src, | 12610 const TypedData& src, |
| 12611 intptr_t src_offset_in_bytes, | 12611 intptr_t src_offset_in_bytes, |
| 12612 intptr_t length_in_bytes) { | 12612 intptr_t length_in_bytes) { |
| 12613 ASSERT(Utils::RangeCheck(src_offset_in_bytes, | 12613 TypedArrayCopyData<TypedData, TypedData>( |
| 12614 length_in_bytes, | 12614 dst, dst_offset_in_bytes, src, src_offset_in_bytes, length_in_bytes); |
|
siva
2013/04/19 17:38:40
This code can be removed as it is already set up i
kustermann
2013/04/19 19:21:54
Done.
| |
| 12615 src.LengthInBytes())); | |
| 12616 ASSERT(Utils::RangeCheck(dst_offset_in_bytes, | |
| 12617 length_in_bytes, | |
| 12618 dst.LengthInBytes())); | |
| 12619 { | |
| 12620 NoGCScope no_gc; | |
| 12621 if (length_in_bytes > 0) { | |
| 12622 memmove(dst.DataAddr(dst_offset_in_bytes), | |
| 12623 src.DataAddr(src_offset_in_bytes), | |
| 12624 length_in_bytes); | |
| 12625 } | |
| 12626 } | |
| 12627 } | 12615 } |
| 12628 | 12616 |
| 12629 | 12617 |
| 12630 RawTypedData* TypedData::New(intptr_t class_id, | 12618 RawTypedData* TypedData::New(intptr_t class_id, |
| 12631 intptr_t len, | 12619 intptr_t len, |
| 12632 Heap::Space space) { | 12620 Heap::Space space) { |
| 12633 // TODO(asiva): Add a check for maximum elements. | 12621 // TODO(asiva): Add a check for maximum elements. |
| 12634 TypedData& result = TypedData::Handle(); | 12622 TypedData& result = TypedData::Handle(); |
| 12635 { | 12623 { |
| 12636 // The len field has already been checked by the caller, we only assert | 12624 // The len field has already been checked by the caller, we only assert |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 12662 SetPeer(peer); | 12650 SetPeer(peer); |
| 12663 return dart::AddFinalizer(*this, peer, callback); | 12651 return dart::AddFinalizer(*this, peer, callback); |
| 12664 } | 12652 } |
| 12665 | 12653 |
| 12666 | 12654 |
| 12667 void ExternalTypedData::Copy(const ExternalTypedData& dst, | 12655 void ExternalTypedData::Copy(const ExternalTypedData& dst, |
| 12668 intptr_t dst_offset_in_bytes, | 12656 intptr_t dst_offset_in_bytes, |
| 12669 const ExternalTypedData& src, | 12657 const ExternalTypedData& src, |
| 12670 intptr_t src_offset_in_bytes, | 12658 intptr_t src_offset_in_bytes, |
| 12671 intptr_t length_in_bytes) { | 12659 intptr_t length_in_bytes) { |
| 12672 ASSERT(Utils::RangeCheck(src_offset_in_bytes, | 12660 TypedArrayCopyData<ExternalTypedData, ExternalTypedData>( |
| 12673 length_in_bytes, | 12661 dst, dst_offset_in_bytes, src, src_offset_in_bytes, length_in_bytes); |
| 12674 src.LengthInBytes())); | |
| 12675 ASSERT(Utils::RangeCheck(dst_offset_in_bytes, | |
| 12676 length_in_bytes, | |
| 12677 dst.LengthInBytes())); | |
| 12678 { | |
| 12679 NoGCScope no_gc; | |
| 12680 if (length_in_bytes > 0) { | |
| 12681 memmove(dst.DataAddr(dst_offset_in_bytes), | |
| 12682 src.DataAddr(src_offset_in_bytes), | |
| 12683 length_in_bytes); | |
| 12684 } | |
| 12685 } | |
| 12686 } | 12662 } |
|
siva
2013/04/19 17:38:40
Get rid of this Copy function.
kustermann
2013/04/19 19:21:54
Done.
| |
| 12687 | 12663 |
| 12688 | 12664 |
| 12689 RawExternalTypedData* ExternalTypedData::New(intptr_t class_id, | 12665 RawExternalTypedData* ExternalTypedData::New(intptr_t class_id, |
| 12690 uint8_t* data, | 12666 uint8_t* data, |
| 12691 intptr_t len, | 12667 intptr_t len, |
| 12692 Heap::Space space) { | 12668 Heap::Space space) { |
| 12693 ExternalTypedData& result = ExternalTypedData::Handle(); | 12669 ExternalTypedData& result = ExternalTypedData::Handle(); |
| 12694 { | 12670 { |
| 12695 RawObject* raw = Object::Allocate(class_id, | 12671 RawObject* raw = Object::Allocate(class_id, |
| 12696 ExternalTypedData::InstanceSize(), | 12672 ExternalTypedData::InstanceSize(), |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13093 } | 13069 } |
| 13094 return result.raw(); | 13070 return result.raw(); |
| 13095 } | 13071 } |
| 13096 | 13072 |
| 13097 | 13073 |
| 13098 const char* WeakProperty::ToCString() const { | 13074 const char* WeakProperty::ToCString() const { |
| 13099 return "_WeakProperty"; | 13075 return "_WeakProperty"; |
| 13100 } | 13076 } |
| 13101 | 13077 |
| 13102 } // namespace dart | 13078 } // namespace dart |
| OLD | NEW |