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

Unified Diff: src/assembler.cc

Issue 1332283002: Make FlushICache part of Assembler(Base) and take Isolate as parameter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm64 PatchingAssembler that initialized its isolate with NULL :) Created 5 years, 3 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/assembler.h ('k') | src/deoptimizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/assembler.cc
diff --git a/src/assembler.cc b/src/assembler.cc
index aabc64ba5c71ba8ef6f5bcc1c991666c787d6ab7..e2e10248946577fba6c0663d0b9773e967e5b70f 100644
--- a/src/assembler.cc
+++ b/src/assembler.cc
@@ -54,6 +54,7 @@
#include "src/regexp/regexp-macro-assembler.h"
#include "src/regexp/regexp-stack.h"
#include "src/runtime/runtime.h"
+#include "src/simulator.h" // For flushing instruction cache.
#include "src/snapshot/serialize.h"
#include "src/token.h"
@@ -155,6 +156,31 @@ AssemblerBase::~AssemblerBase() {
}
+void AssemblerBase::FlushICache(Isolate* isolate, void* start, size_t size) {
+ if (size == 0) return;
+ if (CpuFeatures::IsSupported(COHERENT_CACHE)) return;
+
+#if defined(USE_SIMULATOR)
+ Simulator::FlushICache(isolate->simulator_i_cache(), start, size);
+#else
+ CpuFeatures::FlushICache(start, size);
+#endif // USE_SIMULATOR
+}
+
+
+void AssemblerBase::FlushICacheWithoutIsolate(void* start, size_t size) {
+ // Ideally we would just call Isolate::Current() here. However, this flushes
+ // out issues because we usually only need the isolate when in the simulator.
+ Isolate* isolate;
+#if defined(USE_SIMULATOR)
+ isolate = Isolate::Current();
+#else
+ isolate = nullptr;
+#endif // USE_SIMULATOR
+ FlushICache(isolate, start, size);
+}
+
+
// -----------------------------------------------------------------------------
// Implementation of PredictableCodeSizeScope
@@ -1024,7 +1050,7 @@ ExternalReference ExternalReference::
ExternalReference ExternalReference::flush_icache_function(Isolate* isolate) {
return ExternalReference(
- Redirect(isolate, FUNCTION_ADDR(CpuFeatures::FlushICache)));
+ Redirect(isolate, FUNCTION_ADDR(Assembler::FlushICacheWithoutIsolate)));
}
« no previous file with comments | « src/assembler.h ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698