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 18761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18772 | 18772 |
18773 RawTwoByteString* TwoByteString::New(const String& str, | 18773 RawTwoByteString* TwoByteString::New(const String& str, |
18774 Heap::Space space) { | 18774 Heap::Space space) { |
18775 intptr_t len = str.Length(); | 18775 intptr_t len = str.Length(); |
18776 const String& result = String::Handle(TwoByteString::New(len, space)); | 18776 const String& result = String::Handle(TwoByteString::New(len, space)); |
18777 String::Copy(result, 0, str, 0, len); | 18777 String::Copy(result, 0, str, 0, len); |
18778 return TwoByteString::raw(result); | 18778 return TwoByteString::raw(result); |
18779 } | 18779 } |
18780 | 18780 |
18781 | 18781 |
| 18782 RawTwoByteString* TwoByteString::New(const TypedData& other_typed_data, |
| 18783 intptr_t other_start_index, |
| 18784 intptr_t other_len, |
| 18785 Heap::Space space) { |
| 18786 const String& result = String::Handle(TwoByteString::New(other_len, space)); |
| 18787 if (other_len > 0) { |
| 18788 NoGCScope no_gc; |
| 18789 memmove(TwoByteString::CharAddr(result, 0), |
| 18790 other_typed_data.DataAddr(other_start_index), |
| 18791 other_len * sizeof(uint16_t)); |
| 18792 } |
| 18793 return TwoByteString::raw(result); |
| 18794 } |
| 18795 |
| 18796 |
| 18797 RawTwoByteString* TwoByteString::New(const ExternalTypedData& other_typed_data, |
| 18798 intptr_t other_start_index, |
| 18799 intptr_t other_len, |
| 18800 Heap::Space space) { |
| 18801 const String& result = String::Handle(TwoByteString::New(other_len, space)); |
| 18802 if (other_len > 0) { |
| 18803 NoGCScope no_gc; |
| 18804 memmove(TwoByteString::CharAddr(result, 0), |
| 18805 other_typed_data.DataAddr(other_start_index), |
| 18806 other_len * sizeof(uint16_t)); |
| 18807 } |
| 18808 return TwoByteString::raw(result); |
| 18809 } |
| 18810 |
| 18811 |
18782 RawTwoByteString* TwoByteString::Concat(const String& str1, | 18812 RawTwoByteString* TwoByteString::Concat(const String& str1, |
18783 const String& str2, | 18813 const String& str2, |
18784 Heap::Space space) { | 18814 Heap::Space space) { |
18785 intptr_t len1 = str1.Length(); | 18815 intptr_t len1 = str1.Length(); |
18786 intptr_t len2 = str2.Length(); | 18816 intptr_t len2 = str2.Length(); |
18787 intptr_t len = len1 + len2; | 18817 intptr_t len = len1 + len2; |
18788 const String& result = String::Handle(TwoByteString::New(len, space)); | 18818 const String& result = String::Handle(TwoByteString::New(len, space)); |
18789 String::Copy(result, 0, str1, 0, len1); | 18819 String::Copy(result, 0, str1, 0, len1); |
18790 String::Copy(result, len1, str2, 0, len2); | 18820 String::Copy(result, len1, str2, 0, len2); |
18791 return TwoByteString::raw(result); | 18821 return TwoByteString::raw(result); |
(...skipping 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20644 return tag_label.ToCString(); | 20674 return tag_label.ToCString(); |
20645 } | 20675 } |
20646 | 20676 |
20647 | 20677 |
20648 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20678 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20649 Instance::PrintJSONImpl(stream, ref); | 20679 Instance::PrintJSONImpl(stream, ref); |
20650 } | 20680 } |
20651 | 20681 |
20652 | 20682 |
20653 } // namespace dart | 20683 } // namespace dart |
OLD | NEW |