OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
(...skipping 17 matching lines...) Expand all Loading... |
28 #ifndef V8_ARM_FRAMES_ARM_H_ | 28 #ifndef V8_ARM_FRAMES_ARM_H_ |
29 #define V8_ARM_FRAMES_ARM_H_ | 29 #define V8_ARM_FRAMES_ARM_H_ |
30 | 30 |
31 namespace v8 { | 31 namespace v8 { |
32 namespace internal { | 32 namespace internal { |
33 | 33 |
34 | 34 |
35 // The ARM ABI does not specify the usage of register r9, which may be reserved | 35 // The ARM ABI does not specify the usage of register r9, which may be reserved |
36 // as the static base or thread register on some platforms, in which case we | 36 // as the static base or thread register on some platforms, in which case we |
37 // leave it alone. Adjust the value of kR9Available accordingly: | 37 // leave it alone. Adjust the value of kR9Available accordingly: |
38 static const int kR9Available = 1; // 1 if available to us, 0 if reserved | 38 const int kR9Available = 1; // 1 if available to us, 0 if reserved |
39 | 39 |
40 | 40 |
41 // Register list in load/store instructions | 41 // Register list in load/store instructions |
42 // Note that the bit values must match those used in actual instruction encoding | 42 // Note that the bit values must match those used in actual instruction encoding |
43 static const int kNumRegs = 16; | 43 const int kNumRegs = 16; |
44 | 44 |
45 | 45 |
46 // Caller-saved/arguments registers | 46 // Caller-saved/arguments registers |
47 static const RegList kJSCallerSaved = | 47 const RegList kJSCallerSaved = |
48 1 << 0 | // r0 a1 | 48 1 << 0 | // r0 a1 |
49 1 << 1 | // r1 a2 | 49 1 << 1 | // r1 a2 |
50 1 << 2 | // r2 a3 | 50 1 << 2 | // r2 a3 |
51 1 << 3; // r3 a4 | 51 1 << 3; // r3 a4 |
52 | 52 |
53 static const int kNumJSCallerSaved = 4; | 53 const int kNumJSCallerSaved = 4; |
54 | 54 |
55 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved]; | 55 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved]; |
56 | 56 |
57 // Return the code of the n-th caller-saved register available to JavaScript | 57 // Return the code of the n-th caller-saved register available to JavaScript |
58 // e.g. JSCallerSavedReg(0) returns r0.code() == 0 | 58 // e.g. JSCallerSavedReg(0) returns r0.code() == 0 |
59 int JSCallerSavedCode(int n); | 59 int JSCallerSavedCode(int n); |
60 | 60 |
61 | 61 |
62 // Callee-saved registers preserved when switching from C to JavaScript | 62 // Callee-saved registers preserved when switching from C to JavaScript |
63 static const RegList kCalleeSaved = | 63 const RegList kCalleeSaved = |
64 1 << 4 | // r4 v1 | 64 1 << 4 | // r4 v1 |
65 1 << 5 | // r5 v2 | 65 1 << 5 | // r5 v2 |
66 1 << 6 | // r6 v3 | 66 1 << 6 | // r6 v3 |
67 1 << 7 | // r7 v4 | 67 1 << 7 | // r7 v4 |
68 1 << 8 | // r8 v5 (cp in JavaScript code) | 68 1 << 8 | // r8 v5 (cp in JavaScript code) |
69 kR9Available << 9 | // r9 v6 | 69 kR9Available << 9 | // r9 v6 |
70 1 << 10 | // r10 v7 | 70 1 << 10 | // r10 v7 |
71 1 << 11; // r11 v8 (fp in JavaScript code) | 71 1 << 11; // r11 v8 (fp in JavaScript code) |
72 | 72 |
73 // When calling into C++ (only for C++ calls that can't cause a GC). | 73 // When calling into C++ (only for C++ calls that can't cause a GC). |
74 // The call code will take care of lr, fp, etc. | 74 // The call code will take care of lr, fp, etc. |
75 static const RegList kCallerSaved = | 75 const RegList kCallerSaved = |
76 1 << 0 | // r0 | 76 1 << 0 | // r0 |
77 1 << 1 | // r1 | 77 1 << 1 | // r1 |
78 1 << 2 | // r2 | 78 1 << 2 | // r2 |
79 1 << 3 | // r3 | 79 1 << 3 | // r3 |
80 1 << 9; // r9 | 80 1 << 9; // r9 |
81 | 81 |
82 | 82 |
83 static const int kNumCalleeSaved = 7 + kR9Available; | 83 const int kNumCalleeSaved = 7 + kR9Available; |
84 | 84 |
85 // Double registers d8 to d15 are callee-saved. | 85 // Double registers d8 to d15 are callee-saved. |
86 static const int kNumDoubleCalleeSaved = 8; | 86 const int kNumDoubleCalleeSaved = 8; |
87 | 87 |
88 | 88 |
89 // Number of registers for which space is reserved in safepoints. Must be a | 89 // Number of registers for which space is reserved in safepoints. Must be a |
90 // multiple of 8. | 90 // multiple of 8. |
91 // TODO(regis): Only 8 registers may actually be sufficient. Revisit. | 91 // TODO(regis): Only 8 registers may actually be sufficient. Revisit. |
92 static const int kNumSafepointRegisters = 16; | 92 const int kNumSafepointRegisters = 16; |
93 | 93 |
94 // Define the list of registers actually saved at safepoints. | 94 // Define the list of registers actually saved at safepoints. |
95 // Note that the number of saved registers may be smaller than the reserved | 95 // Note that the number of saved registers may be smaller than the reserved |
96 // space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters. | 96 // space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters. |
97 static const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved; | 97 const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved; |
98 static const int kNumSafepointSavedRegisters = | 98 const int kNumSafepointSavedRegisters = kNumJSCallerSaved + kNumCalleeSaved; |
99 kNumJSCallerSaved + kNumCalleeSaved; | |
100 | 99 |
101 // ---------------------------------------------------- | 100 // ---------------------------------------------------- |
102 | 101 |
103 | 102 |
104 class StackHandlerConstants : public AllStatic { | 103 class StackHandlerConstants : public AllStatic { |
105 public: | 104 public: |
106 static const int kNextOffset = 0 * kPointerSize; | 105 static const int kNextOffset = 0 * kPointerSize; |
107 static const int kCodeOffset = 1 * kPointerSize; | 106 static const int kCodeOffset = 1 * kPointerSize; |
108 static const int kStateOffset = 2 * kPointerSize; | 107 static const int kStateOffset = 2 * kPointerSize; |
109 static const int kContextOffset = 3 * kPointerSize; | 108 static const int kContextOffset = 3 * kPointerSize; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 172 |
174 inline Object* JavaScriptFrame::function_slot_object() const { | 173 inline Object* JavaScriptFrame::function_slot_object() const { |
175 const int offset = JavaScriptFrameConstants::kFunctionOffset; | 174 const int offset = JavaScriptFrameConstants::kFunctionOffset; |
176 return Memory::Object_at(fp() + offset); | 175 return Memory::Object_at(fp() + offset); |
177 } | 176 } |
178 | 177 |
179 | 178 |
180 } } // namespace v8::internal | 179 } } // namespace v8::internal |
181 | 180 |
182 #endif // V8_ARM_FRAMES_ARM_H_ | 181 #endif // V8_ARM_FRAMES_ARM_H_ |
OLD | NEW |