Index: src/ppc/simulator-ppc.cc |
diff --git a/src/ppc/simulator-ppc.cc b/src/ppc/simulator-ppc.cc |
index 7139ead2134aff860c657c7099d347b62a884f8d..31fcc9e6cdb48a62e964454f13f4b7478c699191 100644 |
--- a/src/ppc/simulator-ppc.cc |
+++ b/src/ppc/simulator-ppc.cc |
@@ -830,7 +830,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 |
@@ -888,6 +888,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_; |
@@ -896,6 +904,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); |