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

Unified Diff: src/assembler.h

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: Make serializer aware of new methods 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
Index: src/assembler.h
diff --git a/src/assembler.h b/src/assembler.h
index a4c19e6b027bbfdddc97bdec2dd5ab02addce19d..244766bbdf95644d207e4053a3f65068525c7576 100644
--- a/src/assembler.h
+++ b/src/assembler.h
@@ -51,6 +51,59 @@ namespace internal {
// Forward declarations.
class StatsCounter;
+
+// CpuFeatures keeps track of which features are supported by the target CPU.
+// Supported features must be enabled by a CpuFeatureScope before use.
+// Example:
+// if (assembler->IsSupported(SSE3)) {
+// CpuFeatureScope fscope(assembler, SSE3);
+// // Generate code containing SSE3 instructions.
+// } else {
+// // Generate alternative code.
+// }
+class CpuFeatures : public AllStatic {
+ public:
+ static void Probe(bool cross_compile) {
+ STATIC_ASSERT(NUMBER_OF_CPU_FEATURES <= kBitsPerInt);
+ if (initialized_) return;
+ initialized_ = true;
+ ProbeImpl(cross_compile);
+ }
+
+ static unsigned SupportedFeatures() {
+ Probe(false);
+ return supported_;
+ }
+
+ static bool IsSupported(CpuFeature f) {
+ return (supported_ & (1u << f)) != 0;
+ }
+
+ static inline bool SupportsCrankshaft();
+
+ static inline unsigned cache_line_size() {
+ DCHECK(cache_line_size_ != 0);
+ return cache_line_size_;
+ }
+
+ static void PrintTarget();
+ static void PrintFeatures();
+
+ // Flush instruction cache.
+ static void FlushICache(void* start, size_t size);
+
+ private:
+ // Platform-dependent implementation.
+ static void ProbeImpl(bool cross_compile);
+
+ static unsigned supported_;
+ static unsigned cache_line_size_;
+ static bool initialized_;
+ friend class ExternalReference;
+ DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
+};
+
+
// -----------------------------------------------------------------------------
// Platform independent assembler base class.
@@ -102,6 +155,11 @@ class AssemblerBase: public Malloced {
static const int kMinimalBufferSize = 4*KB;
protected:
+ static void FlushICache(Isolate* isolate, void* start, size_t size);
+
+ // TODO(all): Help get rid of this one.
+ static void FlushICacheWithoutIsolate(void* start, size_t size);
+
// The buffer into which code and relocation info are generated. It could
// either be owned by the assembler or be provided externally.
byte* buffer_;
@@ -187,58 +245,6 @@ class CpuFeatureScope BASE_EMBEDDED {
};
-// CpuFeatures keeps track of which features are supported by the target CPU.
-// Supported features must be enabled by a CpuFeatureScope before use.
-// Example:
-// if (assembler->IsSupported(SSE3)) {
-// CpuFeatureScope fscope(assembler, SSE3);
-// // Generate code containing SSE3 instructions.
-// } else {
-// // Generate alternative code.
-// }
-class CpuFeatures : public AllStatic {
- public:
- static void Probe(bool cross_compile) {
- STATIC_ASSERT(NUMBER_OF_CPU_FEATURES <= kBitsPerInt);
- if (initialized_) return;
- initialized_ = true;
- ProbeImpl(cross_compile);
- }
-
- static unsigned SupportedFeatures() {
- Probe(false);
- return supported_;
- }
-
- static bool IsSupported(CpuFeature f) {
- return (supported_ & (1u << f)) != 0;
- }
-
- static inline bool SupportsCrankshaft();
-
- static inline unsigned cache_line_size() {
- DCHECK(cache_line_size_ != 0);
- return cache_line_size_;
- }
-
- static void PrintTarget();
- static void PrintFeatures();
-
- // Flush instruction cache.
- static void FlushICache(void* start, size_t size);
-
- private:
- // Platform-dependent implementation.
- static void ProbeImpl(bool cross_compile);
-
- static unsigned supported_;
- static unsigned cache_line_size_;
- static bool initialized_;
- friend class ExternalReference;
- DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
-};
-
-
// -----------------------------------------------------------------------------
// Labels represent pc locations; they are typically jump or call targets.
// After declaration, a label can be freely used to denote known or (yet)
« no previous file with comments | « src/arm64/simulator-arm64.h ('k') | src/assembler.cc » ('j') | src/assembler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698