| 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 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 return; | 1179 return; |
| 1180 } | 1180 } |
| 1181 StorePointer(&raw_ptr()->interfaces_, Object::empty_array()); | 1181 StorePointer(&raw_ptr()->interfaces_, Object::empty_array()); |
| 1182 StorePointer(&raw_ptr()->constants_, Object::empty_array()); | 1182 StorePointer(&raw_ptr()->constants_, Object::empty_array()); |
| 1183 StorePointer(&raw_ptr()->canonical_types_, Object::empty_array()); | 1183 StorePointer(&raw_ptr()->canonical_types_, Object::empty_array()); |
| 1184 StorePointer(&raw_ptr()->functions_, Object::empty_array()); | 1184 StorePointer(&raw_ptr()->functions_, Object::empty_array()); |
| 1185 StorePointer(&raw_ptr()->fields_, Object::empty_array()); | 1185 StorePointer(&raw_ptr()->fields_, Object::empty_array()); |
| 1186 } | 1186 } |
| 1187 | 1187 |
| 1188 | 1188 |
| 1189 void Class::InitFunctionsCache() const { | |
| 1190 // TODO(srdjan): Make functions_cache growable and start with smaller size. | |
| 1191 StorePointer(&raw_ptr()->functions_cache_, | |
| 1192 Array::New(FunctionsCache::kNumEntries * 32, Heap::kOld)); | |
| 1193 } | |
| 1194 | |
| 1195 | |
| 1196 bool Class::HasInstanceFields() const { | 1189 bool Class::HasInstanceFields() const { |
| 1197 const Array& field_array = Array::Handle(fields()); | 1190 const Array& field_array = Array::Handle(fields()); |
| 1198 Field& field = Field::Handle(); | 1191 Field& field = Field::Handle(); |
| 1199 for (intptr_t i = 0; i < field_array.Length(); ++i) { | 1192 for (intptr_t i = 0; i < field_array.Length(); ++i) { |
| 1200 field ^= field_array.At(i); | 1193 field ^= field_array.At(i); |
| 1201 if (!field.is_static()) { | 1194 if (!field.is_static()) { |
| 1202 return true; | 1195 return true; |
| 1203 } | 1196 } |
| 1204 } | 1197 } |
| 1205 return false; | 1198 return false; |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1673 } | 1666 } |
| 1674 | 1667 |
| 1675 | 1668 |
| 1676 void Class::set_interfaces(const Array& value) const { | 1669 void Class::set_interfaces(const Array& value) const { |
| 1677 // Verification and resolving of interfaces occurs in finalizer. | 1670 // Verification and resolving of interfaces occurs in finalizer. |
| 1678 ASSERT(!value.IsNull()); | 1671 ASSERT(!value.IsNull()); |
| 1679 StorePointer(&raw_ptr()->interfaces_, value.raw()); | 1672 StorePointer(&raw_ptr()->interfaces_, value.raw()); |
| 1680 } | 1673 } |
| 1681 | 1674 |
| 1682 | 1675 |
| 1683 void Class::set_functions_cache(const Array& value) const { | |
| 1684 ASSERT(!value.IsNull()); | |
| 1685 StorePointer(&raw_ptr()->functions_cache_, value.raw()); | |
| 1686 } | |
| 1687 | |
| 1688 | |
| 1689 RawArray* Class::constants() const { | 1676 RawArray* Class::constants() const { |
| 1690 return raw_ptr()->constants_; | 1677 return raw_ptr()->constants_; |
| 1691 } | 1678 } |
| 1692 | 1679 |
| 1693 void Class::set_constants(const Array& value) const { | 1680 void Class::set_constants(const Array& value) const { |
| 1694 ASSERT(!value.IsNull()); | 1681 ASSERT(!value.IsNull()); |
| 1695 StorePointer(&raw_ptr()->constants_, value.raw()); | 1682 StorePointer(&raw_ptr()->constants_, value.raw()); |
| 1696 } | 1683 } |
| 1697 | 1684 |
| 1698 | 1685 |
| (...skipping 9342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11041 const char* JSRegExp::ToCString() const { | 11028 const char* JSRegExp::ToCString() const { |
| 11042 const String& str = String::Handle(pattern()); | 11029 const String& str = String::Handle(pattern()); |
| 11043 const char* format = "JSRegExp: pattern=%s flags=%s"; | 11030 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 11044 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 11031 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 11045 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); | 11032 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); |
| 11046 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 11033 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 11047 return chars; | 11034 return chars; |
| 11048 } | 11035 } |
| 11049 | 11036 |
| 11050 } // namespace dart | 11037 } // namespace dart |
| OLD | NEW |