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 10762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10773 | 10773 |
| 10774 RawOneByteString* OneByteString::New(const String& str, | 10774 RawOneByteString* OneByteString::New(const String& str, |
| 10775 Heap::Space space) { | 10775 Heap::Space space) { |
| 10776 intptr_t len = str.Length(); | 10776 intptr_t len = str.Length(); |
| 10777 const String& result = String::Handle(OneByteString::New(len, space)); | 10777 const String& result = String::Handle(OneByteString::New(len, space)); |
| 10778 String::Copy(result, 0, str, 0, len); | 10778 String::Copy(result, 0, str, 0, len); |
| 10779 return OneByteString::raw(result); | 10779 return OneByteString::raw(result); |
| 10780 } | 10780 } |
| 10781 | 10781 |
| 10782 | 10782 |
| 10783 RawOneByteString* OneByteString::New(const String& other, | |
| 10784 intptr_t other_start_index, | |
| 10785 intptr_t other_len, | |
| 10786 Heap::Space space) { | |
| 10787 const String& result = String::Handle(OneByteString::New(other_len, space)); | |
| 10788 String::Copy(result, 0, other, other_start_index, other_len); | |
|
siva
2012/11/29 21:42:46
Could be written as:
ASSERT(other.IsOneByteString(
srdjan
2012/11/29 22:57:14
Done.
| |
| 10789 return OneByteString::raw(result); | |
| 10790 } | |
| 10791 | |
| 10792 | |
| 10783 RawOneByteString* OneByteString::Concat(const String& str1, | 10793 RawOneByteString* OneByteString::Concat(const String& str1, |
| 10784 const String& str2, | 10794 const String& str2, |
| 10785 Heap::Space space) { | 10795 Heap::Space space) { |
| 10786 intptr_t len1 = str1.Length(); | 10796 intptr_t len1 = str1.Length(); |
| 10787 intptr_t len2 = str2.Length(); | 10797 intptr_t len2 = str2.Length(); |
| 10788 intptr_t len = len1 + len2; | 10798 intptr_t len = len1 + len2; |
| 10789 const String& result = String::Handle(OneByteString::New(len, space)); | 10799 const String& result = String::Handle(OneByteString::New(len, space)); |
| 10790 String::Copy(result, 0, str1, 0, len1); | 10800 String::Copy(result, 0, str1, 0, len1); |
| 10791 String::Copy(result, len1, str2, 0, len2); | 10801 String::Copy(result, len1, str2, 0, len2); |
| 10792 return OneByteString::raw(result); | 10802 return OneByteString::raw(result); |
| (...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12172 } | 12182 } |
| 12173 return result.raw(); | 12183 return result.raw(); |
| 12174 } | 12184 } |
| 12175 | 12185 |
| 12176 | 12186 |
| 12177 const char* WeakProperty::ToCString() const { | 12187 const char* WeakProperty::ToCString() const { |
| 12178 return "_WeakProperty"; | 12188 return "_WeakProperty"; |
| 12179 } | 12189 } |
| 12180 | 12190 |
| 12181 } // namespace dart | 12191 } // namespace dart |
| OLD | NEW |