| 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 8583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8594 } | 8594 } |
| 8595 ASSERT(Length() < Capacity()); | 8595 ASSERT(Length() < Capacity()); |
| 8596 intptr_t index = Length(); | 8596 intptr_t index = Length(); |
| 8597 SetLength(index + 1); | 8597 SetLength(index + 1); |
| 8598 contents.SetAt(index, value); | 8598 contents.SetAt(index, value); |
| 8599 } | 8599 } |
| 8600 | 8600 |
| 8601 | 8601 |
| 8602 void GrowableObjectArray::Grow(intptr_t new_capacity, Heap::Space space) const { | 8602 void GrowableObjectArray::Grow(intptr_t new_capacity, Heap::Space space) const { |
| 8603 ASSERT(new_capacity > Capacity()); | 8603 ASSERT(new_capacity > Capacity()); |
| 8604 Array& contents = Array::Handle(data()); | 8604 const Array& contents = Array::Handle(data()); |
| 8605 StorePointer(&(raw_ptr()->data_), | 8605 const Array& new_contents = |
| 8606 Array::Grow(contents, new_capacity, space)); | 8606 Array::Handle(Array::Grow(contents, new_capacity, space)); |
| 8607 StorePointer(&(raw_ptr()->data_), new_contents.raw()); |
| 8607 } | 8608 } |
| 8608 | 8609 |
| 8609 | 8610 |
| 8610 RawObject* GrowableObjectArray::RemoveLast() const { | 8611 RawObject* GrowableObjectArray::RemoveLast() const { |
| 8611 ASSERT(!IsNull()); | 8612 ASSERT(!IsNull()); |
| 8612 ASSERT(Length() > 0); | 8613 ASSERT(Length() > 0); |
| 8613 intptr_t index = Length() - 1; | 8614 intptr_t index = Length() - 1; |
| 8614 const Array& contents = Array::Handle(data()); | 8615 const Array& contents = Array::Handle(data()); |
| 8615 const Object& obj = Object::Handle(contents.At(index)); | 8616 const Object& obj = Object::Handle(contents.At(index)); |
| 8616 contents.SetAt(index, Object::Handle()); | 8617 contents.SetAt(index, Object::Handle()); |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9131 const String& str = String::Handle(pattern()); | 9132 const String& str = String::Handle(pattern()); |
| 9132 const char* format = "JSRegExp: pattern=%s flags=%s"; | 9133 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 9133 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 9134 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 9134 char* chars = reinterpret_cast<char*>( | 9135 char* chars = reinterpret_cast<char*>( |
| 9135 Isolate::Current()->current_zone()->Allocate(len + 1)); | 9136 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 9136 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 9137 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 9137 return chars; | 9138 return chars; |
| 9138 } | 9139 } |
| 9139 | 9140 |
| 9140 } // namespace dart | 9141 } // namespace dart |
| OLD | NEW |