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

Unified Diff: src/wasm/wasm-interpreter.cc

Issue 2055803002: [wasm] Fix CFI failures due to Wasm threads. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « src/wasm/wasm-interpreter.h ('k') | test/cctest/wasm/test-run-wasm-interpreter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-interpreter.cc
diff --git a/src/wasm/wasm-interpreter.cc b/src/wasm/wasm-interpreter.cc
index 95e10097c0b59cda1fe555618a333cf9ff2787ff..fc727801b983555a21f2992b3676eb92f59f648d 100644
--- a/src/wasm/wasm-interpreter.cc
+++ b/src/wasm/wasm-interpreter.cc
@@ -1675,13 +1675,19 @@ class WasmInterpreterInternals : public ZoneObject {
public:
WasmModuleInstance* instance_;
CodeMap codemap_;
- ZoneVector<ThreadImpl> threads_;
+ ZoneVector<ThreadImpl*> threads_;
WasmInterpreterInternals(Zone* zone, WasmModuleInstance* instance)
: instance_(instance),
codemap_(instance_ ? instance_->module : nullptr, zone),
threads_(zone) {
- threads_.push_back(ThreadImpl(zone, &codemap_, instance));
+ threads_.push_back(new ThreadImpl(zone, &codemap_, instance));
+ }
+
+ void Delete() {
+ // TODO(titzer): CFI doesn't like threads in the ZoneVector.
+ for (auto t : threads_) delete t;
+ threads_.resize(0);
}
};
@@ -1693,11 +1699,11 @@ WasmInterpreter::WasmInterpreter(WasmModuleInstance* instance,
: zone_(allocator),
internals_(new (&zone_) WasmInterpreterInternals(&zone_, instance)) {}
-WasmInterpreter::~WasmInterpreter() {}
+WasmInterpreter::~WasmInterpreter() { internals_->Delete(); }
ahaas 2016/06/09 14:07:17 I wonder if it would be useful to use a SmartPoint
-void WasmInterpreter::Run() { internals_->threads_[0].Run(); }
+void WasmInterpreter::Run() { internals_->threads_[0]->Run(); }
-void WasmInterpreter::Pause() { internals_->threads_[0].Pause(); }
+void WasmInterpreter::Pause() { internals_->threads_[0]->Pause(); }
bool WasmInterpreter::SetBreakpoint(const WasmFunction* function, pc_t pc,
bool enabled) {
@@ -1740,7 +1746,7 @@ int WasmInterpreter::GetThreadCount() {
return 1; // only one thread for now.
}
-WasmInterpreter::Thread& WasmInterpreter::GetThread(int id) {
+WasmInterpreter::Thread* WasmInterpreter::GetThread(int id) {
CHECK_EQ(0, id); // only one thread for now.
return internals_->threads_[id];
}
« no previous file with comments | « src/wasm/wasm-interpreter.h ('k') | test/cctest/wasm/test-run-wasm-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698