| 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 9685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9696 NoGCScope no_gc; | 9696 NoGCScope no_gc; |
| 9697 result ^= raw; | 9697 result ^= raw; |
| 9698 result.raw_ptr()->allocated_length_ = length; // Chunk length allocated. | 9698 result.raw_ptr()->allocated_length_ = length; // Chunk length allocated. |
| 9699 result.raw_ptr()->signed_length_ = length; // Chunk length in use. | 9699 result.raw_ptr()->signed_length_ = length; // Chunk length in use. |
| 9700 } | 9700 } |
| 9701 return result.raw(); | 9701 return result.raw(); |
| 9702 } | 9702 } |
| 9703 | 9703 |
| 9704 | 9704 |
| 9705 static uword BigintAllocator(intptr_t size) { | 9705 static uword BigintAllocator(intptr_t size) { |
| 9706 StackZone* zone = Isolate::Current()->current_zone(); | 9706 Zone* zone = Isolate::Current()->current_zone(); |
| 9707 return zone->AllocUnsafe(size); | 9707 return zone->AllocUnsafe(size); |
| 9708 } | 9708 } |
| 9709 | 9709 |
| 9710 | 9710 |
| 9711 const char* Bigint::ToCString() const { | 9711 const char* Bigint::ToCString() const { |
| 9712 return BigintOperations::ToDecimalCString(*this, &BigintAllocator); | 9712 return BigintOperations::ToDecimalCString(*this, &BigintAllocator); |
| 9713 } | 9713 } |
| 9714 | 9714 |
| 9715 | 9715 |
| 9716 class StringHasher : ValueObject { | 9716 class StringHasher : ValueObject { |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10208 return result; | 10208 return result; |
| 10209 } | 10209 } |
| 10210 | 10210 |
| 10211 | 10211 |
| 10212 RawString* String::NewFormattedV(const char* format, va_list args) { | 10212 RawString* String::NewFormattedV(const char* format, va_list args) { |
| 10213 va_list args_copy; | 10213 va_list args_copy; |
| 10214 va_copy(args_copy, args); | 10214 va_copy(args_copy, args); |
| 10215 intptr_t len = OS::VSNPrint(NULL, 0, format, args_copy); | 10215 intptr_t len = OS::VSNPrint(NULL, 0, format, args_copy); |
| 10216 va_end(args_copy); | 10216 va_end(args_copy); |
| 10217 | 10217 |
| 10218 StackZone* zone = Isolate::Current()->current_zone(); | 10218 Zone* zone = Isolate::Current()->current_zone(); |
| 10219 char* buffer = zone->Alloc<char>(len + 1); | 10219 char* buffer = zone->Alloc<char>(len + 1); |
| 10220 OS::VSNPrint(buffer, (len + 1), format, args); | 10220 OS::VSNPrint(buffer, (len + 1), format, args); |
| 10221 | 10221 |
| 10222 return String::New(buffer); | 10222 return String::New(buffer); |
| 10223 } | 10223 } |
| 10224 | 10224 |
| 10225 | 10225 |
| 10226 RawString* String::Concat(const String& str1, | 10226 RawString* String::Concat(const String& str1, |
| 10227 const String& str2, | 10227 const String& str2, |
| 10228 Heap::Space space) { | 10228 Heap::Space space) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10313 } else { | 10313 } else { |
| 10314 result ^= FourByteString::New(length, space); | 10314 result ^= FourByteString::New(length, space); |
| 10315 } | 10315 } |
| 10316 String::Copy(result, 0, str, begin_index, length); | 10316 String::Copy(result, 0, str, begin_index, length); |
| 10317 return result.raw(); | 10317 return result.raw(); |
| 10318 } | 10318 } |
| 10319 | 10319 |
| 10320 | 10320 |
| 10321 const char* String::ToCString() const { | 10321 const char* String::ToCString() const { |
| 10322 intptr_t len = Utf8::Length(*this); | 10322 intptr_t len = Utf8::Length(*this); |
| 10323 StackZone* zone = Isolate::Current()->current_zone(); | 10323 Zone* zone = Isolate::Current()->current_zone(); |
| 10324 char* result = zone->Alloc<char>(len + 1); | 10324 char* result = zone->Alloc<char>(len + 1); |
| 10325 Utf8::Encode(*this, result, len); | 10325 Utf8::Encode(*this, result, len); |
| 10326 result[len] = 0; | 10326 result[len] = 0; |
| 10327 return result; | 10327 return result; |
| 10328 } | 10328 } |
| 10329 | 10329 |
| 10330 | 10330 |
| 10331 RawString* String::Transform(int32_t (*mapping)(int32_t ch), | 10331 RawString* String::Transform(int32_t (*mapping)(int32_t ch), |
| 10332 const String& str, | 10332 const String& str, |
| 10333 Heap::Space space) { | 10333 Heap::Space space) { |
| (...skipping 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12205 } | 12205 } |
| 12206 return result.raw(); | 12206 return result.raw(); |
| 12207 } | 12207 } |
| 12208 | 12208 |
| 12209 | 12209 |
| 12210 const char* WeakProperty::ToCString() const { | 12210 const char* WeakProperty::ToCString() const { |
| 12211 return "_WeakProperty"; | 12211 return "_WeakProperty"; |
| 12212 } | 12212 } |
| 12213 | 12213 |
| 12214 } // namespace dart | 12214 } // namespace dart |
| OLD | NEW |