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 10045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10056 intptr_t array_len = strlen(str); | 10056 intptr_t array_len = strlen(str); |
10057 const uint8_t* utf8_array = reinterpret_cast<const uint8_t*>(str); | 10057 const uint8_t* utf8_array = reinterpret_cast<const uint8_t*>(str); |
10058 return String::New(utf8_array, array_len, space); | 10058 return String::New(utf8_array, array_len, space); |
10059 } | 10059 } |
10060 | 10060 |
10061 | 10061 |
10062 RawString* String::New(const uint8_t* utf8_array, | 10062 RawString* String::New(const uint8_t* utf8_array, |
10063 intptr_t array_len, | 10063 intptr_t array_len, |
10064 Heap::Space space) { | 10064 Heap::Space space) { |
10065 Utf8::Type type; | 10065 Utf8::Type type; |
10066 intptr_t len = Utf8::CodePointCount(utf8_array, array_len, &type); | 10066 intptr_t len = Utf8::CodeUnitCount(utf8_array, array_len, &type); |
10067 if (type == Utf8::kLatin1) { | 10067 if (type == Utf8::kLatin1) { |
10068 const String& strobj = String::Handle(OneByteString::New(len, space)); | 10068 const String& strobj = String::Handle(OneByteString::New(len, space)); |
10069 if (len > 0) { | 10069 if (len > 0) { |
10070 NoGCScope no_gc; | 10070 NoGCScope no_gc; |
10071 Utf8::DecodeToLatin1(utf8_array, array_len, | 10071 Utf8::DecodeToLatin1(utf8_array, array_len, |
10072 OneByteString::CharAddr(strobj, 0), len); | 10072 OneByteString::CharAddr(strobj, 0), len); |
10073 } | 10073 } |
10074 return strobj.raw(); | 10074 return strobj.raw(); |
10075 } | 10075 } |
10076 ASSERT((type == Utf8::kBMP) || (type == Utf8::kSupplementary)); | 10076 ASSERT((type == Utf8::kBMP) || (type == Utf8::kSupplementary)); |
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12083 } | 12083 } |
12084 return result.raw(); | 12084 return result.raw(); |
12085 } | 12085 } |
12086 | 12086 |
12087 | 12087 |
12088 const char* WeakProperty::ToCString() const { | 12088 const char* WeakProperty::ToCString() const { |
12089 return "_WeakProperty"; | 12089 return "_WeakProperty"; |
12090 } | 12090 } |
12091 | 12091 |
12092 } // namespace dart | 12092 } // namespace dart |
OLD | NEW |