Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: vm/object.cc

Issue 8879063: Changes to set up the object tag bits (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « vm/object.h ('k') | vm/raw_object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/assert.h" 8 #include "vm/assert.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 2118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2129 AbstractTypeArguments::Handle(other.arguments())); 2129 AbstractTypeArguments::Handle(other.arguments()));
2130 } 2130 }
2131 2131
2132 2132
2133 RawAbstractType* Type::Canonicalize() const { 2133 RawAbstractType* Type::Canonicalize() const {
2134 ASSERT(IsFinalized()); 2134 ASSERT(IsFinalized());
2135 const Class& cls = Class::Handle(type_class()); 2135 const Class& cls = Class::Handle(type_class());
2136 Array& canonical_types = Array::Handle(cls.canonical_types()); 2136 Array& canonical_types = Array::Handle(cls.canonical_types());
2137 if (canonical_types.IsNull()) { 2137 if (canonical_types.IsNull()) {
2138 // Types defined in the VM isolate are canonicalized via the object store. 2138 // Types defined in the VM isolate are canonicalized via the object store.
2139 // TODO(regis): Should we add null_class_, void_class_, dynamic_class_ to
2140 // the object store, remove all types from the object store, and replace
2141 // the test above by an assert?
2142 return this->raw(); 2139 return this->raw();
2143 } 2140 }
2144 const intptr_t canonical_types_len = canonical_types.Length(); 2141 if (!IsCanonical()) {
2145 // Linear search to see whether this type is already present in the 2142 const intptr_t canonical_types_len = canonical_types.Length();
2146 // list of canonicalized types. 2143 // Linear search to see whether this type is already present in the
2147 Type& type = Type::Handle(); 2144 // list of canonicalized types.
2148 intptr_t index = 0; 2145 Type& type = Type::Handle();
2149 while (index < canonical_types_len) { 2146 intptr_t index = 0;
2150 type ^= canonical_types.At(index); 2147 while (index < canonical_types_len) {
2151 if (type.IsNull()) { 2148 type ^= canonical_types.At(index);
2152 break; 2149 if (type.IsNull()) {
2150 break;
2151 }
2152 if (!type.IsFinalized()) {
2153 ASSERT((index == 0) && cls.IsSignatureClass());
2154 index++;
2155 continue;
2156 }
2157 if (this->Equals(type)) {
2158 return type.raw();
2159 }
2160 index++;
2153 } 2161 }
2154 if (!type.IsFinalized()) { 2162 // The type needs to be added to the list. Grow the list if it is full.
2155 ASSERT((index == 0) && cls.IsSignatureClass()); 2163 if (index == canonical_types_len) {
2156 index++; 2164 const intptr_t kLengthIncrement = 2; // Raw and parameterized.
2157 continue; 2165 const intptr_t new_length = canonical_types.Length() + kLengthIncrement;
2166 const Array& new_canonical_types =
2167 Array::Handle(Array::Grow(canonical_types, new_length, Heap::kOld));
2168 cls.set_canonical_types(new_canonical_types);
2169 new_canonical_types.SetAt(index, *this);
2170 } else {
2171 canonical_types.SetAt(index, *this);
2158 } 2172 }
2159 if (this->Equals(type)) { 2173 SetCanonical();
2160 return type.raw();
2161 }
2162 index++;
2163 }
2164 // The type needs to be added to the list. Grow the list if it is full.
2165 if (index == canonical_types_len) {
2166 const intptr_t kLengthIncrement = 2; // Raw and parameterized.
2167 const intptr_t new_length = canonical_types.Length() + kLengthIncrement;
2168 const Array& new_canonical_types =
2169 Array::Handle(Array::Grow(canonical_types, new_length, Heap::kOld));
2170 cls.set_canonical_types(new_canonical_types);
2171 new_canonical_types.SetAt(index, *this);
2172 } else {
2173 canonical_types.SetAt(index, *this);
2174 } 2174 }
2175 return this->raw(); 2175 return this->raw();
2176 } 2176 }
2177 2177
2178 2178
2179 void Type::set_type_class(const Object& value) const { 2179 void Type::set_type_class(const Object& value) const {
2180 ASSERT(!value.IsNull() && (value.IsClass() || value.IsUnresolvedClass())); 2180 ASSERT(!value.IsNull() && (value.IsClass() || value.IsUnresolvedClass()));
2181 StorePointer(&raw_ptr()->type_class_, value.raw()); 2181 StorePointer(&raw_ptr()->type_class_, value.raw());
2182 } 2182 }
2183 2183
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 return Smi::Value(raw_ptr()->length_); 2515 return Smi::Value(raw_ptr()->length_);
2516 } 2516 }
2517 2517
2518 2518
2519 RawAbstractType* TypeArguments::TypeAt(intptr_t index) const { 2519 RawAbstractType* TypeArguments::TypeAt(intptr_t index) const {
2520 return *TypeAddr(index); 2520 return *TypeAddr(index);
2521 } 2521 }
2522 2522
2523 2523
2524 void TypeArguments::SetTypeAt(intptr_t index, const AbstractType& value) const { 2524 void TypeArguments::SetTypeAt(intptr_t index, const AbstractType& value) const {
2525 ASSERT(!is_canonical()); 2525 ASSERT(!IsCanonical());
2526 // TODO(iposva): Add storing NoGCScope. 2526 // TODO(iposva): Add storing NoGCScope.
2527 *TypeAddr(index) = value.raw(); 2527 *TypeAddr(index) = value.raw();
2528 } 2528 }
2529 2529
2530 2530
2531 bool TypeArguments::IsResolved() const { 2531 bool TypeArguments::IsResolved() const {
2532 AbstractType& type = AbstractType::Handle(); 2532 AbstractType& type = AbstractType::Handle();
2533 intptr_t num_types = Length(); 2533 intptr_t num_types = Length();
2534 for (intptr_t i = 0; i < num_types; i++) { 2534 for (intptr_t i = 0; i < num_types; i++) {
2535 type = TypeAt(i); 2535 type = TypeAt(i);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2601 2601
2602 const Class& type_arguments_class = 2602 const Class& type_arguments_class =
2603 Class::Handle(Object::type_arguments_class()); 2603 Class::Handle(Object::type_arguments_class());
2604 TypeArguments& result = TypeArguments::Handle(); 2604 TypeArguments& result = TypeArguments::Handle();
2605 { 2605 {
2606 RawObject* raw = Object::Allocate(type_arguments_class, 2606 RawObject* raw = Object::Allocate(type_arguments_class,
2607 TypeArguments::InstanceSize(len), 2607 TypeArguments::InstanceSize(len),
2608 Heap::kOld); 2608 Heap::kOld);
2609 NoGCScope no_gc; 2609 NoGCScope no_gc;
2610 result ^= raw; 2610 result ^= raw;
2611 result.set_is_canonical(false);
2612 // Length must be set before we start storing into the array. 2611 // Length must be set before we start storing into the array.
2613 result.SetLength(len); 2612 result.SetLength(len);
2614 for (intptr_t i = 0; i < len; i++) { 2613 for (intptr_t i = 0; i < len; i++) {
2615 *result.TypeAddr(i) = Type::null(); 2614 *result.TypeAddr(i) = Type::null();
2616 } 2615 }
2617 } 2616 }
2618 return result.raw(); 2617 return result.raw();
2619 } 2618 }
2620 2619
2621 2620
2622 2621
2623 RawAbstractType** TypeArguments::TypeAddr(intptr_t index) const { 2622 RawAbstractType** TypeArguments::TypeAddr(intptr_t index) const {
2624 // TODO(iposva): Determine if we should throw an exception here. 2623 // TODO(iposva): Determine if we should throw an exception here.
2625 ASSERT((index >= 0) && (index < Length())); 2624 ASSERT((index >= 0) && (index < Length()));
2626 return &raw_ptr()->types_[index]; 2625 return &raw_ptr()->types_[index];
2627 } 2626 }
2628 2627
2629 2628
2630 void TypeArguments::SetLength(intptr_t value) { 2629 void TypeArguments::SetLength(intptr_t value) {
2631 ASSERT(!is_canonical()); 2630 ASSERT(!IsCanonical());
2632 // This is only safe because we create a new Smi, which does not cause 2631 // This is only safe because we create a new Smi, which does not cause
2633 // heap allocation. 2632 // heap allocation.
2634 raw_ptr()->length_ = Smi::New(value); 2633 raw_ptr()->length_ = Smi::New(value);
2635 } 2634 }
2636 2635
2637 2636
2638 RawAbstractTypeArguments* TypeArguments::Canonicalize() const { 2637 RawAbstractTypeArguments* TypeArguments::Canonicalize() const {
2639 if (IsNull() || is_canonical() || !IsInstantiated()) { 2638 if (IsNull() || IsCanonical() || !IsInstantiated()) {
2640 return this->raw(); 2639 return this->raw();
2641 } 2640 }
2642 ObjectStore* object_store = Isolate::Current()->object_store(); 2641 ObjectStore* object_store = Isolate::Current()->object_store();
2643 // 'table' must be null terminated. 2642 // 'table' must be null terminated.
2644 Array& table = Array::Handle(object_store->canonical_type_arguments()); 2643 Array& table = Array::Handle(object_store->canonical_type_arguments());
2645 ASSERT(table.Length() > 0); 2644 ASSERT(table.Length() > 0);
2646 intptr_t index = 0; 2645 intptr_t index = 0;
2647 TypeArguments& other = TypeArguments::Handle(); 2646 TypeArguments& other = TypeArguments::Handle();
2648 other ^= table.At(index); 2647 other ^= table.At(index);
2649 while (!other.IsNull()) { 2648 while (!other.IsNull()) {
2650 if (this->Equals(other)) { 2649 if (this->Equals(other)) {
2651 return other.raw(); 2650 return other.raw();
2652 } 2651 }
2653 other ^= table.At(++index); 2652 other ^= table.At(++index);
2654 } 2653 }
2655 // Not found. Add 'this' to table. 2654 // Not found. Add 'this' to table.
2656 if (index == table.Length() - 1) { 2655 if (index == table.Length() - 1) {
2657 table = Array::Grow(table, table.Length() + 4, Heap::kOld); 2656 table = Array::Grow(table, table.Length() + 4, Heap::kOld);
2658 object_store->set_canonical_type_arguments(table); 2657 object_store->set_canonical_type_arguments(table);
2659 } 2658 }
2660 table.SetAt(index, *this); 2659 table.SetAt(index, *this);
2661 this->set_is_canonical(true); 2660 SetCanonical();
2662 return this->raw(); 2661 return this->raw();
2663 } 2662 }
2664 2663
2665 2664
2666 bool TypeArguments::is_canonical() const {
2667 return raw_ptr()->is_canonical_;
2668 }
2669
2670
2671 void TypeArguments::set_is_canonical(bool value) const {
2672 raw_ptr()->is_canonical_ = value;
2673 }
2674
2675
2676 const char* TypeArguments::ToCString() const { 2665 const char* TypeArguments::ToCString() const {
2677 if (IsNull()) { 2666 if (IsNull()) {
2678 return "NULL TypeArguments"; 2667 return "NULL TypeArguments";
2679 } 2668 }
2680 const char* format = "%s [%s]"; 2669 const char* format = "%s [%s]";
2681 const char* prev_cstr = "TypeArguments:"; 2670 const char* prev_cstr = "TypeArguments:";
2682 for (int i = 0; i < Length(); i++) { 2671 for (int i = 0; i < Length(); i++) {
2683 const AbstractType& type_at = AbstractType::Handle(TypeAt(i)); 2672 const AbstractType& type_at = AbstractType::Handle(TypeAt(i));
2684 const char* type_cstr = type_at.IsNull() ? "null" : type_at.ToCString(); 2673 const char* type_cstr = type_at.IsNull() ? "null" : type_at.ToCString();
2685 intptr_t len = OS::SNPrint(NULL, 0, format, prev_cstr, type_cstr) + 1; 2674 intptr_t len = OS::SNPrint(NULL, 0, format, prev_cstr, type_cstr) + 1;
(...skipping 2316 matching lines...) Expand 10 before | Expand all | Expand 10 after
5002 return false; 4991 return false;
5003 } 4992 }
5004 4993
5005 { 4994 {
5006 NoGCScope no_gc; 4995 NoGCScope no_gc;
5007 // Raw bits compare. 4996 // Raw bits compare.
5008 const intptr_t instance_size = Class::Handle(this->clazz()).instance_size(); 4997 const intptr_t instance_size = Class::Handle(this->clazz()).instance_size();
5009 ASSERT(instance_size != 0); 4998 ASSERT(instance_size != 0);
5010 uword this_addr = reinterpret_cast<uword>(this->raw_ptr()); 4999 uword this_addr = reinterpret_cast<uword>(this->raw_ptr());
5011 uword other_addr = reinterpret_cast<uword>(other.raw_ptr()); 5000 uword other_addr = reinterpret_cast<uword>(other.raw_ptr());
5012 for (intptr_t offset = 0; offset < instance_size; offset += kWordSize) { 5001 for (intptr_t offset = sizeof(RawObject);
5002 offset < instance_size;
5003 offset += kWordSize) {
5013 if ((*reinterpret_cast<RawObject**>(this_addr + offset)) != 5004 if ((*reinterpret_cast<RawObject**>(this_addr + offset)) !=
5014 (*reinterpret_cast<RawObject**>(other_addr + offset))) { 5005 (*reinterpret_cast<RawObject**>(other_addr + offset))) {
5015 return false; 5006 return false;
5016 } 5007 }
5017 } 5008 }
5018 } 5009 }
5019 return true; 5010 return true;
5020 } 5011 }
5021 5012
5022 5013
5023 RawInstance* Instance::Canonicalize() const { 5014 RawInstance* Instance::Canonicalize() const {
5024 ASSERT(!IsNull()); 5015 ASSERT(!IsNull());
5025 const Class& cls = Class::Handle(this->clazz()); 5016 if (!IsCanonical()) {
5026 Array& constants = Array::Handle(cls.constants()); 5017 const Class& cls = Class::Handle(this->clazz());
5027 const intptr_t constants_len = constants.Length(); 5018 Array& constants = Array::Handle(cls.constants());
5028 // Linear search to see whether this value is already present in the 5019 const intptr_t constants_len = constants.Length();
5029 // list of canonicalized constants. 5020 // Linear search to see whether this value is already present in the
5030 Instance& norm_value = Instance::Handle(); 5021 // list of canonicalized constants.
5031 intptr_t index = 0; 5022 Instance& norm_value = Instance::Handle();
5032 while (index < constants_len) { 5023 intptr_t index = 0;
5033 norm_value ^= constants.At(index); 5024 while (index < constants_len) {
5034 if (norm_value.IsNull()) { 5025 norm_value ^= constants.At(index);
5035 break; 5026 if (norm_value.IsNull()) {
5027 break;
5028 }
5029 if (this->Equals(norm_value)) {
5030 return norm_value.raw();
5031 }
5032 index++;
5036 } 5033 }
5037 if (this->Equals(norm_value)) { 5034 // The value needs to be added to the list. Grow the list if
5038 return norm_value.raw(); 5035 // it is full.
5036 // TODO(srdjan): Copy instance into old space if canonicalized?
5037 if (index == constants_len) {
5038 const intptr_t kInitialConstLength = 4;
5039 const intptr_t old_length = constants.Length();
5040 const intptr_t new_length =
5041 (old_length == 0) ? kInitialConstLength : old_length * 2;
5042 const Array& new_constants =
5043 Array::Handle(Array::Grow(constants, new_length, Heap::kOld));
5044 cls.set_constants(new_constants);
5045 new_constants.SetAt(index, *this);
5046 } else {
5047 constants.SetAt(index, *this);
5039 } 5048 }
5040 index++; 5049 SetCanonical();
5041 }
5042 // The value needs to be added to the list. Grow the list if
5043 // it is full.
5044 // TODO(srdjan): Copy instance into old space if canonicalized?
5045 if (index == constants_len) {
5046 const intptr_t kInitialConstLength = 4;
5047 const intptr_t old_length = constants.Length();
5048 const intptr_t new_length =
5049 (old_length == 0) ? kInitialConstLength : old_length * 2;
5050 const Array& new_constants =
5051 Array::Handle(Array::Grow(constants, new_length, Heap::kOld));
5052 cls.set_constants(new_constants);
5053 new_constants.SetAt(index, *this);
5054 } else {
5055 constants.SetAt(index, *this);
5056 } 5050 }
5057 return this->raw(); 5051 return this->raw();
5058 } 5052 }
5059 5053
5060 5054
5061 RawType* Instance::GetType() const { 5055 RawType* Instance::GetType() const {
5062 if (IsNull()) { 5056 if (IsNull()) {
5063 return Type::NullType(); 5057 return Type::NullType();
5064 } 5058 }
5065 const Class& cls = Class::Handle(clazz()); 5059 const Class& cls = Class::Handle(clazz());
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
5841 for (int i = 0; i < slen; i++) { 5835 for (int i = 0; i < slen; i++) {
5842 if (this->CharAt(i) != other.CharAt(i)) { 5836 if (this->CharAt(i) != other.CharAt(i)) {
5843 return false; 5837 return false;
5844 } 5838 }
5845 } 5839 }
5846 return true; 5840 return true;
5847 } 5841 }
5848 5842
5849 5843
5850 RawInstance* String::Canonicalize() const { 5844 RawInstance* String::Canonicalize() const {
5845 if (IsCanonical()) {
5846 return this->raw();
5847 }
5851 return NewSymbol(*this); 5848 return NewSymbol(*this);
5852 } 5849 }
5853 5850
5854 5851
5855 bool String::IsSymbol() const {
5856 if (!HasHash()) {
5857 // All symbols have had their hash calculated.
5858 return false;
5859 }
5860
5861 // Get the hash for this string.
5862 intptr_t hash = Hash();
5863
5864 ObjectStore* object_store = Isolate::Current()->object_store();
5865 const Array& symbol_table = Array::Handle(object_store->symbol_table());
5866 // Last element of the array is the number of used elements.
5867 intptr_t table_size = symbol_table.Length() - 1;
5868 intptr_t index = hash % table_size;
5869
5870 // Try to find this string object in the symbol table. The symbol table is
5871 // never entirely full so this loop will terminate.
5872 String& symbol = String::Handle();
5873 symbol ^= symbol_table.At(index);
5874 while (!symbol.IsNull() && (raw_ptr() != symbol.raw_ptr())) {
5875 index = (index + 1) % table_size; // Move to next element.
5876 symbol ^= symbol_table.At(index);
5877 }
5878
5879 // This string is a symbol if we found a matching entry.
5880 return !symbol.IsNull();
5881 }
5882
5883
5884 RawString* String::New(const char* str, Heap::Space space) { 5852 RawString* String::New(const char* str, Heap::Space space) {
5885 intptr_t width = 0; 5853 intptr_t width = 0;
5886 intptr_t len = Utf8::CodePointCount(str, &width); 5854 intptr_t len = Utf8::CodePointCount(str, &width);
5887 if (width == 1) { 5855 if (width == 1) {
5888 const OneByteString& onestr 5856 const OneByteString& onestr
5889 = OneByteString::Handle(OneByteString::New(len, space)); 5857 = OneByteString::Handle(OneByteString::New(len, space));
5890 if (len > 0) { 5858 if (len > 0) {
5891 NoGCScope no_gc; 5859 NoGCScope no_gc;
5892 Utf8::Decode(str, onestr.CharAddr(0), len); 5860 Utf8::Decode(str, onestr.CharAddr(0), len);
5893 } 5861 }
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
6183 new_symbol_table.SetAt(new_table_size, new_element); 6151 new_symbol_table.SetAt(new_table_size, new_element);
6184 // Remember the new symbol table now. 6152 // Remember the new symbol table now.
6185 Isolate::Current()->object_store()->set_symbol_table(new_symbol_table); 6153 Isolate::Current()->object_store()->set_symbol_table(new_symbol_table);
6186 } 6154 }
6187 6155
6188 6156
6189 static void InsertIntoSymbolTable(const Array& symbol_table, 6157 static void InsertIntoSymbolTable(const Array& symbol_table,
6190 const String& symbol, 6158 const String& symbol,
6191 intptr_t index, 6159 intptr_t index,
6192 intptr_t table_size) { 6160 intptr_t table_size) {
6161 symbol.SetCanonical(); // Mark object as being canonical.
6193 symbol_table.SetAt(index, symbol); // Remember the new symbol. 6162 symbol_table.SetAt(index, symbol); // Remember the new symbol.
6194 Smi& used = Smi::Handle(); 6163 Smi& used = Smi::Handle();
6195 used ^= symbol_table.At(table_size); 6164 used ^= symbol_table.At(table_size);
6196 intptr_t used_elements = used.Value() + 1; // One more element added. 6165 intptr_t used_elements = used.Value() + 1; // One more element added.
6197 used = Smi::New(used_elements); 6166 used = Smi::New(used_elements);
6198 symbol_table.SetAt(table_size, used); // Update used count. 6167 symbol_table.SetAt(table_size, used); // Update used count.
6199 6168
6200 // Rehash if symbol_table is 75% full. 6169 // Rehash if symbol_table is 75% full.
6201 if (used_elements > ((table_size / 4) * 3)) { 6170 if (used_elements > ((table_size / 4) * 3)) {
6202 GrowSymbolTable(symbol_table, table_size); 6171 GrowSymbolTable(symbol_table, table_size);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
6257 ASSERT(symbol.IsSymbol()); 6226 ASSERT(symbol.IsSymbol());
6258 return symbol.raw(); 6227 return symbol.raw();
6259 } 6228 }
6260 6229
6261 template RawString* String::NewSymbol(const uint8_t* characters, intptr_t len); 6230 template RawString* String::NewSymbol(const uint8_t* characters, intptr_t len);
6262 template RawString* String::NewSymbol(const uint16_t* characters, intptr_t len); 6231 template RawString* String::NewSymbol(const uint16_t* characters, intptr_t len);
6263 template RawString* String::NewSymbol(const uint32_t* characters, intptr_t len); 6232 template RawString* String::NewSymbol(const uint32_t* characters, intptr_t len);
6264 6233
6265 6234
6266 RawString* String::NewSymbol(const String& str) { 6235 RawString* String::NewSymbol(const String& str) {
6236 if (str.IsSymbol()) {
6237 return str.raw();
6238 }
6267 return NewSymbol(str, 0, str.Length()); 6239 return NewSymbol(str, 0, str.Length());
6268 } 6240 }
6269 6241
6270 6242
6271 RawString* String::NewSymbol(const String& str, 6243 RawString* String::NewSymbol(const String& str,
6272 intptr_t begin_index, 6244 intptr_t begin_index,
6273 intptr_t len) { 6245 intptr_t len) {
6274 ASSERT(begin_index >= 0); 6246 ASSERT(begin_index >= 0);
6275 ASSERT(len >= 0); 6247 ASSERT(len >= 0);
6276 ASSERT((begin_index + len) <= str.Length()); 6248 ASSERT((begin_index + len) <= str.Length());
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
7333 const String& str = String::Handle(pattern()); 7305 const String& str = String::Handle(pattern());
7334 const char* format = "JSRegExp: pattern=%s flags=%s"; 7306 const char* format = "JSRegExp: pattern=%s flags=%s";
7335 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 7307 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
7336 char* chars = reinterpret_cast<char*>( 7308 char* chars = reinterpret_cast<char*>(
7337 Isolate::Current()->current_zone()->Allocate(len + 1)); 7309 Isolate::Current()->current_zone()->Allocate(len + 1));
7338 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 7310 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
7339 return chars; 7311 return chars;
7340 } 7312 }
7341 7313
7342 } // namespace dart 7314 } // namespace dart
OLDNEW
« no previous file with comments | « vm/object.h ('k') | vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698