Chromium Code Reviews| Index: vm/object.cc |
| =================================================================== |
| --- vm/object.cc (revision 3975) |
| +++ vm/object.cc (working copy) |
| @@ -4000,6 +4000,11 @@ |
| } |
| +void Library::set_import_map(const Array& map) const { |
| + StorePointer(&raw_ptr()->import_map_, map.raw()); |
| +} |
| + |
| + |
| void Library::SetName(const String& name) const { |
| // Only set name once. |
| ASSERT(!Loaded()); |
| @@ -4469,6 +4474,23 @@ |
| } |
| +RawString* Library::LookupImportMap(const String& ident) const { |
| + Array& import_map = Array::Handle(this->import_map()); |
| + intptr_t length = import_map.Length(); |
| + intptr_t index = 0; |
| + String& name = String::Handle(); |
| + while (index < (length - 1)) { |
| + name ^= import_map.At(index); |
| + if (name.Equals(ident)) { |
| + name ^= import_map.At(index + 1); |
| + return name.raw(); |
| + } |
| + index += 2; |
| + } |
| + return String::null(); |
| +} |
| + |
| + |
| void Library::AddImport(const Library& library) const { |
| Array& imports = Array::Handle(this->imports()); |
| intptr_t capacity = imports.Length(); |
| @@ -4544,6 +4566,7 @@ |
| result.raw_ptr()->dictionary_ = Array::Empty(); |
| result.raw_ptr()->anonymous_classes_ = Array::Empty(); |
| result.raw_ptr()->num_anonymous_ = 0; |
| + result.raw_ptr()->import_map_ = Array::Empty(); |
|
hausner
2012/02/08 18:28:47
I don't see that this field is written to the snap
siva
2012/02/08 23:23:47
The field is written out in a snapshot (all object
|
| result.raw_ptr()->imports_ = Array::Empty(); |
| result.raw_ptr()->next_registered_ = Library::null(); |
| result.raw_ptr()->loaded_scripts_ = Array::null(); |