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 "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
(...skipping 6905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6916 | 6916 |
6917 RawBigint* Bigint::Allocate(intptr_t length, Heap::Space space) { | 6917 RawBigint* Bigint::Allocate(intptr_t length, Heap::Space space) { |
6918 ASSERT(length >= 0); | 6918 ASSERT(length >= 0); |
6919 Isolate* isolate = Isolate::Current(); | 6919 Isolate* isolate = Isolate::Current(); |
6920 const Class& cls = Class::Handle(isolate->object_store()->bigint_class()); | 6920 const Class& cls = Class::Handle(isolate->object_store()->bigint_class()); |
6921 Bigint& result = Bigint::Handle(); | 6921 Bigint& result = Bigint::Handle(); |
6922 { | 6922 { |
6923 RawObject* raw = Object::Allocate(cls, Bigint::InstanceSize(length), space); | 6923 RawObject* raw = Object::Allocate(cls, Bigint::InstanceSize(length), space); |
6924 NoGCScope no_gc; | 6924 NoGCScope no_gc; |
6925 result ^= raw; | 6925 result ^= raw; |
6926 result.raw_ptr()->allocated_length_ = length; | 6926 result.raw_ptr()->allocated_length_ = length; // Chunk length allocated. |
6927 result.raw_ptr()->signed_length_ = length; | 6927 result.raw_ptr()->signed_length_ = length; // Chunk length in use. |
6928 } | 6928 } |
6929 return result.raw(); | 6929 return result.raw(); |
6930 } | 6930 } |
6931 | 6931 |
6932 | 6932 |
6933 static uword ZoneAllocator(intptr_t size) { | 6933 static uword ZoneAllocator(intptr_t size) { |
6934 Zone* zone = Isolate::Current()->current_zone(); | 6934 Zone* zone = Isolate::Current()->current_zone(); |
6935 return zone->Allocate(size); | 6935 return zone->Allocate(size); |
6936 } | 6936 } |
6937 | 6937 |
(...skipping 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8957 const String& str = String::Handle(pattern()); | 8957 const String& str = String::Handle(pattern()); |
8958 const char* format = "JSRegExp: pattern=%s flags=%s"; | 8958 const char* format = "JSRegExp: pattern=%s flags=%s"; |
8959 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 8959 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
8960 char* chars = reinterpret_cast<char*>( | 8960 char* chars = reinterpret_cast<char*>( |
8961 Isolate::Current()->current_zone()->Allocate(len + 1)); | 8961 Isolate::Current()->current_zone()->Allocate(len + 1)); |
8962 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 8962 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
8963 return chars; | 8963 return chars; |
8964 } | 8964 } |
8965 | 8965 |
8966 } // namespace dart | 8966 } // namespace dart |
OLD | NEW |