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

Unified Diff: src/sh4/frames-sh4.h

Issue 11275184: First draft of the sh4 port Base URL: http://github.com/v8/v8.git@master
Patch Set: Use GYP and fixe some typos Created 8 years, 1 month 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/sh4/disasm-sh4.cc ('k') | src/sh4/frames-sh4.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/sh4/frames-sh4.h
diff --git a/src/x64/frames-x64.h b/src/sh4/frames-sh4.h
similarity index 73%
copy from src/x64/frames-x64.h
copy to src/sh4/frames-sh4.h
index 3e3d63d62b917f4c2547dd353cbeec6b7128ef9e..79d7e633b41ee0c5a06d0fdb6963d15f3f199ed2 100644
--- a/src/x64/frames-x64.h
+++ b/src/sh4/frames-sh4.h
@@ -1,4 +1,4 @@
-// Copyright 2012 the V8 project authors. All rights reserved.
+// Copyright 2011-2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -25,29 +25,55 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef V8_X64_FRAMES_X64_H_
-#define V8_X64_FRAMES_X64_H_
+#ifndef V8_SH4_FRAMES_SH4_H_
+#define V8_SH4_FRAMES_SH4_H_
+
+#include "memory.h"
namespace v8 {
namespace internal {
+
+// Register lists
+// Note that the bit values must match those used in actual instruction encoding
const int kNumRegs = 16;
+
+
+// Caller-saved registers
const RegList kJSCallerSaved =
- 1 << 0 | // rax
- 1 << 1 | // rcx
- 1 << 2 | // rdx
- 1 << 3 | // rbx - used as a caller-saved register in JavaScript code
- 1 << 7; // rdi - callee function
+ 1 << 0 | // r0
+ 1 << 1 | // r1
+ 1 << 2 | // r2
+ 1 << 3 | // r3
+ 1 << 4 | // r4
+ 1 << 5 | // r5
+ 1 << 6 | // r6
+ 1 << 7; // r7
+
+const int kNumJSCallerSaved = 8;
+
+// Callee-saved registers preserved when switching from C to JavaScript
+const RegList kCalleeSaved =
+ 1 << 8 | // r8
+ 1 << 9 | // r9
+ 1 << 10 | // r10
+ 1 << 11 | // r11
+ 1 << 12 | // r12 (roots in JS)
+ 1 << 13 | // r13 (cp in JS)
+ 1 << 14; // r14 (fp in JS)
+
+const int kNumCalleeSaved = 7;
-const int kNumJSCallerSaved = 5;
typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved];
+
// Number of registers for which space is reserved in safepoints.
const int kNumSafepointRegisters = 16;
// ----------------------------------------------------
+
class StackHandlerConstants : public AllStatic {
public:
static const int kNextOffset = 0 * kPointerSize;
@@ -62,26 +88,23 @@ class StackHandlerConstants : public AllStatic {
class EntryFrameConstants : public AllStatic {
public:
-#ifdef _WIN64
- static const int kCallerFPOffset = -10 * kPointerSize;
-#else
- static const int kCallerFPOffset = -8 * kPointerSize;
-#endif
- static const int kArgvOffset = 6 * kPointerSize;
+ static const int kCallerFPOffset = -3 * kPointerSize;
};
class ExitFrameConstants : public AllStatic {
public:
- static const int kCodeOffset = -2 * kPointerSize;
- static const int kSPOffset = -1 * kPointerSize;
+ static const int kCodeOffset = -2 * kPointerSize;
+ static const int kSPOffset = -1 * kPointerSize;
- static const int kCallerFPOffset = +0 * kPointerSize;
- static const int kCallerPCOffset = +1 * kPointerSize;
+ // The caller fields are below the frame pointer on the stack.
+ static const int kCallerFPOffset = 0 * kPointerSize;
+ // The calling JS function is below FP.
+ static const int kCallerPCOffset = 1 * kPointerSize;
// FP-relative displacement of the caller's SP. It points just
// below the saved PC.
- static const int kCallerSPDisplacement = +2 * kPointerSize;
+ static const int kCallerSPDisplacement = 2 * kPointerSize;
};
@@ -94,8 +117,8 @@ class StandardFrameConstants : public AllStatic {
static const int kMarkerOffset = -2 * kPointerSize;
static const int kContextOffset = -1 * kPointerSize;
static const int kCallerFPOffset = 0 * kPointerSize;
- static const int kCallerPCOffset = +1 * kPointerSize;
- static const int kCallerSPOffset = +2 * kPointerSize;
+ static const int kCallerPCOffset = 1 * kPointerSize;
+ static const int kCallerSPOffset = 2 * kPointerSize;
};
@@ -131,6 +154,7 @@ inline Object* JavaScriptFrame::function_slot_object() const {
return Memory::Object_at(fp() + offset);
}
+
} } // namespace v8::internal
-#endif // V8_X64_FRAMES_X64_H_
+#endif // V8_SH4_FRAMES_SH4_H_
« no previous file with comments | « src/sh4/disasm-sh4.cc ('k') | src/sh4/frames-sh4.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698