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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/sh4/disasm-sh4.cc ('k') | src/sh4/frames-sh4.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2011-2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_X64_FRAMES_X64_H_ 28 #ifndef V8_SH4_FRAMES_SH4_H_
29 #define V8_X64_FRAMES_X64_H_ 29 #define V8_SH4_FRAMES_SH4_H_
30
31 #include "memory.h"
30 32
31 namespace v8 { 33 namespace v8 {
32 namespace internal { 34 namespace internal {
33 35
36
37 // Register lists
38 // Note that the bit values must match those used in actual instruction encoding
34 const int kNumRegs = 16; 39 const int kNumRegs = 16;
40
41
42 // Caller-saved registers
35 const RegList kJSCallerSaved = 43 const RegList kJSCallerSaved =
36 1 << 0 | // rax 44 1 << 0 | // r0
37 1 << 1 | // rcx 45 1 << 1 | // r1
38 1 << 2 | // rdx 46 1 << 2 | // r2
39 1 << 3 | // rbx - used as a caller-saved register in JavaScript code 47 1 << 3 | // r3
40 1 << 7; // rdi - callee function 48 1 << 4 | // r4
49 1 << 5 | // r5
50 1 << 6 | // r6
51 1 << 7; // r7
41 52
42 const int kNumJSCallerSaved = 5; 53 const int kNumJSCallerSaved = 8;
54
55 // Callee-saved registers preserved when switching from C to JavaScript
56 const RegList kCalleeSaved =
57 1 << 8 | // r8
58 1 << 9 | // r9
59 1 << 10 | // r10
60 1 << 11 | // r11
61 1 << 12 | // r12 (roots in JS)
62 1 << 13 | // r13 (cp in JS)
63 1 << 14; // r14 (fp in JS)
64
65 const int kNumCalleeSaved = 7;
66
43 67
44 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved]; 68 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved];
45 69
70
46 // Number of registers for which space is reserved in safepoints. 71 // Number of registers for which space is reserved in safepoints.
47 const int kNumSafepointRegisters = 16; 72 const int kNumSafepointRegisters = 16;
48 73
49 // ---------------------------------------------------- 74 // ----------------------------------------------------
50 75
76
51 class StackHandlerConstants : public AllStatic { 77 class StackHandlerConstants : public AllStatic {
52 public: 78 public:
53 static const int kNextOffset = 0 * kPointerSize; 79 static const int kNextOffset = 0 * kPointerSize;
54 static const int kCodeOffset = 1 * kPointerSize; 80 static const int kCodeOffset = 1 * kPointerSize;
55 static const int kStateOffset = 2 * kPointerSize; 81 static const int kStateOffset = 2 * kPointerSize;
56 static const int kContextOffset = 3 * kPointerSize; 82 static const int kContextOffset = 3 * kPointerSize;
57 static const int kFPOffset = 4 * kPointerSize; 83 static const int kFPOffset = 4 * kPointerSize;
58 84
59 static const int kSize = kFPOffset + kPointerSize; 85 static const int kSize = kFPOffset + kPointerSize;
60 }; 86 };
61 87
62 88
63 class EntryFrameConstants : public AllStatic { 89 class EntryFrameConstants : public AllStatic {
64 public: 90 public:
65 #ifdef _WIN64 91 static const int kCallerFPOffset = -3 * kPointerSize;
66 static const int kCallerFPOffset = -10 * kPointerSize;
67 #else
68 static const int kCallerFPOffset = -8 * kPointerSize;
69 #endif
70 static const int kArgvOffset = 6 * kPointerSize;
71 }; 92 };
72 93
73 94
74 class ExitFrameConstants : public AllStatic { 95 class ExitFrameConstants : public AllStatic {
75 public: 96 public:
76 static const int kCodeOffset = -2 * kPointerSize; 97 static const int kCodeOffset = -2 * kPointerSize;
77 static const int kSPOffset = -1 * kPointerSize; 98 static const int kSPOffset = -1 * kPointerSize;
78 99
79 static const int kCallerFPOffset = +0 * kPointerSize; 100 // The caller fields are below the frame pointer on the stack.
80 static const int kCallerPCOffset = +1 * kPointerSize; 101 static const int kCallerFPOffset = 0 * kPointerSize;
102 // The calling JS function is below FP.
103 static const int kCallerPCOffset = 1 * kPointerSize;
81 104
82 // FP-relative displacement of the caller's SP. It points just 105 // FP-relative displacement of the caller's SP. It points just
83 // below the saved PC. 106 // below the saved PC.
84 static const int kCallerSPDisplacement = +2 * kPointerSize; 107 static const int kCallerSPDisplacement = 2 * kPointerSize;
85 }; 108 };
86 109
87 110
88 class StandardFrameConstants : public AllStatic { 111 class StandardFrameConstants : public AllStatic {
89 public: 112 public:
90 // Fixed part of the frame consists of return address, caller fp, 113 // Fixed part of the frame consists of return address, caller fp,
91 // context and function. 114 // context and function.
92 static const int kFixedFrameSize = 4 * kPointerSize; 115 static const int kFixedFrameSize = 4 * kPointerSize;
93 static const int kExpressionsOffset = -3 * kPointerSize; 116 static const int kExpressionsOffset = -3 * kPointerSize;
94 static const int kMarkerOffset = -2 * kPointerSize; 117 static const int kMarkerOffset = -2 * kPointerSize;
95 static const int kContextOffset = -1 * kPointerSize; 118 static const int kContextOffset = -1 * kPointerSize;
96 static const int kCallerFPOffset = 0 * kPointerSize; 119 static const int kCallerFPOffset = 0 * kPointerSize;
97 static const int kCallerPCOffset = +1 * kPointerSize; 120 static const int kCallerPCOffset = 1 * kPointerSize;
98 static const int kCallerSPOffset = +2 * kPointerSize; 121 static const int kCallerSPOffset = 2 * kPointerSize;
99 }; 122 };
100 123
101 124
102 class JavaScriptFrameConstants : public AllStatic { 125 class JavaScriptFrameConstants : public AllStatic {
103 public: 126 public:
104 // FP-relative. 127 // FP-relative.
105 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset; 128 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
106 static const int kLastParameterOffset = +2 * kPointerSize; 129 static const int kLastParameterOffset = +2 * kPointerSize;
107 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset; 130 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;
108 131
(...skipping 15 matching lines...) Expand all
124 public: 147 public:
125 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; 148 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
126 }; 149 };
127 150
128 151
129 inline Object* JavaScriptFrame::function_slot_object() const { 152 inline Object* JavaScriptFrame::function_slot_object() const {
130 const int offset = JavaScriptFrameConstants::kFunctionOffset; 153 const int offset = JavaScriptFrameConstants::kFunctionOffset;
131 return Memory::Object_at(fp() + offset); 154 return Memory::Object_at(fp() + offset);
132 } 155 }
133 156
157
134 } } // namespace v8::internal 158 } } // namespace v8::internal
135 159
136 #endif // V8_X64_FRAMES_X64_H_ 160 #endif // V8_SH4_FRAMES_SH4_H_
OLDNEW
« 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