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

Side by Side Diff: runtime/vm/kernel_reader.h

Issue 2658693002: Removed usage of std::map and std::vector from kernel code. Issue #28064. (Closed)
Patch Set: Removed usage of std::map and std::vector from kernel code. Issue #28064. Created 3 years, 10 months 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
« no previous file with comments | « runtime/vm/kernel_binary.cc ('k') | runtime/vm/kernel_to_il.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 #ifndef RUNTIME_VM_KERNEL_READER_H_ 5 #ifndef RUNTIME_VM_KERNEL_READER_H_
6 #define RUNTIME_VM_KERNEL_READER_H_ 6 #define RUNTIME_VM_KERNEL_READER_H_
7 7
8 #if !defined(DART_PRECOMPILED_RUNTIME) 8 #if !defined(DART_PRECOMPILED_RUNTIME)
9 #include <map> 9 #include <map>
10 10
(...skipping 16 matching lines...) Expand all
27 virtual RawClass* LookupClassByKernelClass(Class* klass); 27 virtual RawClass* LookupClassByKernelClass(Class* klass);
28 28
29 private: 29 private:
30 KernelReader* reader_; 30 KernelReader* reader_;
31 }; 31 };
32 32
33 template <typename KernelType, typename VmType> 33 template <typename KernelType, typename VmType>
34 class Mapping { 34 class Mapping {
35 public: 35 public:
36 bool Lookup(KernelType* node, VmType** handle) { 36 bool Lookup(KernelType* node, VmType** handle) {
37 typename MapType::iterator value = map_.find(node); 37 typename MapType::Pair* pair = map_.LookupPair(node);
38 if (value != map_.end()) { 38 if (pair != NULL) {
39 *handle = value->second; 39 *handle = pair->value;
40 return true; 40 return true;
41 } 41 }
42 return false; 42 return false;
43 } 43 }
44 44
45 void Insert(KernelType* node, VmType* object) { map_[node] = object; } 45 void Insert(KernelType* node, VmType* object) { map_.Insert(node, object); }
46 46
47 private: 47 private:
48 typedef typename std::map<KernelType*, VmType*> MapType; 48 typedef MallocMap<KernelType, VmType*> MapType;
49 MapType map_; 49 MapType map_;
50 }; 50 };
51 51
52 class KernelReader { 52 class KernelReader {
53 public: 53 public:
54 explicit KernelReader(Program* program); 54 explicit KernelReader(Program* program);
55 55
56 // Returns either a library or a failure object. 56 // Returns either a library or a failure object.
57 dart::Object& ReadProgram(); 57 dart::Object& ReadProgram();
58 58
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 Mapping<Library, dart::Library> libraries_; 110 Mapping<Library, dart::Library> libraries_;
111 Mapping<Class, dart::Class> classes_; 111 Mapping<Class, dart::Class> classes_;
112 }; 112 };
113 113
114 } // namespace kernel 114 } // namespace kernel
115 } // namespace dart 115 } // namespace dart
116 116
117 #endif // !defined(DART_PRECOMPILED_RUNTIME) 117 #endif // !defined(DART_PRECOMPILED_RUNTIME)
118 #endif // RUNTIME_VM_KERNEL_READER_H_ 118 #endif // RUNTIME_VM_KERNEL_READER_H_
OLDNEW
« no previous file with comments | « runtime/vm/kernel_binary.cc ('k') | runtime/vm/kernel_to_il.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698