Index: src/arm/simulator-arm.cc |
diff --git a/src/arm/simulator-arm.cc b/src/arm/simulator-arm.cc |
index ca9a0a894727829d8d70efd008f9a445446fceba..97d6127cb7fb114df1bdaa1cde72622978847b7d 100644 |
--- a/src/arm/simulator-arm.cc |
+++ b/src/arm/simulator-arm.cc |
@@ -774,8 +774,7 @@ Simulator::Simulator(Isolate* isolate) : isolate_(isolate) { |
} |
-Simulator::~Simulator() { |
-} |
+Simulator::~Simulator() { free(stack_); } |
// When the generated code calls an external reference we need to catch that in |
@@ -834,6 +833,14 @@ class Redirection { |
return redirection->external_function(); |
} |
+ static void DeleteChain(Redirection* redirection) { |
+ while (redirection != nullptr) { |
+ Redirection* next = redirection->next_; |
+ delete redirection; |
+ redirection = next; |
+ } |
+ } |
+ |
private: |
void* external_function_; |
uint32_t swi_instruction_; |
@@ -842,6 +849,19 @@ class Redirection { |
}; |
+// static |
+void Simulator::TearDown(HashMap* i_cache, Redirection* first) { |
+ Redirection::DeleteChain(first); |
+ if (i_cache != nullptr) { |
+ for (HashMap::Entry* entry = i_cache->Start(); entry != nullptr; |
+ entry = i_cache->Next(entry)) { |
+ delete static_cast<CachePage*>(entry->value); |
+ } |
+ delete i_cache; |
+ } |
+} |
+ |
+ |
void* Simulator::RedirectExternalReference(void* external_function, |
ExternalReference::Type type) { |
Redirection* redirection = Redirection::Get(external_function, type); |