| 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 intptr_t* length) { | 1707 intptr_t* length) { |
| 1708 Isolate* isolate = Isolate::Current(); | 1708 Isolate* isolate = Isolate::Current(); |
| 1709 DARTSCOPE(isolate); | 1709 DARTSCOPE(isolate); |
| 1710 if (latin1_array == NULL) { | 1710 if (latin1_array == NULL) { |
| 1711 RETURN_NULL_ERROR(latin1_array); | 1711 RETURN_NULL_ERROR(latin1_array); |
| 1712 } | 1712 } |
| 1713 if (length == NULL) { | 1713 if (length == NULL) { |
| 1714 RETURN_NULL_ERROR(length); | 1714 RETURN_NULL_ERROR(length); |
| 1715 } | 1715 } |
| 1716 const String& str_obj = Api::UnwrapStringHandle(isolate, str); | 1716 const String& str_obj = Api::UnwrapStringHandle(isolate, str); |
| 1717 if (str_obj.IsNull() || !Dart_IsStringLatin1(str)) { | 1717 if (str_obj.IsNull() || !str_obj.IsOneByteString()) { |
| 1718 RETURN_TYPE_ERROR(isolate, str, String); | 1718 RETURN_TYPE_ERROR(isolate, str, String); |
| 1719 } | 1719 } |
| 1720 intptr_t str_len = str_obj.Length(); | 1720 intptr_t str_len = str_obj.Length(); |
| 1721 intptr_t copy_len = (str_len > *length) ? *length : str_len; | 1721 intptr_t copy_len = (str_len > *length) ? *length : str_len; |
| 1722 | 1722 |
| 1723 // We have already asserted that the string object is a Latin-1 string | 1723 // We have already asserted that the string object is a Latin-1 string |
| 1724 // so we can copy the characters over using a simple loop. | 1724 // so we can copy the characters over using a simple loop. |
| 1725 for (intptr_t i = 0; i < copy_len; i++) { | 1725 for (intptr_t i = 0; i < copy_len; i++) { |
| 1726 latin1_array[i] = str_obj.CharAt(i); | 1726 latin1_array[i] = str_obj.CharAt(i); |
| 1727 } | 1727 } |
| (...skipping 2778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4506 } | 4506 } |
| 4507 { | 4507 { |
| 4508 NoGCScope no_gc; | 4508 NoGCScope no_gc; |
| 4509 RawObject* raw_obj = obj.raw(); | 4509 RawObject* raw_obj = obj.raw(); |
| 4510 isolate->heap()->SetPeer(raw_obj, peer); | 4510 isolate->heap()->SetPeer(raw_obj, peer); |
| 4511 } | 4511 } |
| 4512 return Api::Success(isolate); | 4512 return Api::Success(isolate); |
| 4513 } | 4513 } |
| 4514 | 4514 |
| 4515 } // namespace dart | 4515 } // namespace dart |
| OLD | NEW |