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 9654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9665 NoGCScope no_gc; | 9665 NoGCScope no_gc; |
9666 result ^= raw; | 9666 result ^= raw; |
9667 result.raw_ptr()->allocated_length_ = length; // Chunk length allocated. | 9667 result.raw_ptr()->allocated_length_ = length; // Chunk length allocated. |
9668 result.raw_ptr()->signed_length_ = length; // Chunk length in use. | 9668 result.raw_ptr()->signed_length_ = length; // Chunk length in use. |
9669 } | 9669 } |
9670 return result.raw(); | 9670 return result.raw(); |
9671 } | 9671 } |
9672 | 9672 |
9673 | 9673 |
9674 static uword BigintAllocator(intptr_t size) { | 9674 static uword BigintAllocator(intptr_t size) { |
9675 Zone* zone = Isolate::Current()->current_zone(); | 9675 StackZone* zone = Isolate::Current()->current_zone(); |
9676 return zone->AllocUnsafe(size); | 9676 return zone->AllocUnsafe(size); |
9677 } | 9677 } |
9678 | 9678 |
9679 | 9679 |
9680 const char* Bigint::ToCString() const { | 9680 const char* Bigint::ToCString() const { |
9681 return BigintOperations::ToDecimalCString(*this, &BigintAllocator); | 9681 return BigintOperations::ToDecimalCString(*this, &BigintAllocator); |
9682 } | 9682 } |
9683 | 9683 |
9684 | 9684 |
9685 class StringHasher : ValueObject { | 9685 class StringHasher : ValueObject { |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10177 return result; | 10177 return result; |
10178 } | 10178 } |
10179 | 10179 |
10180 | 10180 |
10181 RawString* String::NewFormattedV(const char* format, va_list args) { | 10181 RawString* String::NewFormattedV(const char* format, va_list args) { |
10182 va_list args_copy; | 10182 va_list args_copy; |
10183 va_copy(args_copy, args); | 10183 va_copy(args_copy, args); |
10184 intptr_t len = OS::VSNPrint(NULL, 0, format, args_copy); | 10184 intptr_t len = OS::VSNPrint(NULL, 0, format, args_copy); |
10185 va_end(args_copy); | 10185 va_end(args_copy); |
10186 | 10186 |
10187 Zone* zone = Isolate::Current()->current_zone(); | 10187 StackZone* zone = Isolate::Current()->current_zone(); |
10188 char* buffer = zone->Alloc<char>(len + 1); | 10188 char* buffer = zone->Alloc<char>(len + 1); |
10189 OS::VSNPrint(buffer, (len + 1), format, args); | 10189 OS::VSNPrint(buffer, (len + 1), format, args); |
10190 | 10190 |
10191 return String::New(buffer); | 10191 return String::New(buffer); |
10192 } | 10192 } |
10193 | 10193 |
10194 | 10194 |
10195 RawString* String::Concat(const String& str1, | 10195 RawString* String::Concat(const String& str1, |
10196 const String& str2, | 10196 const String& str2, |
10197 Heap::Space space) { | 10197 Heap::Space space) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10282 } else { | 10282 } else { |
10283 result ^= FourByteString::New(length, space); | 10283 result ^= FourByteString::New(length, space); |
10284 } | 10284 } |
10285 String::Copy(result, 0, str, begin_index, length); | 10285 String::Copy(result, 0, str, begin_index, length); |
10286 return result.raw(); | 10286 return result.raw(); |
10287 } | 10287 } |
10288 | 10288 |
10289 | 10289 |
10290 const char* String::ToCString() const { | 10290 const char* String::ToCString() const { |
10291 intptr_t len = Utf8::Length(*this); | 10291 intptr_t len = Utf8::Length(*this); |
10292 Zone* zone = Isolate::Current()->current_zone(); | 10292 StackZone* zone = Isolate::Current()->current_zone(); |
10293 char* result = zone->Alloc<char>(len + 1); | 10293 char* result = zone->Alloc<char>(len + 1); |
10294 Utf8::Encode(*this, result, len); | 10294 Utf8::Encode(*this, result, len); |
10295 result[len] = 0; | 10295 result[len] = 0; |
10296 return result; | 10296 return result; |
10297 } | 10297 } |
10298 | 10298 |
10299 | 10299 |
10300 RawString* String::Transform(int32_t (*mapping)(int32_t ch), | 10300 RawString* String::Transform(int32_t (*mapping)(int32_t ch), |
10301 const String& str, | 10301 const String& str, |
10302 Heap::Space space) { | 10302 Heap::Space space) { |
(...skipping 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12174 } | 12174 } |
12175 return result.raw(); | 12175 return result.raw(); |
12176 } | 12176 } |
12177 | 12177 |
12178 | 12178 |
12179 const char* WeakProperty::ToCString() const { | 12179 const char* WeakProperty::ToCString() const { |
12180 return "_WeakProperty"; | 12180 return "_WeakProperty"; |
12181 } | 12181 } |
12182 | 12182 |
12183 } // namespace dart | 12183 } // namespace dart |
OLD | NEW |