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

Unified Diff: runtime/vm/kernel_reader.h

Issue 2853423002: Move the Kernel canonical name table into the VM's heap (Closed)
Patch Set: Merge a bugfix Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/kernel_reader.h
diff --git a/runtime/vm/kernel_reader.h b/runtime/vm/kernel_reader.h
index 4b54010d2cbe7971a0a683aa3b3ff1c0f0063e4d..dba71cba1a55ca3e538bbf577166b6d46ed79c3c 100644
--- a/runtime/vm/kernel_reader.h
+++ b/runtime/vm/kernel_reader.h
@@ -23,18 +23,18 @@ class BuildingTranslationHelper : public TranslationHelper {
: TranslationHelper(thread), reader_(reader) {}
virtual ~BuildingTranslationHelper() {}
- virtual RawLibrary* LookupLibraryByKernelLibrary(CanonicalName* library);
- virtual RawClass* LookupClassByKernelClass(CanonicalName* klass);
+ virtual RawLibrary* LookupLibraryByKernelLibrary(intptr_t library);
+ virtual RawClass* LookupClassByKernelClass(intptr_t klass);
private:
KernelReader* reader_;
};
-template <typename KernelType, typename VmType>
+template <typename VmType>
class Mapping {
public:
- bool Lookup(KernelType* node, VmType** handle) {
- typename MapType::Pair* pair = map_.LookupPair(node);
+ bool Lookup(intptr_t canonical_name, VmType** handle) {
+ typename MapType::Pair* pair = map_.LookupPair(canonical_name);
if (pair != NULL) {
*handle = pair->value;
return true;
@@ -42,10 +42,12 @@ class Mapping {
return false;
}
- void Insert(KernelType* node, VmType* object) { map_.Insert(node, object); }
+ void Insert(intptr_t canonical_name, VmType* object) {
+ map_.Insert(canonical_name, object);
+ }
private:
- typedef MallocMap<KernelType, VmType*> MapType;
+ typedef IntMap<VmType*> MapType;
MapType map_;
};
@@ -101,8 +103,8 @@ class KernelReader {
void SetupFieldAccessorFunction(const dart::Class& klass,
const dart::Function& function);
- dart::Library& LookupLibrary(CanonicalName* library);
- dart::Class& LookupClass(CanonicalName* klass);
+ dart::Library& LookupLibrary(intptr_t library);
+ dart::Class& LookupClass(intptr_t klass);
dart::RawFunction::Kind GetFunctionType(Procedure* kernel_procedure);
@@ -116,8 +118,8 @@ class KernelReader {
BuildingTranslationHelper translation_helper_;
DartTypeTranslator type_translator_;
- Mapping<CanonicalName, dart::Library> libraries_;
- Mapping<CanonicalName, dart::Class> classes_;
+ Mapping<dart::Library> libraries_;
+ Mapping<dart::Class> classes_;
GrowableArray<const dart::Function*> functions_;
GrowableArray<const dart::Field*> fields_;

Powered by Google App Engine
This is Rietveld 408576698