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

Unified Diff: src/ppc/cpu-ppc.cc

Issue 422063005: Contribution of PowerPC port. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: re-upload - catch up to 8/19 level Created 6 years, 4 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/ppc/cpu-ppc.cc
diff --git a/src/ppc/cpu-ppc.cc b/src/ppc/cpu-ppc.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7f2ecf54ba36b448654da7f9b4e4ffa3e5966d8b
--- /dev/null
+++ b/src/ppc/cpu-ppc.cc
@@ -0,0 +1,55 @@
+// Copyright 2006-2009 the V8 project authors. All rights reserved.
+//
+// Copyright IBM Corp. 2012, 2013. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// CPU specific code for ppc independent of OS goes here.
+#include "src/v8.h"
+
+#if V8_TARGET_ARCH_PPC
+
+#include "src/assembler.h"
+#include "src/macro-assembler.h"
+#include "src/simulator.h" // for cache flushing.
+
+namespace v8 {
+namespace internal {
+
+void CpuFeatures::FlushICache(void* buffer, size_t size) {
+ // Nothing to do flushing no instructions.
+ if (size == 0) {
+ return;
+ }
+
+#if defined(USE_SIMULATOR)
+ // Not generating PPC instructions for C-code. This means that we are
+ // building an PPC emulator based target. We should notify the simulator
+ // that the Icache was flushed.
+ // None of this code ends up in the snapshot so there are no issues
+ // around whether or not to generate the code when building snapshots.
+ Simulator::FlushICache(Isolate::Current()->simulator_i_cache(), buffer, size);
+#else
+
+ const int kCacheLineSize = CpuFeatures::cache_line_size();
+ intptr_t mask = kCacheLineSize - 1;
+ byte *start =
+ reinterpret_cast<byte *>(reinterpret_cast<intptr_t>(buffer) & ~mask);
+ byte *end = static_cast<byte *>(buffer) + size;
+ for (byte *pointer = start; pointer < end; pointer += kCacheLineSize) {
+ __asm__(
+ "dcbf 0, %0 \n"
+ "sync \n"
+ "icbi 0, %0 \n"
+ "isync \n"
+ : /* no output */
+ : "r"(pointer));
+ }
+
+#endif // USE_SIMULATOR
+}
+}
+} // namespace v8::internal
+
+#endif // V8_TARGET_ARCH_PPC
« src/hydrogen-bch.cc ('K') | « src/ppc/constants-ppc.cc ('k') | src/ppc/debug-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698