| 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 9691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9702 NoGCScope no_gc; | 9702 NoGCScope no_gc; |
| 9703 result ^= raw; | 9703 result ^= raw; |
| 9704 result.raw_ptr()->allocated_length_ = length; // Chunk length allocated. | 9704 result.raw_ptr()->allocated_length_ = length; // Chunk length allocated. |
| 9705 result.raw_ptr()->signed_length_ = length; // Chunk length in use. | 9705 result.raw_ptr()->signed_length_ = length; // Chunk length in use. |
| 9706 } | 9706 } |
| 9707 return result.raw(); | 9707 return result.raw(); |
| 9708 } | 9708 } |
| 9709 | 9709 |
| 9710 | 9710 |
| 9711 static uword BigintAllocator(intptr_t size) { | 9711 static uword BigintAllocator(intptr_t size) { |
| 9712 StackZone* zone = Isolate::Current()->current_zone(); | 9712 Zone* zone = Isolate::Current()->current_zone(); |
| 9713 return zone->AllocUnsafe(size); | 9713 return zone->AllocUnsafe(size); |
| 9714 } | 9714 } |
| 9715 | 9715 |
| 9716 | 9716 |
| 9717 const char* Bigint::ToCString() const { | 9717 const char* Bigint::ToCString() const { |
| 9718 return BigintOperations::ToDecimalCString(*this, &BigintAllocator); | 9718 return BigintOperations::ToDecimalCString(*this, &BigintAllocator); |
| 9719 } | 9719 } |
| 9720 | 9720 |
| 9721 | 9721 |
| 9722 class StringHasher : ValueObject { | 9722 class StringHasher : ValueObject { |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10214 return result; | 10214 return result; |
| 10215 } | 10215 } |
| 10216 | 10216 |
| 10217 | 10217 |
| 10218 RawString* String::NewFormattedV(const char* format, va_list args) { | 10218 RawString* String::NewFormattedV(const char* format, va_list args) { |
| 10219 va_list args_copy; | 10219 va_list args_copy; |
| 10220 va_copy(args_copy, args); | 10220 va_copy(args_copy, args); |
| 10221 intptr_t len = OS::VSNPrint(NULL, 0, format, args_copy); | 10221 intptr_t len = OS::VSNPrint(NULL, 0, format, args_copy); |
| 10222 va_end(args_copy); | 10222 va_end(args_copy); |
| 10223 | 10223 |
| 10224 StackZone* zone = Isolate::Current()->current_zone(); | 10224 Zone* zone = Isolate::Current()->current_zone(); |
| 10225 char* buffer = zone->Alloc<char>(len + 1); | 10225 char* buffer = zone->Alloc<char>(len + 1); |
| 10226 OS::VSNPrint(buffer, (len + 1), format, args); | 10226 OS::VSNPrint(buffer, (len + 1), format, args); |
| 10227 | 10227 |
| 10228 return String::New(buffer); | 10228 return String::New(buffer); |
| 10229 } | 10229 } |
| 10230 | 10230 |
| 10231 | 10231 |
| 10232 RawString* String::Concat(const String& str1, | 10232 RawString* String::Concat(const String& str1, |
| 10233 const String& str2, | 10233 const String& str2, |
| 10234 Heap::Space space) { | 10234 Heap::Space space) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10319 } else { | 10319 } else { |
| 10320 result ^= FourByteString::New(length, space); | 10320 result ^= FourByteString::New(length, space); |
| 10321 } | 10321 } |
| 10322 String::Copy(result, 0, str, begin_index, length); | 10322 String::Copy(result, 0, str, begin_index, length); |
| 10323 return result.raw(); | 10323 return result.raw(); |
| 10324 } | 10324 } |
| 10325 | 10325 |
| 10326 | 10326 |
| 10327 const char* String::ToCString() const { | 10327 const char* String::ToCString() const { |
| 10328 intptr_t len = Utf8::Length(*this); | 10328 intptr_t len = Utf8::Length(*this); |
| 10329 StackZone* zone = Isolate::Current()->current_zone(); | 10329 Zone* zone = Isolate::Current()->current_zone(); |
| 10330 char* result = zone->Alloc<char>(len + 1); | 10330 char* result = zone->Alloc<char>(len + 1); |
| 10331 Utf8::Encode(*this, result, len); | 10331 Utf8::Encode(*this, result, len); |
| 10332 result[len] = 0; | 10332 result[len] = 0; |
| 10333 return result; | 10333 return result; |
| 10334 } | 10334 } |
| 10335 | 10335 |
| 10336 | 10336 |
| 10337 RawString* String::Transform(int32_t (*mapping)(int32_t ch), | 10337 RawString* String::Transform(int32_t (*mapping)(int32_t ch), |
| 10338 const String& str, | 10338 const String& str, |
| 10339 Heap::Space space) { | 10339 Heap::Space space) { |
| (...skipping 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12201 } | 12201 } |
| 12202 return result.raw(); | 12202 return result.raw(); |
| 12203 } | 12203 } |
| 12204 | 12204 |
| 12205 | 12205 |
| 12206 const char* WeakProperty::ToCString() const { | 12206 const char* WeakProperty::ToCString() const { |
| 12207 return "_WeakProperty"; | 12207 return "_WeakProperty"; |
| 12208 } | 12208 } |
| 12209 | 12209 |
| 12210 } // namespace dart | 12210 } // namespace dart |
| OLD | NEW |