| 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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 10137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10148 | 10148 |
| 10149 | 10149 |
| 10150 static RawArray* NewDictionary(intptr_t initial_size) { | 10150 static RawArray* NewDictionary(intptr_t initial_size) { |
| 10151 const Array& dict = Array::Handle(Array::New(initial_size + 1, Heap::kOld)); | 10151 const Array& dict = Array::Handle(Array::New(initial_size + 1, Heap::kOld)); |
| 10152 // The last element of the dictionary specifies the number of in use slots. | 10152 // The last element of the dictionary specifies the number of in use slots. |
| 10153 dict.SetAt(initial_size, Smi::Handle(Smi::New(0))); | 10153 dict.SetAt(initial_size, Smi::Handle(Smi::New(0))); |
| 10154 return dict.raw(); | 10154 return dict.raw(); |
| 10155 } | 10155 } |
| 10156 | 10156 |
| 10157 | 10157 |
| 10158 void Library::InitResolvedNamesCache(intptr_t size) const { | 10158 void Library::InitResolvedNamesCache(intptr_t size, |
| 10159 const Array& cache = Array::Handle(HashTables::New<ResolvedNamesMap>(size)); | 10159 SnapshotReader* reader) const { |
| 10160 StorePointer(&raw_ptr()->resolved_names_, cache.raw()); | 10160 if (reader == NULL) { |
| 10161 StorePointer(&raw_ptr()->resolved_names_, |
| 10162 HashTables::New<ResolvedNamesMap>(size)); |
| 10163 } else { |
| 10164 intptr_t len = ResolvedNamesMap::ArrayLengthForNumOccupied(size); |
| 10165 *reader->ArrayHandle() ^= reader->NewArray(len); |
| 10166 StorePointer(&raw_ptr()->resolved_names_, |
| 10167 HashTables::New<ResolvedNamesMap>(*reader->ArrayHandle())); |
| 10168 } |
| 10161 } | 10169 } |
| 10162 | 10170 |
| 10163 | 10171 |
| 10164 void Library::InitClassDictionary() const { | 10172 void Library::InitClassDictionary() const { |
| 10165 // TODO(iposva): Find reasonable initial size. | 10173 // TODO(iposva): Find reasonable initial size. |
| 10166 const int kInitialElementCount = 16; | 10174 const int kInitialElementCount = 16; |
| 10167 StorePointer(&raw_ptr()->dictionary_, NewDictionary(kInitialElementCount)); | 10175 StorePointer(&raw_ptr()->dictionary_, NewDictionary(kInitialElementCount)); |
| 10168 } | 10176 } |
| 10169 | 10177 |
| 10170 | 10178 |
| (...skipping 11929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22100 return tag_label.ToCString(); | 22108 return tag_label.ToCString(); |
| 22101 } | 22109 } |
| 22102 | 22110 |
| 22103 | 22111 |
| 22104 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 22112 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 22105 Instance::PrintJSONImpl(stream, ref); | 22113 Instance::PrintJSONImpl(stream, ref); |
| 22106 } | 22114 } |
| 22107 | 22115 |
| 22108 | 22116 |
| 22109 } // namespace dart | 22117 } // namespace dart |
| OLD | NEW |